WinUsb_QueryInterfaceSettings function

The WinUsb_QueryInterfaceSettings function retrieves the interface descriptor for the specified alternate interface settings for a particular interface handle.

Syntax

BOOL WinUsb_QueryInterfaceSettings(
  WINUSB_INTERFACE_HANDLE   InterfaceHandle,
  UCHAR                     AlternateInterfaceNumber,
  PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor
);

Parameters

InterfaceHandle

An opaque handle to an interface in the selected configuration.

To retrieve the settings of the first interface, use the handle returned by WinUsb_Initialize. For all other interfaces, use the handle to the target interface, retrieved by WinUsb_GetAssociatedInterface.

AlternateInterfaceNumber

A value that indicates which alternate settings to return. A value of 0 indicates the first alternate setting, a value of 1 indicates the second alternate setting, and so on.

UsbAltInterfaceDescriptor

A pointer to a caller-allocated USB_INTERFACE_DESCRIPTOR structure that contains information about the interface that AlternateSettingNumber specified.

Return Value

WinUsb_QueryInterfaceSettings returns TRUE if the operation succeeds. Otherwise, it returns FALSE, and the caller can retrieve the logged error by calling GetLastError.

GetLastError can return the following error code.

Return code Description
ERROR_INVALID_HANDLE
The caller passed NULL in the InterfaceHandle parameter.
ERROR_NO_MORE_ITEMS
The specified alternate interface was not found.

Remarks

WinUsb_QueryInterfaceSettings parses the configuration descriptor previously retrieved by WinUsb_Initialize. For more information, see the Remarks section for WinUsb_Initialize.

The WinUsb_QueryInterfaceSettings call searches the interface array for the alternate interface specified by the interface index passed by the caller in the AlternateSettingNumber. If the specified interface is found, the function populates the caller-allocated USB_INTERFACE_DESCRIPTOR structure. If the specified interface is not found, then the call fails with the ERROR_NO_MORE_ITEMS code.

Requirements

   
Target Platform Universal
Header winusb.h (include Winusb.h)
Library Winusb.lib
DLL Winusb.dll

See Also

USB_INTERFACE_DESCRIPTOR

WinUSB

WinUSB Functions

WinUsb_Initialize