WinUsb_QueryInterfaceSettings function (winusb.h)

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

Syntax

BOOL WinUsb_QueryInterfaceSettings(
  [in]  WINUSB_INTERFACE_HANDLE   InterfaceHandle,
  [in]  UCHAR                     AlternateInterfaceNumber,
  [out] PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor
);

Parameters

[in] 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.

[in] 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.

[out] 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

Requirement Value
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