亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91丝袜国产在线播放| 在线播放亚洲一区| 亚洲青青青在线视频| 久久精品一二三| 五月天激情综合网| 色综合婷婷久久| 日本韩国精品在线| 欧美v亚洲v综合ⅴ国产v| 国产精品免费免费| 日本亚洲一区二区| 欧美日韩1区2区| 亚洲日本免费电影| 9191精品国产综合久久久久久 | 久久精品国产免费看久久精品| 五月激情综合网| 国产传媒久久文化传媒| 欧美视频中文一区二区三区在线观看| 91在线视频18| 欧美大尺度电影在线| 亚洲视频在线观看一区| 一区二区三区欧美日韩| 亚洲影视在线播放| 视频一区视频二区中文字幕| 免费在线观看日韩欧美| 26uuu色噜噜精品一区二区| 91在线看国产| zzijzzij亚洲日本少妇熟睡| 麻豆精品蜜桃视频网站| 亚洲欧美日韩中文字幕一区二区三区| 看国产成人h片视频| 国产精品欧美久久久久一区二区| 欧美日韩一区二区电影| 国内久久婷婷综合| 一区二区三区不卡视频| 亚洲欧美一区二区不卡| jlzzjlzz欧美大全| 日韩免费性生活视频播放| 一区二区不卡在线视频 午夜欧美不卡在| 精品亚洲国内自在自线福利| 日韩一区二区三区视频在线 | 麻豆成人av在线| 亚洲国产高清aⅴ视频| 7777女厕盗摄久久久| 91丨九色丨国产丨porny| 国产毛片精品一区| 美日韩一区二区| 亚洲成a人片综合在线| 亚洲欧美日韩国产一区二区三区| 亚洲精品一线二线三线无人区| 欧美视频精品在线观看| 色狠狠av一区二区三区| 91在线码无精品| 色综合视频在线观看| 成人福利在线看| 一本色道久久综合亚洲精品按摩| 国产精品亚洲综合一区在线观看| 韩国av一区二区三区四区| 成人永久看片免费视频天堂| 久久久777精品电影网影网 | 国产剧情一区二区三区| 欧美电影免费观看高清完整版 | 欧美精品一区二区三区蜜桃视频| 亚洲动漫第一页| 51久久夜色精品国产麻豆| 丰满少妇久久久久久久| 91猫先生在线| 成人少妇影院yyyy| 亚洲欧洲在线观看av| 国产精品国产三级国产| 欧美日韩日日夜夜| 欧美蜜桃一区二区三区| 欧美日本一道本在线视频| 欧美日韩国产另类不卡| 69堂国产成人免费视频| 精品理论电影在线观看| 国产欧美日韩精品一区| 一区二区激情视频| 韩国视频一区二区| av不卡在线播放| 欧美一级精品大片| 国产亚洲成aⅴ人片在线观看 | 成人午夜私人影院| 在线免费观看日本欧美| 日韩欧美卡一卡二| 一区二区欧美视频| 高清国产一区二区| 欧美欧美欧美欧美首页| 亚洲图片你懂的| 日韩精品视频网| 成人激情免费视频| 日韩一区二区免费在线电影| 欧美激情在线一区二区| 日日夜夜精品视频免费| 91老师片黄在线观看| 中文字幕日本乱码精品影院| 日韩精品色哟哟| 久久er精品视频| 欧美艳星brazzers| 一区二区在线看| 成人av高清在线| 欧美国产欧美综合| 国产成人免费9x9x人网站视频| 日韩一区二区在线观看| 国产三级一区二区| 欧美96一区二区免费视频| 色老综合老女人久久久| 亚洲乱码日产精品bd| 99精品久久99久久久久| 成人欧美一区二区三区白人| 国产成a人无v码亚洲福利| 国产亚洲精品资源在线26u| 国产在线一区二区综合免费视频| 日韩亚洲欧美在线| 精品一区二区三区不卡 | 亚洲成年人网站在线观看| 欧美日韩国产bt| 韩日欧美一区二区三区| 国产视频不卡一区| www.成人在线| ㊣最新国产の精品bt伙计久久| 91女人视频在线观看| 午夜视频在线观看一区| 欧美一区二区三区日韩| 国产成a人无v码亚洲福利| 日本一区二区在线不卡| 欧美性色黄大片手机版| 青草国产精品久久久久久| 久久久久久毛片| 欧美亚洲国产一区在线观看网站 | 国产不卡在线视频| 夜夜嗨av一区二区三区| 精品国产凹凸成av人导航| 一本久道久久综合中文字幕| 美国毛片一区二区三区| 午夜精品福利一区二区三区蜜桃| 欧美视频一区二区在线观看| 国产一区91精品张津瑜| 亚洲精品久久嫩草网站秘色| 欧美一区二区三区四区在线观看 | 国产精品一二三区在线| 一区二区三国产精华液| 中文av一区二区| 精品国产乱码久久久久久图片| 在线看一区二区| 国产suv精品一区二区6| 日韩高清不卡一区二区| 亚洲女子a中天字幕| 成人免费小视频| 亚洲视频一二区| 中文字幕制服丝袜一区二区三区| 欧美videossexotv100| 日韩欧美亚洲国产另类| 欧美日韩二区三区| 91精品视频网| 日韩欧美精品在线视频| 日韩一区二区在线看| 欧美v亚洲v综合ⅴ国产v| 久久综合999| 国产欧美精品一区| 国产精品国产成人国产三级| 久久免费国产精品 | 日韩一区二区三区精品视频| 日韩亚洲欧美综合| 国产人成亚洲第一网站在线播放| 欧美激情一区二区在线| 亚洲精品免费看| 麻豆国产91在线播放| 国产在线观看免费一区| av动漫一区二区| 欧美日韩国产在线观看| 国产女人水真多18毛片18精品视频 | 久久综合精品国产一区二区三区| 精品剧情在线观看| 中文字幕免费不卡在线| 一区二区国产盗摄色噜噜| 秋霞电影一区二区| av一区二区久久| 日韩精品在线一区| 亚洲综合色网站| 国产91精品精华液一区二区三区| 91成人网在线| 日韩理论片一区二区| 国产在线精品免费| 91精品婷婷国产综合久久性色| 国产精品麻豆视频| 国产真实乱对白精彩久久| 欧美日韩三级一区| 一区二区中文视频| 成人在线综合网| 26uuu成人网一区二区三区| 亚洲成a人片综合在线| 91高清视频免费看| 国产精品国产三级国产专播品爱网 | 久久综合一区二区| 奇米四色…亚洲| 欧美高清精品3d| 无码av免费一区二区三区试看| 色综合久久综合网欧美综合网 | 亚洲综合在线电影| 99久久久国产精品|