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

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

?? usbls120.c

?? 一個好用的MS的USB驅動編程工具包,希望有用.
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*++

Copyright (c) 1999 Microsoft Corporation

Module Name:

    Usbls120.c 

Abstract:

    USB device driver for USB LS-120 drive
    Main 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) 1999 Microsoft Corporation.  All Rights Reserved.


Revision History:

    01/13/99: MRB  Adapted from BULKUSB DDK sample.

--*/
#define GLOBAL_VARS

#include "wdm.h"
#include "stdarg.h"
#include "stdio.h"
#include "usbdi.h"
#include "usbdlib.h"
#include "usbls120.h"
#include "USBLS120.h"


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

Routine Description:

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

Arguments:

    DriverObject - pointer to the driver object

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

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT deviceObject = NULL;
    BOOLEAN fRes;

#if DBG
	// should be done before any debug output is done.
    // read our debug verbosity level from the registry
    USBLS120_GetRegistryDword( USBLS120_REGISTRY_PARAMETERS_PATH, //absolute registry path
				     L"DebugLevel",     // REG_DWORD ValueName
				     &gDebugLevel );    // Value receiver
#endif

    USBLS120_KdPrint( DBGLVL_MINIMUM ,("Entering DriverEntry(), RegistryPath=\n    %ws\n", RegistryPath->Buffer ));

    // Remember our driver object, for when we create our child PDO
    USBLS120DriverObject = DriverObject;

    //
    // Create dispatch points for create, close, unload
    DriverObject->MajorFunction[IRP_MJ_CREATE] = USBLS120_DispatchIrp;
    DriverObject->MajorFunction[IRP_MJ_CLOSE] = USBLS120_DispatchIrp;
    DriverObject->DriverUnload = USBLS120_Unload;

    // User mode DeviceIoControl() calls will be routed here
    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = USBLS120_DispatchIrp;

    // User mode ReadFile()/WriteFile() calls will be routed here
    DriverObject->MajorFunction[IRP_MJ_WRITE] = USBLS120_DispatchIrp;
    DriverObject->MajorFunction[IRP_MJ_READ] = USBLS120_DispatchIrp;

    // routines for handling system PNP and power management requests
    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = USBLS120_DispatchIrp;
    DriverObject->MajorFunction[IRP_MJ_PNP] = USBLS120_DispatchIrp;
    DriverObject->MajorFunction[IRP_MJ_POWER] = USBLS120_DispatchIrp;

    // The Functional Device Object (FDO) will not be created for PNP devices until 
    // this routine is called upon device plug-in.
    DriverObject->DriverExtension->AddDevice = USBLS120_PnPAddDevice;


    USBLS120_KdPrint( DBGLVL_DEFAULT,("exiting DriverEntry (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
USBLS120_DispatchIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    IRP dispatch routine.  
    
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;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION DeviceExtension;
	
    DeviceExtension = DeviceObject->DeviceExtension;
    IrpStack = IoGetCurrentIrpStackLocation (Irp);

    if (DO_FDO == DeviceExtension->DeviceObjectType) {
        switch (IrpStack->MajorFunction) {

            case IRP_MJ_SYSTEM_CONTROL:
                ntStatus = USBLS120_ProcessSysControlIrp(DeviceObject, Irp);
                break;

            case IRP_MJ_PNP:
                ntStatus = USBLS120_ProcessPnPIrp(DeviceObject, Irp);
                break;

            case IRP_MJ_POWER:
                ntStatus = USBLS120_ProcessPowerIrp(DeviceObject, Irp);
                break;
        }
    }
    else
    if (DO_PDO == DeviceExtension->DeviceObjectType) {
        switch (IrpStack->MajorFunction) {

            case IRP_MJ_PNP:
                ntStatus = USBLS120_PdoProcessPnPIrp(DeviceObject, Irp);
                break;

            case IRP_MJ_POWER:
                ntStatus = USBLS120_PdoProcessPowerIrp(DeviceObject, Irp);
                break;
        }
			
        Irp->IoStatus.Status = ntStatus;
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
    }

    return ntStatus;
}


NTSTATUS
USBLS120_ProcessSysControlIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    Main dispatch table routine for IRP_MJ_SYSTEM_CONTROL
	We basically just pass these down to the PDO

Arguments:

    DeviceObject - pointer to FDO device object

    Irp          - pointer to an I/O Request Packet

Return Value:

	Status returned from lower driver


--*/
{

    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    NTSTATUS waitStatus;
    PDEVICE_OBJECT stackDeviceObject;

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

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

    USBLS120_KdPrint( DBGLVL_HIGH, ( "enter USBLS120_ProcessSysControlIrp()\n") );

    USBLS120_IncrementIoCount(DeviceObject);

    USBLS120_ASSERT( IRP_MJ_SYSTEM_CONTROL == irpStack->MajorFunction );

    IoCopyCurrentIrpStackLocationToNext(Irp);


    ntStatus = IoCallDriver(stackDeviceObject,
			    Irp);

    USBLS120_DecrementIoCount(DeviceObject);

    USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_ProcessSysControlIrp() Exit USBLS120_ProcessSysControlIrp %x\n", ntStatus));

    return ntStatus;
}


VOID
USBLS120_Unload(
    IN PDRIVER_OBJECT DriverObject
    )
/*++

Routine Description:

    Free all the allocated resources, etc.

Arguments:

    DriverObject - pointer to a driver object

Return Value:


--*/
{
    USBLS120_KdPrint( DBGLVL_HIGH,("enter USBLS120_Unload\n"));

    //
    // Free any global resources allocated
    // in DriverEntry.

    // We have few or none because for a PNP device, almost all
    // allocation is done in PnpAddDevice() and all freeing 
    // while handling IRP_MN_REMOVE_DEVICE:
    //
    USBLS120_ASSERT( gExAllocCount == 0 );

    USBLS120_KdPrint( DBGLVL_DEFAULT,("exit USBLS120_Unload\n"));
}



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

Routine Description:

    Creates a Functional DeviceObject

Arguments:

    DriverObject - pointer to the driver object for device

    DeviceObject - pointer to DeviceObject pointer to return
		    created device object.

    Instance - instance of the device create.

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus;
    PDEVICE_EXTENSION deviceExtension;
    USHORT i;

    USBLS120_KdPrint( DBGLVL_DEFAULT,("enter USBLS120_CreateDeviceObject() \n"));

    ntStatus = IoCreateDevice(
        DriverObject,
        sizeof (DEVICE_EXTENSION),
        NULL,
        FILE_DEVICE_UNKNOWN,
        FILE_AUTOGENERATED_DEVICE_NAME,
        FALSE,
        DeviceObject
        );

    if (NT_SUCCESS(ntStatus))  {
        deviceExtension = (PDEVICE_EXTENSION) ((*DeviceObject)->DeviceExtension);
    }

    USBLS120_KdPrintCond(
        DBGLVL_DEFAULT,
        (!(NT_SUCCESS(ntStatus))),
        ("USBLS120_CreateDeviceObject() IoCreateDevice() FAILED\n"));

 
    if (!NT_SUCCESS(ntStatus))  {
        return ntStatus;
     }

    deviceExtension->DeviceObjectType = DO_FDO;

    //default maximum transfer size per io request
    deviceExtension->MaximumTransferSize =  USBLS120_MAX_TRANSFER_SIZE ;

    // this event is triggered when there is no pending io of any kind and device is removed
    KeInitializeEvent(&deviceExtension->RemoveEvent, NotificationEvent, FALSE);

    // this event is triggered when self-requested power irps complete
    KeInitializeEvent(&deviceExtension->SelfRequestedPowerIrpEvent, NotificationEvent, FALSE);

    // this event is triggered when there is no pending io  (pending io count == 1 )
    KeInitializeEvent(&deviceExtension->NoPendingIoEvent, NotificationEvent, FALSE);

    // spinlock used to protect inc/dec iocount logic
    KeInitializeSpinLock (&deviceExtension->IoCountSpinLock);

    return ntStatus;
}


