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

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

?? usblspnp.c

?? 來自微軟的usb2.0開發包,加速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一区二区三区免费野_久草精品视频
久久色.com| 国产一区福利在线| gogogo免费视频观看亚洲一| 亚洲精品一区二区三区在线观看| 国产一区二区三区香蕉| 日本免费新一区视频| 欧美xxxxx裸体时装秀| 国产成人亚洲综合a∨婷婷图片 | 欧美电影一区二区| 日本成人中文字幕在线视频| 日韩电影网1区2区| 久久国产夜色精品鲁鲁99| 国产日产欧美一区二区三区| av毛片久久久久**hd| 99精品在线观看视频| 精品亚洲aⅴ乱码一区二区三区| 国产精品女上位| 91精品国产手机| 成人av电影免费观看| 视频在线观看一区二区三区| 久久久久久久综合日本| 在线播放中文一区| 久久综合九色综合97婷婷女人 | 在线免费观看一区| 久久99精品视频| 成人网在线播放| 国产精品1区二区.| 精品一区在线看| av不卡一区二区三区| 91精选在线观看| 欧美日韩激情一区二区三区| av电影在线观看一区| 欧美精品tushy高清| 国产精品午夜在线| 日韩黄色一级片| 成人av电影在线网| 欧美疯狂做受xxxx富婆| 国产精品国产成人国产三级| 久久精品欧美一区二区三区不卡| 91精品国产色综合久久不卡蜜臀 | 精品少妇一区二区三区| 成人欧美一区二区三区在线播放| 国产亚洲精品精华液| 一区二区三区电影在线播| 亚洲天堂福利av| 一区二区三区电影在线播| 激情深爱一区二区| 国产麻豆精品theporn| 欧美在线免费观看亚洲| 久久夜色精品国产噜噜av| 亚洲一区二区综合| 午夜国产精品一区| 视频一区视频二区中文字幕| 高清国产午夜精品久久久久久| 国产成人综合亚洲网站| 日韩一级片网站| 欧美精品一区二区三区在线播放 | 久久精品视频一区| 麻豆视频一区二区| 国产成人av电影在线观看| 在线电影国产精品| 性做久久久久久免费观看| 美女mm1313爽爽久久久蜜臀| 色综合天天综合狠狠| 91国内精品野花午夜精品| 在线电影院国产精品| 亚洲自拍欧美精品| 欧洲一区二区av| 亚洲一二三四在线| 欧洲亚洲精品在线| 一区二区三区免费| 欧美日韩三级视频| 久久婷婷综合激情| 国产伦精品一区二区三区免费迷| 精品剧情v国产在线观看在线| 免费精品视频在线| 91色九色蝌蚪| 精品国产成人系列| 久久精品国产精品亚洲红杏| 日韩免费福利电影在线观看| 国产欧美一区二区三区网站| 国产精品一品二品| 国产精品三级电影| 99re热视频精品| 一区二区三区影院| 欧美老女人第四色| 美国三级日本三级久久99| 精品国产乱码久久久久久久| 黄色日韩网站视频| 中文字幕一区二区5566日韩| 91丝袜国产在线播放| 亚洲在线一区二区三区| 欧美日韩国产高清一区二区| 日韩电影在线免费观看| 久久久久久9999| 99在线精品免费| 亚洲第一综合色| 精品乱人伦一区二区三区| 丁香六月综合激情| 亚洲在线一区二区三区| 日韩欧美在线网站| 成人avav影音| 性做久久久久久久免费看| www欧美成人18+| 色悠悠久久综合| 国产精品国产成人国产三级| 欧美色视频在线| 国内一区二区在线| 一区二区日韩电影| 久久综合九色欧美综合狠狠| 色综合久久久久综合99| 久久av中文字幕片| 亚洲少妇30p| 久久一日本道色综合| 欧美三级日本三级少妇99| 久久精品国产亚洲5555| 中文字幕亚洲不卡| 欧美mv和日韩mv国产网站| 一本大道久久a久久综合| 久久99九九99精品| 亚洲图片一区二区| 欧美日韩美女一区二区| 粉嫩一区二区三区性色av| 亚洲高清免费一级二级三级| 国产亚洲精品超碰| 日韩午夜在线观看| 色菇凉天天综合网| 国产成人超碰人人澡人人澡| 久久精品国内一区二区三区| 亚洲情趣在线观看| 91麻豆精品国产91久久久资源速度| 成人高清免费观看| 国产一区二区三区四区在线观看| 日韩成人午夜电影| 亚洲va在线va天堂| 一区二区三区在线影院| 国产精品久久久久影院色老大| 精品福利一二区| 制服丝袜av成人在线看| 欧洲精品在线观看| 91在线精品一区二区| 国产成人aaa| 国产精品亚洲一区二区三区在线| 久久99久久99精品免视看婷婷| 日韩高清国产一区在线| 亚洲一区二区三区中文字幕| 亚洲精选视频免费看| 日韩一区二区三区在线| 欧美日韩亚洲另类| 欧美亚洲动漫精品| 国产91露脸合集magnet| 国产一区二区毛片| 精品亚洲porn| 国产成人av影院| 99这里只有精品| 色婷婷久久99综合精品jk白丝 | 久久se精品一区二区| 久久激情五月激情| 国内欧美视频一区二区| 国产一区不卡视频| 东方aⅴ免费观看久久av| 国产成人免费视频精品含羞草妖精| 韩日精品视频一区| 国产91丝袜在线18| 91天堂素人约啪| 欧美午夜一区二区| 日韩视频一区二区三区| 精品国产网站在线观看| 久久精品一区八戒影视| 中文字幕一区二区三区不卡在线 | 国产福利精品一区二区| 成人午夜av电影| 91国在线观看| 日韩视频一区二区| 中文字幕免费不卡| 日韩欧美成人一区二区| 精品国产第一区二区三区观看体验| 欧美国产激情一区二区三区蜜月| 国产精品美女视频| 午夜精品久久久久| 国产一区在线视频| 99精品黄色片免费大全| 在线不卡的av| 欧美韩国日本一区| 亚洲无人区一区| 国产91综合一区在线观看| 91亚洲精品久久久蜜桃网站| 91精品在线免费| 欧美国产视频在线| 婷婷一区二区三区| 成人97人人超碰人人99| 欧美精品一二三区| 国产精品国产馆在线真实露脸| 亚洲h在线观看| 成人黄色777网| 精品区一区二区| 亚洲午夜精品网| www.成人网.com| 久久女同精品一区二区| 亚洲成a人片综合在线|