Expand Minimize

USBD_ParseDescriptors routine

The USBD_ParseDescriptors routine searches a given configuration descriptor and returns a pointer to the first descriptor that matches the search criteria.

Syntax


PUSB_COMMON_DESCRIPTOR USBD_ParseDescriptors(
  _In_  PVOID DescriptorBuffer,
  _In_  ULONG TotalLength,
  _In_  PVOID StartPosition,
  _In_  LONG DescriptorType
);

Parameters

DescriptorBuffer [in]

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

TotalLength [in]

Specifies the size, in bytes, of the buffer pointed to by DescriptorBuffer.

StartPosition [in]

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

DescriptorType [in]

Specifies the descriptor type code as assigned by USB. The following values are valid for USB-defined descriptor types:

USB_STRING_DESCRIPTOR_TYPE

Specifies that the descriptor being searched for is a string descriptor.

USB_INTERFACE_DESCRIPTOR_TYPE

Specifies that the descriptor being searched for is an interface descriptor.

USB_ENDPOINT_DESCRIPTOR_TYPE

Specifies that the descriptor being searched for is an endpoint descriptor.

Return value

USBD_ParseDescriptors returns a pointer to a USB_COMMON_DESCRIPTOR structure that is the head of the first descriptor that matches the given search criteria, or NULL is returned if no match is found:

Remarks

This structure is used to hold a portion of a descriptor, so that the caller of USBD_ParseDescriptors can determine the correct structure to use to access the remaining data in the descriptor. Every descriptor type has these fields at the beginning of the data and callers can use the bLength and bDescriptorType members to correctly identify the type of this descriptor.

When this routine parses the configuration descriptor looking for the descriptor that matches the search criteria, it returns the first match, terminating the search.

Requirements

Header

Usbdlib.h (include Usbdlib.h)

Library

Usbd.lib

IRQL

< DISPATCH_LEVEL

See also

Routines for USB Client Drivers

 

 

Send comments about this topic to Microsoft

Build date: 12/5/2013

Show:
© 2014 Microsoft. All rights reserved.