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

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

?? usbls120.c

?? 來自微軟的usb2.0開發包,加速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一区二区三区免费野_久草精品视频
国产欧美久久久精品影院| 国模少妇一区二区三区| 日韩精品电影一区亚洲| 国产自产高清不卡| 91福利在线观看| 久久亚洲综合色| 亚洲午夜精品一区二区三区他趣| 亚洲一区二区三区国产| 久久精品国产秦先生| 91丝袜美腿高跟国产极品老师| 3d动漫精品啪啪一区二区竹菊| 国产精品久99| 久久电影网站中文字幕| 精品污污网站免费看| 国产精品视频线看| 久久国产精品露脸对白| 欧美日韩亚洲不卡| 亚洲欧美偷拍卡通变态| 粉嫩aⅴ一区二区三区四区五区 | 亚洲欧美成aⅴ人在线观看| 免费久久99精品国产| 在线观看欧美日本| 亚洲欧美影音先锋| 国产福利91精品| 欧美一区二区三区喷汁尤物| 亚洲欧美视频在线观看| 成人午夜免费av| 欧美精品一区二区三区很污很色的 | 国产精品福利一区| 国产自产视频一区二区三区| 91精品欧美福利在线观看| 亚洲一区二区三区四区中文字幕| 成人在线综合网站| 久久久精品国产免大香伊| 精品在线你懂的| 日韩精品一区二区三区三区免费| 日韩综合小视频| 欧美日韩国产综合一区二区三区 | 亚洲黄色片在线观看| 成人国产精品视频| 中文字幕巨乱亚洲| 国产91精品一区二区| 国产日韩v精品一区二区| 国产精品综合二区| 国产日韩欧美电影| 成人激情小说网站| 中文字幕亚洲在| 91片在线免费观看| 一区二区三区四区亚洲| 一本色道a无线码一区v| 亚洲国产精品久久久久婷婷884| 欧美在线观看一区二区| 亚洲黄色在线视频| 欧美福利一区二区| 男男视频亚洲欧美| 精品国产欧美一区二区| 国产乱码精品1区2区3区| 久久久亚洲精品石原莉奈 | 亚洲一区二区三区美女| 欧美二区三区的天堂| 蜜桃av一区二区| 精品电影一区二区| 成人激情免费电影网址| 一二三四区精品视频| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲影视在线播放| 欧美一区二区三区电影| 精品一区二区国语对白| 欧美国产一区在线| 在线视频一区二区三区| 青青草原综合久久大伊人精品| 欧美精品一区二区三区在线| 懂色av中文一区二区三区| 日韩一区欧美一区| 欧美一区欧美二区| 粉嫩av亚洲一区二区图片| 亚洲午夜影视影院在线观看| 日韩欧美三级在线| 不卡av免费在线观看| 亚洲超碰精品一区二区| 久久综合色8888| 不卡的电影网站| 免费一级片91| 亚洲视频在线一区二区| 日韩美女在线视频| 色婷婷精品久久二区二区蜜臀av| 免费成人在线网站| 亚洲精品成a人| 26uuu另类欧美| 欧美在线观看禁18| 国产精品888| 五月天网站亚洲| 中文字幕国产一区| 精品国产伦一区二区三区免费| 日本电影亚洲天堂一区| 国产一区二区伦理片| 午夜av一区二区三区| 亚洲欧洲精品成人久久奇米网| 7777精品伊人久久久大香线蕉最新版 | 一本久久综合亚洲鲁鲁五月天| 韩国av一区二区三区四区| 亚洲成人黄色小说| 中文字幕一区二区三区在线不卡 | 不卡的电视剧免费网站有什么| 日本人妖一区二区| 亚洲日本电影在线| 久久久久久久久久久99999| 欧美日韩国产大片| 日本乱人伦aⅴ精品| 懂色av一区二区三区免费看| 日本sm残虐另类| 婷婷六月综合亚洲| 亚洲国产中文字幕在线视频综合| 国产精品色婷婷| 精品国产凹凸成av人导航| 日韩欧美中文字幕一区| 这里只有精品电影| 91精品欧美久久久久久动漫| 欧美日韩一区二区三区高清| 色八戒一区二区三区| 欧美中文字幕亚洲一区二区va在线| 成人精品视频一区二区三区| 成人aa视频在线观看| 国产精品一区在线观看乱码| 狠狠色狠狠色综合| 精品一区免费av| 国内外成人在线| 国产高清成人在线| 成人午夜电影网站| 97精品国产露脸对白| 色综合久久久久综合99| 欧日韩精品视频| 欧美日韩国产综合一区二区三区| 91精品欧美久久久久久动漫| 日韩一级黄色片| 亚洲精品在线观看网站| 欧美激情在线一区二区三区| 国产精品久久福利| 夜夜亚洲天天久久| 丝袜亚洲另类欧美综合| 久久成人av少妇免费| 国产很黄免费观看久久| 97久久超碰国产精品| 欧美三级资源在线| 欧美成人艳星乳罩| 国产日韩影视精品| 亚洲乱码日产精品bd| 日本aⅴ亚洲精品中文乱码| 韩国毛片一区二区三区| 成人a区在线观看| 欧美日韩国产小视频| 日韩精品最新网址| 中文字幕亚洲欧美在线不卡| 亚洲午夜免费电影| 久久99久久精品| www.久久久久久久久| 欧美美女喷水视频| 久久久久9999亚洲精品| 洋洋成人永久网站入口| 麻豆91在线看| av电影在线观看完整版一区二区| 欧美日韩国产一区| 久久久久久亚洲综合| 亚洲高清免费视频| 国内久久精品视频| 日本高清不卡一区| 国产亚洲女人久久久久毛片| 亚洲综合久久av| 久久99精品久久久久婷婷| 91福利在线播放| 久久久精品日韩欧美| 五月激情六月综合| 成人深夜在线观看| 精品久久久久久久久久久久久久久久久| 国产女人aaa级久久久级| 日韩精品电影在线| 日本久久一区二区三区| 久久亚区不卡日本| 日韩电影免费在线观看网站| 成人免费视频视频| 欧美成人aa大片| 亚洲一区二区欧美激情| 成人黄色软件下载| 日韩精品一区二区三区蜜臀| 亚洲二区在线观看| 成人免费毛片嘿嘿连载视频| 日韩一级视频免费观看在线| 亚洲免费在线看| 风间由美一区二区av101| 日韩免费观看2025年上映的电影| 亚洲尤物在线视频观看| 91免费看片在线观看| 国产日韩欧美a| 国模冰冰炮一区二区| 日韩写真欧美这视频| 首页综合国产亚洲丝袜| 色综合天天综合给合国产| 国产精品久久影院| 成人av在线影院| 国产欧美一区视频|