USBD_ValidateConfigurationDescriptor function (usbdlib.h)

The USBD_ValidateConfigurationDescriptor routine validates all descriptors returned by a device in its response to a configuration descriptor request.

Syntax

USBD_STATUS USBD_ValidateConfigurationDescriptor(
  [in]           PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc,
  [in]           ULONG                         BufferLength,
  [in]           USHORT                        Level,
  [out]          PUCHAR                        *Offset,
  [in, optional] ULONG                         Tag
);

Parameters

[in] ConfigDesc

Pointer to a configuration descriptor that includes all interface, endpoint, vendor, and class-specific descriptors retrieved from a USB device.

[in] BufferLength

Size, in bytes, of the configuration descriptor being validated.

[in] Level

Level of validation to be performed. The following are valid values:

  • 1-Basic validation of the configuration descriptor header.
  • 2-Full validation of the configuration descriptor including checking for invalid endpoint addresses, interface numbers, descriptor structures, interface alternate settings, number of interfaces and bLength fields of all descriptors.
  • 3-In addition to the validation for levels 1 and 2, level 3 validates plus validates the number of endpoints in each interface, enforces the USB specification's descriptor bLength sizes, and verifies that all interface numbers are in sequential order.

[out] Offset

Offset within configuration descriptor where validation failed. Only valid when a status other than USBD_STATUS_SUCCESS is returned.

[in, optional] Tag

Pool tag used by USBD_ValidateConfigurationDescriptor when allocating memory.

Return value

USBD_STATUS_SUCCESS, or appropriate USBD error code if validation failed.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later operating systems.
Target Platform Universal
Header usbdlib.h (include Usbdlib.h)
Library Usbd.lib
IRQL PASSIVE_LEVEL

See also

USB device driver programming reference