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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bulkusb.c

?? usb范例代碼
?? C
字號:
/*++

Copyright (c) 2000  Microsoft Corporation

Module Name:

    bulkusb.c

Abstract:

    Bulk USB device driver for Intel 82930 USB test board
	Main module

Author:

Environment:

    kernel mode only

Notes:

    Copyright (c) 2000 Microsoft Corporation.  
    All Rights Reserved.

--*/

#include "bulkusb.h"
#include "bulkpnp.h"
#include "bulkpwr.h"
#include "bulkdev.h"
#include "bulkwmi.h"
#include "bulkusr.h"
#include "bulkrwr.h"

//
// Globals
//

GLOBALS Globals;
ULONG   DebugLevel = 1;

DRIVER_UNLOAD BulkUsb_DriverUnload;
DRIVER_ADD_DEVICE BulkUsb_AddDevice;
DRIVER_INITIALIZE DriverEntry;

NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING UniRegistryPath
    );

#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, DriverEntry)
#pragma alloc_text(PAGE, BulkUsb_DriverUnload)
#endif

NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING UniRegistryPath
    )
/*++ 

Routine Description:

    Installable driver initialization entry point.
    This entry point is called directly by the I/O system.    

Arguments:
    
    DriverObject - pointer to driver object 

    RegistryPath - pointer to a unicode string representing the path to driver 
                   specific key in the registry.

Return Values:

    NT status value
    
--*/
{

    NTSTATUS        ntStatus;
    PUNICODE_STRING registryPath;
    
    PAGED_CODE();

    //
    // initialization of variables
    //

    registryPath = &Globals.BulkUsb_RegistryPath;

    //
    // Allocate pool to hold a null-terminated copy of the path.
    // Safe in paged pool since all registry routines execute at
    // PASSIVE_LEVEL.
    //

    registryPath->MaximumLength = UniRegistryPath->Length + sizeof(UNICODE_NULL);
    registryPath->Length        = UniRegistryPath->Length;
    registryPath->Buffer        = ExAllocatePool(PagedPool,
                                                 registryPath->MaximumLength);

    if (!registryPath->Buffer) {

        BulkUsb_DbgPrint(1, ("Failed to allocate memory for registryPath\n"));
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        goto DriverEntry_Exit;
    } 


    RtlZeroMemory (registryPath->Buffer, 
                   registryPath->MaximumLength);
    RtlMoveMemory (registryPath->Buffer, 
                   UniRegistryPath->Buffer, 
                   UniRegistryPath->Length);

    ntStatus = STATUS_SUCCESS;

    //
    // Initialize the driver object with this driver's entry points.
    //
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BulkUsb_DispatchDevCtrl;
    DriverObject->MajorFunction[IRP_MJ_POWER]          = BulkUsb_DispatchPower;
    DriverObject->MajorFunction[IRP_MJ_PNP]            = BulkUsb_DispatchPnP;
    DriverObject->MajorFunction[IRP_MJ_CREATE]         = BulkUsb_DispatchCreate;
    DriverObject->MajorFunction[IRP_MJ_CLOSE]          = BulkUsb_DispatchClose;
    DriverObject->MajorFunction[IRP_MJ_CLEANUP]        = BulkUsb_DispatchClean;
    DriverObject->MajorFunction[IRP_MJ_READ]           =
    DriverObject->MajorFunction[IRP_MJ_WRITE]          = BulkUsb_DispatchReadWrite;
    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = BulkUsb_DispatchSysCtrl;
    DriverObject->DriverUnload                         = BulkUsb_DriverUnload;
    DriverObject->DriverExtension->AddDevice           = (PDRIVER_ADD_DEVICE)
                                                         BulkUsb_AddDevice;
DriverEntry_Exit:

    return ntStatus;
}

VOID
BulkUsb_DriverUnload(
    IN PDRIVER_OBJECT DriverObject
    )
/*++

Description:

    This function will free the memory allocations in DriverEntry.

Arguments:

    DriverObject - pointer to driver object 

Return:
	
    None

--*/
{
    PUNICODE_STRING registryPath;
    
    UNREFERENCED_PARAMETER( DriverObject );
	
    PAGED_CODE();

    BulkUsb_DbgPrint(3, ("BulkUsb_DriverUnload - begins\n"));

    registryPath = &Globals.BulkUsb_RegistryPath;

    if(registryPath->Buffer) {

        ExFreePool(registryPath->Buffer);
        registryPath->Buffer = NULL;
    }

    BulkUsb_DbgPrint(3, ("BulkUsb_DriverUnload - ends\n"));

    return;
}

