From: Vijay Kiran Kamuju Subject: [PATCH] user32: Added GetPointerType stub Message-Id: <20190402110140.2008-1-infyquest@gmail.com> Date: Tue, 2 Apr 2019 13:01:40 +0200 From: Louis Lenders Add more tests for failures. From: Louis Lenders Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45765 Signed-off-by: Vijay Kiran Kamuju --- ...ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec | 2 +- dlls/user32/misc.c | 16 ++++++++++ dlls/user32/tests/input.c | 32 +++++++++++++++++++ dlls/user32/user32.spec | 1 + include/winuser.h | 1 + 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec b/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec index 93ecc1b3e41..c58d51a47e2 100644 --- a/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec +++ b/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec @@ -17,7 +17,7 @@ @ stub GetPointerPenInfoHistory @ stub GetPointerTouchInfo @ stub GetPointerTouchInfoHistory -@ stub GetPointerType +@ stdcall GetPointerType(long ptr) user32.GetPointerType @ stub GetRawPointerDeviceData @ stub InitializeTouchInjection @ stub InjectTouchInput diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c index d28cd9fd055..1a03d70ddec 100644 --- a/dlls/user32/misc.c +++ b/dlls/user32/misc.c @@ -664,6 +664,22 @@ BOOL WINAPI RegisterTouchHitTestingWindow(HWND hwnd, ULONG value) return TRUE; } +/********************************************************************** + * GetPointerType [USER32.@] + */ +BOOL WINAPI GetPointerType(UINT32 id, POINTER_INPUT_TYPE *type) +{ + FIXME("(%d %p): stub\n", id, type); + + if(!id || !type) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + *type = PT_MOUSE; + return TRUE; +} static const WCHAR imeW[] = {'I','M','E',0}; const struct builtin_class_descr IME_builtin_class = diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 625de3d7688..a37c6a01b79 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -78,6 +78,7 @@ static struct { static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t); static BOOL (WINAPI *pGetCurrentInputMessageSource)( INPUT_MESSAGE_SOURCE *source ); +static BOOL (WINAPI *pGetPointerType)(UINT32, POINTER_INPUT_TYPE*); static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD); static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT); static UINT (WINAPI *pGetRawInputDeviceInfoW) (HANDLE, UINT, void *, UINT *); @@ -165,6 +166,7 @@ static void init_function_pointers(void) GET_PROC(SendInput); GET_PROC(GetCurrentInputMessageSource); GET_PROC(GetMouseMovePointsEx); + GET_PROC(GetPointerType); GET_PROC(GetRawInputDeviceList); GET_PROC(GetRawInputDeviceInfoW); GET_PROC(GetRawInputDeviceInfoA); @@ -2800,6 +2802,31 @@ static void test_input_message_source(void) UnregisterClassA( cls.lpszClassName, GetModuleHandleA(0) ); } +static void test_GetPointerType(void) +{ + BOOL ret; + POINTER_INPUT_TYPE type = -1; + UINT id = 0; + + SetLastError(0xdeadbeef); + ret = pGetPointerType(id, NULL); + ok(!ret, "GetPointerType should have failed.\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, + "expected error ERROR_INVALID_PARAMETER, got %u.\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pGetPointerType(id, &type); + ok(GetLastError() == ERROR_INVALID_PARAMETER, + "expected error ERROR_INVALID_PARAMETER, got %u.\n", GetLastError()); + ok(!ret, "GetPointerType failed, got type %d for %u.\n", type, id ); + ok(type == -1, " type %d\n", type ); + + id = 1; + ret = pGetPointerType(id, &type); + ok(ret, "GetPointerType failed, got type %d for %u.\n", type, id ); + ok(type == PT_MOUSE, " type %d\n", type ); +} + START_TEST(input) { POINT pos; @@ -2845,4 +2872,9 @@ START_TEST(input) win_skip("GetCurrentInputMessageSource is not available\n"); SetCursorPos( pos.x, pos.y ); + + if(pGetPointerType) + test_GetPointerType(); + else + win_skip("GetPointerType is not available\n"); } diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index d5b8597d8e4..f9a4ae26df4 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -356,6 +356,7 @@ @ stdcall GetParent(long) @ stdcall GetPhysicalCursorPos(ptr) @ stdcall GetPointerDevices(ptr ptr) +@ stdcall GetPointerType(long ptr) @ stdcall GetPriorityClipboardFormat(ptr long) @ stdcall GetProcessDefaultLayout(ptr) @ stdcall GetProcessDpiAwarenessInternal(long ptr) diff --git a/include/winuser.h b/include/winuser.h index 3cffaa19acd..45015199efc 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -3831,6 +3831,7 @@ WINUSERAPI HWND WINAPI GetNextDlgTabItem(HWND,HWND,BOOL); WINUSERAPI HWND WINAPI GetOpenClipboardWindow(void); WINUSERAPI HWND WINAPI GetParent(HWND); WINUSERAPI BOOL WINAPI GetPhysicalCursorPos(POINT*); +WINUSERAPI BOOL WINAPI GetPointerType(UINT32,POINTER_INPUT_TYPE *); WINUSERAPI INT WINAPI GetPriorityClipboardFormat(UINT*,INT); WINUSERAPI BOOL WINAPI GetProcessDefaultLayout(DWORD*); WINUSERAPI BOOL WINAPI GetProcessDpiAwarenessInternal(HANDLE,DPI_AWARENESS*); -- 2.17.0