Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RawInput: Buffer pointer should be aligned on a DWORD (32-bit) boundary #1953

Open
wants to merge 13 commits into
base: docs
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Performs a buffered read of the raw input messages data found in the calling thr

Type: **PRAWINPUT**

A pointer to a buffer of [RAWINPUT](ns-winuser-rawinput.md) structures that contain the raw input data. Buffer should be aligned on a pointer boundary, which is a **DWORD** on 32-bit architectures and a **QWORD** on 64-bit architectures.
A pointer to a buffer of [RAWINPUT](ns-winuser-rawinput.md) structures that contain the raw input data. Pointer should be aligned on a **DWORD** (32-bit) boundary.

If **NULL**, size of the first raw input message data (minimum required buffer), in bytes, is returned in \**pcbSize*.

Expand Down
24 changes: 6 additions & 18 deletions sdk-api-src/content/winuser/nf-winuser-getrawinputdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ Retrieves the raw input from the specified device.

Type: <b>HRAWINPUT</b>

A handle to the <a href="/windows/desktop/api/winuser/ns-winuser-rawinput">RAWINPUT</a> structure. This comes from the
<i>lParam</i> in <a href="/windows/desktop/inputdev/wm-input">WM_INPUT</a>.
A handle to the <a href="/windows/desktop/api/winuser/ns-winuser-rawinput">RAWINPUT</a> structure. This comes from the <i>lParam</i> in <a href="/windows/desktop/inputdev/wm-input">WM_INPUT</a>.

### -param uiCommand [in]

Expand Down Expand Up @@ -106,16 +105,15 @@ Get the raw data from the <a href="/windows/desktop/api/winuser/ns-winuser-rawin

Type: <b>LPVOID</b>

A pointer to the data that comes from the <a href="/windows/desktop/api/winuser/ns-winuser-rawinput">RAWINPUT</a> structure. This depends on the value of
<i>uiCommand</i>. If
<i>pData</i> is <b>NULL</b>, the required size of the buffer is returned in *<i>pcbSize</i>.
A pointer to the data that comes from the <a href="/windows/desktop/api/winuser/ns-winuser-rawinput">RAWINPUT</a> structure. This depends on the value of <i>uiCommand</i>. Pointer should be aligned on a **DWORD** (32-bit) boundary.

If <i>pData</i> is <b>NULL</b>, the required size of the buffer is returned in *<i>pcbSize</i>.

### -param pcbSize [in, out]

Type: <b>PUINT</b>

The size, in bytes, of the data in
<i>pData</i>.
The size, in bytes, of the data in <i>pData</i>.

### -param cbSizeHeader [in]

Expand All @@ -127,9 +125,7 @@ The size, in bytes, of the <a href="/windows/desktop/api/winuser/ns-winuser-rawi

Type: <b>UINT</b>

If
<i>pData</i> is <b>NULL</b> and the function is successful, the return value is 0. If
<i>pData</i> is not <b>NULL</b> and the function is successful, the return value is the number of bytes copied into pData.
If <i>pData</i> is <b>NULL</b> and the function is successful, the return value is 0. If <i>pData</i> is not <b>NULL</b> and the function is successful, the return value is the number of bytes copied into pData.

If there is an error, the return value is (<b>UINT</b>)-1.

Expand All @@ -141,20 +137,12 @@ If there is an error, the return value is (<b>UINT</b>)-1.

<b>Conceptual</b>



<a href="/windows/desktop/api/winuser/nf-winuser-getrawinputbuffer">GetRawInputBuffer</a>



<a href="/windows/desktop/api/winuser/ns-winuser-rawinput">RAWINPUT</a>



<a href="/windows/desktop/api/winuser/ns-winuser-rawinputheader">RAWINPUTHEADER</a>



<a href="/windows/desktop/inputdev/raw-input">Raw Input</a>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ For this <i>uiCommand</i> only, the value in <i>pcbSize</i> is the character cou

Type: <b>LPVOID</b>

A pointer to a buffer that contains the information specified by <i>uiCommand</i>.
A pointer to a buffer that contains the information specified by <i>uiCommand</i>. Pointer should be aligned on a **DWORD** (32-bit) boundary.

If <i>uiCommand</i> is <b>RIDI_DEVICEINFO</b>, set the <b>cbSize</b> member of <a href="/windows/desktop/api/winuser/ns-winuser-rid_device_info">RID_DEVICE_INFO</a> to <code>sizeof(RID_DEVICE_INFO)</code> before calling <b>GetRawInputDeviceInfo</b>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ For this <i>uiCommand</i> only, the value in <i>pcbSize</i> is the character cou

