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

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

?? usblspnp.c

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

    IoCopyCurrentIrpStackLocationToNext(Irp);

    //
    // All PNP_POWER messages get passed to the TopOfStackDeviceObject
    // we were given in PnPAddDevice
    //

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("USBLS120_ProcessPnPIrp() Passing PnP Irp down, status = %x\n", ntStatus));

    ntStatus = IoCallDriver(stackDeviceObject, Irp);

    USBLS120_DecrementIoCount(DeviceObject);

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("USBLS120_ProcessPnPIrp() Exit USBLS120_ProcessPnPIrp %x\n", ntStatus));

    return ntStatus;
}


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

Routine Description:

    This routine is called to create and initialize our Functional Device Object (FDO).
    For monolithic drivers, this is done in DriverEntry(), but Plug and Play devices
    wait for a PnP event

Arguments:

    DriverObject - pointer to the driver object for this instance of BulkUsb

    PhysicalDeviceObject - pointer to a device object created by the bus

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS                ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT          deviceObject = NULL;
    PDEVICE_EXTENSION       deviceExtension;
    USBD_VERSION_INFORMATION versionInformation;
    ULONG i;


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

    //
    // create our funtional device object (FDO)
    //

    ntStatus =
        USBLS120_CreateDeviceObject(DriverObject, PhysicalDeviceObject, &deviceObject);

    if (NT_SUCCESS(ntStatus)) {
        deviceExtension = deviceObject->DeviceExtension;

        deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

        //
        // we do not support direct io for read/write
        //
        // deviceObject->Flags |= DO_DIRECT_IO;

        // Storage devices are flushed by VPOWERED shortly after resuming
        // from a standby.  This means we can get I/O requests after resume
        // even if the device was removed while we were suspended.  To avoid
        // this we will *not* set the DO_POWER_PAGABLE flag.  This is
        // interpreted by Win98 as meaning we only support D0, and will
        // cause our driver to be removed during suspend, and reloaded
        // after resume.
        // deviceObject->Flags |= DO_POWER_PAGABLE;

        // initialize our device extension
        //
        // remember the Physical device Object
        //
        deviceExtension->PhysicalDeviceObject=PhysicalDeviceObject;

        //
        // Attach to the PDO
        //
        deviceExtension->TopOfStackDeviceObject =
            IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);


        // Initialize the DPC we use to schedule data transfers to/from the device
        deviceExtension->TransferDataDpc = (PRKDPC)USBLS120_ExAllocatePool(
                                                       NonPagedPool,
                                                       sizeof(KDPC)
                                                       );

        KeInitializeDpc(
            deviceExtension->TransferDataDpc,
            USBLS120_TransferDataDPC,
            NULL
            );


        // Get a copy of the physical device's capabilities into a
        // DEVICE_CAPABILITIES struct in our device extension;
        // We are most interested in learning which system power states
        // are to be mapped to which device power states for handling
        // IRP_MJ_SET_POWER Irps.
        USBLS120_QueryCapabilities(PhysicalDeviceObject,
            &deviceExtension->DeviceCapabilities
            );


        // We want to determine what level to auto-powerdown to; This is the lowest
        //  sleeping level that is LESS than D3; 
        // If all are set to D3, auto powerdown/powerup will be disabled.

        deviceExtension->PowerDownLevel = PowerDeviceUnspecified; // init to disabled

        for (i=PowerSystemSleeping1; i<= PowerSystemSleeping3; i++) {
            if ( deviceExtension->DeviceCapabilities.DeviceState[i] < PowerDeviceD3 )
                deviceExtension->PowerDownLevel = deviceExtension->DeviceCapabilities.DeviceState[i];
        }

