信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfUsbTargetDeviceRetrieveInformation 方法

The WdfUsbTargetDeviceRetrieveInformation method retrieves information about the USB device that is associated with a specified framework USB device object.

语法

NTSTATUS WdfUsbTargetDeviceRetrieveInformation(
  [in]   WDFUSBDEVICE UsbDevice,
  [out]  PWDF_USB_DEVICE_INFORMATION Information
);

参数

UsbDevice [in]

A handle to a USB device object that was obtained from a previous call to WdfUsbTargetDeviceCreate.

Information [out]

A pointer to a caller-allocated WDF_USB_DEVICE_INFORMATION structure that receives USB device information.

返回值

WdfUsbTargetDeviceRetrieveInformation returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method can return one of the following values:

返回代码说明
STATUS_INVALID_PARAMETER

An invalid parameter was detected.

 

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

评论

For more information about the WdfUsbTargetDeviceRetrieveInformation method and USB I/O targets, see USB I/O Targets.

示例

The following code example is part of an EvtDevicePrepareHardware callback function that creates a USB device object, initializes a WDF_USB_DEVICE_INFORMATION structure, and calls WdfUsbTargetDeviceRetrieveInformation.

NTSTATUS
MyEvtDevicePrepareHardware(
    IN WDFDEVICE  Device,
    IN WDFCMRESLIST  ResourceList,
    IN WDFCMRESLIST  ResourceListTranslated
    )
{
    NTSTATUS  status;
    PMY_DEVICE_CONTEXT  pMyDeviceContext;
    WDF_USB_DEVICE_INFORMATION  deviceInfo;

    pMyDeviceContext = GetDeviceContext(Device);

    // If object handle is not NULL, MyEvtDevicePrepareHardware
    // was called previously and the handle is still valid.
    if (pMyDeviceContext->UsbDevice != NULL) {
        return STATUS_SUCCESS;
    }
    status = WdfUsbTargetDeviceCreate(
                                      Device,
                                      WDF_NO_OBJECT_ATTRIBUTES,
                                      &pMyDeviceContext->UsbDevice
                                      );
    if (!NT_SUCCESS(status)) {
        return status;
    }
    WDF_USB_DEVICE_INFORMATION_INIT(&deviceInfo);

    status = WdfUsbTargetDeviceRetrieveInformation(
                                      pDeviceContext->UsbDevice, 
                                      &deviceInfo
                                      );
...
}

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfusb.h (包括Wdfusb.h)

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

<=DISPATCH_LEVEL

另请参见

WDF_USB_DEVICE_INFORMATION
WdfUsbTargetDeviceCreate

 

 

社区附加资源

显示:
© 2014 Microsoft