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

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

?? bulkpnp.c

?? TUSB3410 win9x和win xp 驅動源代碼,包含開發測試工具
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 1997-1998  Microsoft Corporation

Module Name:

    BulkPnp.c 

Abstract:

    Bulk USB device driver for Intel 82930 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

--*/


#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;


    //
    // 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) {
    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);
        }

        // 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;
        }

        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;
        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);

        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);


        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
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_CANCEL_REMOVE_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->RemoveDeviceRequested = FALSE;

        break; // end, case IRP_MN_CANCEL_REMOVE_DEVICE

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一二三四| 色呦呦日韩精品| 99riav久久精品riav| 宅男在线国产精品| 国产精品乱人伦中文| 日韩在线一二三区| 色素色在线综合| 国产欧美日韩不卡| 日本午夜一本久久久综合| av一区二区三区在线| 精品国产1区二区| 亚洲bt欧美bt精品| 一本高清dvd不卡在线观看| 久久久久99精品一区| 日本午夜精品一区二区三区电影| 91小宝寻花一区二区三区| 精品久久久久久久久久久院品网 | 一区二区三区精品视频| 国产大陆a不卡| 精品国产一区久久| 日本aⅴ精品一区二区三区 | 亚洲欧美日韩国产综合| 精品一区二区影视| 欧美大片一区二区三区| 免费高清在线一区| 欧美久久久久久久久中文字幕| 国产精品你懂的| av电影在线不卡| 国产精品久久久久久亚洲毛片| 国产一区二区在线电影| 精品99久久久久久| 国产一区二区精品久久| 精品国产乱码久久久久久蜜臀| 美女视频一区二区| 26uuu久久天堂性欧美| 狠狠v欧美v日韩v亚洲ⅴ| 精品国产髙清在线看国产毛片| 奇米精品一区二区三区在线观看一| 欧美午夜精品久久久| 亚洲精品一二三四区| 色丁香久综合在线久综合在线观看| 亚洲激情校园春色| 欧美亚州韩日在线看免费版国语版| 亚洲在线视频网站| 337p亚洲精品色噜噜噜| 日本不卡视频一二三区| 日韩久久精品一区| 国产乱国产乱300精品| 国产色91在线| 色中色一区二区| 亚洲二区视频在线| 欧美嫩在线观看| 久久疯狂做爰流白浆xx| 日本一区二区三区免费乱视频| 成人av网站在线观看免费| 中文字幕中文字幕一区二区| 91啦中文在线观看| 日韩黄色免费网站| 久久综合狠狠综合久久激情| 国产+成+人+亚洲欧洲自线| 一区在线播放视频| 欧美日韩激情一区| 国产高清视频一区| 亚洲亚洲精品在线观看| 欧美一区二区三区的| 成人av影视在线观看| 亚洲电影欧美电影有声小说| 日韩三级电影网址| 粉嫩aⅴ一区二区三区四区| 亚洲制服丝袜av| 精品国产sm最大网站免费看| caoporn国产一区二区| 日韩和的一区二区| 国产精品色噜噜| 538在线一区二区精品国产| 丁香桃色午夜亚洲一区二区三区| 亚洲综合色成人| 欧美精品一区男女天堂| 欧美中文字幕久久| 高清不卡在线观看| 日韩电影在线观看一区| 综合久久国产九一剧情麻豆| 日韩一本二本av| 在线区一区二视频| 国产99一区视频免费| 丝袜美腿亚洲综合| 中文字幕中文字幕一区| 精品处破学生在线二十三| 在线免费观看不卡av| 国产精品一区在线观看乱码| 性久久久久久久| 成人免费小视频| 国产丝袜欧美中文另类| 日韩欧美一级在线播放| 91浏览器打开| 成人激情视频网站| 高清在线不卡av| 国产原创一区二区| 久久99久久久欧美国产| 天天av天天翘天天综合网| 亚洲少妇30p| 中文字幕亚洲一区二区av在线 | 久久久久国色av免费看影院| 91精品国产综合久久久久久久久久| jlzzjlzz欧美大全| 成人激情午夜影院| 成人三级伦理片| 粉嫩aⅴ一区二区三区四区 | 性感美女极品91精品| 亚洲精品一二三区| 亚洲欧美日韩在线| 国产精品久久久久久久久快鸭| 国产日韩影视精品| 久久久精品中文字幕麻豆发布| 精品成人私密视频| 2024国产精品视频| 久久精品欧美一区二区三区不卡| 久久网这里都是精品| 精品国产乱码久久久久久图片| 欧美一区二区三区免费观看视频| 91精品国产综合久久蜜臀 | 久久免费精品国产久精品久久久久| 91精品国产综合久久精品| 欧美性色黄大片手机版| 欧美在线观看一区二区| 色吊一区二区三区| 欧美日本在线视频| 精品欧美一区二区久久| 久久综合国产精品| 国产精品国产自产拍高清av| 亚洲视频免费观看| 亚洲国产乱码最新视频 | 日韩欧美国产高清| 久久久久久久综合日本| 欧美国产97人人爽人人喊| 中文字幕av在线一区二区三区| 欧美激情中文不卡| 依依成人精品视频| 性久久久久久久久久久久| 免费成人结看片| 成人精品在线视频观看| 欧美在线视频你懂得| 日韩精品一区二区三区四区| 国产精品视频第一区| 一区二区三区在线观看欧美| 五月婷婷另类国产| 国产乱一区二区| 日本韩国欧美三级| 日韩视频免费观看高清完整版在线观看| 欧美变态口味重另类| 国产精品国产三级国产有无不卡 | 国产欧美一区二区精品久导航| 国产精品久久久99| 日韩精品一二三区| av在线不卡观看免费观看| 欧美一区欧美二区| 国产精品欧美久久久久无广告| 午夜激情久久久| 成人黄色小视频| 精品美女一区二区| 亚洲一二三区在线观看| 国产激情一区二区三区| 欧美日韩一区二区在线观看| 国产日韩精品久久久| 午夜欧美大尺度福利影院在线看| 国产麻豆精品在线| 欧美日韩高清在线播放| 中文字幕一区不卡| 国产麻豆欧美日韩一区| 这里是久久伊人| 亚洲精品成人悠悠色影视| 国产福利精品导航| 日韩精品一区二区三区四区 | 亚洲男女毛片无遮挡| 韩日av一区二区| 538在线一区二区精品国产| 亚洲欧美激情小说另类| 国产福利一区在线观看| 精品日本一线二线三线不卡| 亚洲网友自拍偷拍| 99精品国产99久久久久久白柏| 精品粉嫩aⅴ一区二区三区四区| 亚洲成人综合在线| 在线这里只有精品| 亚洲视频免费观看| www.性欧美| 中文字幕中文字幕中文字幕亚洲无线| 极品美女销魂一区二区三区 | 麻豆国产欧美一区二区三区| 在线精品视频一区二区三四| 国产精品久久午夜| 高清国产一区二区| 亚洲国产精品高清| 丁香六月久久综合狠狠色| 久久精品在线观看| 国产成人av网站| 国产精品不卡在线| 成人av网在线| 亚洲免费观看高清完整版在线观看| 粉嫩av一区二区三区|