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

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

?? intusb.c

?? This document provides information that supplements the Silicon Labs Interrupt Driver, which includ
?? C
字號:
/*++


Module Name:

    intusb.c

Abstract:

    Main module

Author:

Environment:

    kernel mode only

Notes:

    All Rights Reserved.

--*/

#include "intusb.h"
#include "intpnp.h"
#include "intpwr.h"
#include "intdev.h"
#include "intwmi.h"
#include "intusr.h"
#include "intrwr.h"

//
// Globals
//

GLOBALS Globals;
ULONG   DebugLevel = 1;
BOOLEAN win98 = FALSE;

#ifdef PAGE_CODE
#ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT, DriverEntry)
#pragma alloc_text(PAGE, IntUsb_DriverUnload)
#endif
#endif

#pragma INITCODE

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;

	// DriverEntry
	KdPrint((DRIVERNAME " - Entering DriverEntry: DriverObject %8.8lX\n", DriverObject));

	// Insist that OS support at least the WDM level of the DDK we use

	if (!IoIsWdmVersionAvailable(1, 0))
		{
		KdPrint((DRIVERNAME " - Expected version of WDM (%d.%2.2d) not available\n", 1, 0));
		return STATUS_UNSUCCESSFUL;
		}

	//
    // initialization of variables
    //

    registryPath = &Globals.IntUsb_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) {

        KdPrint( ("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] = IntUsb_DispatchDevCtrl;
    DriverObject->MajorFunction[IRP_MJ_POWER]          = IntUsb_DispatchPower;
    DriverObject->MajorFunction[IRP_MJ_PNP]            = IntUsb_DispatchPnP;
    DriverObject->MajorFunction[IRP_MJ_CREATE]         = IntUsb_DispatchCreate;
    DriverObject->MajorFunction[IRP_MJ_CLOSE]          = IntUsb_DispatchClose;
    DriverObject->MajorFunction[IRP_MJ_CLEANUP]        = IntUsb_DispatchClean;
	DriverObject->MajorFunction[IRP_MJ_READ]           = IntUsb_DispatchRead;
    DriverObject->MajorFunction[IRP_MJ_WRITE]          = IntUsb_DispatchWrite;
    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IntUsb_DispatchSysCtrl;
    DriverObject->DriverUnload                         = IntUsb_DriverUnload;
    DriverObject->DriverExtension->AddDevice           = (PDRIVER_ADD_DEVICE)
                                                         IntUsb_AddDevice;
	
	
DriverEntry_Exit:

    return ntStatus;
}

#pragma PAGEDCODE

VOID
IntUsb_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;
	KdPrint((DRIVERNAME " - Entering DriverEntry: DriverObject %8.8lX\n", DriverObject));

    KdPrint((DRIVERNAME " - Entering DriverUnload: DriverObject %8.8lX\n", DriverObject));

    registryPath = &Globals.IntUsb_RegistryPath;

    if(registryPath->Buffer) {

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

    KdPrint( ("IntUsb_DriverUnload - ends\n"));

    return;
}

NTSTATUS
IntUsb_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;

    KdPrint( (DRIVERNAME " - IntUsb_AddDevice - begins %8.8lX\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.
        //                
        KdPrint( ("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_BUFFERED_IO;
		
	IoInitializeRemoveLock(&(deviceExtension->RemoveLock), 0, 0, 0);
	
    //
    // 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 = IntUsb_WmiRegistration(deviceExtension);

    if(!NT_SUCCESS(ntStatus)) {

        KdPrint( ("IntUsb_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) {

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

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

    if(!NT_SUCCESS(ntStatus)) {

        IntUsb_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) {

        IntUsb_GetRegistryDword(INTUSB_REGISTRY_PARAMETERS_PATH,
                                 L"IntUsbEnable",
                                 &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);
        }
    }

	// Create an IRP and a URB to use in polling for interrupts

	ntStatus = CreateInterruptUrbIN(deviceObject);
	if (!NT_SUCCESS(ntStatus))
	{
		KdPrint( ("CreateInterruptUrb failed with %X\n", ntStatus));
        IoDeleteDevice(deviceObject);
        return ntStatus;
	}

	
	InitializeListHead(&deviceExtension->Pending_IOCTL_READINT_List);
	KeInitializeSpinLock(&deviceExtension->Cachelock);
		
    //
    // 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;

    KdPrint( ("IntUsb_AddDevice - ends\n"));

    return ntStatus;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产手机在线| 51精品视频一区二区三区| 日韩高清电影一区| 亚洲欧美另类久久久精品| 国产精品久久久久aaaa| 亚洲国产一二三| 日韩一区有码在线| 亚洲天堂a在线| 亚洲日本丝袜连裤袜办公室| 国产精品国产三级国产| 亚洲日本va午夜在线影院| 国产精品家庭影院| 亚洲欧美一区二区三区孕妇| 中文字幕一区二区三区精华液 | 国产精品久久久久婷婷二区次| 精品国产网站在线观看| 久久综合久久99| 久久精品亚洲麻豆av一区二区| 国产欧美一区二区精品性色超碰| 日本亚洲三级在线| 麻豆国产精品视频| 国产美女精品一区二区三区| 丁香啪啪综合成人亚洲小说 | 亚洲国产高清在线| 亚洲欧美一区二区三区国产精品 | 欧美手机在线视频| 日韩欧美中文字幕制服| 26uuu久久综合| 亚洲欧洲无码一区二区三区| 亚洲综合区在线| 免费在线视频一区| 国产精品主播直播| 一道本成人在线| 91精品蜜臀在线一区尤物| 亚洲精品在线免费播放| 亚洲婷婷综合色高清在线| 亚洲成人av电影| 91精品国产综合久久香蕉的特点| 日韩午夜中文字幕| 中文字幕巨乱亚洲| 日韩在线观看一区二区| 国产精品456露脸| 91丝袜国产在线播放| 欧美精品三级在线观看| 日本一区二区三区电影| 亚洲一区二区三区四区中文字幕| 激情欧美日韩一区二区| 91理论电影在线观看| 精品久久久久久久久久久久包黑料 | 香蕉加勒比综合久久| 国产美女精品一区二区三区| 色综合久久中文综合久久牛| 欧美成人性福生活免费看| 亚洲精品国产视频| 国产精品自拍网站| 欧美性欧美巨大黑白大战| 国产欧美日韩另类一区| 日产精品久久久久久久性色| 99久久国产综合色|国产精品| 日韩精品中午字幕| 亚洲国产一区二区在线播放| 成人av在线影院| 久久综合成人精品亚洲另类欧美 | 亚洲宅男天堂在线观看无病毒| 久久不见久久见免费视频7| 欧美性感一类影片在线播放| 国产精品久久久久一区二区三区| 国内精品在线播放| 51精品久久久久久久蜜臀| 亚洲综合网站在线观看| 99久久久精品| 国产精品盗摄一区二区三区| 国产成人在线视频免费播放| 日韩精品一区二区三区三区免费| 婷婷开心久久网| 欧美三级视频在线| 亚洲国产精品一区二区久久恐怖片| 波多野洁衣一区| 中文字幕中文在线不卡住| 国产aⅴ综合色| 免费高清成人在线| 91精品国产福利| 日韩成人午夜电影| 欧美电影影音先锋| 五月天视频一区| 在线91免费看| 青青草国产成人av片免费| 日韩久久久精品| 久久成人精品无人区| 26uuu国产一区二区三区| 国产剧情一区二区三区| 国产午夜精品福利| 成人精品亚洲人成在线| 中文字幕免费在线观看视频一区| 成人免费高清视频在线观看| 国产精品午夜春色av| 99视频一区二区| 亚洲小说欧美激情另类| 欧美日韩1234| 国产另类ts人妖一区二区| 欧美极品aⅴ影院| 色综合中文字幕国产 | 亚洲精品视频自拍| 欧美性生活久久| 麻豆freexxxx性91精品| 精品国产污污免费网站入口 | 91福利在线导航| 午夜精品123| 久久久久久亚洲综合| 91在线观看高清| 蜜乳av一区二区| 国产精品嫩草久久久久| 欧美日韩国产大片| 国产成人精品www牛牛影视| 一区在线播放视频| 91精品国产一区二区三区蜜臀 | 久久精品一区二区三区四区| 91免费小视频| 精品一区二区免费视频| 自拍偷自拍亚洲精品播放| 538在线一区二区精品国产| 懂色av中文一区二区三区| 亚洲第一福利一区| 久久九九99视频| 欧美最新大片在线看 | 国产女人18毛片水真多成人如厕| 欧美亚洲综合一区| 成人黄页毛片网站| 日韩精品免费视频人成| 中文字幕中文字幕在线一区 | 激情综合网最新| 亚洲第一av色| 中文幕一区二区三区久久蜜桃| 337p亚洲精品色噜噜| 91亚洲精品一区二区乱码| 国产乱码精品一品二品| 日日欢夜夜爽一区| 亚洲欧美区自拍先锋| 欧美经典一区二区三区| 日韩一区二区精品葵司在线| 欧洲中文字幕精品| 成人一级视频在线观看| 精品综合久久久久久8888| 亚洲妇熟xx妇色黄| 一区二区三区四区在线播放 | 国产精品国产三级国产有无不卡| 欧美一区二区三区色| 在线免费一区三区| 91麻豆国产自产在线观看| 国产电影精品久久禁18| 久久99国产精品久久| 秋霞午夜av一区二区三区| 亚洲福利视频三区| 亚洲精品乱码久久久久久| 亚洲人吸女人奶水| 中文字幕一区二区三区不卡 | 色综合久久88色综合天天6 | 亚洲日韩欧美一区二区在线| 国产精品国产a| 国产精品伦理在线| 国产精品传媒入口麻豆| 国产精品久久久久一区二区三区| 中文字幕永久在线不卡| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 久久综合色婷婷| 日韩精品一区二区三区在线| 日韩欧美在线一区二区三区| 亚洲欧美激情插 | 欧美日韩和欧美的一区二区| 欧美日韩三级一区二区| 欧美日韩国产综合一区二区三区| 欧美日韩国产乱码电影| 日韩三级视频在线观看| 久久久久久久综合日本| 中文在线一区二区| 一区二区三区四区激情| 午夜精品一区在线观看| 日本中文字幕一区| 国产一区二区久久| 成人91在线观看| 欧美影院精品一区| 日韩精品中文字幕在线一区| 亚洲国产精品av| 亚洲综合在线观看视频| 日本美女视频一区二区| 狠狠色丁香久久婷婷综合_中| 国产老妇另类xxxxx| 91在线视频观看| 欧美一区二区在线观看| 日本一区二区三级电影在线观看| 亚洲久本草在线中文字幕| 蜜桃视频第一区免费观看| 成人av在线播放网址| 欧美亚洲图片小说| 久久久久久久综合日本| 亚洲国产一区二区三区 | 久久精品欧美一区二区三区麻豆| 日韩毛片一二三区| 捆绑变态av一区二区三区| 91无套直看片红桃|