USBD_ParseConfigurationDescriptorEx function (usbdlib.h)

The USBD_ParseConfigurationDescriptorEx routine searches a given configuration descriptor and returns a pointer to an interface that matches the given search criteria.

Syntax

PUSB_INTERFACE_DESCRIPTOR USBD_ParseConfigurationDescriptorEx(
  [in] PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
  [in] PVOID                         StartPosition,
  [in] LONG                          InterfaceNumber,
  [in] LONG                          AlternateSetting,
  [in] LONG                          InterfaceClass,
  [in] LONG                          InterfaceSubClass,
  [in] LONG                          InterfaceProtocol
);

Parameters

[in] ConfigurationDescriptor

Pointer to a USB configuration descriptor that contains the interface for which to search.

[in] StartPosition

Pointer to the address within the configuration descriptor, provided at ConfigurationDescriptor, to begin searching from. To search from the beginning of the configuration descriptor, the parameters ConfigurationDescriptor and StartPosition must be the same address.

[in] InterfaceNumber

Specifies the device-defined index of the interface to be retrieved. This should be set to -1 if it should not be a search criterion.

[in] AlternateSetting

Specifies the device-defined alternate-setting index of the interface to be retrieved. If the caller does not wish the alternate setting value to be a search criterion, this parameter should be set to -1.

[in] InterfaceClass

Specifies the device- or USB-defined identifier for the interface class of the interface to be retrieved. If the caller does not wish the interface class value to be a search criterion, this parameter should be set to -1.

[in] InterfaceSubClass

Specifies the device- or USB-defined identifier for the interface subclass of the interface to be retrieved. If the caller does not wish the interface subclass value to be a search criterion, this parameter should be set to -1.

[in] InterfaceProtocol

Specifies the device- or USB-defined identifier for the interface protocol of the interface to be retrieved. If the caller does not wish the interface protocol value to be a search criterion, this parameter should be set to -1.

Return value

USBD_ParseConfigurationDescriptorEx returns a pointer to the first interface descriptor that matches the given search criteria. If no interface matches the search criteria, it returns NULL.

Remarks

Callers can specify more than one of the search criteria (InterfaceNumber, AlternateSetting, InterfaceClass, InterfaceSubClass, and InterfaceProtocol) when using this routine to find an interface within a configuration descriptor. For example code, see USBD_CreateConfigurationRequestEx.

When this routine parses the configuration descriptor looking for the interface descriptor that matches the search criteria, it returns the first match, terminating the search. Callers should specify as many search criteria as are necessary to find the desired interface.

Requirements

Requirement Value
Target Platform Universal
Header usbdlib.h (include Usbdlib.h)
Library Usbd.lib
IRQL < DISPATCH_LEVEL

See also

USB device driver programming reference

USB_CONFIGURATION_DESCRIPTOR