Windows Driver Kit: Kernel-Mode Driver Framework
WdfUsbTargetDeviceGetInterface

The WdfUsbTargetDeviceGetInterface method returns a handle to the framework USB interface object that is associated with a specified interface index.

WDFUSBINTERFACE
  WdfUsbTargetDeviceGetInterface(
    IN WDFUSBDEVICE  UsbDevice,
    UCHAR  InterfaceIndex
    );

Parameters

UsbDevice
A handle to a USB device object that was obtained from a previous call to WdfUsbTargetDeviceCreate.
InterfaceIndex
A zero-based index value that specifies a USB interface object in the current configuration. This index value might not be the same as the interface number that the USB specification defines.

Return Value

WdfUsbTargetDeviceGetInterface returns a handle to a USB interface object if the operation succeeds. If the InterfaceIndex value is invalid, this method returns NULL.

A bug check occurs if a driver-supplied object handle is invalid.

Comments

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

Example

The following code example obtains a handle to the first USB interface object that the framework has created for a USB device. The example then obtains the number of endpoints that are associated with the interface object.

WDFUSBINTERFACE  UsbInterface;
BYTE  numEndpoints;

UsbInterface = WdfUsbTargetDeviceGetInterface(
                                              deviceContext->UsbTargetDevice,
                                              0
                                              );
numEndpoints = WdfUsbInterfaceGetNumEndpoints(
                                              UsbInterface,
                                              0
                                              );

Requirements

Versions: The WdfUsbTargetDeviceGetInterface method is available in version 1.0 and later versions of KMDF.

IRQL: <=DISPATCH_LEVEL

Headers: Declared in Wdfusb.h. Include Wdfusb.h.

Library: See Framework Library Versions.

See Also

WdfUsbTargetDeviceCreate


Send feedback on this topic
Built on November 19, 2009
Page view tracker