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

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

?? usbls120.c

?? 參考著寫(xiě)其他的驅(qū)動(dòng)程序就可以了。
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*++

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:

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美aⅴ...| 亚洲高清视频的网址| 91精品久久久久久久99蜜桃| 国产白丝精品91爽爽久久 | 久久精品视频在线看| 欧洲激情一区二区| www.日韩在线| 国产一区二区三区av电影| 亚洲成人av在线电影| 中文字幕日韩精品一区| 久久久久久免费| 91精品国产一区二区三区| 91捆绑美女网站| 成人午夜电影小说| 国产麻豆91精品| 激情五月婷婷综合| 日韩中文字幕av电影| 亚洲一区二区三区美女| 亚洲视频在线一区观看| 欧美国产一区二区| 久久午夜羞羞影院免费观看| 91精品在线一区二区| 欧美日韩一区高清| 欧美色图第一页| 欧美性色欧美a在线播放| 99久久婷婷国产| www.亚洲精品| 99精品黄色片免费大全| 波多野结衣91| 91免费视频网址| 成人黄页毛片网站| 不卡免费追剧大全电视剧网站| 国产精品18久久久久久久久久久久| 麻豆精品视频在线观看视频| 美洲天堂一区二卡三卡四卡视频| 日韩和的一区二区| 青青国产91久久久久久| 免费高清不卡av| 免费不卡在线观看| 精品一区二区免费在线观看| 精品一区二区在线免费观看| 国产一区二区h| 国产精品一级在线| 岛国精品在线观看| 97se亚洲国产综合自在线| 色综合久久66| 欧美视频三区在线播放| 91精品免费观看| 精品国产91久久久久久久妲己| 精品国产污污免费网站入口 | 欧美日本精品一区二区三区| 欧美日韩国产乱码电影| 日韩写真欧美这视频| 欧美精品一区二区蜜臀亚洲| 国产欧美一区二区精品久导航| 国产精品理伦片| 亚洲一区二区三区四区的| 蜜桃一区二区三区在线观看| 国产乱子伦一区二区三区国色天香| 国产成人综合在线播放| 91日韩在线专区| 3751色影院一区二区三区| 欧美成人伊人久久综合网| 欧美激情一区不卡| 亚洲国产精品麻豆| 狠狠色综合播放一区二区| av爱爱亚洲一区| 欧美精品一卡两卡| 久久久久久亚洲综合| 一区二区在线免费| 美脚の诱脚舐め脚责91| 不卡电影一区二区三区| 9191成人精品久久| 国产欧美日韩精品在线| 香港成人在线视频| 国产一区二区按摩在线观看| 在线观看日韩电影| 337p日本欧洲亚洲大胆色噜噜| 亚洲欧洲日产国产综合网| 日韩成人一区二区三区在线观看| 国产一区二三区好的| 日本乱人伦一区| www亚洲一区| 一区二区三区欧美亚洲| 精品一区二区三区视频| 欧美亚洲动漫精品| 国产日产精品1区| 青青国产91久久久久久| 色综合中文字幕国产 | 久久99蜜桃精品| 99国产精品99久久久久久| 欧美一区二区三区日韩| 亚洲视频中文字幕| 国产大片一区二区| 日韩欧美一级二级三级| 亚洲美女免费视频| 国产精品18久久久久久久久久久久| 欧美日韩视频在线一区二区| 中国av一区二区三区| 久久aⅴ国产欧美74aaa| 欧美日精品一区视频| 国产精品久久久久国产精品日日| 另类小说欧美激情| 欧美专区日韩专区| 专区另类欧美日韩| 国产精品中文字幕日韩精品| 555夜色666亚洲国产免| 亚洲激情自拍偷拍| 91原创在线视频| 中文字幕国产一区二区| 久久国产精品72免费观看| 欧美精品亚洲一区二区在线播放| 亚洲女与黑人做爰| 97精品电影院| 1000精品久久久久久久久| 成人午夜碰碰视频| 国产视频亚洲色图| 国产伦理精品不卡| 久久久青草青青国产亚洲免观| 免费三级欧美电影| 日韩三级高清在线| 日本在线播放一区二区三区| 欧美日韩成人综合| 午夜精品久久久久久久久| 欧美日韩综合在线免费观看| 亚洲国产美女搞黄色| 欧洲在线/亚洲| 亚洲国产日产av| 欧美午夜一区二区三区免费大片| 一区二区三区欧美在线观看| 91国内精品野花午夜精品| 亚洲综合激情网| 欧美性极品少妇| 日韩国产欧美在线播放| 欧美一区在线视频| 精品一区二区国语对白| 久久久亚洲综合| 国产高清成人在线| 国产欧美一区二区在线| 东方aⅴ免费观看久久av| 国产精品免费aⅴ片在线观看| 国产成人综合视频| 国产精品久久久久久久久动漫 | 亚洲天堂久久久久久久| 97久久精品人人澡人人爽| 一区二区免费视频| 337p亚洲精品色噜噜狠狠| 乱一区二区av| 国产欧美精品国产国产专区 | 91国偷自产一区二区三区成为亚洲经典| 亚洲免费观看高清完整版在线观看熊 | 欧美国产日产图区| av爱爱亚洲一区| 亚洲成a人片在线不卡一二三区| 欧美福利电影网| 国产精品一区在线观看乱码| 国产精品全国免费观看高清 | 99这里只有久久精品视频| 一区二区三区在线视频免费 | 国产1区2区3区精品美女| 1024亚洲合集| 91精品国产色综合久久ai换脸 | 欧美午夜在线观看| 精品中文av资源站在线观看| 国产精品国产三级国产a| 欧美色爱综合网| 国产盗摄一区二区三区| 一区二区三区成人| 精品国产一二三| 一本到高清视频免费精品| 久久精品av麻豆的观看方式| 中文字幕 久热精品 视频在线| 欧美色图天堂网| 国产精品综合久久| 亚洲香蕉伊在人在线观| 精品国产电影一区二区| 91电影在线观看| 久热成人在线视频| 亚洲伦理在线免费看| 欧美大片在线观看一区二区| 99这里只有久久精品视频| 老司机午夜精品| 亚洲欧美激情一区二区| 精品久久久久久亚洲综合网| 色综合天天在线| 国模冰冰炮一区二区| 一区二区三区在线观看动漫 | 久久久久久夜精品精品免费| 欧美在线视频全部完| 国产91丝袜在线18| 日韩精品亚洲一区| 亚洲视频在线一区| 久久婷婷国产综合精品青草| 欧美日韩一二区| 91在线观看美女| 国产成人一区在线| 美女精品一区二区| 亚洲午夜激情网页| 亚洲理论在线观看| 国产午夜久久久久|