feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Is this information on the GetRawInputDeviceInfoA page a bug?

Open Wallby opened this issue 1 year ago • 1 comments

Describe the bug The following section..

If successful, this function returns a non-negative number indicating the number of bytes copied to pData.

If pData is not large enough for the data, the function returns -1. If pData is NULL, the function returns a value of zero. In both of these cases, pcbSize is set to the minimum size required for the pData buffer.

Call GetLastError to identify any other errors.

.. says that..

  • if successful, GetRawInputDeviceInfoA returns a "non-negative number"
  • if pData == NULL.. 0 is returned
  • if pcbSize is too small.. -1 is returned
  • any other errors can be identified using GetLastError

The first and the last seem confusing. pData == NULL is "non-negative", thus I suppose that is considered success. However does "to identify any other errors" mean that there is no way to detect those errors except checking if GetLastError() != ERROR_SUCCESS? Or does it mean that any other error will also return a negative (but not -1) number and GetLastError can be used to "To get extended error information" as the CreateWindowA documentation page puts it?

To Reproduce -

Expected behavior The words "Call GetLastError to identify any other errors" are confusing. "To get extended error information, call GetLastError" is clearer.

Screenshots -

Desktop (please complete the following information): -

Smartphone (please complete the following information): -

Additional context -

Wallby avatar May 04 '24 12:05 Wallby

@drewbatgit FYI.

gewarren avatar May 24 '24 18:05 gewarren