亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91美女在线看| 国产精品成人免费精品自在线观看| 欧美日本高清视频在线观看| 成人av高清在线| 97成人超碰视| 欧美视频在线一区二区三区| 欧美色综合网站| 欧美成人一区二区三区在线观看| 欧美不卡激情三级在线观看| 2024国产精品| 亚洲精品videosex极品| 免费成人av在线播放| 黄色小说综合网站| 国产美女精品一区二区三区| 国产91色综合久久免费分享| 成人手机电影网| 99re成人在线| 日韩一区二区三区三四区视频在线观看| 亚洲精品在线网站| 一区在线播放视频| 视频一区二区国产| eeuss鲁片一区二区三区在线观看| 不卡欧美aaaaa| 精品福利视频一区二区三区| 亚洲一区二区三区自拍| 国产成人精品一区二| 久久久久成人黄色影片| 欧美精选一区二区| 久久综合狠狠综合久久激情| 亚洲激情综合网| www.久久久久久久久| 日韩精品一区二区三区在线播放 | 久久久91精品国产一区二区精品| 夜色激情一区二区| 波多野结衣精品在线| 精品国产一区久久| 秋霞午夜鲁丝一区二区老狼| 日本韩国欧美在线| 国产欧美日韩精品一区| 毛片不卡一区二区| 亚洲欧洲av色图| 婷婷中文字幕综合| 成人免费看黄yyy456| 日韩精品资源二区在线| 丝袜美腿亚洲综合| 欧美日韩国产首页| 一区二区三区国产| 不卡一区中文字幕| 久久久噜噜噜久久中文字幕色伊伊| 国产精品一区二区久激情瑜伽| 欧美日韩国产三级| 日韩影视精彩在线| 欧美精品黑人性xxxx| 日韩精品国产欧美| wwww国产精品欧美| 色综合久久久久久久| 专区另类欧美日韩| 欧美伊人精品成人久久综合97 | 99精品热视频| 日韩精品成人一区二区在线| 日韩欧美中文字幕精品| 国产成人免费视频网站| 国产欧美日韩三区| 9l国产精品久久久久麻豆| 亚洲天堂a在线| 欧美人妖巨大在线| 蜜臀av一区二区| 国产精品久久久久毛片软件| 色综合av在线| 久久99久久久欧美国产| 国产欧美综合在线| 777亚洲妇女| 99国产精品久| 国产在线一区二区| 亚洲人午夜精品天堂一二香蕉| 91在线免费播放| 日韩精品一级中文字幕精品视频免费观看 | 亚洲成人精品影院| 久久久久久久久久久黄色| 一本一本大道香蕉久在线精品 | 久久99精品久久久久久动态图| 亚洲区小说区图片区qvod| 精品国产一区二区三区不卡| 懂色av一区二区三区免费观看| 肉色丝袜一区二区| 中日韩av电影| 欧美videossexotv100| 欧美日韩精品三区| 99久久精品99国产精品| 国产在线视频一区二区| 日本中文字幕一区| 亚洲黄色尤物视频| 国产精品毛片高清在线完整版| 精品国精品国产| www久久精品| 日韩免费视频线观看| 91蜜桃婷婷狠狠久久综合9色| 亚洲国产视频在线| 亚洲综合在线电影| 亚洲宅男天堂在线观看无病毒| 中文字幕亚洲成人| 综合网在线视频| 亚洲视频一区二区免费在线观看| 久久精品亚洲一区二区三区浴池| 日韩一区二区电影网| 欧美三级中文字幕| 欧美日本一道本| 欧美亚一区二区| 欧美日韩一区在线| 欧美乱熟臀69xxxxxx| 91精品国产综合久久香蕉的特点| 欧美精品久久99久久在免费线| 欧美日韩亚洲高清一区二区| 9191精品国产综合久久久久久| 欧美日韩久久久| 欧美刺激脚交jootjob| 国产日韩成人精品| 一区二区三区成人| 午夜精品福利在线| 午夜精品成人在线视频| 日本v片在线高清不卡在线观看| 免费人成在线不卡| 成人短视频下载| 777久久久精品| 国产日本欧洲亚洲| 亚洲大片免费看| 丁香啪啪综合成人亚洲小说 | 欧美性感一区二区三区| 欧美精品在线视频| 国产亚洲婷婷免费| 亚洲午夜久久久久久久久电影院| 日本在线不卡一区| 国产成人av电影在线播放| 一本到不卡免费一区二区| 日韩欧美国产小视频| 国产精品嫩草影院av蜜臀| 男男gaygay亚洲| 在线观看亚洲专区| 国产精品激情偷乱一区二区∴| 亚洲国产成人tv| 99国产欧美久久久精品| 精品国产髙清在线看国产毛片| 国产精品传媒入口麻豆| 久久99深爱久久99精品| 欧美午夜宅男影院| 国产精品女上位| 国产成人在线色| 久久精品亚洲乱码伦伦中文 | 美女一区二区在线观看| 欧美精品乱人伦久久久久久| 亚洲欧美另类小说视频| 国产成人超碰人人澡人人澡| 欧美一二三区在线观看| 亚洲国产wwwccc36天堂| 91麻豆精品在线观看| 亚洲视频一区在线观看| 91免费版在线看| 亚洲图片欧美一区| 欧美日韩一区不卡| 日韩电影免费在线看| 91精品国产一区二区三区蜜臀| 亚洲一二三四久久| 欧亚洲嫩模精品一区三区| 一区二区三区精品在线观看| 成人av资源在线观看| 伊人婷婷欧美激情| 91精品国产黑色紧身裤美女| 久久精品国产成人一区二区三区| 欧美成人精品1314www| 成人亚洲一区二区一| 日韩精品在线一区| 久久成人久久爱| 中文字幕在线不卡视频| 91免费在线视频观看| 午夜精品视频在线观看| 日韩一级视频免费观看在线| 成人av资源网站| 日本在线不卡一区| 中文字幕乱码亚洲精品一区| 丰满白嫩尤物一区二区| 亚州成人在线电影| 国产婷婷色一区二区三区| 99re成人精品视频| 奇米四色…亚洲| 国产精品久久久久久久午夜片| 在线不卡a资源高清| 成人午夜激情片| 免费高清成人在线| 亚洲一区二区三区在线| 2017欧美狠狠色| 欧美探花视频资源| 成人中文字幕合集| 麻豆91在线播放免费| 亚洲小说春色综合另类电影| 久久免费视频色| 欧美区一区二区三区| 91日韩在线专区| 成人黄色一级视频| 国产福利一区在线观看| 午夜精品久久久久久|