NTSTATUS
BulkUsb_AddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )
/*++

Description:

Arguments:

    DriverObject - Store the pointer to the object representing us.

    PhysicalDeviceObject - Pointer to the device object created by the
                           undelying bus driver.

Return:
	
    STATUS_SUCCESS - if successful 
    STATUS_UNSUCCESSFUL - otherwise

--*/
{
    NTSTATUS          ntStatus;
    PDEVICE_OBJECT    deviceObject;
    PDEVICE_EXTENSION deviceExtension;
    POWER_STATE       state;
//    KIRQL             oldIrql;

//	UNREFERENCED_PARAMETER( oldIrql );
	
    BulkUsb_DbgPrint(3, ("BulkUsb_AddDevice - begins\n"));

    deviceObject = NULL;

    ntStatus = IoCreateDevice(
                    DriverObject,                   // our driver object
                    sizeof(DEVICE_EXTENSION),       // extension size for us
                    NULL,                           // name for this device
                    FILE_DEVICE_UNKNOWN,
                    FILE_AUTOGENERATED_DEVICE_NAME, // device characteristics
                    FALSE,                          // Not exclusive
                    &deviceObject);                 // Our device object

    if(!NT_SUCCESS(ntStatus)) {
        //
        // returning failure here prevents the entire stack from functioning,
        // but most likely the rest of the stack will not be able to create
        // device objects either, so it is still OK.
        //                
        BulkUsb_DbgPrint(1, ("Failed to create device object\n"));
        return ntStatus;
    }

    //
    // Initialize the device extension
    //

    deviceExtension = (PDEVICE_EXTENSION) deviceObject->DeviceExtension;
    deviceExtension->FunctionalDeviceObject = deviceObject;
    deviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
    deviceObject->Flags |= DO_DIRECT_IO;

    //
    // initialize the device state lock and set the device state
    //

    KeInitializeSpinLock(&deviceExtension->DevStateLock);
    INITIALIZE_PNP_STATE(deviceExtension);

    //
    //initialize OpenHandleCount
    //
    deviceExtension->OpenHandleCount = 0;

    //
    // Initialize the selective suspend variables
    //
    KeInitializeSpinLock(&deviceExtension->IdleReqStateLock);
    deviceExtension->IdleReqPend = 0;
    deviceExtension->PendingIdleIrp = NULL;

    //
    // Hold requests until the device is started
    //

    deviceExtension->QueueState = HoldRequests;

    //
    // Initialize the queue and the queue spin lock
    //

    InitializeListHead(&deviceExtension->NewRequestsQueue);
    KeInitializeSpinLock(&deviceExtension->QueueLock);

    //
    // Initialize the remove event to not-signaled.
    //

    KeInitializeEvent(&deviceExtension->RemoveEvent, 
                      SynchronizationEvent, 
                      FALSE);

    //
    // Initialize the stop event to signaled.
    // This event is signaled when the OutstandingIO becomes 1
    //

    KeInitializeEvent(&deviceExtension->StopEvent, 
                      SynchronizationEvent, 
                      TRUE);

    //
    // OutstandingIo count biased to 1.
    // Transition to 0 during remove device means IO is finished.
    // Transition to 1 means the device can be stopped
    //

    deviceExtension->OutStandingIO = 1;
    KeInitializeSpinLock(&deviceExtension->IOCountLock);

    //
    // Delegating to WMILIB
    //
    ntStatus = BulkUsb_WmiRegistration(deviceExtension);

    if(!NT_SUCCESS(ntStatus)) {

        BulkUsb_DbgPrint(1, ("BulkUsb_WmiRegistration failed with %X\n", ntStatus));
        IoDeleteDevice(deviceObject);
        return ntStatus;
    }

    //
    // set the flags as underlying PDO
    //

    if(PhysicalDeviceObject->Flags & DO_POWER_PAGABLE) {

        deviceObject->Flags |= DO_POWER_PAGABLE;
    }

    //
    // Typically, the function driver for a device is its 
    // power policy owner, although for some devices another 
    // driver or system component may assume this role. 
    // Set the initial power state of the device, if known, by calling 
    // PoSetPowerState.
    // 

    deviceExtension->DevPower = PowerDeviceD0;
    deviceExtension->SysPower = PowerSystemWorking;

    state.DeviceState = PowerDeviceD0;
    PoSetPowerState(deviceObject, DevicePowerState, state);

    //
    // attach our driver to device stack
    // The return value of IoAttachDeviceToDeviceStack is the top of the
    // attachment chain.  This is where all the IRPs should be routed.
    //

    deviceExtension->TopOfStackDeviceObject = 
                IoAttachDeviceToDeviceStack(deviceObject,
                                            PhysicalDeviceObject);

    if(NULL == deviceExtension->TopOfStackDeviceObject) {

        BulkUsb_WmiDeRegistration(deviceExtension);
        IoDeleteDevice(deviceObject);
        return STATUS_NO_SUCH_DEVICE;
    }
        
    //
    // Register device interfaces
    //

    ntStatus = IoRegisterDeviceInterface(deviceExtension->PhysicalDeviceObject, 
                                         &GUID_CLASS_I82930_BULK, 
                                         NULL, 
                                         &deviceExtension->InterfaceName);

    if(!NT_SUCCESS(ntStatus)) {

        BulkUsb_WmiDeRegistration(deviceExtension);
        IoDetachDevice(deviceExtension->TopOfStackDeviceObject);
        IoDeleteDevice(deviceObject);
        return ntStatus;
    }

    if(RtlIsNtDdiVersionAvailable(NTDDI_LONGHORN)) {

        deviceExtension->WdmVersion = WinVistaOrBetter;
    }
    else if(RtlIsNtDdiVersionAvailable(NTDDI_WINXP)) {

        deviceExtension->WdmVersion = WinXpOrBetter;
    }
    else if(RtlIsNtDdiVersionAvailable(NTDDI_WIN2K)) {

        deviceExtension->WdmVersion = Win2kOrBetter;
    }

    deviceExtension->SSRegistryEnable = 0;
    deviceExtension->SSEnable = 0;

    //
    // WinXP only
    // check the registry flag -
    // whether the device should selectively
    // suspend when idle
    //

    if(WinXpOrBetter == deviceExtension->WdmVersion) {

        BulkUsb_GetRegistryDword(BULKUSB_REGISTRY_PARAMETERS_PATH,
                                 L"BulkUsbEnable",
                                 (PULONG)&deviceExtension->SSRegistryEnable);

        if(deviceExtension->SSRegistryEnable) {

            //
            // initialize DPC
            //
            KeInitializeDpc(&deviceExtension->DeferredProcCall, 
                            DpcRoutine, 
                            deviceObject);

            //
            // initialize the timer.
            // the DPC and the timer in conjunction, 
            // monitor the state of the device to 
            // selectively suspend the device.
            //
            KeInitializeTimerEx(&deviceExtension->Timer,
                                NotificationTimer);

            //
            // Initialize the NoDpcWorkItemPendingEvent to signaled state.
            // This event is cleared when a Dpc is fired and signaled
            // on completion of the work-item.
            //
            KeInitializeEvent(&deviceExtension->NoDpcWorkItemPendingEvent, 
                              NotificationEvent, 
                              TRUE);

            //
            // Initialize the NoIdleReqPendEvent to ensure that the idle request
            // is indeed complete before we unload the drivers.
            //
            KeInitializeEvent(&deviceExtension->NoIdleReqPendEvent,
                              NotificationEvent,
                              TRUE);
        }
    }

    //
    // Clear the DO_DEVICE_INITIALIZING flag.
    // Note: Do not clear this flag until the driver has set the
    // device power state and the power DO flags. 
    //

    deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

    BulkUsb_DbgPrint(3, ("BulkUsb_AddDevice - ends\n"));

    return ntStatus;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩精品三区| 日本视频中文字幕一区二区三区| 国产一区二区不卡在线| 欧美tickle裸体挠脚心vk| 日本少妇一区二区| 亚洲精品一区二区三区香蕉| 激情另类小说区图片区视频区| 精品久久久久久久久久久久久久久久久| 日本中文字幕一区二区有限公司| 欧美日韩亚洲综合一区 | 欧美三级中文字| 亚洲视频电影在线| 欧美中文一区二区三区| 亚洲精品高清视频在线观看| 欧美精品一卡二卡| 午夜亚洲国产au精品一区二区| 91精品一区二区三区久久久久久| 日韩精品成人一区二区三区| 麻豆精品在线看| 国产精品免费网站在线观看| 99视频超级精品| 一区二区三区日韩欧美| 欧美日韩综合一区| 免费黄网站欧美| 精品久久一区二区| 99re在线精品| 亚洲综合自拍偷拍| 国产成人日日夜夜| 一区二区视频在线看| 在线观看亚洲精品| 国产制服丝袜一区| 国产精品女同互慰在线看| 色噜噜狠狠成人网p站| 亚洲电影激情视频网站| 色一情一伦一子一伦一区| 午夜影视日本亚洲欧洲精品| 日韩一区二区三区免费看 | 一本一道综合狠狠老| 一区二区三区在线免费观看| 在线电影院国产精品| 国产乱子轮精品视频| 亚洲乱码中文字幕综合| 欧美日韩五月天| 国内成人免费视频| 中文字幕欧美激情一区| 欧美日韩中文另类| 成人免费视频播放| 日韩国产欧美三级| 亚洲日本在线看| 欧美一级高清片在线观看| 波多野结衣一区二区三区| 亚洲五月六月丁香激情| 2021久久国产精品不只是精品| av中文字幕一区| 亚洲18色成人| 亚洲另类在线视频| 精品国产3级a| 69p69国产精品| 成人教育av在线| 韩国中文字幕2020精品| 亚洲免费观看在线观看| 欧美电影免费观看高清完整版 | 日韩成人一区二区| 亚洲色图一区二区| 国产亚洲一区二区三区| 国产精品1区2区3区在线观看| 视频一区二区三区在线| 国产精品久久久久久久久免费桃花 | 欧美精品一区二区三区蜜桃| 91视频免费看| 国产精品伊人色| 欧美激情中文字幕一区二区| 日韩三级视频在线看| 在线免费视频一区二区| 91尤物视频在线观看| 国产综合久久久久影院| 久久精品免费观看| 亚洲午夜视频在线| 一级中文字幕一区二区| 国产欧美一区二区在线观看| 欧美va亚洲va香蕉在线| 欧美日韩一区久久| 欧美少妇一区二区| 色综合久久综合中文综合网| 国产精品理论片| 国产女人aaa级久久久级| 日韩一区二区三区av| 欧美一区二区三区视频在线| 在线视频你懂得一区| 在线日韩国产精品| 色狠狠色狠狠综合| 91福利国产精品| 日本道免费精品一区二区三区| 色狠狠一区二区三区香蕉| 99免费精品在线| 色综合视频一区二区三区高清| 成人性生交大片免费看中文| 亚洲一区二区三区国产| 亚洲成年人网站在线观看| 一区二区免费在线播放| 亚洲aⅴ怡春院| 三级一区在线视频先锋| 精品影视av免费| 久久精品72免费观看| 国产激情一区二区三区| 国产一区二区三区观看| aaa国产一区| 一本一道波多野结衣一区二区| 欧美无砖砖区免费| 欧美日本在线播放| 欧美亚洲国产一区二区三区 | 欧美猛男超大videosgay| 色婷婷亚洲一区二区三区| 欧美日韩精品欧美日韩精品一 | 欧美日韩aaa| 国产色产综合色产在线视频| 久久久91精品国产一区二区精品 | 欧美日韩一区精品| 欧美亚洲高清一区二区三区不卡| 欧美一区二区三区男人的天堂| 欧美一区二区私人影院日本| 欧美高清在线一区二区| 最近日韩中文字幕| 日韩精品亚洲一区| 国内不卡的二区三区中文字幕| 色婷婷精品久久二区二区蜜臂av| 欧美在线一二三四区| 精品久久久久久综合日本欧美| 中文字幕精品一区二区精品绿巨人 | 久草在线在线精品观看| 蜜桃91丨九色丨蝌蚪91桃色| 国产成人在线观看免费网站| 91视频观看免费| 欧美日韩精品免费观看视频| 精品国产伦一区二区三区观看体验| 国产日韩欧美不卡在线| 国产精品人妖ts系列视频| 亚洲欧美另类久久久精品2019 | 日本成人中文字幕| www.av精品| 欧美一级理论性理论a| 日韩一区在线播放| 日本中文字幕不卡| 欧美性猛交xxxxxx富婆| 精品国产99国产精品| 日韩在线观看一区二区| 成人免费高清视频| 精品免费日韩av| 一区二区三区.www| 成人avav影音| 日韩免费高清电影| 午夜精品福利一区二区三区av | 国产一区二区三区精品视频| 国产ts人妖一区二区| 日韩精品一区国产麻豆| 亚洲视频网在线直播| 高清av一区二区| 欧美一区二区三区小说| 亚洲高清久久久| 成人午夜免费视频| 久久久久久久久久久久电影| 亚洲国产成人av好男人在线观看| 波多野结衣中文字幕一区| 欧美一级午夜免费电影| 婷婷开心久久网| 91蜜桃免费观看视频| 中文av字幕一区| 蜜臀久久久久久久| 欧美一区二区视频免费观看| 亚洲一区二区三区视频在线播放| 99久免费精品视频在线观看| 久久美女高清视频| 日本伊人精品一区二区三区观看方式| 日本道色综合久久| 精品美女一区二区| 国产精品亚洲第一区在线暖暖韩国| 在线免费观看日韩欧美| 一区二区三区美女视频| 91视频一区二区三区| 一区二区三区四区不卡在线| 99re这里只有精品6| 有码一区二区三区| 99天天综合性| 一区二区欧美国产| 在线观看91视频| 日精品一区二区| 欧美另类z0zxhd电影| 奇米影视在线99精品| 欧美日韩电影一区| 精品午夜久久福利影院| 精品国免费一区二区三区| 国产伦精品一区二区三区免费迷| 精品日产卡一卡二卡麻豆| 国产精品99久久久| 国产人成亚洲第一网站在线播放| 成人高清免费观看| 国产精品女同互慰在线看| 欧美亚洲禁片免费| 亚洲在线中文字幕| 日韩欧美国产综合在线一区二区三区|