mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 23:53:37 +00:00
win32u: Move NtUserGetRegisteredRawInputDevices from user32.
This commit is contained in:
parent
0ce4ed675f
commit
cbbab65571
|
@ -506,63 +506,6 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
|
|||
return *data_size;
|
||||
}
|
||||
|
||||
static int __cdecl compare_raw_input_devices(const void *ap, const void *bp)
|
||||
{
|
||||
const RAWINPUTDEVICE a = *(const RAWINPUTDEVICE *)ap;
|
||||
const RAWINPUTDEVICE b = *(const RAWINPUTDEVICE *)bp;
|
||||
|
||||
if (a.usUsagePage != b.usUsagePage) return a.usUsagePage - b.usUsagePage;
|
||||
if (a.usUsage != b.usUsage) return a.usUsage - b.usUsage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetRegisteredRawInputDevices (USER32.@)
|
||||
*/
|
||||
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(RAWINPUTDEVICE *devices, UINT *device_count, UINT size)
|
||||
{
|
||||
struct rawinput_device *buffer = NULL;
|
||||
unsigned int i, status, count = ~0U, buffer_size;
|
||||
|
||||
TRACE("devices %p, device_count %p, size %u\n", devices, device_count, size);
|
||||
|
||||
if (size != sizeof(RAWINPUTDEVICE) || !device_count || (devices && !*device_count))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
buffer_size = *device_count * sizeof(*buffer);
|
||||
if (devices && !(buffer = HeapAlloc(GetProcessHeap(), 0, buffer_size)))
|
||||
return ~0U;
|
||||
|
||||
SERVER_START_REQ(get_rawinput_devices)
|
||||
{
|
||||
if (buffer) wine_server_set_reply(req, buffer, buffer_size);
|
||||
status = wine_server_call_err(req);
|
||||
*device_count = reply->device_count;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (buffer && !status)
|
||||
{
|
||||
for (i = 0, count = *device_count; i < count; ++i)
|
||||
{
|
||||
devices[i].usUsagePage = buffer[i].usage_page;
|
||||
devices[i].usUsage = buffer[i].usage;
|
||||
devices[i].dwFlags = buffer[i].flags;
|
||||
devices[i].hwndTarget = wine_server_ptr_handle(buffer[i].target);
|
||||
}
|
||||
|
||||
qsort(devices, count, sizeof(*devices), compare_raw_input_devices);
|
||||
}
|
||||
|
||||
if (buffer) HeapFree(GetProcessHeap(), 0, buffer);
|
||||
else count = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DefRawInputProc (USER32.@)
|
||||
*/
|
||||
|
|
|
@ -372,7 +372,7 @@
|
|||
@ stdcall GetRawInputDeviceInfoW(ptr long ptr ptr)
|
||||
@ stdcall GetRawInputDeviceList(ptr ptr long)
|
||||
# @ stub GetReasonTitleFromReasonCode
|
||||
@ stdcall GetRegisteredRawInputDevices(ptr ptr long)
|
||||
@ stdcall GetRegisteredRawInputDevices(ptr ptr long) NtUserGetRegisteredRawInputDevices
|
||||
@ stdcall GetScrollBarInfo(long long ptr)
|
||||
@ stdcall GetScrollInfo(long long ptr)
|
||||
@ stdcall GetScrollPos(long long)
|
||||
|
|
|
@ -427,3 +427,62 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int compare_raw_input_devices( const void *ap, const void *bp )
|
||||
{
|
||||
const RAWINPUTDEVICE a = *(const RAWINPUTDEVICE *)ap;
|
||||
const RAWINPUTDEVICE b = *(const RAWINPUTDEVICE *)bp;
|
||||
|
||||
if (a.usUsagePage != b.usUsagePage) return a.usUsagePage - b.usUsagePage;
|
||||
if (a.usUsage != b.usUsage) return a.usUsage - b.usUsage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserGetRegisteredRawInputDevices (win32u.@)
|
||||
*/
|
||||
UINT WINAPI NtUserGetRegisteredRawInputDevices( RAWINPUTDEVICE *devices, UINT *device_count, UINT size )
|
||||
{
|
||||
struct rawinput_device *buffer = NULL;
|
||||
unsigned int i, status, buffer_size;
|
||||
|
||||
TRACE("devices %p, device_count %p, size %u\n", devices, device_count, size);
|
||||
|
||||
if (size != sizeof(RAWINPUTDEVICE) || !device_count || (devices && !*device_count))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
buffer_size = *device_count * sizeof(*buffer);
|
||||
if (devices && !(buffer = malloc( buffer_size )))
|
||||
return ~0u;
|
||||
|
||||
SERVER_START_REQ(get_rawinput_devices)
|
||||
{
|
||||
if (buffer) wine_server_set_reply( req, buffer, buffer_size );
|
||||
status = wine_server_call_err(req);
|
||||
*device_count = reply->device_count;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (status)
|
||||
{
|
||||
free( buffer );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
if (!devices) return 0;
|
||||
|
||||
for (i = 0; i < *device_count; ++i)
|
||||
{
|
||||
devices[i].usUsagePage = buffer[i].usage_page;
|
||||
devices[i].usUsage = buffer[i].usage;
|
||||
devices[i].dwFlags = buffer[i].flags;
|
||||
devices[i].hwndTarget = wine_server_ptr_handle(buffer[i].target);
|
||||
}
|
||||
|
||||
qsort( devices, *device_count, sizeof(*devices), compare_raw_input_devices );
|
||||
|
||||
free( buffer );
|
||||
return *device_count;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ static void * const syscalls[] =
|
|||
NtUserGetProp,
|
||||
NtUserGetRawInputBuffer,
|
||||
NtUserGetRawInputData,
|
||||
NtUserGetRegisteredRawInputDevices,
|
||||
NtUserGetSystemDpiForProcess,
|
||||
NtUserGetThreadDesktop,
|
||||
NtUserGetTitleBarInfo,
|
||||
|
|
|
@ -988,7 +988,7 @@
|
|||
@ stub NtUserGetRawInputDeviceInfo
|
||||
@ stub NtUserGetRawInputDeviceList
|
||||
@ stub NtUserGetRawPointerDeviceData
|
||||
@ stub NtUserGetRegisteredRawInputDevices
|
||||
@ stdcall -syscall NtUserGetRegisteredRawInputDevices(ptr ptr long)
|
||||
@ stub NtUserGetRequiredCursorSizes
|
||||
@ stub NtUserGetResizeDCompositionSynchronizationObject
|
||||
@ stub NtUserGetScrollBarInfo
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
SYSCALL_ENTRY( NtUserGetProp ) \
|
||||
SYSCALL_ENTRY( NtUserGetRawInputBuffer ) \
|
||||
SYSCALL_ENTRY( NtUserGetRawInputData ) \
|
||||
SYSCALL_ENTRY( NtUserGetRegisteredRawInputDevices ) \
|
||||
SYSCALL_ENTRY( NtUserGetSystemDpiForProcess ) \
|
||||
SYSCALL_ENTRY( NtUserGetThreadDesktop ) \
|
||||
SYSCALL_ENTRY( NtUserGetTitleBarInfo ) \
|
||||
|
|
|
@ -1015,3 +1015,44 @@ NTSTATUS WINAPI wow64_NtUserRegisterRawInputDevices( UINT *args )
|
|||
|
||||
return NtUserRegisterRawInputDevices( devices64, count, sizeof(*devices64) );
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI wow64_NtUserGetRegisteredRawInputDevices( UINT *args )
|
||||
{
|
||||
RAWINPUTDEVICE32 *devices32 = get_ptr( &args );
|
||||
UINT *count = get_ptr( &args );
|
||||
UINT size = get_ulong( &args );
|
||||
|
||||
if (size != sizeof(RAWINPUTDEVICE32))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
if (devices32)
|
||||
{
|
||||
RAWINPUTDEVICE *devices64;
|
||||
unsigned int ret, i;
|
||||
|
||||
if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) )))
|
||||
{
|
||||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
ret = NtUserGetRegisteredRawInputDevices( devices64, count, sizeof(RAWINPUTDEVICE) );
|
||||
if (ret == ~0u) return ret;
|
||||
|
||||
for (i = 0; i < *count; ++i)
|
||||
{
|
||||
devices32[i].usUsagePage = devices64[i].usUsagePage;
|
||||
devices32[i].usUsage = devices64[i].usUsage;
|
||||
devices32[i].dwFlags = devices64[i].dwFlags;
|
||||
devices32[i].hwndTarget = (ULONG_PTR)devices64[i].hwndTarget;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NtUserGetRegisteredRawInputDevices( NULL, count, sizeof(RAWINPUTDEVICE) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -621,6 +621,7 @@ ULONG WINAPI NtUserGetProcessDpiAwarenessContext( HANDLE process );
|
|||
DWORD WINAPI NtUserGetQueueStatus( UINT flags );
|
||||
UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT header_size );
|
||||
UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size );
|
||||
UINT WINAPI NtUserGetRegisteredRawInputDevices( RAWINPUTDEVICE *devices, UINT *device_count, UINT size );
|
||||
ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process );
|
||||
HMENU WINAPI NtUserGetSystemMenu( HWND hwnd, BOOL revert );
|
||||
HDESK WINAPI NtUserGetThreadDesktop( DWORD thread );
|
||||
|
|
Loading…
Reference in a new issue