亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sbulkpnp.c

?? USB驅動程序文件
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    SBulkPnp.c

Abstract:

    Modified Bulk USB device driver for SEC SOC USB test board
    Plug and Play module

Environment:

    kernel mode only

Notes:

  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  PURPOSE.

  Copyright (c) 1997-1998 Microsoft Corporation.  All Rights Reserved.


Revision History:

    2/7/98: created
	11/24/01:purnnamu: modified to support SupriseRemoval
--*/


#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"

#include "usbdi.h"
#include "usbdlib.h"
#include "Blk82930.h"



NTSTATUS
BulkUsb_ProcessPnPIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    Dispatch table routine for IRP_MJ_PNP.
    Process the Plug and Play IRPs sent to this device.

Arguments:

    DeviceObject - pointer to our FDO (Functional Device Object)

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

--*/
{

    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    NTSTATUS waitStatus;
    PDEVICE_OBJECT stackDeviceObject;
    KEVENT startDeviceEvent;

    PDEVICE_CAPABILITIES    deviceCapabilities; //purnnamu:11/23/2001

    //
    // Get a pointer to the current location in the Irp. This is where
    //     the function codes and parameters are located.
    //
    irpStack = IoGetCurrentIrpStackLocation (Irp);

    //
    // Get a pointer to the device extension
    //

    deviceExtension = DeviceObject->DeviceExtension;
    stackDeviceObject = deviceExtension->TopOfStackDeviceObject;

    BULKUSB_KdPrint( DBGLVL_MEDIUM, ( "enter BulkUsb_ProcessPnPIrp() IRP_MJ_PNP, minor %s\n",
        BULKUSB_StringForPnpMnFunc( irpStack->MinorFunction ) ));

        // inc the FDO device extension's pending IO count for this Irp
    BulkUsb_IncrementIoCount(DeviceObject);

    BULKUSB_ASSERT( IRP_MJ_PNP == irpStack->MajorFunction );

    switch (irpStack->MinorFunction) {
    //=========================================
	//purnnamu:11/23/2001:added for the surprise removal
    case IRP_MN_QUERY_CAPABILITIES:
            //TRACE(TL_TRACE, ("t1394Diag_Pnp: IRP_MN_QUERY_CAPABILITIES\n"));

            deviceCapabilities = irpStack->Parameters.DeviceCapabilities.Capabilities;
           
            if(deviceCapabilities->Version < 1)break;
            
            deviceCapabilities->SurpriseRemovalOK = TRUE;
			deviceCapabilities->Removable = TRUE;

			deviceExtension->DeviceCapabilities.Removable =1;
			deviceExtension->DeviceCapabilities.SurpriseRemovalOK=1;;
    		
            Irp->IoStatus.Status = STATUS_SUCCESS;
            IoCompleteRequest(Irp, IO_NO_INCREMENT);
            BulkUsb_DecrementIoCount(DeviceObject);
            return STATUS_SUCCESS;
    //=========================================
    case IRP_MN_START_DEVICE:

        // The PnP Manager sends this IRP after it has assigned resources,
        // if any, to the device. The device may have been recently enumerated
        // and is being started for the first time, or the device may be
        // restarting after being stopped for resource reconfiguration.

        // Initialize an event we can wait on for the PDO to be done with this irp
        KeInitializeEvent(&startDeviceEvent, NotificationEvent, FALSE);
        IoCopyCurrentIrpStackLocationToNext(Irp);

        // Set a completion routine so it can signal our event when
        //  the PDO is done with the Irp
        IoSetCompletionRoutine(Irp,
                               BulkUsb_IrpCompletionRoutine,
                               &startDeviceEvent,  // pass the event to the completion routine as the Context
                               TRUE,    // invoke on success
                               TRUE,    // invoke on error
                               TRUE);   // invoke on cancellation


        // let the PDO process the IRP
        ntStatus = IoCallDriver(stackDeviceObject,
                                Irp);

        // if PDO is not done yet, wait for the event to be set in our completion routine
        if (ntStatus == STATUS_PENDING) {
             // wait for irp to complete

            waitStatus = KeWaitForSingleObject(
                &startDeviceEvent,
                Suspended,
                KernelMode,
                FALSE,
                NULL);

            ntStatus = Irp->IoStatus.Status;
        }

        if (NT_SUCCESS(ntStatus)) {

            // Now we're ready to do our own startup processing.
            // USB client drivers such as us set up URBs (USB Request Packets) to send requests
            // to the host controller driver (HCD). The URB structure defines a format for all
            // possible commands that can be sent to a USB device.
            // Here, we request the device descriptor and store it,
            // and configure the device.
            ntStatus = BulkUsb_StartDevice(DeviceObject);
            Irp->IoStatus.Status = ntStatus;
        }

        IoCompleteRequest (Irp,
                           IO_NO_INCREMENT
                           );

        BulkUsb_DecrementIoCount(DeviceObject);
        return ntStatus;  // end, case IRP_MN_START_DEVICE

    case IRP_MN_QUERY_STOP_DEVICE:

                // The IRP_MN_QUERY_STOP_DEVICE/IRP_MN_STOP_DEVICE sequence only occurs
                // during "polite" shutdowns, such as the user explicitily requesting the
                // service be stopped in, or requesting unplug from the Pnp tray icon.
                // This sequence is NOT received during "impolite" shutdowns,
                // such as someone suddenly yanking the USB cord or otherwise
                // unexpectedly disabling/resetting the device.

        // If a driver sets STATUS_SUCCESS for this IRP,
        // the driver must not start any operations on the device that
        // would prevent that driver from successfully completing an IRP_MN_STOP_DEVICE
        // for the device.
        // For mass storage devices such as disk drives, while the device is in the
        // stop-pending state,the driver holds IRPs that require access to the device,
        // but for most USB devices, there is no 'persistent storage', so we will just
        // refuse any more IO until restarted or the stop is cancelled

        // If a driver in the device stack determines that the device cannot be
        // stopped for resource reconfiguration, the driver is not required to pass
        // the IRP down the device stack. If a query-stop IRP fails,
        // the PnP Manager sends an IRP_MN_CANCEL_STOP_DEVICE to the device stack,
        // notifying the drivers for the device that the query has been cancelled
        // and that the device will not be stopped.


        // It is possible to receive this irp when the device has not been started
        //  ( as on a boot device )
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);

            return ntStatus;
        }


        // fail the request if we have any read/write IRPS pending
        if( deviceExtension->StagedPendingIrpCount ) {
            ntStatus = STATUS_UNSUCCESSFUL;
        }
        else {
                        // We'll not veto it; pass it on and flag that stop was requested.
                        // Once StopDeviceRequested is set no new IOCTL or read/write irps will be passed
                        // down the stack to lower drivers; all will be quickly failed
             deviceExtension->StopDeviceRequested = TRUE;
             Irp->IoStatus.Status = STATUS_SUCCESS;
        }

        break; // end, case IRP_MN_QUERY_STOP_DEVICE

    case IRP_MN_CANCEL_STOP_DEVICE:

                // The PnP Manager uses this IRP to inform the drivers for a device
                // that the device will not be stopped for resource reconfiguration.
                // This should only be received after a successful IRP_MN_QUERY_STOP_DEVICE.


        // It is possible to receive this irp when the device has not been started
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_CANCEL_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);
            return ntStatus;
        }

                // Reset this flag so new IOCTL and IO Irp processing will be re-enabled
        deviceExtension->StopDeviceRequested = FALSE;
        Irp->IoStatus.Status = STATUS_SUCCESS;
        break; // end, case IRP_MN_CANCEL_STOP_DEVICE

    case IRP_MN_STOP_DEVICE:

                // The PnP Manager sends this IRP to stop a device so it can reconfigure
                // its hardware resources. The PnP Manager only sends this IRP if a prior
                // IRP_MN_QUERY_STOP_DEVICE completed successfully.


        // Cancel any pending io requests.  (there shouldn't be any)
        BulkUsb_CancelPendingIo( DeviceObject );
        //
        // Send the select configuration urb with a NULL pointer for the configuration
        // handle, this closes the configuration and puts the device in the 'unconfigured'
        // state.
        //
        ntStatus = BulkUsb_StopDevice(DeviceObject);
        Irp->IoStatus.Status = ntStatus;

        break; // end, case IRP_MN_STOP_DEVICE



    case IRP_MN_QUERY_REMOVE_DEVICE:

        //  In response to this IRP, drivers indicate whether the device can be
        //  removed without disrupting the system.
        //  If a driver determines it is safe to remove the device,
        //  the driver completes any outstanding I/O requests, arranges to hold any subsequent
        //  read/write requests, and sets Irp->IoStatus.Status to STATUS_SUCCESS. Function
        //  and filter drivers then pass the IRP to the next-lower driver in the device stack.
        //  The underlying bus driver calls IoCompleteRequest.

        //  If a driver sets STATUS_SUCCESS for this IRP, the driver must not start any
        //  operations on the device that would prevent that driver from successfully completing
        //  an IRP_MN_REMOVE_DEVICE for the device. If a driver in the device stack determines
        //  that the device cannot be removed, the driver is not required to pass the
        //  query-remove IRP down the device stack. If a query-remove IRP fails, the PnP Manager
        //  sends an IRP_MN_CANCEL_REMOVE_DEVICE to the device stack, notifying the drivers for
        //  the device that the query has been cancelled and that the device will not be removed.

        // It is possible to receive this irp when the device has not been started
        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_QUERY_STOP_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);

            return ntStatus;
        }

                // Once RemoveDeviceRequested is set no new IOCTL or read/write irps will be passed
                // down the stack to lower drivers; all will be quickly failed
       deviceExtension->RemoveDeviceRequested = TRUE;

        // Wait for any io request pending in our driver to
        // complete before returning success.
                // This  event is set when deviceExtension->PendingIoCount goes to 1
        waitStatus = KeWaitForSingleObject(
                    &deviceExtension->NoPendingIoEvent,
                    Suspended,
                    KernelMode,
                    FALSE,
                    NULL);


        Irp->IoStatus.Status = STATUS_SUCCESS;
        break; // end, case IRP_MN_QUERY_REMOVE_DEVICE

    case IRP_MN_CANCEL_REMOVE_DEVICE:

                // The PnP Manager uses this IRP to inform the drivers
                // for a device that the device will not be removed.
                // It is sent only after a successful IRP_MN_QUERY_REMOVE_DEVICE.

        if (!deviceExtension->DeviceStarted) { // if get when never started, just pass on

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区视频在线观看2020 | 99精品欧美一区二区三区小说 | 久久精品一区蜜桃臀影院| 色94色欧美sute亚洲线路二| 久久av资源站| 免费人成精品欧美精品| 天天av天天翘天天综合网色鬼国产| 中文字幕免费不卡在线| 久久久三级国产网站| 26uuu国产电影一区二区| 欧美xingq一区二区| 久久久久久久综合| 国产精品女同互慰在线看| 18成人在线观看| 亚洲精品va在线观看| 一区二区三区精品在线观看| 一区二区三区日韩欧美精品 | 成人黄动漫网站免费app| 成人免费av网站| 99精品视频在线播放观看| 91网上在线视频| 在线中文字幕不卡| 日本福利一区二区| 日韩av中文字幕一区二区三区 | 亚洲午夜私人影院| 日韩毛片精品高清免费| 国产成人av在线影院| av中文字幕在线不卡| 久久精品日韩一区二区三区| 国产精品麻豆99久久久久久| 久久久亚洲综合| 国产精品丝袜久久久久久app| 国产成a人无v码亚洲福利| 91视频www| 日韩欧美国产精品| 亚洲日本欧美天堂| 国产又粗又猛又爽又黄91精品| 国v精品久久久网| 欧美久久一二三四区| 久久免费精品国产久精品久久久久| 国产亚洲一区二区三区四区 | 在线综合+亚洲+欧美中文字幕| caoporn国产一区二区| 欧美午夜宅男影院| 久久亚洲欧美国产精品乐播 | 国产三级精品三级| 91免费观看在线| 欧美一区二区三区在| 最新成人av在线| 久久不见久久见免费视频1| 日本视频一区二区三区| 久久99精品国产.久久久久久| 日本伦理一区二区| 国产日产欧美精品一区二区三区| 一区二区三区在线高清| 国产aⅴ综合色| 日韩女优av电影| 亚洲小说春色综合另类电影| 欧美国产一区二区| 精品制服美女久久| 欧美高清视频在线高清观看mv色露露十八 | 欧美日韩中文字幕一区二区| 久久久www免费人成精品| 午夜视频在线观看一区| 一区二区三区蜜桃网| 成人高清免费观看| 国产色91在线| 亚洲一区二区综合| 国产原创一区二区| 69精品人人人人| 午夜一区二区三区视频| 韩国精品久久久| 色综合一区二区三区| 日韩美女天天操| 美女视频黄 久久| 91精品久久久久久蜜臀| 日韩精品亚洲专区| 99精品欧美一区二区三区综合在线| 欧美va在线播放| 亚洲午夜日本在线观看| 国产日韩欧美不卡在线| 精品一区二区三区香蕉蜜桃| 欧美日韩亚洲综合一区二区三区| 亚洲一区二区五区| 欧美做爰猛烈大尺度电影无法无天| 3751色影院一区二区三区| 日韩成人一级片| 日韩欧美激情一区| 国产成人免费视频一区| 国产精品美日韩| 成人午夜电影小说| 亚洲精品国产品国语在线app| 亚洲欧美日韩国产另类专区| 色视频成人在线观看免| 亚洲观看高清完整版在线观看| 欧美日韩久久久| 国内精品伊人久久久久av影院| 久久人人爽人人爽| 色婷婷久久久综合中文字幕| 香蕉乱码成人久久天堂爱免费| 91麻豆精品国产91久久久久久| 精品无人码麻豆乱码1区2区| 婷婷一区二区三区| 欧美成人一级视频| 91在线精品一区二区三区| 一区二区三区日韩在线观看| 欧美日韩国产三级| 国产精品一区二区黑丝| 亚洲欧美日韩一区二区 | 精品对白一区国产伦| 成人一区二区在线观看| 亚洲一区视频在线观看视频| 久久99久久精品| 久久婷婷综合激情| 在线观看日韩高清av| 国产精品一卡二卡| 一区二区三区精品久久久| 欧美日本高清视频在线观看| 国产精品一区二区久久精品爱涩 | 欧美日韩一级黄| 国产成人aaa| 青青草成人在线观看| 亚洲天堂网中文字| 精品欧美久久久| 欧美日韩国产首页在线观看| 成人午夜大片免费观看| 蜜臂av日日欢夜夜爽一区| 亚洲免费在线看| 国产日韩欧美综合在线| 5月丁香婷婷综合| 成人精品视频一区| 国产剧情一区二区三区| 日韩激情视频网站| 国产免费久久精品| 26uuu欧美日本| 日韩午夜精品视频| 欧美日韩一区成人| 色偷偷久久人人79超碰人人澡| 国产精品一区二区久激情瑜伽| 免费日本视频一区| 日本不卡免费在线视频| 亚洲一区二区五区| 有坂深雪av一区二区精品| 中文欧美字幕免费| 国产无一区二区| 久久久久久一二三区| 精品国产一区二区三区四区四| 亚洲精品国产第一综合99久久| 久久在线观看免费| 日韩一区二区三区av| 欧美日本在线播放| 日韩影院在线观看| 日韩激情av在线| 免费不卡在线观看| 国产一区二区福利| 亚洲国产wwwccc36天堂| 午夜成人在线视频| 美日韩黄色大片| 精品一区二区在线免费观看| 青青青伊人色综合久久| 香蕉久久一区二区不卡无毒影院 | 成人永久免费视频| 91亚洲午夜精品久久久久久| 久久久综合激的五月天| 喷水一区二区三区| 精品一区二区三区视频在线观看 | 中文字幕欧美日本乱码一线二线| 精品国产青草久久久久福利| 日韩免费看的电影| 91麻豆精品国产91久久久久久久久 | 在线观看亚洲a| 精品视频在线免费观看| 4438亚洲最大| 2020国产精品自拍| 日本一区二区三区在线不卡| 国产精品国产a级| 亚洲精品国产品国语在线app| 午夜精品福利一区二区蜜股av | 久久品道一品道久久精品| 国产欧美视频在线观看| 亚洲欧美在线aaa| 一区二区成人在线观看| 日本美女一区二区| 大胆亚洲人体视频| 在线一区二区观看| 精品久久久影院| 国产精品久久久久久久久久免费看 | 国产一区激情在线| 成人激情开心网| 在线视频一区二区免费| 欧美一级搡bbbb搡bbbb| 久久精品一区二区三区四区| 亚洲乱码国产乱码精品精的特点| 奇米综合一区二区三区精品视频| 春色校园综合激情亚洲| 日本韩国精品在线| 国产日产亚洲精品系列| 天堂蜜桃一区二区三区| 国产一区二区在线视频| 欧美性生活影院|