#if DBG

        // May want override auto power-down level from registry;
        // ( CurrentControlSet\Services\BulkUsb\Parameters )
        // Setting to 0 or 1 in registry disables auto power-down
        USBLS120_GetRegistryDword( USBLS120_REGISTRY_PARAMETERS_PATH,
            L"PowerDownLevel",
            &(deviceExtension->PowerDownLevel)
            );



        //
        // display the device  caps
        //
        USBLS120_KdPrint( DBGLVL_MEDIUM,(" >>>>>> DeviceCaps\n"));
        USBLS120_KdPrint( DBGLVL_MEDIUM,(" SystemWake = %s\n",
        USBLS120_StringForSysState( deviceExtension->DeviceCapabilities.SystemWake ) ));
        USBLS120_KdPrint( DBGLVL_MEDIUM,(" DeviceWake = %s\n",
        USBLS120_StringForDevState( deviceExtension->DeviceCapabilities.DeviceWake) ));

        for (i=PowerSystemUnspecified; i< PowerSystemMaximum; i++) {
            USBLS120_KdPrint( DBGLVL_MEDIUM,(" Device State Map: sysstate %s = devstate %s\n",
                USBLS120_StringForSysState( i ),
                USBLS120_StringForDevState( deviceExtension->DeviceCapabilities.DeviceState[i] ) ));
        }
        USBLS120_KdPrint( DBGLVL_MEDIUM,(" <<<<<<<<DeviceCaps\n"));
#endif

        // We keep a pending IO count ( extension->PendingIoCount )  in the device extension.
        // The first increment of this count is done on adding the device.
        // Subsequently, the count is incremented for each new IRP received and
        // decremented when each IRP is completed or passed on.

        // Transition to 'one' therefore indicates no IO is pending and signals
        // deviceExtension->NoPendingIoEvent. This is needed for processing
        // IRP_MN_QUERY_REMOVE_DEVICE

        // Transition to 'zero' signals an event ( deviceExtension->RemoveEvent )
        // to enable device removal. This is used in processing for IRP_MN_REMOVE_DEVICE
        //
        USBLS120_IncrementIoCount(deviceObject);

    }

    USBD_GetUSBDIVersion(&versionInformation);

    if( NT_SUCCESS( ntStatus ) )  
    {
        NTSTATUS actStat;
        // try to power down device until IO actually requested
        actStat = USBLS120_SelfSuspendOrActivate( deviceObject, TRUE );
    }

    USBLS120_KdPrint( DBGLVL_DEFAULT,("exit USBLS120_PnPAddDevice() (%x)\n", ntStatus));

    return ntStatus;
}



NTSTATUS
USBLS120_StartDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Called from USBLS120_ProcessPnPIrp(), the dispatch routine for IRP_MJ_PNP.
    Initializes a given instance of the device on the USB.
    USB client drivers such as us set up URBs (USB Request Packets) to send requests
    to the host controller driver (HCD). The URB structure defines a format for all
    possible commands that can be sent to a USB device.
    Here, we request the device descriptor and store it, and configure the device.


