2 * Windows hook functions
4 * Copyright 2002 Alexandre Julliard
5 * Copyright 2005 Dmitry Timoshkov
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Status of the various hooks:
24 * WH_JOURNALRECORD Partially implemented
25 * WH_JOURNALPLAYBACK Partially implemented
27 * WH_GETMESSAGE OK (FIXME: A/W mapping?)
28 * WH_CALLWNDPROC OK (FIXME: A/W mapping?)
36 * HCBT_CLICKSKIPPED OK
42 * WH_HARDWARE Not supported in Win32
43 * WH_DEBUG Not implemented
45 * HSHELL_WINDOWCREATED OK
46 * HSHELL_WINDOWDESTROYED OK
47 * HSHELL_ACTIVATESHELLWINDOW Not implemented
48 * HSHELL_WINDOWACTIVATED Not implemented
49 * HSHELL_GETMINRECT Not implemented
50 * HSHELL_REDRAW Not implemented
51 * HSHELL_TASKMAN Not implemented
52 * HSHELL_LANGUAGE Not implemented
53 * HSHELL_SYSMENU Not implemented
54 * HSHELL_ENDTASK Not implemented
55 * HSHELL_ACCESSIBILITYSTATE Not implemented
56 * HSHELL_APPCOMMAND Not implemented
57 * HSHELL_WINDOWREPLACED Not implemented
58 * HSHELL_WINDOWREPLACING Not implemented
59 * WH_FOREGROUNDIDLE Not implemented
60 * WH_CALLWNDPROCRET OK (FIXME: A/W mapping?)
61 * WH_KEYBOARD_LL Implemented but should use SendMessage instead
62 * WH_MOUSE_LL Implemented but should use SendMessage instead
66 #include "wine/port.h"
76 #include "user_private.h"
77 #include "wine/server.h"
78 #include "wine/unicode.h"
79 #include "wine/debug.h"
82 WINE_DEFAULT_DEBUG_CHANNEL(hook
);
83 WINE_DECLARE_DEBUG_CHANNEL(relay
);
90 WCHAR module
[MAX_PATH
];
93 #define WH_WINEVENT (WH_MAXHOOK+1)
95 static const char * const hook_names
[WH_WINEVENT
- WH_MINHOOK
+ 1] =
117 /***********************************************************************
118 * get_ll_hook_timeout
121 static UINT
get_ll_hook_timeout(void)
123 /* FIXME: should retrieve LowLevelHooksTimeout in HKEY_CURRENT_USER\Control Panel\Desktop */
128 /***********************************************************************
131 * Implementation of SetWindowsHookExA and SetWindowsHookExW.
133 static HHOOK
set_windows_hook( INT id
, HOOKPROC proc
, HINSTANCE inst
, DWORD tid
, BOOL unicode
)
136 WCHAR module
[MAX_PATH
];
141 SetLastError( ERROR_INVALID_FILTER_PROC
);
147 SetLastError( ERROR_INVALID_FILTER_PROC
);
151 /* FIXME: what if the tid belongs to another process? */
152 if (tid
) /* thread-local hook */
154 if (id
== WH_JOURNALRECORD
||
155 id
== WH_JOURNALPLAYBACK
||
156 id
== WH_KEYBOARD_LL
||
158 id
== WH_SYSMSGFILTER
)
160 /* these can only be global */
161 SetLastError( ERROR_INVALID_PARAMETER
);
166 else /* system-global hook */
168 if (id
== WH_KEYBOARD_LL
|| id
== WH_MOUSE_LL
) inst
= 0;
169 else if (!inst
|| !(len
= GetModuleFileNameW( inst
, module
, MAX_PATH
)) || len
>= MAX_PATH
)
171 SetLastError( ERROR_HOOK_NEEDS_HMOD
);
176 SERVER_START_REQ( set_hook
)
181 req
->event_min
= EVENT_MIN
;
182 req
->event_max
= EVENT_MAX
;
183 req
->flags
= WINEVENT_INCONTEXT
;
184 req
->unicode
= unicode
;
185 if (inst
) /* make proc relative to the module base */
187 req
->proc
= (void *)((char *)proc
- (char *)inst
);
188 wine_server_add_data( req
, module
, strlenW(module
) * sizeof(WCHAR
) );
190 else req
->proc
= proc
;
192 if (!wine_server_call_err( req
))
194 handle
= reply
->handle
;
195 get_user_thread_info()->active_hooks
= reply
->active_hooks
;
200 TRACE( "%s %p %lx -> %p\n", hook_names
[id
-WH_MINHOOK
], proc
, tid
, handle
);
205 /***********************************************************************
208 static LRESULT
call_hook_AtoW( HOOKPROC proc
, INT id
, INT code
, WPARAM wparam
, LPARAM lparam
)
211 UNICODE_STRING usBuffer
;
212 if (id
!= WH_CBT
|| code
!= HCBT_CREATEWND
) ret
= proc( code
, wparam
, lparam
);
215 CBT_CREATEWNDA
*cbtcwA
= (CBT_CREATEWNDA
*)lparam
;
216 CBT_CREATEWNDW cbtcwW
;
220 cbtcwW
.hwndInsertAfter
= cbtcwA
->hwndInsertAfter
;
221 csW
= *(CREATESTRUCTW
*)cbtcwA
->lpcs
;
223 if (HIWORD(cbtcwA
->lpcs
->lpszName
))
225 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,cbtcwA
->lpcs
->lpszName
);
226 csW
.lpszName
= usBuffer
.Buffer
;
228 if (HIWORD(cbtcwA
->lpcs
->lpszClass
))
230 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,cbtcwA
->lpcs
->lpszClass
);
231 csW
.lpszClass
= usBuffer
.Buffer
;
233 ret
= proc( code
, wparam
, (LPARAM
)&cbtcwW
);
234 cbtcwA
->hwndInsertAfter
= cbtcwW
.hwndInsertAfter
;
235 if (HIWORD(csW
.lpszName
)) HeapFree( GetProcessHeap(), 0, (LPWSTR
)csW
.lpszName
);
236 if (HIWORD(csW
.lpszClass
)) HeapFree( GetProcessHeap(), 0, (LPWSTR
)csW
.lpszClass
);
242 /***********************************************************************
245 static LRESULT
call_hook_WtoA( HOOKPROC proc
, INT id
, INT code
, WPARAM wparam
, LPARAM lparam
)
249 if (id
!= WH_CBT
|| code
!= HCBT_CREATEWND
) ret
= proc( code
, wparam
, lparam
);
252 CBT_CREATEWNDW
*cbtcwW
= (CBT_CREATEWNDW
*)lparam
;
253 CBT_CREATEWNDA cbtcwA
;
258 cbtcwA
.hwndInsertAfter
= cbtcwW
->hwndInsertAfter
;
259 csA
= *(CREATESTRUCTA
*)cbtcwW
->lpcs
;
261 if (HIWORD(cbtcwW
->lpcs
->lpszName
)) {
262 len
= WideCharToMultiByte( CP_ACP
, 0, cbtcwW
->lpcs
->lpszName
, -1, NULL
, 0, NULL
, NULL
);
263 csA
.lpszName
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(CHAR
) );
264 WideCharToMultiByte( CP_ACP
, 0, cbtcwW
->lpcs
->lpszName
, -1, (LPSTR
)csA
.lpszName
, len
, NULL
, NULL
);
267 if (HIWORD(cbtcwW
->lpcs
->lpszClass
)) {
268 len
= WideCharToMultiByte( CP_ACP
, 0, cbtcwW
->lpcs
->lpszClass
, -1, NULL
, 0, NULL
, NULL
);
269 csA
.lpszClass
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(CHAR
) );
270 WideCharToMultiByte( CP_ACP
, 0, cbtcwW
->lpcs
->lpszClass
, -1, (LPSTR
)csA
.lpszClass
, len
, NULL
, NULL
);
273 ret
= proc( code
, wparam
, (LPARAM
)&cbtcwA
);
274 cbtcwW
->hwndInsertAfter
= cbtcwA
.hwndInsertAfter
;
275 if (HIWORD(csA
.lpszName
)) HeapFree( GetProcessHeap(), 0, (LPSTR
)csA
.lpszName
);
276 if (HIWORD(csA
.lpszClass
)) HeapFree( GetProcessHeap(), 0, (LPSTR
)csA
.lpszClass
);
282 /***********************************************************************
285 static LRESULT
call_hook( HOOKPROC proc
, INT id
, INT code
, WPARAM wparam
, LPARAM lparam
,
286 BOOL prev_unicode
, BOOL next_unicode
)
291 DPRINTF( "%04lx:Call hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx)\n",
292 GetCurrentThreadId(), proc
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
);
294 if (!prev_unicode
== !next_unicode
) ret
= proc( code
, wparam
, lparam
);
295 else if (prev_unicode
) ret
= call_hook_WtoA( proc
, id
, code
, wparam
, lparam
);
296 else ret
= call_hook_AtoW( proc
, id
, code
, wparam
, lparam
);
299 DPRINTF( "%04lx:Ret hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx) retval=%08lx\n",
300 GetCurrentThreadId(), proc
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
, ret
);
306 /***********************************************************************
309 * Retrieve the hook procedure real value for a module-relative proc
311 static void *get_hook_proc( void *proc
, const WCHAR
*module
)
315 if (!(mod
= GetModuleHandleW(module
)))
317 TRACE( "loading %s\n", debugstr_w(module
) );
318 /* FIXME: the library will never be freed */
319 if (!(mod
= LoadLibraryW(module
))) return NULL
;
321 return (char *)mod
+ (ULONG_PTR
)proc
;
325 /***********************************************************************
328 LRESULT
HOOK_CallHooks( INT id
, INT code
, WPARAM wparam
, LPARAM lparam
, BOOL unicode
)
330 struct user_thread_info
*thread_info
= get_user_thread_info();
331 HOOKPROC proc
= NULL
;
333 DWORD pid
= 0, tid
= 0;
334 WCHAR module
[MAX_PATH
];
335 BOOL unicode_hook
= FALSE
;
340 if (!HOOK_IsHooked( id
))
342 TRACE( "skipping hook %s mask %x\n", hook_names
[id
-WH_MINHOOK
], thread_info
->active_hooks
);
346 SERVER_START_REQ( start_hook_chain
)
349 req
->event
= EVENT_MIN
;
350 wine_server_set_reply( req
, module
, sizeof(module
)-sizeof(WCHAR
) );
351 if (!wine_server_call( req
))
353 module
[wine_server_reply_size(req
) / sizeof(WCHAR
)] = 0;
354 handle
= reply
->handle
;
358 unicode_hook
= reply
->unicode
;
359 thread_info
->active_hooks
= reply
->active_hooks
;
366 TRACE( "calling hook in thread %04lx %s code %x wp %x lp %lx\n",
367 tid
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
);
372 MSG_SendInternalMessageTimeout( pid
, tid
, WM_WINE_KEYBOARD_LL_HOOK
, wparam
, lparam
,
373 SMTO_ABORTIFHUNG
, get_ll_hook_timeout(), &ret
);
376 MSG_SendInternalMessageTimeout( pid
, tid
, WM_WINE_MOUSE_LL_HOOK
, wparam
, lparam
,
377 SMTO_ABORTIFHUNG
, get_ll_hook_timeout(), &ret
);
380 ERR("Unknown hook id %d\n", id
);
387 TRACE( "calling hook %p %s code %x wp %x lp %lx module %s\n",
388 proc
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
, debugstr_w(module
) );
390 if (!module
[0] || (proc
= get_hook_proc( proc
, module
)) != NULL
)
392 HHOOK prev
= thread_info
->hook
;
393 thread_info
->hook
= handle
;
394 ret
= call_hook( proc
, id
, code
, wparam
, lparam
, unicode
, unicode_hook
);
395 thread_info
->hook
= prev
;
401 SERVER_START_REQ( finish_hook_chain
)
404 wine_server_call( req
);
411 /***********************************************************************
414 BOOL
HOOK_IsHooked( INT id
)
416 struct user_thread_info
*thread_info
= get_user_thread_info();
418 if (!thread_info
->active_hooks
) return TRUE
;
419 return (thread_info
->active_hooks
& (1 << (id
- WH_MINHOOK
))) != 0;
423 /***********************************************************************
424 * SetWindowsHookA (USER32.@)
426 HHOOK WINAPI
SetWindowsHookA( INT id
, HOOKPROC proc
)
428 return SetWindowsHookExA( id
, proc
, 0, GetCurrentThreadId() );
432 /***********************************************************************
433 * SetWindowsHookW (USER32.@)
435 HHOOK WINAPI
SetWindowsHookW( INT id
, HOOKPROC proc
)
437 return SetWindowsHookExW( id
, proc
, 0, GetCurrentThreadId() );
441 /***********************************************************************
442 * SetWindowsHookExA (USER32.@)
444 HHOOK WINAPI
SetWindowsHookExA( INT id
, HOOKPROC proc
, HINSTANCE inst
, DWORD tid
)
446 return set_windows_hook( id
, proc
, inst
, tid
, FALSE
);
449 /***********************************************************************
450 * SetWindowsHookExW (USER32.@)
452 HHOOK WINAPI
SetWindowsHookExW( INT id
, HOOKPROC proc
, HINSTANCE inst
, DWORD tid
)
454 return set_windows_hook( id
, proc
, inst
, tid
, TRUE
);
458 /***********************************************************************
459 * UnhookWindowsHook (USER32.@)
461 BOOL WINAPI
UnhookWindowsHook( INT id
, HOOKPROC proc
)
465 TRACE( "%s %p\n", hook_names
[id
-WH_MINHOOK
], proc
);
467 SERVER_START_REQ( remove_hook
)
472 ret
= !wine_server_call_err( req
);
473 if (ret
) get_user_thread_info()->active_hooks
= reply
->active_hooks
;
476 if (!ret
&& GetLastError() == ERROR_INVALID_HANDLE
) SetLastError( ERROR_INVALID_HOOK_HANDLE
);
482 /***********************************************************************
483 * UnhookWindowsHookEx (USER32.@)
485 BOOL WINAPI
UnhookWindowsHookEx( HHOOK hhook
)
489 TRACE( "%p\n", hhook
);
491 SERVER_START_REQ( remove_hook
)
495 ret
= !wine_server_call_err( req
);
496 if (ret
) get_user_thread_info()->active_hooks
= reply
->active_hooks
;
499 if (!ret
&& GetLastError() == ERROR_INVALID_HANDLE
) SetLastError( ERROR_INVALID_HOOK_HANDLE
);
504 /***********************************************************************
505 * CallNextHookEx (USER32.@)
507 LRESULT WINAPI
CallNextHookEx( HHOOK hhook
, INT code
, WPARAM wparam
, LPARAM lparam
)
509 struct user_thread_info
*thread_info
= get_user_thread_info();
510 HOOKPROC proc
= NULL
;
511 WCHAR module
[MAX_PATH
];
513 DWORD pid
= 0, tid
= 0;
515 BOOL prev_unicode
= FALSE
, next_unicode
= FALSE
;
518 SERVER_START_REQ( get_next_hook
)
520 req
->handle
= thread_info
->hook
;
521 req
->event
= EVENT_MIN
;
522 wine_server_set_reply( req
, module
, sizeof(module
)-sizeof(WCHAR
) );
523 if (!wine_server_call_err( req
))
525 module
[wine_server_reply_size(req
) / sizeof(WCHAR
)] = 0;
526 handle
= reply
->next
;
531 prev_unicode
= reply
->prev_unicode
;
532 next_unicode
= reply
->next_unicode
;
539 TRACE( "calling hook in thread %04lx %s code %x wp %x lp %lx\n",
540 tid
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
);
545 MSG_SendInternalMessageTimeout( pid
, tid
, WM_WINE_KEYBOARD_LL_HOOK
, wparam
, lparam
,
546 SMTO_ABORTIFHUNG
, get_ll_hook_timeout(), &ret
);
549 MSG_SendInternalMessageTimeout( pid
, tid
, WM_WINE_MOUSE_LL_HOOK
, wparam
, lparam
,
550 SMTO_ABORTIFHUNG
, get_ll_hook_timeout(), &ret
);
553 ERR("Unknown hook id %d\n", id
);
560 TRACE( "calling hook %p %s code %x wp %x lp %lx module %s\n",
561 proc
, hook_names
[id
-WH_MINHOOK
], code
, wparam
, lparam
, debugstr_w(module
) );
563 if (!module
[0] || (proc
= get_hook_proc( proc
, module
)) != NULL
)
565 HHOOK prev
= thread_info
->hook
;
566 thread_info
->hook
= handle
;
567 ret
= call_hook( proc
, id
, code
, wparam
, lparam
, prev_unicode
, next_unicode
);
568 thread_info
->hook
= prev
;
575 /***********************************************************************
576 * CallMsgFilterA (USER32.@)
578 BOOL WINAPI
CallMsgFilterA( LPMSG msg
, INT code
)
580 if (HOOK_CallHooks( WH_SYSMSGFILTER
, code
, 0, (LPARAM
)msg
, FALSE
)) return TRUE
;
581 return HOOK_CallHooks( WH_MSGFILTER
, code
, 0, (LPARAM
)msg
, FALSE
);
585 /***********************************************************************
586 * CallMsgFilterW (USER32.@)
588 BOOL WINAPI
CallMsgFilterW( LPMSG msg
, INT code
)
590 if (HOOK_CallHooks( WH_SYSMSGFILTER
, code
, 0, (LPARAM
)msg
, TRUE
)) return TRUE
;
591 return HOOK_CallHooks( WH_MSGFILTER
, code
, 0, (LPARAM
)msg
, TRUE
);
595 /***********************************************************************
596 * SetWinEventHook [USER32.@]
598 * Set up an event hook for a set of events.
601 * event_min [I] Lowest event handled by pfnProc
602 * event_max [I] Highest event handled by pfnProc
603 * inst [I] DLL containing pfnProc
604 * proc [I] Callback event hook function
605 * pid [I] Process to get events from, or 0 for all processes
606 * tid [I] Thread to get events from, or 0 for all threads
607 * flags [I] Flags indicating the status of pfnProc
610 * Success: A handle representing the hook.
611 * Failure: A NULL handle.
613 HWINEVENTHOOK WINAPI
SetWinEventHook(DWORD event_min
, DWORD event_max
,
614 HMODULE inst
, WINEVENTPROC proc
,
615 DWORD pid
, DWORD tid
, DWORD flags
)
617 HWINEVENTHOOK handle
= 0;
618 WCHAR module
[MAX_PATH
];
621 TRACE("%ld,%ld,%p,%p,%08lx,%04lx,%08lx\n", event_min
, event_max
, inst
,
622 proc
, pid
, tid
, flags
);
626 if (!(len
= GetModuleFileNameW(inst
, module
, MAX_PATH
)) || len
>= MAX_PATH
)
630 if ((flags
& WINEVENT_INCONTEXT
) && !inst
)
632 SetLastError(ERROR_HOOK_NEEDS_HMOD
);
636 if (event_min
> event_max
)
638 SetLastError(ERROR_INVALID_HOOK_FILTER
);
642 /* FIXME: what if the tid or pid belongs to another process? */
643 if (tid
) /* thread-local hook */
646 SERVER_START_REQ( set_hook
)
648 req
->id
= WH_WINEVENT
;
651 req
->event_min
= event_min
;
652 req
->event_max
= event_max
;
655 if (inst
) /* make proc relative to the module base */
657 req
->proc
= (void *)((char *)proc
- (char *)inst
);
658 wine_server_add_data( req
, module
, strlenW(module
) * sizeof(WCHAR
) );
660 else req
->proc
= proc
;
662 if (!wine_server_call_err( req
))
664 handle
= reply
->handle
;
665 get_user_thread_info()->active_hooks
= reply
->active_hooks
;
670 TRACE("-> %p\n", handle
);
675 /***********************************************************************
676 * UnhookWinEvent [USER32.@]
678 * Remove an event hook for a set of events.
681 * hEventHook [I] Event hook to remove
684 * Success: TRUE. The event hook has been removed.
685 * Failure: FALSE, if hEventHook is invalid.
687 BOOL WINAPI
UnhookWinEvent(HWINEVENTHOOK hEventHook
)
691 TRACE( "%p\n", hEventHook
);
693 SERVER_START_REQ( remove_hook
)
695 req
->handle
= hEventHook
;
696 req
->id
= WH_WINEVENT
;
697 ret
= !wine_server_call_err( req
);
698 if (ret
) get_user_thread_info()->active_hooks
= reply
->active_hooks
;
704 inline static BOOL
find_first_hook(DWORD id
, DWORD event
, HWND hwnd
, LONG object_id
,
705 LONG child_id
, struct hook_info
*info
)
707 struct user_thread_info
*thread_info
= get_user_thread_info();
710 if (!HOOK_IsHooked( id
))
712 TRACE( "skipping hook %s mask %x\n", hook_names
[id
-WH_MINHOOK
], thread_info
->active_hooks
);
716 SERVER_START_REQ( start_hook_chain
)
721 req
->object_id
= object_id
;
722 req
->child_id
= child_id
;
723 wine_server_set_reply( req
, info
->module
, sizeof(info
->module
)-sizeof(WCHAR
) );
724 ret
= !wine_server_call( req
);
727 info
->module
[wine_server_reply_size(req
) / sizeof(WCHAR
)] = 0;
728 info
->handle
= reply
->handle
;
729 info
->proc
= reply
->proc
;
730 info
->tid
= reply
->tid
;
731 thread_info
->active_hooks
= reply
->active_hooks
;
735 return ret
&& (info
->tid
|| info
->proc
);
738 inline static BOOL
find_next_hook(DWORD event
, HWND hwnd
, LONG object_id
,
739 LONG child_id
, struct hook_info
*info
)
743 SERVER_START_REQ( get_next_hook
)
745 req
->handle
= info
->handle
;
748 req
->object_id
= object_id
;
749 req
->child_id
= child_id
;
750 wine_server_set_reply( req
, info
->module
, sizeof(info
->module
)-sizeof(WCHAR
) );
751 ret
= !wine_server_call( req
);
754 info
->module
[wine_server_reply_size(req
) / sizeof(WCHAR
)] = 0;
755 info
->handle
= reply
->next
;
756 info
->proc
= reply
->proc
;
757 info
->tid
= reply
->tid
;
764 inline static void find_hook_close(DWORD id
)
766 SERVER_START_REQ( finish_hook_chain
)
769 wine_server_call( req
);
774 /***********************************************************************
775 * NotifyWinEvent [USER32.@]
777 * Inform the OS that an event has occurred.
780 * event [I] Id of the event
781 * hwnd [I] Window holding the object that created the event
782 * object_id [I] Type of object that created the event
783 * child_id [I] Child object of nId, or CHILDID_SELF.
788 void WINAPI
NotifyWinEvent(DWORD event
, HWND hwnd
, LONG object_id
, LONG child_id
)
790 struct hook_info info
;
792 TRACE("%04lx,%p,%ld,%ld\n", event
, hwnd
, object_id
, child_id
);
796 SetLastError(ERROR_INVALID_WINDOW_HANDLE
);
803 if (event
& 0x80000000)
805 /* FIXME: on 64-bit platforms we need to invent some other way for
806 * passing parameters, nId and nChildId can't hold full [W|L]PARAM.
807 * struct call_hook *hook = (LRESULT *)hWnd;
808 * wparam = hook->wparam;
809 * lparam = hook->lparam;
811 LRESULT
*ret
= (LRESULT
*)hwnd
;
812 INT id
, code
, unicode
;
814 id
= (dwEvent
& 0x7fff0000) >> 16;
815 code
= event
& 0x7fff;
816 unicode
= event
& 0x8000;
817 *ret
= HOOK_CallHooks(id
, code
, object_id
, child_id
, unicode
);
822 if (!find_first_hook(WH_WINEVENT
, event
, hwnd
, object_id
, child_id
, &info
)) return;
828 TRACE( "calling WH_WINEVENT hook %p event %lx hwnd %p %lx %lx module %s\n",
829 info
.proc
, event
, hwnd
, object_id
, child_id
, debugstr_w(info
.module
) );
831 if (!info
.module
[0] || (info
.proc
= get_hook_proc( info
.proc
, info
.module
)) != NULL
)
834 DPRINTF( "%04lx:Call winevent hook proc %p (hhook=%p,event=%lx,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04lx,time=%lx)\n",
835 GetCurrentThreadId(), info
.proc
, info
.handle
, event
, hwnd
, object_id
,
836 child_id
, GetCurrentThreadId(), GetCurrentTime());
838 info
.proc(info
.handle
, event
, hwnd
, object_id
, child_id
,
839 GetCurrentThreadId(), GetCurrentTime());
842 DPRINTF( "%04lx:Ret winevent hook proc %p (hhook=%p,event=%lx,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04lx,time=%lx)\n",
843 GetCurrentThreadId(), info
.proc
, info
.handle
, event
, hwnd
, object_id
,
844 child_id
, GetCurrentThreadId(), GetCurrentTime());
850 while (find_next_hook(event
, hwnd
, object_id
, child_id
, &info
));
852 find_hook_close(WH_WINEVENT
);
856 /***********************************************************************
857 * IsWinEventHookInstalled [USER32.@]
859 * Determine if an event hook is installed for an event.
862 * dwEvent [I] Id of the event
865 * TRUE, If there are any hooks installed for the event.
871 BOOL WINAPI
IsWinEventHookInstalled(DWORD dwEvent
)
873 FIXME("(%ld)-stub!\n", dwEvent
);