Jacek Caban : win32u: Move NtUserUnhookWinEvent implementation from user32.

Alexandre Julliard julliard at winehq.org
Wed Feb 16 15:30:25 CST 2022


Module: wine
Branch: master
Commit: 0e37c674881cf43c0a87bbfe3d3cf5925aed730d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0e37c674881cf43c0a87bbfe3d3cf5925aed730d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb 16 12:29:43 2022 +0100

win32u: Move NtUserUnhookWinEvent implementation from user32.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/hook.c      | 28 ----------------------------
 dlls/user32/user32.spec |  2 +-
 dlls/win32u/Makefile.in |  1 +
 dlls/win32u/hook.c      | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/win32u/syscall.c   |  1 +
 dlls/win32u/win32u.spec |  2 +-
 dlls/wow64win/syscall.h |  3 ++-
 dlls/wow64win/user.c    |  7 +++++++
 include/ntuser.h        |  1 +
 9 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c
index 94a31239c24..26bde944175 100644
--- a/dlls/user32/hook.c
+++ b/dlls/user32/hook.c
@@ -766,34 +766,6 @@ HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max,
     return handle;
 }
 
-
-/***********************************************************************
- *           UnhookWinEvent                             [USER32.@]
- *
- * Remove an event hook for a set of events.
- *
- * PARAMS
- *  hEventHook [I] Event hook to remove
- *
- * RETURNS
- *  Success: TRUE. The event hook has been removed.
- *  Failure: FALSE, if hEventHook is invalid.
- */
-BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hEventHook)
-{
-    BOOL ret;
-
-    SERVER_START_REQ( remove_hook )
-    {
-        req->handle = wine_server_user_handle( hEventHook );
-        req->id     = WH_WINEVENT;
-        ret = !wine_server_call_err( req );
-        if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
-    }
-    SERVER_END_REQ;
-    return ret;
-}
-
 static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object_id,
                                    LONG child_id, struct hook_info *info)
 {
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index aec29dfa4cf..112b79049ce 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -770,7 +770,7 @@
 @ stdcall TranslateMDISysAccel(long ptr)
 @ stdcall TranslateMessage(ptr)
 # @ stub TranslateMessageEx
-@ stdcall UnhookWinEvent(long)
+@ stdcall UnhookWinEvent(long) NtUserUnhookWinEvent
 @ stdcall UnhookWindowsHook(long ptr)
 @ stdcall UnhookWindowsHookEx(long)
 @ stdcall UnionRect(ptr ptr ptr)
diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in
index 76fd4396c7d..68849a802ec 100644
--- a/dlls/win32u/Makefile.in
+++ b/dlls/win32u/Makefile.in
@@ -28,6 +28,7 @@ C_SRCS = \
 	font.c \
 	freetype.c \
 	gdiobj.c \
+	hook.c \
 	input.c \
 	main.c \
 	mapping.c \
diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c
new file mode 100644
index 00000000000..02520a025f8
--- /dev/null
+++ b/dlls/win32u/hook.c
@@ -0,0 +1,49 @@
+/*
+ * Windows hook functions
+ *
+ * Copyright 2002 Alexandre Julliard
+ * Copyright 2005 Dmitry Timoshkov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if 0
+#pragma makedep unix
+#endif
+
+#include "win32u_private.h"
+#include "ntuser_private.h"
+#include "wine/server.h"
+
+#define WH_WINEVENT (WH_MAXHOOK+1)
+
+
+/***********************************************************************
+ *           NtUserUnhookWinEvent   (win32u.@)
+ */
+BOOL WINAPI NtUserUnhookWinEvent( HWINEVENTHOOK handle )
+{
+    BOOL ret;
+
+    SERVER_START_REQ( remove_hook )
+    {
+        req->handle = wine_server_user_handle( handle );
+        req->id     = WH_WINEVENT;
+        ret = !wine_server_call_err( req );
+        if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
+    }
+    SERVER_END_REQ;
+    return ret;
+}
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index 69d0e1ff66f..d698dc31743 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -139,6 +139,7 @@ static void * const syscalls[] =
     NtUserSetProcessWindowStation,
     NtUserSetProp,
     NtUserSetThreadDesktop,
+    NtUserUnhookWinEvent,
 };
 
 static BYTE arguments[ARRAY_SIZE(syscalls)];
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index abdb11cc266..42bfc1bb4c4 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1284,7 +1284,7 @@
 @ stub NtUserTranslateAccelerator
 @ stub NtUserTranslateMessage
 @ stub NtUserUndelegateInput
-@ stub NtUserUnhookWinEvent
+@ stdcall -syscall NtUserUnhookWinEvent(long)
 @ stub NtUserUnhookWindowsHookEx
 @ stub NtUserUnloadKeyboardLayout
 @ stub NtUserUnlockWindowStation
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index 54919f7b3fd..3b852147dc1 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -125,6 +125,7 @@
     SYSCALL_ENTRY( NtUserSetProcessDpiAwarenessContext ) \
     SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
     SYSCALL_ENTRY( NtUserSetProp ) \
-    SYSCALL_ENTRY( NtUserSetThreadDesktop )
+    SYSCALL_ENTRY( NtUserSetThreadDesktop ) \
+    SYSCALL_ENTRY( NtUserUnhookWinEvent )
 
 #endif /* __WOW64WIN_SYSCALL_H */
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index 02623d089a4..c55af5233a8 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -355,3 +355,10 @@ NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args )
 {
     return NtUserGetDoubleClickTime();
 }
+
+NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args )
+{
+    HWINEVENTHOOK handle = get_handle( &args );
+
+    return NtUserUnhookWinEvent( handle );
+}
diff --git a/include/ntuser.h b/include/ntuser.h
index 9ed3385e17e..499c9bf809e 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -184,6 +184,7 @@ BOOL    WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UIN
 BOOL    WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi );
 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 NtUserUnregisterHotKey( HWND hwnd, INT id );
 WORD    WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout );
 




More information about the wine-cvs mailing list