diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 71ddb6860dc..7a9cff63298 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -538,27 +538,6 @@ BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc ) } - -/*********************************************************************** - * UnhookWindowsHookEx (USER32.@) - */ -BOOL WINAPI UnhookWindowsHookEx( HHOOK hhook ) -{ - BOOL ret; - - SERVER_START_REQ( remove_hook ) - { - req->handle = wine_server_user_handle( hhook ); - req->id = 0; - ret = !wine_server_call_err( req ); - if (ret) get_user_thread_info()->active_hooks = reply->active_hooks; - } - SERVER_END_REQ; - if (!ret && GetLastError() == ERROR_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE ); - return ret; -} - - /*********************************************************************** * CallNextHookEx (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 16342d15ee7..d60b424321b 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -772,7 +772,7 @@ # @ stub TranslateMessageEx @ stdcall UnhookWinEvent(long) NtUserUnhookWinEvent @ stdcall UnhookWindowsHook(long ptr) -@ stdcall UnhookWindowsHookEx(long) +@ stdcall UnhookWindowsHookEx(long) NtUserUnhookWindowsHookEx @ stdcall UnionRect(ptr ptr ptr) @ stdcall UnloadKeyboardLayout(long) @ stub UnlockWindowStation diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index c91ccf41f6f..b7630a14f16 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -126,6 +126,25 @@ HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWO return handle; } +/*********************************************************************** + * NtUserUnhookWindowsHookEx (win32u.@) + */ +BOOL WINAPI NtUserUnhookWindowsHookEx( HHOOK handle ) +{ + NTSTATUS status; + + SERVER_START_REQ( remove_hook ) + { + req->handle = wine_server_user_handle( handle ); + req->id = 0; + status = wine_server_call_err( req ); + if (!status) get_user_thread_info()->active_hooks = reply->active_hooks; + } + SERVER_END_REQ; + if (status == STATUS_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE ); + return !status; +} + /*********************************************************************** * NtUserSetWinEventHook (win32u.@) */ diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 9258b6b6377..d97688d7c8c 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -143,6 +143,7 @@ static void * const syscalls[] = NtUserSetWinEventHook, NtUserSetWindowsHookEx, NtUserUnhookWinEvent, + NtUserUnhookWindowsHookEx, }; static BYTE arguments[ARRAY_SIZE(syscalls)]; diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 0088d21eda5..20faca70c5e 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1285,7 +1285,7 @@ @ stub NtUserTranslateMessage @ stub NtUserUndelegateInput @ stdcall -syscall NtUserUnhookWinEvent(long) -@ stub NtUserUnhookWindowsHookEx +@ stdcall -syscall NtUserUnhookWindowsHookEx(long) @ stub NtUserUnloadKeyboardLayout @ stub NtUserUnlockWindowStation @ stub NtUserUnregisterClass diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 6c70d95f263..47e95a98a4b 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -129,6 +129,7 @@ SYSCALL_ENTRY( NtUserSetThreadDesktop ) \ SYSCALL_ENTRY( NtUserSetWinEventHook ) \ SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \ - SYSCALL_ENTRY( NtUserUnhookWinEvent ) + SYSCALL_ENTRY( NtUserUnhookWinEvent ) \ + SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) #endif /* __WOW64WIN_SYSCALL_H */ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index b78ae290049..cd4dc32d407 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -408,3 +408,10 @@ NTSTATUS WINAPI wow64_NtUserSetWindowsHookEx( UINT *args ) tid, id, proc, ansi ); return HandleToUlong( ret ); } + +NTSTATUS WINAPI wow64_NtUserUnhookWindowsHookEx( UINT *args ) +{ + HHOOK handle = get_handle( &args ); + + return NtUserUnhookWindowsHookEx( handle ); +} diff --git a/include/ntuser.h b/include/ntuser.h index a591363f77e..14ff5d861d0 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -204,6 +204,7 @@ BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID pt INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state, WCHAR *str, int size, UINT flags, HKL layout ); BOOL WINAPI NtUserUnhookWinEvent( HWINEVENTHOOK hEventHook ); +BOOL WINAPI NtUserUnhookWindowsHookEx( HHOOK handle ); BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id ); WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout );