win32u: Move NtUserUnhookWinEvent implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-02-16 12:29:43 +01:00 committed by Alexandre Julliard
parent 3e4f4c020a
commit 0e37c67488
9 changed files with 63 additions and 31 deletions

View File

@ -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)
{

View File

@ -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)

View File

@ -28,6 +28,7 @@ C_SRCS = \
font.c \
freetype.c \
gdiobj.c \
hook.c \
input.c \
main.c \
mapping.c \

49
dlls/win32u/hook.c Normal file
View File

@ -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;
}

View File

@ -139,6 +139,7 @@ static void * const syscalls[] =
NtUserSetProcessWindowStation,
NtUserSetProp,
NtUserSetThreadDesktop,
NtUserUnhookWinEvent,
};
static BYTE arguments[ARRAY_SIZE(syscalls)];

View File

@ -1284,7 +1284,7 @@
@ stub NtUserTranslateAccelerator
@ stub NtUserTranslateMessage
@ stub NtUserUndelegateInput
@ stub NtUserUnhookWinEvent
@ stdcall -syscall NtUserUnhookWinEvent(long)
@ stub NtUserUnhookWindowsHookEx
@ stub NtUserUnloadKeyboardLayout
@ stub NtUserUnlockWindowStation

View File

@ -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 */

View File

@ -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 );
}

View File

@ -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 );