Jump to content

UsbQueryStringReport: Difference between revisions

From EDM2
W.m.brul (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
 
Line 4: Line 4:


==Syntax==
==Syntax==
<pre>
ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)
ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)
</pre>


==Parameters==
==Parameters==
; Handle : the Device Handle received from the previous UsbOpen.
; Handle : the Device Handle received from the previous UsbOpen.
; usLangID : the appropriate Language Code as to the array of Language Codes.
; usLangID : the appropriate Language Code as to the array of Language Codes.
; ucStringID : ucStringID - the Descriptor Index or 0 to obtain the array of Language Codes.
; ucStringID : ucStringID - the Descriptor Index or 0 to obtain the array of Language Codes.
; pulBufLen : the address of the variable to specify/receive the number of bytes.
; pulBufLen : the address of the variable to specify/receive the number of bytes.
; pucData : the address of the buffer to receive the String Descriptor.
; pucData : the address of the buffer to receive the String Descriptor.


==Return Code==
==Return Code==
<pre>
0x0000 - NO_ERROR
0x0000 - NO_ERROR
 
</pre>
===Errors===
===Errors===
<pre>
<pre>
Line 30: Line 23:
0xFF57 - ERROR_INVALID_PARAMETER
0xFF57 - ERROR_INVALID_PARAMETER
</pre>
</pre>
==Remarks==
==Remarks==



Latest revision as of 22:42, 13 September 2021

Description

Obtains the array of languages supported by a USB device. Obtains the specified string descriptor of a USB device.

Syntax

ulrc = UsbQueryStringReport(Handle,usLangID,ucStringID,pulBufLen,pucData)

Parameters

Handle
the Device Handle received from the previous UsbOpen.
usLangID
the appropriate Language Code as to the array of Language Codes.
ucStringID
ucStringID - the Descriptor Index or 0 to obtain the array of Language Codes.
pulBufLen
the address of the variable to specify/receive the number of bytes.
pucData
the address of the buffer to receive the String Descriptor.

Return Code

0x0000 - NO_ERROR

Errors

0x0057 - ERROR_INVALID_PARAMETER
0x1B58 - USB_NOT_INIT
0xFF1F - ERROR_GEN_FAILURE
0xFF57 - ERROR_INVALID_PARAMETER

Remarks

Example Code

//Code Snippet - UsbQueryStringReport
{
  APIRET ulrc;
  PUCHAR pucReport;
  PULONG pulBufLen;
  UCHAR ucIndex = 2;
  UCHAR ucReport[4096];
  ULONG ulBufLen = sizeof(ucReport);
  USHORT usLanguage = 0x0409;

  pucReport = &ucReport[0];
  pulBufLen = &ulBufLen;
  ulrc = UsbQueryStringReport(Handle,usLanguage,ucIndex,pulBufLen,pucReport);
  printf("\nUsbQueryStringReport - ulrc: 0x%04X (%hu)",ulrc,ulrc);
  if (!ulrc) //success
  {
    int i; printf(" - StringReport:\n");
    for (i=0;i<ulBufLen;i++) printf("%02X",ucReport[i]);
  }
}

Related Functions