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

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

?? bulkusb.c

?? DDK開發(fā)例子
?? C
字號(hào):
/*++

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;

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

VOID
BulkUsb_DriverUnload(
    IN PDRIVER_OBJECT DriverObject
    );

NTSTATUS
BulkUsb_AddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    );

#ifdef PAGE_CODE
#ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT, DriverEntry)
#pragma alloc_text(PAGE, BulkUsb_DriverUnload)
#endif
#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;
    
    //
    // 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;

    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;

    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(IoIsWdmVersionAvailable(1, 0x20)) {

        deviceExtension->WdmVersion = WinXpOrBetter;
    }
    else if(IoIsWdmVersionAvailable(1, 0x10)) {

        deviceExtension->WdmVersion = Win2kOrBetter;
    }
    else if(IoIsWdmVersionAvailable(1, 0x5)) {

        deviceExtension->WdmVersion = WinMeOrBetter;
    }
    else if(IoIsWdmVersionAvailable(1, 0x0)) {

        deviceExtension->WdmVersion = Win98OrBetter;
    }

    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",
                                 &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
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品视频| 日韩一区二区三区免费看| 国产精品123区| 国产精品一二三区在线| 国产乱人伦偷精品视频不卡| 精品一区二区三区不卡 | 亚洲综合激情另类小说区| 国产精品毛片大码女人| 亚洲欧洲日产国产综合网| 亚洲视频在线观看一区| 一区二区在线看| 亚洲国产裸拍裸体视频在线观看乱了 | 91蜜桃传媒精品久久久一区二区| 成人激情免费电影网址| 99re亚洲国产精品| 精品视频免费在线| 日韩欧美综合在线| 久久日一线二线三线suv| 欧美高清在线精品一区| 亚洲女厕所小便bbb| 亚洲综合免费观看高清完整版在线| 一区二区久久久久久| 亚洲成a天堂v人片| 欧美乱妇20p| 日韩午夜精品电影| 国产欧美日韩视频在线观看| 国产精品女主播av| 亚洲一区二区三区视频在线 | 国产一区二三区| 国产精品亚洲视频| 91女厕偷拍女厕偷拍高清| 欧美三级乱人伦电影| 日韩免费看的电影| 国产精品午夜免费| 亚洲成av人片观看| 国产伦精品一区二区三区免费| 成人美女视频在线看| 欧美最猛性xxxxx直播| 日韩欧美国产不卡| 国产精品久久久久久久浪潮网站| 亚洲一区二三区| 激情小说欧美图片| 99久久综合精品| 91麻豆精品国产91久久久久久久久| 久久久久久久久久看片| 亚洲狠狠丁香婷婷综合久久久| 麻豆免费看一区二区三区| 成人久久18免费网站麻豆 | 久久视频一区二区| 亚洲欧美偷拍三级| 久久精品国产一区二区三 | 欧美做爰猛烈大尺度电影无法无天| 欧美一级片免费看| 国产精品久久毛片av大全日韩| 亚洲bdsm女犯bdsm网站| 国产中文字幕一区| 欧美日韩国产成人在线91 | 国产一区二区电影| 欧美亚洲综合色| 国产三级一区二区| 日韩影院免费视频| 99久久免费国产| 亚洲精品在线三区| 亚洲国产视频在线| 不卡av在线免费观看| 欧美一卡二卡三卡| 一区2区3区在线看| 懂色av噜噜一区二区三区av| 8v天堂国产在线一区二区| 综合久久久久综合| 国产精品一品二品| 91精品国产综合久久精品性色| 亚洲欧美激情视频在线观看一区二区三区| 免播放器亚洲一区| 欧美性videosxxxxx| 国产精品乱子久久久久| 久久国产精品露脸对白| 欧美人妖巨大在线| 亚洲欧洲中文日韩久久av乱码| 国产老妇另类xxxxx| 日韩欧美一区二区视频| 亚洲综合一区二区| 色婷婷综合久久久中文一区二区 | 国产一区二区三区四区五区入口| 8v天堂国产在线一区二区| 一区二区三区在线观看视频 | 久久久久国产一区二区三区四区| 日本成人在线网站| 精品婷婷伊人一区三区三| 亚洲美女视频一区| www.在线欧美| 国产精品久99| 成人黄色a**站在线观看| 国产亚洲精久久久久久| 国内精品伊人久久久久av影院| 91精品国产综合久久久蜜臀粉嫩 | 色综合久久99| 亚洲欧美激情小说另类| 色综合天天狠狠| 亚洲人亚洲人成电影网站色| 99vv1com这只有精品| 日韩美女精品在线| 91蜜桃免费观看视频| 亚洲免费看黄网站| 欧美性大战xxxxx久久久| 亚洲午夜久久久久久久久电影网 | 成人精品在线视频观看| 中文在线资源观看网站视频免费不卡| 国产精品主播直播| 欧美激情综合在线| av成人老司机| 亚洲精品菠萝久久久久久久| 欧美三级韩国三级日本一级| 亚洲成人av电影在线| 337p亚洲精品色噜噜噜| 奇米精品一区二区三区四区| 日韩精品一区二区在线| 国产一区二区三区四区五区美女| 久久久久国产成人精品亚洲午夜| 国产成人av电影免费在线观看| 国产日韩三级在线| 91一区二区在线| 亚洲小少妇裸体bbw| 日韩午夜在线观看| 国产高清不卡二三区| 亚洲欧洲www| 欧美性感一类影片在线播放| 日韩电影免费在线观看网站| 精品粉嫩超白一线天av| 国产98色在线|日韩| **欧美大码日韩| 欧美日韩激情在线| 黑人巨大精品欧美黑白配亚洲| 国产精品网曝门| 欧美性受xxxx| 国产在线一区二区| 亚洲色图欧洲色图婷婷| 91麻豆精品国产91久久久使用方法 | 久久精品国产第一区二区三区| 久久综合网色—综合色88| 不卡的av中国片| 日韩精品一区第一页| 国产午夜精品一区二区三区嫩草| 91蝌蚪porny| 麻豆免费看一区二区三区| 国产精品蜜臀在线观看| 欧美日韩国产综合一区二区 | 精品一区二区三区久久| 亚洲欧美日本韩国| 91精品国产一区二区人妖| 成人免费福利片| 日产欧产美韩系列久久99| 国产情人综合久久777777| 色吧成人激情小说| 九色porny丨国产精品| 亚洲乱码精品一二三四区日韩在线| 日韩午夜精品电影| 日本高清无吗v一区| 久久国产夜色精品鲁鲁99| 亚洲日本在线视频观看| 欧美成人一区二区| 色久优优欧美色久优优| 国产一区二区h| 午夜亚洲国产au精品一区二区| 久久综合av免费| 欧美日韩1区2区| 99精品热视频| 国内一区二区在线| 午夜精品123| 亚洲欧美乱综合| 国产三级一区二区三区| 91精品国产综合久久精品麻豆| 97se亚洲国产综合在线| 黑人精品欧美一区二区蜜桃| 亚洲大片免费看| 亚洲女性喷水在线观看一区| 国产午夜亚洲精品不卡| 日韩欧美国产三级| 67194成人在线观看| 91福利社在线观看| www.成人网.com| 成人综合婷婷国产精品久久蜜臀| 麻豆91精品91久久久的内涵| 亚洲一区二区视频| 国产精品电影院| 国产欧美精品日韩区二区麻豆天美| 91精品国产高清一区二区三区| 91极品美女在线| 94-欧美-setu| 成人黄色免费短视频| 国产福利不卡视频| 国产精品一线二线三线| 久久草av在线| 麻豆精品一区二区三区| 日韩av一区二| 免费精品视频最新在线| 日韩经典一区二区| 奇米色777欧美一区二区| 日韩av电影天堂| 蜜臀av一区二区|