From deb455ec25ea9f47c9bf3119ff5b77089300fe0e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 16 Nov 2021 12:33:23 +0100 Subject: [PATCH] win32u: Move NtUserGetKeyboardState implementation from user32. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/input.c | 23 ----------------------- dlls/user32/message.c | 2 +- dlls/user32/user32.spec | 2 +- dlls/win32u/input.c | 22 ++++++++++++++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 7 +++++++ 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 7d0581dfc8f..08b5cffaa5f 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -593,29 +593,6 @@ BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii) } -/********************************************************************** - * GetKeyboardState (USER32.@) - */ -BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state ) -{ - BOOL ret; - UINT i; - - TRACE("(%p)\n", state); - - memset( state, 0, 256 ); - SERVER_START_REQ( get_key_state ) - { - req->key = -1; - wine_server_set_reply( req, state, 256 ); - ret = !wine_server_call_err( req ); - for (i = 0; i < 256; i++) state[i] &= 0x81; - } - SERVER_END_REQ; - return ret; -} - - /********************************************************************** * SetKeyboardState (USER32.@) */ diff --git a/dlls/user32/message.c b/dlls/user32/message.c index e5ea0735ed2..50c13323bc3 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -3888,7 +3888,7 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) return ImmTranslateMessage(msg->hwnd, msg->message, msg->wParam, msg->lParam); } - GetKeyboardState( state ); + NtUserGetKeyboardState( state ); len = ToUnicode(msg->wParam, HIWORD(msg->lParam), state, wp, ARRAY_SIZE(wp), 0); if (len == -1) { diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 91dc9674a3b..c4013b3dcfa 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -321,7 +321,7 @@ @ stdcall GetKeyboardLayoutList(long ptr) @ stdcall GetKeyboardLayoutNameA(ptr) @ stdcall GetKeyboardLayoutNameW(ptr) -@ stdcall GetKeyboardState(ptr) +@ stdcall -import GetKeyboardState(ptr) NtUserGetKeyboardState @ stdcall GetKeyboardType(long) @ stdcall GetLastActivePopup(long) @ stdcall GetLastInputInfo(ptr) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 5383115a424..4e790257ab1 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -71,3 +71,25 @@ SHORT WINAPI NtUserGetKeyState( INT vkey ) TRACE("key (0x%x) -> %x\n", vkey, retval); return retval; } + +/********************************************************************** + * NtUserGetKeyboardState (win32u.@) + */ +BOOL WINAPI NtUserGetKeyboardState( BYTE *state ) +{ + BOOL ret; + UINT i; + + TRACE("(%p)\n", state); + + memset( state, 0, 256 ); + SERVER_START_REQ( get_key_state ) + { + req->key = -1; + wine_server_set_reply( req, state, 256 ); + ret = !wine_server_call_err( req ); + for (i = 0; i < 256; i++) state[i] &= 0x81; + } + SERVER_END_REQ; + return ret; +} diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 9216e95f25c..a7c08c5cef6 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -112,6 +112,7 @@ static void * const syscalls[] = NtUserGetClipboardSequenceNumber, NtUserGetClipboardViewer, NtUserGetKeyState, + NtUserGetKeyboardState, NtUserGetLayeredWindowAttributes, NtUserGetObjectInformation, NtUserGetProcessWindowStation, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 2003dc39bcd..e4b31efe436 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -949,7 +949,7 @@ @ stub NtUserGetKeyboardLayout @ stub NtUserGetKeyboardLayoutList @ stub NtUserGetKeyboardLayoutName -@ stub NtUserGetKeyboardState +@ stdcall -syscall NtUserGetKeyboardState(ptr) @ stdcall -syscall NtUserGetLayeredWindowAttributes(long ptr ptr ptr) @ stub NtUserGetListBoxInfo @ stub NtUserGetMenuBarInfo diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 7dc791e8eb5..7c2ccbe63c7 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -99,6 +99,7 @@ SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \ SYSCALL_ENTRY( NtUserGetClipboardViewer ) \ SYSCALL_ENTRY( NtUserGetKeyState ) \ + SYSCALL_ENTRY( NtUserGetKeyboardState ) \ SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \ SYSCALL_ENTRY( NtUserGetObjectInformation ) \ SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index dcf8850c3f2..a563e78a8f5 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -244,3 +244,10 @@ NTSTATUS WINAPI wow64_NtUserGetKeyState( UINT *args ) return NtUserGetKeyState( vkey ); } + +NTSTATUS WINAPI wow64_NtUserGetKeyboardState( UINT *args ) +{ + BYTE *state = get_ptr( &args ); + + return NtUserGetKeyboardState( state ); +}