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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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);
91 BOOL prev_unicode, next_unicode;
92 WCHAR module[MAX_PATH];
95 #define WH_WINEVENT (WH_MAXHOOK+1)
97 static const char * const hook_names[WH_WINEVENT - WH_MINHOOK + 1] =
101 "WH_JOURNALPLAYBACK",
119 /***********************************************************************
120 * get_ll_hook_timeout
123 static UINT get_ll_hook_timeout(void)
125 /* FIXME: should retrieve LowLevelHooksTimeout in HKEY_CURRENT_USER\Control Panel\Desktop */
130 /***********************************************************************
133 * Implementation of SetWindowsHookExA and SetWindowsHookExW.
135 static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid, BOOL unicode )
138 WCHAR module[MAX_PATH];
143 SetLastError( ERROR_INVALID_FILTER_PROC );
147 if (tid) /* thread-local hook */
149 if (id == WH_JOURNALRECORD ||
150 id == WH_JOURNALPLAYBACK ||
151 id == WH_KEYBOARD_LL ||
153 id == WH_SYSMSGFILTER)
155 /* these can only be global */
156 SetLastError( ERROR_INVALID_PARAMETER );
160 else /* system-global hook */
162 if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;
165 SetLastError( ERROR_HOOK_NEEDS_HMOD );
170 if (inst && (!(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH))
172 SetLastError( ERROR_INVALID_PARAMETER );
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 = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) );
188 wine_server_add_data( req, module, strlenW(module) * sizeof(WCHAR) );
190 else req->proc = wine_server_client_ptr( proc );
192 if (!wine_server_call_err( req ))
194 handle = wine_server_ptr_handle( reply->handle );
195 get_user_thread_info()->active_hooks = reply->active_hooks;
200 TRACE( "%s %p %x -> %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;
219 LPWSTR classW = NULL;
222 cbtcwW.hwndInsertAfter = cbtcwA->hwndInsertAfter;
223 csW = *(CREATESTRUCTW *)cbtcwA->lpcs;
225 if (HIWORD(cbtcwA->lpcs->lpszName))
227 RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
228 csW.lpszName = nameW = usBuffer.Buffer;
230 if (HIWORD(cbtcwA->lpcs->lpszClass))
232 RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszClass);
233 csW.lpszClass = classW = usBuffer.Buffer;
235 ret = proc( code, wparam, (LPARAM)&cbtcwW );
236 cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter;
237 HeapFree( GetProcessHeap(), 0, nameW );
238 HeapFree( GetProcessHeap(), 0, classW );
244 /***********************************************************************
247 static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam )
251 if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam );
254 CBT_CREATEWNDW *cbtcwW = (CBT_CREATEWNDW *)lparam;
255 CBT_CREATEWNDA cbtcwA;
262 cbtcwA.hwndInsertAfter = cbtcwW->hwndInsertAfter;
263 csA = *(CREATESTRUCTA *)cbtcwW->lpcs;
265 if (HIWORD(cbtcwW->lpcs->lpszName)) {
266 len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, NULL, 0, NULL, NULL );
267 nameA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
268 WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, nameA, len, NULL, NULL );
269 csA.lpszName = nameA;
272 if (HIWORD(cbtcwW->lpcs->lpszClass)) {
273 len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, NULL, 0, NULL, NULL );
274 classA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
275 WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, classA, len, NULL, NULL );
276 csA.lpszClass = classA;
279 ret = proc( code, wparam, (LPARAM)&cbtcwA );
280 cbtcwW->hwndInsertAfter = cbtcwA.hwndInsertAfter;
281 HeapFree( GetProcessHeap(), 0, nameA );
282 HeapFree( GetProcessHeap(), 0, classA );
288 /***********************************************************************
291 static LRESULT call_hook_proc( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam,
292 BOOL prev_unicode, BOOL next_unicode )
297 DPRINTF( "%04x:Call hook proc %p (id=%s,code=%x,wp=%08lx,lp=%08lx)\n",
298 GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam );
300 if (!prev_unicode == !next_unicode) ret = proc( code, wparam, lparam );
301 else if (prev_unicode) ret = call_hook_WtoA( proc, id, code, wparam, lparam );
302 else ret = call_hook_AtoW( proc, id, code, wparam, lparam );
305 DPRINTF( "%04x:Ret hook proc %p (id=%s,code=%x,wp=%08lx,lp=%08lx) retval=%08lx\n",
306 GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam, ret );
312 /***********************************************************************
315 * Retrieve the hook procedure real value for a module-relative proc
317 void *get_hook_proc( void *proc, const WCHAR *module )
321 if (!(mod = GetModuleHandleW(module)))
323 TRACE( "loading %s\n", debugstr_w(module) );
324 /* FIXME: the library will never be freed */
325 if (!(mod = LoadLibraryW(module))) return NULL;
327 return (char *)mod + (ULONG_PTR)proc;
330 /***********************************************************************
333 * Call hook either in current thread or send message to the destination
336 static LRESULT call_hook( struct hook_info *info, INT code, WPARAM wparam, LPARAM lparam )
342 struct hook_extra_info h_extra;
343 h_extra.handle = info->handle;
344 h_extra.lparam = lparam;
346 TRACE( "calling hook in thread %04x %s code %x wp %lx lp %lx\n",
347 info->tid, hook_names[info->id-WH_MINHOOK], code, wparam, lparam );
352 MSG_SendInternalMessageTimeout( info->pid, info->tid, WM_WINE_KEYBOARD_LL_HOOK,
353 wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG,
354 get_ll_hook_timeout(), &ret );
357 MSG_SendInternalMessageTimeout( info->pid, info->tid, WM_WINE_MOUSE_LL_HOOK,
358 wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG,
359 get_ll_hook_timeout(), &ret );
362 ERR("Unknown hook id %d\n", info->id);
369 TRACE( "calling hook %p %s code %x wp %lx lp %lx module %s\n",
370 info->proc, hook_names[info->id-WH_MINHOOK], code, wparam,
371 lparam, debugstr_w(info->module) );
373 if (!info->module[0] ||
374 (info->proc = get_hook_proc( info->proc, info->module )) != NULL)
376 struct user_thread_info *thread_info = get_user_thread_info();
377 HHOOK prev = thread_info->hook;
378 BOOL prev_unicode = thread_info->hook_unicode;
380 thread_info->hook = info->handle;
381 thread_info->hook_unicode = info->next_unicode;
382 ret = call_hook_proc( info->proc, info->id, code, wparam, lparam,
383 info->prev_unicode, info->next_unicode );
384 thread_info->hook = prev;
385 thread_info->hook_unicode = prev_unicode;
391 /***********************************************************************
394 LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode )
396 struct user_thread_info *thread_info = get_user_thread_info();
397 struct hook_info info;
402 if (!HOOK_IsHooked( id ))
404 TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], thread_info->active_hooks );
408 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
409 info.prev_unicode = unicode;
412 SERVER_START_REQ( start_hook_chain )
415 req->event = EVENT_MIN;
416 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
417 if (!wine_server_call( req ))
419 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
420 info.handle = wine_server_ptr_handle( reply->handle );
421 info.pid = reply->pid;
422 info.tid = reply->tid;
423 info.proc = wine_server_get_ptr( reply->proc );
424 info.next_unicode = reply->unicode;
425 thread_info->active_hooks = reply->active_hooks;
430 if (!info.tid && !info.proc) return 0;
431 ret = call_hook( &info, code, wparam, lparam );
433 SERVER_START_REQ( finish_hook_chain )
436 wine_server_call( req );
443 /***********************************************************************
446 BOOL HOOK_IsHooked( INT id )
448 struct user_thread_info *thread_info = get_user_thread_info();
450 if (!thread_info->active_hooks) return TRUE;
451 return (thread_info->active_hooks & (1 << (id - WH_MINHOOK))) != 0;
455 /***********************************************************************
456 * SetWindowsHookA (USER32.@)
458 HHOOK WINAPI SetWindowsHookA( INT id, HOOKPROC proc )
460 return SetWindowsHookExA( id, proc, 0, GetCurrentThreadId() );
464 /***********************************************************************
465 * SetWindowsHookW (USER32.@)
467 HHOOK WINAPI SetWindowsHookW( INT id, HOOKPROC proc )
469 return SetWindowsHookExW( id, proc, 0, GetCurrentThreadId() );
473 /***********************************************************************
474 * SetWindowsHookExA (USER32.@)
476 HHOOK WINAPI SetWindowsHookExA( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid )
478 return set_windows_hook( id, proc, inst, tid, FALSE );
481 /***********************************************************************
482 * SetWindowsHookExW (USER32.@)
484 HHOOK WINAPI SetWindowsHookExW( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid )
486 return set_windows_hook( id, proc, inst, tid, TRUE );
490 /***********************************************************************
491 * UnhookWindowsHook (USER32.@)
493 BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc )
497 TRACE( "%s %p\n", hook_names[id-WH_MINHOOK], proc );
499 SERVER_START_REQ( remove_hook )
503 req->proc = wine_server_client_ptr( proc );
504 ret = !wine_server_call_err( req );
505 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
508 if (!ret && GetLastError() == ERROR_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE );
514 /***********************************************************************
515 * UnhookWindowsHookEx (USER32.@)
517 BOOL WINAPI UnhookWindowsHookEx( HHOOK hhook )
521 SERVER_START_REQ( remove_hook )
523 req->handle = wine_server_user_handle( hhook );
525 ret = !wine_server_call_err( req );
526 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
529 if (!ret && GetLastError() == ERROR_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE );
534 /***********************************************************************
535 * CallNextHookEx (USER32.@)
537 LRESULT WINAPI CallNextHookEx( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam )
539 struct user_thread_info *thread_info = get_user_thread_info();
540 struct hook_info info;
542 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
544 SERVER_START_REQ( get_hook_info )
546 req->handle = wine_server_user_handle( thread_info->hook );
548 req->event = EVENT_MIN;
549 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
550 if (!wine_server_call_err( req ))
552 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
553 info.handle = wine_server_ptr_handle( reply->handle );
555 info.pid = reply->pid;
556 info.tid = reply->tid;
557 info.proc = wine_server_get_ptr( reply->proc );
558 info.next_unicode = reply->unicode;
563 info.prev_unicode = thread_info->hook_unicode;
564 return call_hook( &info, code, wparam, lparam );
568 LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam )
570 struct hook_info info;
572 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
574 SERVER_START_REQ( get_hook_info )
576 req->handle = wine_server_user_handle( hhook );
578 req->event = EVENT_MIN;
579 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
580 if (!wine_server_call_err( req ))
582 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
583 info.handle = wine_server_ptr_handle( reply->handle );
585 info.pid = reply->pid;
586 info.tid = reply->tid;
587 info.proc = wine_server_get_ptr( reply->proc );
588 info.next_unicode = reply->unicode;
593 info.prev_unicode = TRUE; /* assume Unicode for this function */
594 return call_hook( &info, code, wparam, lparam );
597 /***********************************************************************
598 * CallMsgFilterA (USER32.@)
600 BOOL WINAPI CallMsgFilterA( LPMSG msg, INT code )
602 if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg, FALSE )) return TRUE;
603 return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg, FALSE );
607 /***********************************************************************
608 * CallMsgFilterW (USER32.@)
610 BOOL WINAPI CallMsgFilterW( LPMSG msg, INT code )
612 if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg, TRUE )) return TRUE;
613 return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg, TRUE );
617 /***********************************************************************
618 * SetWinEventHook [USER32.@]
620 * Set up an event hook for a set of events.
623 * event_min [I] Lowest event handled by pfnProc
624 * event_max [I] Highest event handled by pfnProc
625 * inst [I] DLL containing pfnProc
626 * proc [I] Callback event hook function
627 * pid [I] Process to get events from, or 0 for all processes
628 * tid [I] Thread to get events from, or 0 for all threads
629 * flags [I] Flags indicating the status of pfnProc
632 * Success: A handle representing the hook.
633 * Failure: A NULL handle.
635 HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max,
636 HMODULE inst, WINEVENTPROC proc,
637 DWORD pid, DWORD tid, DWORD flags)
639 HWINEVENTHOOK handle = 0;
640 WCHAR module[MAX_PATH];
643 TRACE("%d,%d,%p,%p,%08x,%04x,%08x\n", event_min, event_max, inst,
644 proc, pid, tid, flags);
648 if (!(len = GetModuleFileNameW(inst, module, MAX_PATH)) || len >= MAX_PATH)
652 if ((flags & WINEVENT_INCONTEXT) && !inst)
654 SetLastError(ERROR_HOOK_NEEDS_HMOD);
658 if (event_min > event_max)
660 SetLastError(ERROR_INVALID_HOOK_FILTER);
664 /* FIXME: what if the tid or pid belongs to another process? */
665 if (tid) /* thread-local hook */
668 SERVER_START_REQ( set_hook )
670 req->id = WH_WINEVENT;
673 req->event_min = event_min;
674 req->event_max = event_max;
677 if (inst) /* make proc relative to the module base */
679 req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) );
680 wine_server_add_data( req, module, strlenW(module) * sizeof(WCHAR) );
682 else req->proc = wine_server_client_ptr( proc );
684 if (!wine_server_call_err( req ))
686 handle = wine_server_ptr_handle( reply->handle );
687 get_user_thread_info()->active_hooks = reply->active_hooks;
692 TRACE("-> %p\n", handle);
697 /***********************************************************************
698 * UnhookWinEvent [USER32.@]
700 * Remove an event hook for a set of events.
703 * hEventHook [I] Event hook to remove
706 * Success: TRUE. The event hook has been removed.
707 * Failure: FALSE, if hEventHook is invalid.
709 BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hEventHook)
713 SERVER_START_REQ( remove_hook )
715 req->handle = wine_server_user_handle( hEventHook );
716 req->id = WH_WINEVENT;
717 ret = !wine_server_call_err( req );
718 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
724 static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object_id,
725 LONG child_id, struct hook_info *info)
727 struct user_thread_info *thread_info = get_user_thread_info();
730 if (!HOOK_IsHooked( id ))
732 TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], thread_info->active_hooks );
736 SERVER_START_REQ( start_hook_chain )
740 req->window = wine_server_user_handle( hwnd );
741 req->object_id = object_id;
742 req->child_id = child_id;
743 wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
744 ret = !wine_server_call( req );
747 info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
748 info->handle = wine_server_ptr_handle( reply->handle );
749 info->proc = wine_server_get_ptr( reply->proc );
750 info->tid = reply->tid;
751 thread_info->active_hooks = reply->active_hooks;
755 return ret && (info->tid || info->proc);
758 static inline BOOL find_next_hook(DWORD event, HWND hwnd, LONG object_id,
759 LONG child_id, struct hook_info *info)
763 SERVER_START_REQ( get_hook_info )
765 req->handle = wine_server_user_handle( info->handle );
768 req->window = wine_server_user_handle( hwnd );
769 req->object_id = object_id;
770 req->child_id = child_id;
771 wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
772 ret = !wine_server_call( req );
775 info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
776 info->handle = wine_server_ptr_handle( reply->handle );
777 info->proc = wine_server_get_ptr( reply->proc );
778 info->tid = reply->tid;
785 static inline void find_hook_close(DWORD id)
787 SERVER_START_REQ( finish_hook_chain )
790 wine_server_call( req );
795 /***********************************************************************
796 * NotifyWinEvent [USER32.@]
798 * Inform the OS that an event has occurred.
801 * event [I] Id of the event
802 * hwnd [I] Window holding the object that created the event
803 * object_id [I] Type of object that created the event
804 * child_id [I] Child object of nId, or CHILDID_SELF.
809 void WINAPI NotifyWinEvent(DWORD event, HWND hwnd, LONG object_id, LONG child_id)
811 struct hook_info info;
813 TRACE("%04x,%p,%d,%d\n", event, hwnd, object_id, child_id);
817 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
824 if (event & 0x80000000)
826 /* FIXME: on 64-bit platforms we need to invent some other way for
827 * passing parameters, nId and nChildId can't hold full [W|L]PARAM.
828 * struct call_hook *hook = (LRESULT *)hWnd;
829 * wparam = hook->wparam;
830 * lparam = hook->lparam;
832 LRESULT *ret = (LRESULT *)hwnd;
833 INT id, code, unicode;
835 id = (dwEvent & 0x7fff0000) >> 16;
836 code = event & 0x7fff;
837 unicode = event & 0x8000;
838 *ret = HOOK_CallHooks(id, code, object_id, child_id, unicode);
843 if (!find_first_hook(WH_WINEVENT, event, hwnd, object_id, child_id, &info)) return;
849 TRACE( "calling WH_WINEVENT hook %p event %x hwnd %p %x %x module %s\n",
850 info.proc, event, hwnd, object_id, child_id, debugstr_w(info.module) );
852 if (!info.module[0] || (info.proc = get_hook_proc( info.proc, info.module )) != NULL)
855 DPRINTF( "%04x:Call winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
856 GetCurrentThreadId(), info.proc, info.handle, event, hwnd, object_id,
857 child_id, GetCurrentThreadId(), GetCurrentTime());
859 info.proc(info.handle, event, hwnd, object_id, child_id,
860 GetCurrentThreadId(), GetCurrentTime());
863 DPRINTF( "%04x:Ret winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
864 GetCurrentThreadId(), info.proc, info.handle, event, hwnd, object_id,
865 child_id, GetCurrentThreadId(), GetCurrentTime());
871 while (find_next_hook(event, hwnd, object_id, child_id, &info));
873 find_hook_close(WH_WINEVENT);
877 /***********************************************************************
878 * IsWinEventHookInstalled [USER32.@]
880 * Determine if an event hook is installed for an event.
883 * dwEvent [I] Id of the event
886 * TRUE, If there are any hooks installed for the event.
892 BOOL WINAPI IsWinEventHookInstalled(DWORD dwEvent)
894 /* FIXME: Needed by Office 2007 installer */
895 WARN("(%d)-stub!\n", dwEvent);