NTSTATUS
USBLS120_CallUSBD(
    IN PDEVICE_OBJECT DeviceObject,
    IN PURB Urb
    )
/*++

Routine Description:

    Passes a URB to the USBD class driver
    The client device driver passes USB request block (URB) structures 
    to the class driver as a parameter in an IRP with Irp->MajorFunction
    set to IRP_MJ_INTERNAL_DEVICE_CONTROL and the next IRP stack location 
    Parameters.DeviceIoControl.IoControlCode field set to 
    IOCTL_INTERNAL_USB_SUBMIT_URB. 

Arguments:

    DeviceObject - pointer to the physical device object (PDO)

    Urb - pointer to an already-formatted Urb request block

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS ntStatus, status = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    PIRP irp;
    KEVENT event;
    IO_STATUS_BLOCK ioStatus;
    PIO_STACK_LOCATION nextStack;

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("enter USBLS120_CallUSBD\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(
              IOCTL_INTERNAL_USB_SUBMIT_URB,
              deviceExtension->TopOfStackDeviceObject, //Points to the next-lower driver's device object
              NULL, // optional input bufer; none needed here
              0,    // input buffer len if used
              NULL, // optional output bufer; none needed here
              0,    // output buffer len if used
              TRUE, // If InternalDeviceControl is TRUE the target driver's Dispatch
                    //  outine for IRP_MJ_INTERNAL_DEVICE_CONTROL or IRP_MJ_SCSI 
                    // is called; otherwise, the Dispatch routine for 
                    // IRP_MJ_DEVICE_CONTROL is called.
              &event,     // event to be signalled on completion
              &ioStatus);  // Specifies an I/O status block to be set when the request is completed the lower driver. 

    //
    // Call the class driver to perform the operation.  If the returned status
    // is PENDING, wait for the request to complete.
    //

    nextStack = IoGetNextIrpStackLocation(irp);
    USBLS120_ASSERT(nextStack != NULL);

    //
    // pass the URB to the USB driver stack
    //
    nextStack->Parameters.Others.Argument1 = Urb;

    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, irp);

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("USBLS120_CallUSBD() return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {

        status = KeWaitForSingleObject(
                     &event,
                     Suspended,
                     KernelMode,
                     FALSE,
                     NULL);

    } else {
	ioStatus.Status = ntStatus;
    }

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("USBLS120_CallUSBD() URB status = %x status = %x irp status %x\n",
	Urb->UrbHeader.Status, status, ioStatus.Status));

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    USBLS120_KdPrintCond( DBGLVL_MAXIMUM, !NT_SUCCESS( ntStatus ), ("exit USBLS120_CallUSBD FAILED (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
USBLS120_ConfigureDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Initializes a given instance of the device on the USB and
    selects and saves the configuration.

Arguments:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级乱人伦电影| 国产农村妇女精品| 在线视频中文字幕一区二区| 99亚偷拍自图区亚洲| 国产91丝袜在线播放| 国产精品一二三四区| 国产激情一区二区三区| 国产精品一区在线观看你懂的| 国产精品资源在线观看| 国产麻豆精品在线| 国产黄色精品视频| 成人免费毛片片v| 99re热视频精品| 在线观看视频欧美| 欧美日韩三级一区| 欧美老肥妇做.爰bbww视频| 欧美一区二区三区色| 日韩视频国产视频| 久久九九国产精品| 国产精品色婷婷| 亚洲欧美一区二区久久| 亚洲午夜久久久久久久久电影院| 午夜久久久影院| 免费人成精品欧美精品 | 久久99精品国产麻豆不卡| 麻豆精品一二三| 国产一区二区免费在线| av亚洲产国偷v产偷v自拍| 日本高清不卡在线观看| 欧美一级夜夜爽| 久久午夜羞羞影院免费观看| 国产人久久人人人人爽| 亚洲欧美电影院| 午夜精品久久久久久| 国产精一区二区三区| 99re热这里只有精品免费视频 | 久久蜜桃av一区二区天堂| 国产精品久久一级| 亚洲成人激情自拍| 国产精品一品二品| 欧美三级在线看| ww久久中文字幕| 一区二区三区丝袜| 国产在线乱码一区二区三区| 91在线国产观看| 欧美一二区视频| **网站欧美大片在线观看| 免播放器亚洲一区| 91免费精品国自产拍在线不卡 | 亚洲综合免费观看高清完整版在线| 美日韩黄色大片| 日本久久精品电影| 日韩免费观看2025年上映的电影 | 一区二区三区成人| 精品午夜久久福利影院| 欧美在线综合视频| 久久精品网站免费观看| 亚洲大片一区二区三区| 粉嫩久久99精品久久久久久夜| 欧美日本韩国一区| 国产精品免费视频网站| 久久99热99| 欧美日本精品一区二区三区| 综合欧美一区二区三区| 国产中文字幕一区| 欧美性猛片aaaaaaa做受| 国产精品免费av| 国内精品免费**视频| 欧美日本在线一区| 亚洲欧美激情视频在线观看一区二区三区| 麻豆精品一区二区av白丝在线| 日本韩国视频一区二区| 国产日产欧美精品一区二区三区| 亚洲第一精品在线| 一本色道久久综合狠狠躁的推荐| 国产欧美日韩三级| 蜜乳av一区二区| 欧美日韩国产大片| 一区二区三区免费看视频| 成人av在线电影| 精品粉嫩aⅴ一区二区三区四区| 午夜成人免费电影| 在线观看视频一区二区欧美日韩| 中文字幕乱码亚洲精品一区| 国产麻豆一精品一av一免费| 日韩精品一区二区在线| 日韩激情视频在线观看| 欧美性色综合网| 亚洲夂夂婷婷色拍ww47| 99re成人在线| 亚洲免费在线播放| 91农村精品一区二区在线| 国产精品久久久久影院老司| 成人免费精品视频| 中文字幕av一区二区三区高 | 粉嫩一区二区三区在线看| 久久精品亚洲麻豆av一区二区| 久久se这里有精品| 精品国产乱码久久久久久夜甘婷婷| 全国精品久久少妇| 欧美大白屁股肥臀xxxxxx| 午夜婷婷国产麻豆精品| 欧美性受极品xxxx喷水| 香蕉乱码成人久久天堂爱免费| 欧美日韩国产精品成人| 视频一区中文字幕| 日韩一区二区电影| 韩国av一区二区三区| 久久久蜜臀国产一区二区| 国产精品一区在线观看乱码| 国产欧美精品国产国产专区| 成人晚上爱看视频| 国产精品妹子av| 91同城在线观看| 亚洲综合免费观看高清完整版在线| 91福利视频在线| 亚洲综合久久久久| 69堂国产成人免费视频| 美国av一区二区| 国产日韩在线不卡| 97久久超碰精品国产| 亚洲成人动漫在线观看| 91精品国产麻豆| 国产尤物一区二区| 国产精品久久久久天堂| 日本高清不卡在线观看| 日本少妇一区二区| 精品久久一二三区| 成人性视频网站| 亚洲激情一二三区| 欧美福利视频导航| 激情欧美日韩一区二区| 欧美经典一区二区三区| 色婷婷亚洲精品| 蜜臀av在线播放一区二区三区| wwww国产精品欧美| 一本到不卡精品视频在线观看| 亚洲福利电影网| 久久久一区二区| 在线看日本不卡| 久久国产剧场电影| 亚洲色图丝袜美腿| 欧美一级日韩免费不卡| 国产盗摄女厕一区二区三区| 亚洲一区二区三区在线播放| 精品国产自在久精品国产| 99综合电影在线视频| 青青草一区二区三区| 国产精品国产三级国产aⅴ中文| 欧美日韩另类一区| 国产高清一区日本| 亚洲bt欧美bt精品| 日本一区二区综合亚洲| 欧美日韩国产一级二级| 成人免费视频国产在线观看| 图片区小说区国产精品视频| 欧美国产精品一区二区三区| 欧美视频精品在线| 成人激情校园春色| 男人的j进女人的j一区| 亚洲素人一区二区| 久久婷婷国产综合国色天香| 欧美午夜一区二区| 99这里只有久久精品视频| 蜜桃91丨九色丨蝌蚪91桃色| 一区二区三区在线观看视频| 国产亚洲精品资源在线26u| 欧美日韩美少妇| 99久久综合狠狠综合久久| 久久国产尿小便嘘嘘| 亚洲成人综合在线| 中文字幕一区二区三区四区不卡| 3d动漫精品啪啪| 日本高清免费不卡视频| 成年人国产精品| 国产精品亚洲一区二区三区在线| 日韩av成人高清| 亚洲一区二区三区精品在线| 中文字幕永久在线不卡| 国产视频不卡一区| 欧美va日韩va| 91麻豆精品国产91久久久久久久久| 97久久精品人人爽人人爽蜜臀| 国产精品91xxx| 国产在线精品一区二区夜色| 蜜桃视频第一区免费观看| 亚洲123区在线观看| 亚洲男人的天堂一区二区| 中文字幕第一区二区| 国产亚洲精品资源在线26u| 欧美精品一区男女天堂| 日韩欧美一区二区不卡| 欧美一区二区美女| 欧美日韩精品系列| 欧美日韩中文精品| 欧美日韩一本到| 欧美日本在线视频| 欧美巨大另类极品videosbest| 欧美三级日韩三级| 在线不卡中文字幕播放|