From: Hecheng Yu <kde-yyds(a)qq.com> Implement pointer type detection NtUserGetPointerType. --- dlls/win32u/pointer.c | 46 +++++++++++++++++++++++++++++++++++++ dlls/win32u/win32syscalls.h | 5 ++-- dlls/win32u/win32u.spec | 2 +- dlls/wow64win/user.c | 8 +++++++ include/ntuser.h | 1 + 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/pointer.c b/dlls/win32u/pointer.c index 6fa9f329f2c..c075eb34ca8 100644 --- a/dlls/win32u/pointer.c +++ b/dlls/win32u/pointer.c @@ -123,3 +123,49 @@ void store_pointer_info( HWND hwnd, const INPUT *input, LPARAM lparam ) pthread_mutex_unlock( &pointer_cache_mutex ); } + +BOOL get_pointer_type( UINT32 id, POINTER_INPUT_TYPE *type ) +{ + struct pointer_info_entry *entry; + BOOL ret = FALSE; + + if (id == 1) + { + *type = PT_MOUSE; + TRACE( "Pointer 1 is mouse\n" ); + return TRUE; + } + + pthread_mutex_lock( &pointer_cache_mutex ); + + entry = find_pointer_entry( id ); + if (entry && entry->active) + { + *type = entry->pointerType; + TRACE( "Pointer %u type: %d\n", id, *type ); + ret = TRUE; + } + else + { + WARN( "Pointer %u not found\n", id ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + } + + pthread_mutex_unlock( &pointer_cache_mutex ); + return ret; +} + +/********************************************************************** + * NtUserGetPointerType (win32u.@) + */ +BOOL WINAPI NtUserGetPointerType( UINT32 id, POINTER_INPUT_TYPE *type ) +{ + TRACE( "id %u, type %p\n", id, type ); + if (!type) + { + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + return get_pointer_type( id, type ); +} diff --git a/dlls/win32u/win32syscalls.h b/dlls/win32u/win32syscalls.h index 7826afd3fc3..803defce590 100644 --- a/dlls/win32u/win32syscalls.h +++ b/dlls/win32u/win32syscalls.h @@ -1074,7 +1074,7 @@ SYSCALL_ENTRY( 0x142e, NtUserGetPointerInfoList, 32 ) \ SYSCALL_ENTRY( 0x142f, NtUserGetPointerInputTransform, 0 ) \ SYSCALL_ENTRY( 0x1430, NtUserGetPointerProprietaryId, 0 ) \ - SYSCALL_ENTRY( 0x1431, NtUserGetPointerType, 0 ) \ + SYSCALL_ENTRY( 0x1431, NtUserGetPointerType, 8 ) \ SYSCALL_ENTRY( 0x1432, NtUserGetPrecisionTouchPadConfiguration, 0 ) \ SYSCALL_ENTRY( 0x1433, NtUserGetPriorityClipboardFormat, 8 ) \ SYSCALL_ENTRY( 0x1434, NtUserGetProcessDefaultLayout, 4 ) \ @@ -2616,7 +2616,7 @@ SYSCALL_ENTRY( 0x142e, NtUserGetPointerInfoList, 64 ) \ SYSCALL_ENTRY( 0x142f, NtUserGetPointerInputTransform, 0 ) \ SYSCALL_ENTRY( 0x1430, NtUserGetPointerProprietaryId, 0 ) \ - SYSCALL_ENTRY( 0x1431, NtUserGetPointerType, 0 ) \ + SYSCALL_ENTRY( 0x1431, NtUserGetPointerType, 16 ) \ SYSCALL_ENTRY( 0x1432, NtUserGetPrecisionTouchPadConfiguration, 0 ) \ SYSCALL_ENTRY( 0x1433, NtUserGetPriorityClipboardFormat, 16 ) \ SYSCALL_ENTRY( 0x1434, NtUserGetProcessDefaultLayout, 8 ) \ @@ -3837,7 +3837,6 @@ SYSCALL_STUB( NtUserGetPointerFrameTimes ) \ SYSCALL_STUB( NtUserGetPointerInputTransform ) \ SYSCALL_STUB( NtUserGetPointerProprietaryId ) \ - SYSCALL_STUB( NtUserGetPointerType ) \ SYSCALL_STUB( NtUserGetPrecisionTouchPadConfiguration ) \ SYSCALL_STUB( NtUserGetProcessUIContextInformation ) \ SYSCALL_STUB( NtUserGetProp2 ) \ diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index e3e80a05d0c..4c2aecab17f 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1072,7 +1072,7 @@ @ stdcall -syscall NtUserGetPointerInfoList(long long long long long ptr ptr ptr) @ stub -syscall NtUserGetPointerInputTransform @ stub -syscall NtUserGetPointerProprietaryId -@ stub -syscall NtUserGetPointerType +@ stdcall -syscall NtUserGetPointerType(long ptr) @ stub -syscall NtUserGetPrecisionTouchPadConfiguration @ stdcall -syscall NtUserGetPriorityClipboardFormat(ptr long) @ stdcall -syscall NtUserGetProcessDefaultLayout(ptr) diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index b728e7c01d7..9c7d4c94b80 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -2842,6 +2842,14 @@ NTSTATUS WINAPI wow64_NtUserGetPointerInfoList( UINT *args ) return NtUserGetPointerInfoList( id, type, unk0, unk1, size, entry_count, pointer_count, pointer_info ); } +NTSTATUS WINAPI wow64_NtUserGetPointerType( UINT *args ) +{ + UINT32 id = get_ulong( &args ); + POINTER_INPUT_TYPE *type = get_ptr( &args ); + + return NtUserGetPointerType( id, type ); +} + NTSTATUS WINAPI wow64_NtUserGetPriorityClipboardFormat( UINT *args ) { UINT *list = get_ptr( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 78eee8f17d5..8db8a429803 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -887,6 +887,7 @@ W32KAPI BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, voi W32KAPI HWND WINAPI NtUserGetOpenClipboardWindow(void); W32KAPI BOOL WINAPI NtUserGetPointerInfoList( UINT32 id, POINTER_INPUT_TYPE type, UINT_PTR, UINT_PTR, SIZE_T size, UINT32 *entry_count, UINT32 *pointer_count, void *pointer_info ); +W32KAPI BOOL WINAPI NtUserGetPointerType( UINT32 id, POINTER_INPUT_TYPE *type ); W32KAPI INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count ); W32KAPI BOOL WINAPI NtUserGetProcessDefaultLayout( ULONG *layout ); W32KAPI ULONG WINAPI NtUserGetProcessDpiAwarenessContext( HANDLE process ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9628