Commit 5b7a862c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

win32u: Use syscall interface for NtUserGetRawInputData.

parent 7c418f14
......@@ -1185,7 +1185,6 @@ static struct unix_funcs unix_funcs =
NtUserGetPriorityClipboardFormat,
NtUserGetQueueStatus,
NtUserGetRawInputBuffer,
NtUserGetRawInputData,
NtUserGetSystemMenu,
NtUserGetUpdateRect,
NtUserGetUpdateRgn,
......
......@@ -145,6 +145,7 @@ static void * const syscalls[] =
NtUserGetProcessDpiAwarenessContext,
NtUserGetProcessWindowStation,
NtUserGetProp,
NtUserGetRawInputData,
NtUserGetSystemDpiForProcess,
NtUserGetThreadDesktop,
NtUserGetTitleBarInfo,
......
......@@ -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
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 ) \
......
......@@ -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;
}
}
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