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

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

?? usbls120.c

?? 參考著寫其他的驅動程序就可以了。
?? 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一区二区三区免费野_久草精品视频
日韩欧美国产综合| 欧洲精品一区二区| 欧美夫妻性生活| 视频一区欧美精品| 欧美性受xxxx| 视频在线观看一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 国产精品88888| 日韩免费视频线观看| 日韩成人一区二区三区在线观看| 国产高清不卡一区| 国产午夜精品福利| 成人免费三级在线| 日韩专区一卡二卡| 亚洲男同性恋视频| 久久久精品免费网站| 884aa四虎影成人精品一区| 欧美区一区二区三区| 成人av资源在线| 国内精品国产成人国产三级粉色 | 欧美老人xxxx18| jlzzjlzz欧美大全| 国产精品18久久久久久久网站| 丝袜脚交一区二区| 亚洲综合视频在线观看| 亚洲视频在线观看三级| 中文字幕av一区 二区| ww久久中文字幕| 日韩欧美123| 日韩视频一区在线观看| 911精品国产一区二区在线| 日本精品裸体写真集在线观看 | 欧美成人一区二区三区| 日本久久电影网| 93久久精品日日躁夜夜躁欧美| 国产成人精品亚洲日本在线桃色| 国产一区欧美二区| 国产乱码一区二区三区| 国产精品一区二区视频| 国产一区二区影院| 国产精品中文字幕日韩精品| 久草在线在线精品观看| 另类小说欧美激情| 美女网站色91| 国产一区二区三区久久悠悠色av| 国产在线不卡一区| 国产不卡在线一区| 成人h动漫精品| 日本久久电影网| 欧美精品在线视频| 91麻豆精品91久久久久久清纯| 欧美一区二区视频免费观看| 日韩精品中文字幕一区二区三区 | 亚洲人成影院在线观看| 亚洲免费成人av| 亚洲777理论| 久久精品国产第一区二区三区| 国产精品一区久久久久| 国产精品一级片在线观看| 成人免费视频一区| 91福利小视频| 欧美一区二区高清| 久久精品日产第一区二区三区高清版 | 丁香亚洲综合激情啪啪综合| 波多野结衣精品在线| 色嗨嗨av一区二区三区| 欧美美女直播网站| 日韩视频免费观看高清在线视频| 久久综合狠狠综合| 亚洲日本韩国一区| 日韩av午夜在线观看| 国产精品综合视频| 在线亚洲一区观看| 精品国产sm最大网站免费看| 中文一区在线播放| 五月激情综合婷婷| 国产高清不卡二三区| 在线观看视频一区| 精品日韩欧美一区二区| 亚洲天天做日日做天天谢日日欢| 性做久久久久久免费观看| 韩国三级在线一区| 色哟哟在线观看一区二区三区| 制服丝袜国产精品| 国产精品久久久久一区| 日本午夜一区二区| 成人18视频在线播放| 91精品国产91久久综合桃花| 中文字幕不卡在线播放| 五月天亚洲精品| 成人网在线播放| 91精品在线一区二区| 亚洲三级在线播放| 国产在线国偷精品免费看| 欧美亚洲国产bt| 中国av一区二区三区| 美腿丝袜一区二区三区| 在线观看成人小视频| 中文子幕无线码一区tr| 喷水一区二区三区| 在线欧美日韩精品| 亚洲国产电影在线观看| 久久激五月天综合精品| 日韩精品一区二区三区视频在线观看| 亚洲欧美区自拍先锋| 国产毛片精品国产一区二区三区| 欧美亚洲图片小说| 综合欧美亚洲日本| 国产成人aaa| 精品国内片67194| 午夜精品福利在线| 在线视频国内自拍亚洲视频| 欧美激情综合五月色丁香 | 国产成人精品免费视频网站| 欧美一级黄色片| 午夜久久久久久电影| 欧美综合色免费| 亚洲欧美日韩一区二区三区在线观看| 国产激情一区二区三区四区| 欧美一级淫片007| 亚洲aaa精品| 欧美日韩第一区日日骚| 一区二区三区在线免费观看| 99久久综合狠狠综合久久| 中文字幕欧美三区| 成人中文字幕在线| 国产日韩欧美a| 国产伦精品一区二区三区免费迷 | 欧美日韩免费一区二区三区视频| 中文字幕亚洲一区二区va在线| 国产91露脸合集magnet| 久久久久久影视| 国产盗摄女厕一区二区三区| 久久精品一区蜜桃臀影院| 国产乱一区二区| 国产精品无遮挡| www.在线欧美| 亚洲欧美激情插| 欧洲一区在线观看| 亚洲国产精品一区二区久久恐怖片| 欧美日韩中文字幕一区二区| 午夜欧美一区二区三区在线播放| 欧美日韩免费一区二区三区视频| 日日夜夜精品视频天天综合网| 欧美精品久久一区二区三区| 三级不卡在线观看| 精品国产乱码久久久久久影片| 精品在线播放免费| 精品国产一区二区三区久久久蜜月| 久久黄色级2电影| 久久精品人人做| 99re8在线精品视频免费播放| 亚洲女与黑人做爰| 欧美精品久久久久久久多人混战 | 一区二区三区日韩在线观看| 国产精品一区不卡| 中文字幕av不卡| 91国产福利在线| 久久精品国产久精国产爱| 久久久精品影视| 91年精品国产| 日韩av一区二区在线影视| 精品欧美乱码久久久久久1区2区| 国产成人精品www牛牛影视| 中文字幕综合网| 欧美老肥妇做.爰bbww| 精品伊人久久久久7777人| 久久久精品tv| 欧洲生活片亚洲生活在线观看| 中文字幕一区二区三区在线不卡 | 国产乱子轮精品视频| 综合分类小说区另类春色亚洲小说欧美| 色爱区综合激月婷婷| 男人的j进女人的j一区| 国产精品久久久久桃色tv| 欧美日韩不卡视频| 国产999精品久久久久久| 亚洲一区二区影院| 久久夜色精品国产欧美乱极品| 91农村精品一区二区在线| 久久99精品国产麻豆婷婷洗澡| 国产精品不卡一区| 欧美一区二区三区日韩| 成人永久看片免费视频天堂| 亚洲成在人线免费| 亚洲国产经典视频| 日韩一区二区三区视频在线| 99久久国产综合色|国产精品| 蜜臀久久久久久久| 亚洲欧美日韩中文字幕一区二区三区 | 日本不卡视频在线| 日本一区二区三区四区在线视频 | 午夜免费久久看| 国产精品丝袜91| 日韩免费观看2025年上映的电影| 色噜噜狠狠色综合中国| 国产盗摄一区二区三区| 青青草精品视频| 亚洲国产一区二区三区青草影视| 国产日韩v精品一区二区|