Arguments:

    DeviceObject - pointer to the FDO (Functional Device Object)

Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PUSB_DEVICE_DESCRIPTOR deviceDescriptor = NULL;
    PURB urb;
    ULONG siz;

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

    deviceExtension = DeviceObject->DeviceExtension;

    urb = USBLS120_ExAllocatePool(NonPagedPool, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    USBLS120_KdPrintCond( DBGLVL_HIGH,!urb, ("USBLS120_StartDevice() FAILED USBLS120_ExAllocatePool() for URB\n"));

    if (urb) {
        siz = sizeof(USB_DEVICE_DESCRIPTOR);

        deviceDescriptor = USBLS120_ExAllocatePool(NonPagedPool, siz);

        USBLS120_KdPrintCond( DBGLVL_HIGH, !deviceDescriptor, ("USBLS120_StartDevice() FAILED USBLS120_ExAllocatePool() for deviceDescriptor\n"));

        if (deviceDescriptor) {
            UsbBuildGetDescriptorRequest(urb,
                (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                USB_DEVICE_DESCRIPTOR_TYPE,
                0,
                0,
                deviceDescriptor,
                NULL,
                siz,
                NULL
                );


            ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

            USBLS120_KdPrintCond( DBGLVL_DEFAULT, !NT_SUCCESS(ntStatus), ("USBLS120_StartDevice() FAILED USBLS120_CallUSBD(DeviceObject, urb)\n"));

            if (NT_SUCCESS(ntStatus)) {
                USBLS120_KdPrint( DBGLVL_MEDIUM,("Device Descriptor = %x, len %x\n",
                    deviceDescriptor,
                    urb->UrbControlDescriptorRequest.TransferBufferLength)
                    );

                USBLS120_KdPrint( DBGLVL_MEDIUM,("USB Mass Storage Device Descriptor:\n"));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("-----------------------------------\n"));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bLength %d\n", deviceDescriptor->bLength));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bDescriptorType 0x%x\n", deviceDescriptor->bDescriptorType));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bcdUSB 0x%x\n", deviceDescriptor->bcdUSB));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bDeviceClass 0x%x\n", deviceDescriptor->bDeviceClass));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bDeviceSubClass 0x%x\n", deviceDescriptor->bDeviceSubClass));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bDeviceProtocol 0x%x\n", deviceDescriptor->bDeviceProtocol));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bMaxPacketSize0 0x%x\n", deviceDescriptor->bMaxPacketSize0));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("idVendor 0x%x\n", deviceDescriptor->idVendor));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("idProduct 0x%x\n", deviceDescriptor->idProduct));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bcdDevice 0x%x\n", deviceDescriptor->bcdDevice));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("iManufacturer 0x%x\n", deviceDescriptor->iManufacturer));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("iProduct 0x%x\n", deviceDescriptor->iProduct));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("iSerialNumber 0x%x\n", deviceDescriptor->iSerialNumber));
                USBLS120_KdPrint( DBGLVL_MEDIUM,("bNumConfigurations 0x%x\n", deviceDescriptor->bNumConfigurations));
            }
        } else {
            // if we got here we failed to allocate deviceDescriptor
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

        if (NT_SUCCESS(ntStatus)) {
            deviceExtension->UsbDeviceDescriptor = deviceDescriptor;
        }
        else if (deviceDescriptor) {
            USBLS120_ExFreePool(deviceDescriptor);
        }

        USBLS120_ExFreePool(urb);

    }
    else {
        // if we got here we failed to allocate the urb
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (NT_SUCCESS(ntStatus)) {
        ntStatus = USBLS120_ConfigureDevice(DeviceObject);

        USBLS120_KdPrintCond( DBGLVL_MEDIUM,!NT_SUCCESS(ntStatus),("USBLS120_StartDevice USBLS120_ConfigureDevice() FAILURE (%x)\n", ntStatus));
    }

    //USBLS120_StartInterruptPipe(DeviceObject);

    if (NT_SUCCESS(ntStatus)) {
        deviceExtension->DeviceStarted = TRUE;
    }
    USBLS120_KdPrint( DBGLVL_DEFAULT, ("exit USBLS120_StartDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
USBLS120_RemoveDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Called from USBLS120_ProcessPnPIrp() to
    clean up our device instance's allocated buffers; free symbolic links

Arguments:

    DeviceObject - pointer to the FDO

Return Value:

    NT status code from free symbolic link operation

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    UNICODE_STRING deviceLinkUnicodeString;

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

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // Free device descriptor structure
    //

    if (deviceExtension->UsbDeviceDescriptor) {
        USBLS120_ExFreePool(deviceExtension->UsbDeviceDescriptor);
    }

    //
    // Free up the UsbInterface structure
    //
    if (deviceExtension->UsbInterface) {
        USBLS120_ExFreePool(deviceExtension->UsbInterface);
    }

    // free up the USB config discriptor
    if (deviceExtension->UsbConfigurationDescriptor) {
        USBLS120_ExFreePool(deviceExtension->UsbConfigurationDescriptor);
    }

    // free the data transfer DPC 
    if (deviceExtension->TransferDataDpc) {
        USBLS120_ExFreePool(deviceExtension->TransferDataDpc);
    }

    USBLS120_ASSERT( gExAllocCount == 0 );
    USBLS120_KdPrint( DBGLVL_HIGH,("exit USBLS120_RemoveDevice() gExAllocCount = dec %d\n", gExAllocCount ));

    USBLS120_KdPrint( DBGLVL_DEFAULT,("exit USBLS120_RemoveDevice() status = 0x%x\n", ntStatus ));

    return ntStatus;
}




NTSTATUS
USBLS120_StopDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Stops a given instance of a USB LS-120 device on the USB.
    We basically just tell USB this device is now 'unconfigured'

Arguments:

    DeviceObject - pointer to the device object for this instance of a USB LS-120

Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PURB urb;
    ULONG siz;

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

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // Send the select configuration urb with a NULL pointer for the configuration
    // handle. This closes the configuration and puts the device in the 'unconfigured'
    // state.
    //

    siz = sizeof(struct _URB_SELECT_CONFIGURATION);

    urb = USBLS120_ExAllocatePool(NonPagedPool, siz);

    if (urb) {
        UsbBuildSelectConfigurationRequest(
            urb,
            (USHORT) siz,
            NULL
            );

        ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

        USBLS120_KdPrintCond( DBGLVL_DEFAULT,!NT_SUCCESS(ntStatus),("USBLS120_StopDevice() FAILURE Configuration Closed status = %x usb status = %x.\n", ntStatus, urb->UrbHeader.Status));

        USBLS120_ExFreePool(urb);
    }
    else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }


    if (NT_SUCCESS(ntStatus)) {
        deviceExtension->DeviceStarted = FALSE;
    }

    deviceExtension->StopDeviceRequested = FALSE;

    USBLS120_KdPrint( DBGLVL_DEFAULT,("exit USBLS120_StopDevice() (%x)\n", ntStatus));

    return ntStatus;
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
wwwwxxxxx欧美| 蜜臀久久99精品久久久画质超高清 | 久久久久久久久久久久久女国产乱 | 国产精品一区二区三区四区| 一本色道久久综合亚洲aⅴ蜜桃| 日韩视频一区二区在线观看| 亚洲免费在线电影| 成人免费观看男女羞羞视频| 精品欧美乱码久久久久久| 一区二区三区色| aaa国产一区| 久久一日本道色综合| 日本欧美大码aⅴ在线播放| 在线观看日韩毛片| 亚洲免费在线视频一区 二区| 国产精品亚洲第一区在线暖暖韩国| 91精品国产一区二区三区| 一区二区日韩av| 色综合久久久久久久| 亚洲图片你懂的| 国产成人av电影在线观看| 欧美电视剧在线看免费| 国产另类ts人妖一区二区| 欧美日韩夫妻久久| 亚洲一区二区视频在线观看| 色呦呦日韩精品| 亚洲久草在线视频| 日本道在线观看一区二区| 国产精品久久久久三级| 99视频超级精品| 亚洲视频资源在线| 成人av电影在线网| 亚洲视频中文字幕| 91久久人澡人人添人人爽欧美| 中文字幕一区二区三区乱码在线| 精品一区二区三区久久久| 日韩精品一区二| 极品美女销魂一区二区三区| 久久综合九色综合欧美亚洲| 精品一区二区在线看| 久久久久久久免费视频了| 国产成人免费视频网站高清观看视频| 久久夜色精品国产噜噜av| 国产高清久久久久| 国产精品久久午夜夜伦鲁鲁| av亚洲精华国产精华| 亚洲精品视频免费观看| 欧美日韩中文一区| 日韩av在线发布| 国产亚洲欧美激情| 91视频www| 日韩电影在线免费看| 久久看人人爽人人| 色综合久久久久久久久久久| 婷婷激情综合网| 久久一区二区三区国产精品| 成人av电影在线网| 日本美女一区二区三区视频| 久久久久久久一区| 色av成人天堂桃色av| 蜜乳av一区二区三区| 中文子幕无线码一区tr| 欧美色综合网站| 国产一区二区三区日韩| 亚洲日本在线天堂| 日韩一区二区三区电影| 成人aa视频在线观看| 亚洲3atv精品一区二区三区| 久久亚洲春色中文字幕久久久| 日本韩国欧美一区二区三区| 麻豆成人免费电影| 亚洲欧美色一区| 久久久久久久久岛国免费| 欧美性一二三区| 国内成人精品2018免费看| 夜夜亚洲天天久久| 中文在线资源观看网站视频免费不卡 | 777xxx欧美| 99久久99久久综合| 久久99久久精品| 亚洲一区二区3| 国产精品美女一区二区| 日韩亚洲欧美一区| 欧美在线视频日韩| 成人在线综合网| 久久99久国产精品黄毛片色诱| 亚洲国产一区视频| 中文字幕日本乱码精品影院| 日韩无一区二区| 欧美日韩亚洲综合在线| 91欧美激情一区二区三区成人| 国产一区二区在线视频| 亚洲福利一区二区三区| 日韩理论片一区二区| 国产免费观看久久| 久久品道一品道久久精品| 欧美高清hd18日本| 欧美在线视频全部完| 91伊人久久大香线蕉| 国产成人丝袜美腿| 国产福利不卡视频| 韩国欧美国产1区| 九九在线精品视频| 免费高清在线视频一区·| 亚洲电影视频在线| 夜色激情一区二区| 亚洲精品成a人| 亚洲精品视频自拍| 亚洲精品午夜久久久| 亚洲精品日韩综合观看成人91| 中文在线一区二区| 亚洲欧美一区二区视频| 国产精品毛片大码女人| 国产精品视频麻豆| 国产精品久久777777| 中文字幕一区三区| 亚洲精品视频在线观看网站| 亚洲免费电影在线| 午夜电影网亚洲视频| 婷婷久久综合九色综合伊人色| 午夜精品久久久| 捆绑调教一区二区三区| 精品综合久久久久久8888| 国产精品资源在线看| 波多野结衣中文字幕一区二区三区| 成人黄色av电影| 在线观看日韩精品| 日韩欧美色电影| 久久久久国色av免费看影院| 国产欧美一区二区精品仙草咪| 成人激情av网| 亚洲高清免费观看高清完整版在线观看| 日本电影亚洲天堂一区| 色婷婷国产精品| 91精品国产色综合久久ai换脸| 日韩欧美国产精品| 久久精品视频免费观看| 中文字幕亚洲区| 午夜激情久久久| 国产精品资源网| 欧美在线一区二区| 精品国产百合女同互慰| 国产精品每日更新| 婷婷国产v国产偷v亚洲高清| 久久99最新地址| 91麻豆精品视频| 欧美一级欧美一级在线播放| 国产网红主播福利一区二区| 亚洲人成小说网站色在线 | 青青草成人在线观看| 精品一区免费av| 91成人网在线| 精品91自产拍在线观看一区| 成人欧美一区二区三区| 蜜臀av国产精品久久久久| 成人午夜精品一区二区三区| 欧美日韩国产首页在线观看| 久久久久久电影| 天天操天天干天天综合网| 丁香激情综合国产| 欧美精品亚洲二区| 国产精品九色蝌蚪自拍| 毛片一区二区三区| 欧美精品一卡二卡| 中文一区二区完整视频在线观看| 亚洲五月六月丁香激情| 国产成人激情av| 精品三级在线观看| 亚洲一区二区三区美女| 成人av电影在线播放| 精品国产一区二区三区不卡 | 色偷偷成人一区二区三区91| 久久久久国产精品人| 琪琪一区二区三区| 欧美亚洲动漫制服丝袜| 1000精品久久久久久久久| 精品一区二区影视| 88在线观看91蜜桃国自产| 夜夜揉揉日日人人青青一国产精品| 白白色亚洲国产精品| 久久综合九色综合欧美亚洲| 毛片不卡一区二区| 欧美一级专区免费大片| 亚洲成人免费视| 在线观看一区日韩| 亚洲欧美中日韩| 成人中文字幕在线| 国产精品色在线观看| 国产高清精品网站| 久久麻豆一区二区| 国产精品一级二级三级| 久久综合999| 国产在线视频不卡二| 欧美xxxxxxxxx| 久久精品国产99| 久久日韩精品一区二区五区| 蜜桃av噜噜一区二区三区小说| 日韩一区二区高清| 狠狠网亚洲精品| 久久久久一区二区三区四区|