GetRawInputDeviceInfoW function (winuser.h)

Retrieves information about the raw input device.

Syntax

UINT GetRawInputDeviceInfoW(
  [in, optional]      HANDLE hDevice,
  [in]                UINT   uiCommand,
  [in, out, optional] LPVOID pData,
  [in, out]           PUINT  pcbSize
);

Parameters

[in, optional] hDevice

Type: HANDLE

A handle to the raw input device. This comes from the hDevice member of RAWINPUTHEADER or from GetRawInputDeviceList.

[in] uiCommand

Type: UINT

Specifies what data will be returned in pData. This parameter can be one of the following values.

Value Meaning
RIDI_PREPARSEDDATA
0x20000005
pData is a PHIDP_PREPARSED_DATA pointer to a buffer for a top-level collection's preparsed data.
RIDI_DEVICENAME
0x20000007
pData points to a string that contains the device interface name.

If this device is opened with Shared Access Mode then you can call CreateFile with this name to open a HID collection and use returned handle for calling ReadFile to read input reports and WriteFile to send output reports.

For more information, see Opening HID Collections and Handling HID Reports.

For this uiCommand only, the value in pcbSize is the character count (not the byte count).

RIDI_DEVICEINFO
0x2000000b
pData points to an RID_DEVICE_INFO structure.

[in, out, optional] pData

Type: LPVOID

A pointer to a buffer that contains the information specified by uiCommand.

If uiCommand is RIDI_DEVICEINFO, set the cbSize member of RID_DEVICE_INFO to sizeof(RID_DEVICE_INFO) before calling GetRawInputDeviceInfo.

[in, out] pcbSize

Type: PUINT

The size, in bytes, of the data in pData.

Return value

Type: UINT

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.

Remarks

Note

The winuser.h header defines GetRawInputDeviceInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-rawinput-l1-1-0 (introduced in Windows 10, version 10.0.14393)

See also

Conceptual

RAWINPUTHEADER

RID_DEVICE_INFO

Raw Input

Reference

WM_INPUT

Top-Level Collections

Preparsed Data

PHIDP_PREPARSED_DATA

Opening HID collections

Handling HID Reports