From: Zebediah Figura zfigura@codeweavers.com
--- dlls/win32u/gdiobj.c | 1 - dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 2 - dlls/win32u/wrappers.c | 6 --- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 99 ++++++++++++++++++++++++++++++++++++ 7 files changed, 102 insertions(+), 10 deletions(-)
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 121ed4bbefd..0b148a628b3 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1185,7 +1185,6 @@ static struct unix_funcs unix_funcs = NtUserGetPriorityClipboardFormat, NtUserGetQueueStatus, NtUserGetRawInputBuffer, - NtUserGetRawInputData, NtUserGetSystemMenu, NtUserGetUpdateRect, NtUserGetUpdateRgn, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index ffb1529e03f..cf5615f4dde 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -145,6 +145,7 @@ static void * const syscalls[] = NtUserGetProcessDpiAwarenessContext, NtUserGetProcessWindowStation, NtUserGetProp, + NtUserGetRawInputData, NtUserGetSystemDpiForProcess, NtUserGetThreadDesktop, NtUserGetTitleBarInfo, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 4a8d839007e..80bfb0bc253 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -984,7 +984,7 @@ @ stdcall NtUserGetQueueStatus(long) @ stub NtUserGetQueueStatusReadonly @ stdcall NtUserGetRawInputBuffer(ptr ptr long) -@ stdcall NtUserGetRawInputData(ptr long ptr ptr long) +@ stdcall -syscall NtUserGetRawInputData(ptr long ptr ptr long) @ stub NtUserGetRawInputDeviceInfo @ stub NtUserGetRawInputDeviceList @ stub NtUserGetRawPointerDeviceData diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 51a3d752763..7b4b820d392 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -249,8 +249,6 @@ struct unix_funcs INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count ); DWORD (WINAPI *pNtUserGetQueueStatus)( UINT flags ); UINT (WINAPI *pNtUserGetRawInputBuffer)( RAWINPUT *data, UINT *data_size, UINT header_size ); - UINT (WINAPI *pNtUserGetRawInputData)( HRAWINPUT rawinput, UINT command, - void *data, UINT *data_size, UINT header_size ); HMENU (WINAPI *pNtUserGetSystemMenu)( HWND hwnd, BOOL revert ); BOOL (WINAPI *pNtUserGetUpdateRect)( HWND hwnd, RECT *rect, BOOL erase ); INT (WINAPI *pNtUserGetUpdateRgn)( HWND hwnd, HRGN hrgn, BOOL erase ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 05c25a006e9..a4504135314 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -1054,12 +1054,6 @@ UINT WINAPI DECLSPEC_HOTPATCH NtUserGetRawInputBuffer( RAWINPUT *data, UINT *dat return unix_funcs->pNtUserGetRawInputBuffer( data, data_size, header_size ); }
-UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size ) -{ - if (!unix_funcs) return ~0u; - return unix_funcs->pNtUserGetRawInputData( rawinput, command, data, data_size, header_size ); -} - BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size ) { if (!unix_funcs) return FALSE; diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index e1364c2811e..6c4e12bf59a 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -132,6 +132,7 @@ SYSCALL_ENTRY( NtUserGetProcessDpiAwarenessContext ) \ SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserGetProp ) \ + SYSCALL_ENTRY( NtUserGetRawInputData ) \ SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \ SYSCALL_ENTRY( NtUserGetThreadDesktop ) \ SYSCALL_ENTRY( NtUserGetTitleBarInfo ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 08b8fb6f2a0..8105b66654c 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -56,6 +56,14 @@ typedef struct POINT pt; } MSG32;
+typedef struct +{ + DWORD dwType; + DWORD dwSize; + UINT32 hDevice; + UINT32 wParam; +} RAWINPUTHEADER32; + static MSG *msg_32to64( MSG *msg, MSG32 *msg32 ) { if (!msg32) return NULL; @@ -858,3 +866,94 @@ NTSTATUS WINAPI wow64_NtUserGetTitleBarInfo( UINT *args )
return NtUserGetTitleBarInfo( hwnd, info ); } + +NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args ) +{ + HRAWINPUT handle = get_handle( &args ); + UINT command = get_ulong( &args ); + void *data = get_ptr( &args ); + UINT *data_size = get_ptr( &args ); + UINT header_size = get_ulong( &args ); + + if (header_size != sizeof(RAWINPUTHEADER32)) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return ~0u; + } + + switch (command) + { + case RID_INPUT: + if (data) + { + UINT data_size64, body_size, ret; + RAWINPUTHEADER32 *data32 = data; + RAWINPUTHEADER *data64 = NULL; + + data_size64 = *data_size + sizeof(RAWINPUTHEADER); + if (!(data64 = Wow64AllocateTemp( data_size64 ))) + { + SetLastError( STATUS_NO_MEMORY ); + return ~0u; + } + + ret = NtUserGetRawInputData( handle, command, data64, &data_size64, sizeof(RAWINPUTHEADER) ); + if (ret == ~0u) return ret; + + body_size = ret - sizeof(RAWINPUTHEADER); + if (*data_size < sizeof(RAWINPUTHEADER32) + body_size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return ~0u; + } + + data32->dwType = data64->dwType; + data32->dwSize = sizeof(RAWINPUTHEADER32) + body_size; + data32->hDevice = (UINT_PTR)data64->hDevice; + data32->wParam = data64->wParam; + memcpy( data32 + 1, data64 + 1, body_size ); + return sizeof(RAWINPUTHEADER32) + body_size; + } + else + { + UINT data_size64, ret; + + ret = NtUserGetRawInputData( handle, command, NULL, &data_size64, sizeof(RAWINPUTHEADER) ); + if (ret == ~0u) return ret; + *data_size = data_size64 - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32); + return 0; + } + + case RID_HEADER: + { + UINT data_size64 = sizeof(RAWINPUTHEADER); + RAWINPUTHEADER32 *data32 = data; + RAWINPUTHEADER data64; + UINT ret; + + if (!data) + { + *data_size = sizeof(RAWINPUTHEADER32); + return 0; + } + + if (*data_size < sizeof(RAWINPUTHEADER32)) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return ~0u; + } + + ret = NtUserGetRawInputData( handle, command, &data64, &data_size64, sizeof(RAWINPUTHEADER) ); + if (ret == ~0u) return ret; + data32->dwType = data64.dwType; + data32->dwSize = data64.dwSize - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32); + data32->hDevice = (UINT_PTR)data64.hDevice; + data32->wParam = data64.wParam; + return sizeof(RAWINPUTHEADER32); + } + + default: + SetLastError( ERROR_INVALID_PARAMETER ); + return ~0u; + } +}