WinUsb_GetDescriptor function

The WinUsb_GetDescriptor function returns the requested descriptor. This is a synchronous operation.


BOOL __stdcall WinUsb_GetDescriptor(
  _In_  WINUSB_INTERFACE_HANDLE InterfaceHandle,
  _In_  UCHAR                   DescriptorType,
  _In_  UCHAR                   Index,
  _In_  USHORT                  LanguageID,
  _Out_ PUCHAR                  Buffer,
  _In_  ULONG                   BufferLength,
  _Out_ PULONG                  LengthTransferred


InterfaceHandle [in]

An opaque handle to an interface in the selected configuration.

To retrieve the device or configuration descriptor, use the handle returned by WinUsb_Initialize.

To retrieve the interface descriptor of the first interface, use the handle returned by WinUsb_Initialize.

To retrieve the endpoint descriptor of an endpoint in the first interface, use the handle returned by WinUsb_Initialize.

To retrieve descriptors of all other interfaces and their related endpoints, use the handle to the target interface, retrieved by WinUsb_GetAssociatedInterface.

DescriptorType [in]

A value that specifies the type of descriptor to return. This parameter corresponds to the bDescriptorType field of a standard device descriptor, whose values are described in the Universal Serial Bus specification. Some of these values are listed in the description of the DescriptorType member of the _URB_CONTROL_DESCRIPTOR_REQUEST structure.

Index [in]

The descriptor index. For an explanation of the descriptor index, see the Universal Serial Bus specification (

LanguageID [in]

A value that specifies the language identifier, if the requested descriptor is a string descriptor.

Buffer [out]

A caller-allocated buffer that receives the requested descriptor.

BufferLength [in]

The length, in bytes, of Buffer.

LengthTransferred [out]

The number of bytes that were copied into Buffer.

Return value

WinUsb_GetDescriptor returns TRUE if the operation succeeds. Otherwise, this routine returns FALSE, and the caller can retrieve the logged error by calling GetLastError.

GetLastError can return the following error code.

Return codeDescription

The caller passed NULL in the InterfaceHandle parameter.



If the output buffer pointed to by the Buffer parameter is large enough, WinUsb_GetDescriptor creates a copy of the specified descriptor into the output buffer. No data is copied if the buffer is not large enough to hold descriptor data. The descriptor is created during the WinUsb_Initialize call or it may be retrieved at this point from the device.


Target platform



Winusb.h (include Winusb.h)





See also

WinUSB Functions



Send comments about this topic to Microsoft