Type: <b>LPVOID</b>

A pointer to a buffer that contains the information specified by <i>uiCommand</i>.
A pointer to a buffer that contains the information specified by <i>uiCommand</i>. Pointer should be aligned on a **DWORD** (32-bit) boundary.

If <i>uiCommand</i> is <b>RIDI_DEVICEINFO</b>, set the <b>cbSize</b> member of <a href="/windows/desktop/api/winuser/ns-winuser-rid_device_info">RID_DEVICE_INFO</a> to <code>sizeof(RID_DEVICE_INFO)</code> before calling <b>GetRawInputDeviceInfo</b>.

Expand Down
21 changes: 5 additions & 16 deletions sdk-api-src/content/winuser/nf-winuser-getrawinputdevicelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Enumerates the raw input devices attached to the system.

Type: <b>PRAWINPUTDEVICELIST</b>

An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevicelist">RAWINPUTDEVICELIST</a> structures for the devices attached to the system. If <b>NULL</b>, the number of devices are returned in *<i>puiNumDevices</i>.
An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevicelist">RAWINPUTDEVICELIST</a> structures for the devices attached to the system. Pointer should be aligned on a **DWORD** (32-bit) boundary.

If <b>NULL</b>, the number of devices are returned in *<i>puiNumDevices</i>.

### -param puiNumDevices [in, out]

Expand All @@ -84,19 +86,16 @@ The size of a <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevicelis

Type: <b>UINT</b>

If the function is successful, the return value is the number of devices stored in the buffer pointed to by
<i>pRawInputDeviceList</i>.
If the function is successful, the return value is the number of devices stored in the buffer pointed to by <i>pRawInputDeviceList</i>.

On any other error, the function returns (<b>UINT</b>) -1 and
<a href="/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a> returns the error indication.
On any other error, the function returns (<b>UINT</b>) -1 and <a href="/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a> returns the error indication.

## -remarks

The devices returned from this function are the mouse, the keyboard, and other Human Interface Device (HID) devices.

To get more detailed information about the attached devices, call <a href="/windows/desktop/api/winuser/nf-winuser-getrawinputdeviceinfoa">GetRawInputDeviceInfo</a> using the hDevice from <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevicelist">RAWINPUTDEVICELIST</a>.


#### Examples

The following sample code shows a typical call to <b>GetRawInputDeviceList</b>:
Expand Down Expand Up @@ -126,18 +125,8 @@ free(pRawInputDeviceList);

<b>Conceptual</b>



<a href="/windows/desktop/api/winuser/nf-winuser-getrawinputdeviceinfoa">GetRawInputDeviceInfo</a>



<a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevicelist">RAWINPUTDEVICELIST</a>



<a href="/windows/desktop/inputdev/raw-input">Raw Input</a>



<b>Reference</b>
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Retrieves the information about the raw input devices for the current applicatio

Type: <b>PRAWINPUTDEVICE</b>

An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a> structures for the application.
An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a> structures for the application. Pointer should be aligned on a **DWORD** (32-bit) boundary.

### -param puiNumDevices [in, out]

Expand Down Expand Up @@ -88,18 +88,10 @@ To receive raw input from a device, an application must register it by using <a

<b>Conceptual</b>



<a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a>



<a href="/windows/desktop/inputdev/raw-input">Raw Input</a>



<b>Reference</b>



<a href="/windows/desktop/api/winuser/nf-winuser-registerrawinputdevices">RegisterRawInputDevices</a>
<a href="/windows/desktop/api/winuser/nf-winuser-registerrawinputdevices">RegisterRawInputDevices</a>
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Registers the devices that supply the raw input data.

Type: <b>PCRAWINPUTDEVICE</b>

An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a> structures that represent the devices that supply the raw input.
An array of <a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a> structures that represent the devices that supply the raw input. Pointer should be aligned on a **DWORD** (32-bit) boundary.

### -param uiNumDevices [in]

Expand Down Expand Up @@ -98,18 +98,10 @@ Only one window per raw input device class may be registered to receive raw inpu

<b>Conceptual</b>



<a href="/windows/desktop/api/winuser/ns-winuser-rawinputdevice">RAWINPUTDEVICE</a>



<a href="/windows/desktop/inputdev/raw-input">Raw Input</a>



<b>Reference</b>



<a href="/windows/desktop/inputdev/wm-input">WM_INPUT</a>