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

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

?? usblspnp.c

?? microsoft usb開發(fā)包,能夠給大家一個(gè)很好的參考.
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
    }

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



?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
678五月天丁香亚洲综合网| 在线播放欧美女士性生活| 亚洲福利国产精品| 国产人久久人人人人爽| 欧美精品 国产精品| 丰满少妇久久久久久久| 久久成人免费电影| 麻豆一区二区三| 亚洲精品国久久99热| 久久精品视频一区二区三区| 91精品国产91久久久久久一区二区 | 成人妖精视频yjsp地址| 日精品一区二区| 亚洲黄色片在线观看| 中文av一区二区| 久久综合九色综合欧美98| 欧美日韩久久久一区| 色噜噜狠狠色综合中国| 国产精品66部| 精品中文av资源站在线观看| 美洲天堂一区二卡三卡四卡视频| 亚洲乱码日产精品bd| 国产精品电影院| 中文字幕高清一区| 国产日韩精品视频一区| 日韩免费性生活视频播放| 欧美日韩精品一区二区三区蜜桃| 在线观看91视频| 91免费版pro下载短视频| 成人黄色大片在线观看| 国产乱一区二区| 国产麻豆精品视频| 国产精品系列在线播放| 国产精品18久久久久久久久久久久| 久久99最新地址| 裸体一区二区三区| 久久66热偷产精品| 国产精品自拍av| 国产不卡一区视频| 成人免费看片app下载| 国产成人啪免费观看软件| 国产精品一区二区x88av| 国产精品一区免费在线观看| 国产精品一区二区在线播放 | 欧美成人激情免费网| 日韩一区二区免费在线观看| 日韩一区二区三区电影| 亚洲人成影院在线观看| 国产精品久久久久久户外露出| 国产精品麻豆欧美日韩ww| 成人免费一区二区三区视频| 亚洲精品福利视频网站| 亚洲成人激情av| 久久激五月天综合精品| 国产精品18久久久久久久久| 成人精品鲁一区一区二区| 99久久综合色| 欧美私人免费视频| 日韩欧美亚洲国产另类| 久久久蜜桃精品| 亚洲精品乱码久久久久久黑人| 亚洲不卡在线观看| 韩国成人福利片在线播放| 成人a级免费电影| 欧美日韩一区二区三区四区五区| 91精品国产91久久久久久一区二区| 精品福利在线导航| 国产精品丝袜在线| 亚洲va国产天堂va久久en| 久久99精品网久久| 色综合咪咪久久| 日韩欧美中文字幕精品| 国产精品你懂的| 午夜精品久久久久久久| 久久99热这里只有精品| 91欧美激情一区二区三区成人| 欧美精品黑人性xxxx| 久久你懂得1024| 亚洲国产美国国产综合一区二区| 美美哒免费高清在线观看视频一区二区 | 日韩免费视频一区| 日本一区二区三区四区| 亚洲成a天堂v人片| 成人综合日日夜夜| 91国偷自产一区二区三区观看| 日韩欧美国产一区在线观看| 最好看的中文字幕久久| 日韩黄色免费电影| 99久久久无码国产精品| 精品日韩成人av| 亚洲超丰满肉感bbw| 成人美女视频在线看| 日韩一区二区三区免费看 | 日韩午夜精品电影| 亚洲男人天堂av网| 国内精品嫩模私拍在线| 欧美日韩一区视频| 中文字幕一区三区| 国产在线一区二区| 欧美日韩亚洲综合一区二区三区| 久久婷婷成人综合色| 午夜精品久久久久久久久久| 高清不卡在线观看av| 欧美xxxxx牲另类人与| 亚洲国产精品一区二区久久| 成人18视频日本| 久久嫩草精品久久久精品一| 日本在线不卡视频| 日本高清不卡视频| 国产精品久久久久天堂| 国产电影精品久久禁18| 欧美一级生活片| 亚洲午夜精品网| 在线欧美日韩国产| 日韩毛片视频在线看| 国产成人精品1024| 精品国产露脸精彩对白| 久久er精品视频| 日韩一区二区电影在线| 日本午夜一区二区| 在线成人午夜影院| 亚洲国产婷婷综合在线精品| 色激情天天射综合网| 亚洲欧美日韩国产成人精品影院 | 精品国产一区二区三区不卡| 亚洲成人在线网站| 在线影视一区二区三区| 亚洲男人电影天堂| 99国产精品久| 水蜜桃久久夜色精品一区的特点 | 在线视频你懂得一区| 亚洲日本护士毛茸茸| av中文字幕在线不卡| 中文字幕日本乱码精品影院| 成人黄色a**站在线观看| 国产精品丝袜黑色高跟| 97精品超碰一区二区三区| 国产精品九色蝌蚪自拍| 91免费视频大全| 亚洲午夜av在线| 555www色欧美视频| 日本欧美久久久久免费播放网| 欧美一卡二卡在线观看| 蜜桃视频在线观看一区二区| 日韩精品一区二| 国产成人精品在线看| 国产精品久久久久aaaa樱花| av一区二区久久| 亚洲一区二区三区四区在线| 欧美视频一区在线| 蜜臀国产一区二区三区在线播放| 精品黑人一区二区三区久久 | 日韩电影免费在线观看网站| 欧美日韩国产乱码电影| 另类的小说在线视频另类成人小视频在线 | 麻豆国产精品视频| www国产亚洲精品久久麻豆| 国产成人av电影在线| 亚洲视频每日更新| 欧美日韩国产三级| 麻豆91精品视频| 国产精品国产三级国产普通话蜜臀 | 亚洲一区二区三区视频在线 | 国产亚洲综合色| 26uuu亚洲综合色| 国产成人亚洲综合色影视| 亚洲免费资源在线播放| 6080午夜不卡| 国产精品88888| 亚洲精品乱码久久久久久 | 欧美一二三四在线| 国产91丝袜在线播放| 一区二区三区中文字幕电影| 欧美电影免费观看高清完整版| av在线不卡网| 蜜桃一区二区三区四区| 自拍av一区二区三区| 日韩免费高清视频| 99re66热这里只有精品3直播| 婷婷综合另类小说色区| 欧美国产激情一区二区三区蜜月| 色94色欧美sute亚洲13| 韩国一区二区视频| 一区二区三区欧美视频| 精品国产乱码91久久久久久网站| 91看片淫黄大片一级在线观看| 麻豆91精品91久久久的内涵| 亚洲精选视频在线| 久久综合狠狠综合久久综合88| 在线观看亚洲a| 国产成人精品影视| 日本三级亚洲精品| 亚洲综合一区二区三区| 久久精品男人天堂av| 欧美一区二区大片| 色偷偷成人一区二区三区91| 国产精品一二二区| 美腿丝袜亚洲一区| 亚洲成人激情综合网| 亚洲麻豆国产自偷在线|