Commit 5ca22f55 authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

win32u: Correct GetRawInputBuffer alignment under WoW64.

Patch originally by Rémi Bernon.
parent fb0f8fe5
......@@ -2454,7 +2454,6 @@ static void test_GetRawInputBuffer(void)
ok(size == sizeof(buffer), "GetRawInputBuffer returned unexpected size: %u\n", size);
ok(HEADER_FIELD(dwType) == RIM_TYPEKEYBOARD, "Unexpected rawinput dwType: %ld\n", HEADER_FIELD(dwType));
todo_wine_if(is_wow64)
ok(HEADER_FIELD(wParam) == 0 || HEADER_FIELD(wParam) == 1, "Expected wparam 0 or 1, got %Iu\n", (WPARAM)HEADER_FIELD(wParam));
scan_code = is_wow64 ? ((RAWINPUT64 *)buffer)->data.keyboard.MakeCode : ((RAWINPUT *)buffer)->data.keyboard.MakeCode;
ok(scan_code == 0x2d, "Unexpected rawinput keyboard scan code: %x\n", scan_code);
......
......@@ -671,10 +671,20 @@ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT heade
if (!rawinput_from_hardware_message( data, msg_data )) break;
if (overhead)
{
/* Under WoW64, GetRawInputBuffer always gives 64-bit RAWINPUT structs. */
RAWINPUT64 *ri64 = (RAWINPUT64 *)data;
memmove( (char *)&data->data + overhead, &data->data,
data->header.dwSize - sizeof(RAWINPUTHEADER) );
ri64->header.dwSize += overhead;
/* Need to copy wParam before hDevice so it's not overwritten. */
ri64->header.wParam = data->header.wParam;
#ifdef _WIN64
ri64->header.hDevice = data->header.hDevice;
#else
ri64->header.hDevice = HandleToULong(data->header.hDevice);
#endif
}
data->header.dwSize += overhead;
remaining -= data->header.dwSize;
data = NEXTRAWINPUTBLOCK(data);
msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_data->size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment