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"
77 #include "user_private.h"
78 #include "wine/server.h"
79 #include "wine/unicode.h"
80 #include "wine/debug.h"
83 WINE_DEFAULT_DEBUG_CHANNEL(hook);
84 WINE_DECLARE_DEBUG_CHANNEL(relay);
92 BOOL prev_unicode, next_unicode;
93 WCHAR module[MAX_PATH];
96 #define WH_WINEVENT (WH_MAXHOOK+1)
98 static const char * const hook_names[WH_WINEVENT - WH_MINHOOK + 1] =
102 "WH_JOURNALPLAYBACK",
120 /***********************************************************************
121 * get_ll_hook_timeout
124 static UINT get_ll_hook_timeout(void)
126 /* FIXME: should retrieve LowLevelHooksTimeout in HKEY_CURRENT_USER\Control Panel\Desktop */
131 /***********************************************************************
134 * Implementation of SetWindowsHookExA and SetWindowsHookExW.
136 static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid, BOOL unicode )
139 WCHAR module[MAX_PATH];
144 SetLastError( ERROR_INVALID_FILTER_PROC );
148 if (tid) /* thread-local hook */
150 if (id == WH_JOURNALRECORD ||
151 id == WH_JOURNALPLAYBACK ||
152 id == WH_KEYBOARD_LL ||
154 id == WH_SYSMSGFILTER)
156 /* these can only be global */
157 SetLastError( ERROR_INVALID_PARAMETER );
161 else /* system-global hook */
163 if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;
166 SetLastError( ERROR_HOOK_NEEDS_HMOD );
171 if (inst && (!(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH))
173 SetLastError( ERROR_INVALID_PARAMETER );
177 SERVER_START_REQ( set_hook )
182 req->event_min = EVENT_MIN;
183 req->event_max = EVENT_MAX;
184 req->flags = WINEVENT_INCONTEXT;
185 req->unicode = unicode;
186 if (inst) /* make proc relative to the module base */
188 req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) );
189 wine_server_add_data( req, module, strlenW(module) * sizeof(WCHAR) );
191 else req->proc = wine_server_client_ptr( proc );
193 if (!wine_server_call_err( req ))
195 handle = wine_server_ptr_handle( reply->handle );
196 get_user_thread_info()->active_hooks = reply->active_hooks;
201 TRACE( "%s %p %x -> %p\n", hook_names[id-WH_MINHOOK], proc, tid, handle );
206 /***********************************************************************
209 static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam )
212 UNICODE_STRING usBuffer;
213 if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam );
216 CBT_CREATEWNDA *cbtcwA = (CBT_CREATEWNDA *)lparam;
217 CBT_CREATEWNDW cbtcwW;
220 LPWSTR classW = NULL;
223 cbtcwW.hwndInsertAfter = cbtcwA->hwndInsertAfter;
224 csW = *(CREATESTRUCTW *)cbtcwA->lpcs;
226 if (!IS_INTRESOURCE(cbtcwA->lpcs->lpszName))
228 RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
229 csW.lpszName = nameW = usBuffer.Buffer;
231 if (!IS_INTRESOURCE(cbtcwA->lpcs->lpszClass))
233 RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszClass);
234 csW.lpszClass = classW = usBuffer.Buffer;
236 ret = proc( code, wparam, (LPARAM)&cbtcwW );
237 cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter;
238 HeapFree( GetProcessHeap(), 0, nameW );
239 HeapFree( GetProcessHeap(), 0, classW );
245 /***********************************************************************
248 static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam )
252 if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam );
255 CBT_CREATEWNDW *cbtcwW = (CBT_CREATEWNDW *)lparam;
256 CBT_CREATEWNDA cbtcwA;
263 cbtcwA.hwndInsertAfter = cbtcwW->hwndInsertAfter;
264 csA = *(CREATESTRUCTA *)cbtcwW->lpcs;
266 if (!IS_INTRESOURCE(cbtcwW->lpcs->lpszName)) {
267 len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, NULL, 0, NULL, NULL );
268 nameA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
269 WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, nameA, len, NULL, NULL );
270 csA.lpszName = nameA;
273 if (!IS_INTRESOURCE(cbtcwW->lpcs->lpszClass)) {
274 len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, NULL, 0, NULL, NULL );
275 classA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
276 WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, classA, len, NULL, NULL );
277 csA.lpszClass = classA;
280 ret = proc( code, wparam, (LPARAM)&cbtcwA );
281 cbtcwW->hwndInsertAfter = cbtcwA.hwndInsertAfter;
282 HeapFree( GetProcessHeap(), 0, nameA );
283 HeapFree( GetProcessHeap(), 0, classA );
289 /***********************************************************************
292 static LRESULT call_hook_proc( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam,
293 BOOL prev_unicode, BOOL next_unicode )
298 DPRINTF( "%04x:Call hook proc %p (id=%s,code=%x,wp=%08lx,lp=%08lx)\n",
299 GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam );
301 if (!prev_unicode == !next_unicode) ret = proc( code, wparam, lparam );
302 else if (prev_unicode) ret = call_hook_WtoA( proc, id, code, wparam, lparam );
303 else ret = call_hook_AtoW( proc, id, code, wparam, lparam );
306 DPRINTF( "%04x:Ret hook proc %p (id=%s,code=%x,wp=%08lx,lp=%08lx) retval=%08lx\n",
307 GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam, ret );
313 /***********************************************************************
316 * Retrieve the hook procedure real value for a module-relative proc
318 void *get_hook_proc( void *proc, const WCHAR *module )
322 if (!(mod = GetModuleHandleW(module)))
324 TRACE( "loading %s\n", debugstr_w(module) );
325 /* FIXME: the library will never be freed */
326 if (!(mod = LoadLibraryExW(module, NULL, LOAD_WITH_ALTERED_SEARCH_PATH))) return NULL;
328 return (char *)mod + (ULONG_PTR)proc;
331 /***********************************************************************
334 * Call hook either in current thread or send message to the destination
337 static LRESULT call_hook( struct hook_info *info, INT code, WPARAM wparam, LPARAM lparam )
343 struct hook_extra_info h_extra;
344 h_extra.handle = info->handle;
345 h_extra.lparam = lparam;
347 TRACE( "calling hook in thread %04x %s code %x wp %lx lp %lx\n",
348 info->tid, hook_names[info->id-WH_MINHOOK], code, wparam, lparam );
353 MSG_SendInternalMessageTimeout( info->pid, info->tid, WM_WINE_KEYBOARD_LL_HOOK,
354 wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG,
355 get_ll_hook_timeout(), &ret );
358 MSG_SendInternalMessageTimeout( info->pid, info->tid, WM_WINE_MOUSE_LL_HOOK,
359 wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG,
360 get_ll_hook_timeout(), &ret );
363 ERR("Unknown hook id %d\n", info->id);
370 TRACE( "calling hook %p %s code %x wp %lx lp %lx module %s\n",
371 info->proc, hook_names[info->id-WH_MINHOOK], code, wparam,
372 lparam, debugstr_w(info->module) );
374 if (!info->module[0] ||
375 (info->proc = get_hook_proc( info->proc, info->module )) != NULL)
377 struct user_thread_info *thread_info = get_user_thread_info();
378 HHOOK prev = thread_info->hook;
379 BOOL prev_unicode = thread_info->hook_unicode;
381 thread_info->hook = info->handle;
382 thread_info->hook_unicode = info->next_unicode;
383 ret = call_hook_proc( info->proc, info->id, code, wparam, lparam,
384 info->prev_unicode, info->next_unicode );
385 thread_info->hook = prev;
386 thread_info->hook_unicode = prev_unicode;
390 if (info->id == WH_KEYBOARD_LL || info->id == WH_MOUSE_LL)
391 get_user_thread_info()->key_state_time = 0; /* force refreshing the key state cache */
397 /***********************************************************************
400 static BOOL HOOK_IsHooked( INT id )
402 struct user_thread_info *thread_info = get_user_thread_info();
404 if (!thread_info->active_hooks) return TRUE;
405 return (thread_info->active_hooks & (1 << (id - WH_MINHOOK))) != 0;
409 /***********************************************************************
412 LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode )
414 struct user_thread_info *thread_info = get_user_thread_info();
415 struct hook_info info;
420 if (!HOOK_IsHooked( id ))
422 TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], thread_info->active_hooks );
426 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
427 info.prev_unicode = unicode;
430 SERVER_START_REQ( start_hook_chain )
433 req->event = EVENT_MIN;
434 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
435 if (!wine_server_call( req ))
437 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
438 info.handle = wine_server_ptr_handle( reply->handle );
439 info.pid = reply->pid;
440 info.tid = reply->tid;
441 info.proc = wine_server_get_ptr( reply->proc );
442 info.next_unicode = reply->unicode;
443 thread_info->active_hooks = reply->active_hooks;
448 if (!info.tid && !info.proc) return 0;
449 ret = call_hook( &info, code, wparam, lparam );
451 SERVER_START_REQ( finish_hook_chain )
454 wine_server_call( req );
461 /***********************************************************************
462 * SetWindowsHookA (USER32.@)
464 HHOOK WINAPI SetWindowsHookA( INT id, HOOKPROC proc )
466 return SetWindowsHookExA( id, proc, 0, GetCurrentThreadId() );
470 /***********************************************************************
471 * SetWindowsHookW (USER32.@)
473 HHOOK WINAPI SetWindowsHookW( INT id, HOOKPROC proc )
475 return SetWindowsHookExW( id, proc, 0, GetCurrentThreadId() );
479 /***********************************************************************
480 * SetWindowsHookExA (USER32.@)
482 HHOOK WINAPI SetWindowsHookExA( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid )
484 return set_windows_hook( id, proc, inst, tid, FALSE );
487 /***********************************************************************
488 * SetWindowsHookExW (USER32.@)
490 HHOOK WINAPI SetWindowsHookExW( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid )
492 return set_windows_hook( id, proc, inst, tid, TRUE );
496 /***********************************************************************
497 * UnhookWindowsHook (USER32.@)
499 BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc )
503 TRACE( "%s %p\n", hook_names[id-WH_MINHOOK], proc );
505 SERVER_START_REQ( remove_hook )
509 req->proc = wine_server_client_ptr( proc );
510 ret = !wine_server_call_err( req );
511 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
514 if (!ret && GetLastError() == ERROR_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE );
520 /***********************************************************************
521 * UnhookWindowsHookEx (USER32.@)
523 BOOL WINAPI UnhookWindowsHookEx( HHOOK hhook )
527 SERVER_START_REQ( remove_hook )
529 req->handle = wine_server_user_handle( hhook );
531 ret = !wine_server_call_err( req );
532 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
535 if (!ret && GetLastError() == ERROR_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE );
540 /***********************************************************************
541 * CallNextHookEx (USER32.@)
543 LRESULT WINAPI CallNextHookEx( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam )
545 struct user_thread_info *thread_info = get_user_thread_info();
546 struct hook_info info;
548 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
550 SERVER_START_REQ( get_hook_info )
552 req->handle = wine_server_user_handle( thread_info->hook );
554 req->event = EVENT_MIN;
555 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
556 if (!wine_server_call_err( req ))
558 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
559 info.handle = wine_server_ptr_handle( reply->handle );
561 info.pid = reply->pid;
562 info.tid = reply->tid;
563 info.proc = wine_server_get_ptr( reply->proc );
564 info.next_unicode = reply->unicode;
569 info.prev_unicode = thread_info->hook_unicode;
570 return call_hook( &info, code, wparam, lparam );
574 LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam )
576 struct hook_info info;
578 ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
580 SERVER_START_REQ( get_hook_info )
582 req->handle = wine_server_user_handle( hhook );
584 req->event = EVENT_MIN;
585 wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
586 if (!wine_server_call_err( req ))
588 info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
589 info.handle = wine_server_ptr_handle( reply->handle );
591 info.pid = reply->pid;
592 info.tid = reply->tid;
593 info.proc = wine_server_get_ptr( reply->proc );
594 info.next_unicode = reply->unicode;
599 info.prev_unicode = TRUE; /* assume Unicode for this function */
600 return call_hook( &info, code, wparam, lparam );
603 /***********************************************************************
604 * CallMsgFilterA (USER32.@)
606 BOOL WINAPI CallMsgFilterA( LPMSG msg, INT code )
608 if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg, FALSE )) return TRUE;
609 return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg, FALSE );
613 /***********************************************************************
614 * CallMsgFilterW (USER32.@)
616 BOOL WINAPI CallMsgFilterW( LPMSG msg, INT code )
618 if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg, TRUE )) return TRUE;
619 return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg, TRUE );
623 /***********************************************************************
624 * SetWinEventHook [USER32.@]
626 * Set up an event hook for a set of events.
629 * event_min [I] Lowest event handled by pfnProc
630 * event_max [I] Highest event handled by pfnProc
631 * inst [I] DLL containing pfnProc
632 * proc [I] Callback event hook function
633 * pid [I] Process to get events from, or 0 for all processes
634 * tid [I] Thread to get events from, or 0 for all threads
635 * flags [I] Flags indicating the status of pfnProc
638 * Success: A handle representing the hook.
639 * Failure: A NULL handle.
641 HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max,
642 HMODULE inst, WINEVENTPROC proc,
643 DWORD pid, DWORD tid, DWORD flags)
645 HWINEVENTHOOK handle = 0;
646 WCHAR module[MAX_PATH];
649 TRACE("%d,%d,%p,%p,%08x,%04x,%08x\n", event_min, event_max, inst,
650 proc, pid, tid, flags);
654 if (!(len = GetModuleFileNameW(inst, module, MAX_PATH)) || len >= MAX_PATH)
658 if ((flags & WINEVENT_INCONTEXT) && !inst)
660 SetLastError(ERROR_HOOK_NEEDS_HMOD);
664 if (event_min > event_max)
666 SetLastError(ERROR_INVALID_HOOK_FILTER);
670 /* FIXME: what if the tid or pid belongs to another process? */
671 if (tid) /* thread-local hook */
674 SERVER_START_REQ( set_hook )
676 req->id = WH_WINEVENT;
679 req->event_min = event_min;
680 req->event_max = event_max;
683 if (inst) /* make proc relative to the module base */
685 req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) );
686 wine_server_add_data( req, module, strlenW(module) * sizeof(WCHAR) );
688 else req->proc = wine_server_client_ptr( proc );
690 if (!wine_server_call_err( req ))
692 handle = wine_server_ptr_handle( reply->handle );
693 get_user_thread_info()->active_hooks = reply->active_hooks;
698 TRACE("-> %p\n", handle);
703 /***********************************************************************
704 * UnhookWinEvent [USER32.@]
706 * Remove an event hook for a set of events.
709 * hEventHook [I] Event hook to remove
712 * Success: TRUE. The event hook has been removed.
713 * Failure: FALSE, if hEventHook is invalid.
715 BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hEventHook)
719 SERVER_START_REQ( remove_hook )
721 req->handle = wine_server_user_handle( hEventHook );
722 req->id = WH_WINEVENT;
723 ret = !wine_server_call_err( req );
724 if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
730 static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object_id,
731 LONG child_id, struct hook_info *info)
733 struct user_thread_info *thread_info = get_user_thread_info();
736 if (!HOOK_IsHooked( id ))
738 TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], thread_info->active_hooks );
742 SERVER_START_REQ( start_hook_chain )
746 req->window = wine_server_user_handle( hwnd );
747 req->object_id = object_id;
748 req->child_id = child_id;
749 wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
750 ret = !wine_server_call( req );
753 info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
754 info->handle = wine_server_ptr_handle( reply->handle );
755 info->proc = wine_server_get_ptr( reply->proc );
756 info->tid = reply->tid;
757 thread_info->active_hooks = reply->active_hooks;
761 return ret && (info->tid || info->proc);
764 static inline BOOL find_next_hook(DWORD event, HWND hwnd, LONG object_id,
765 LONG child_id, struct hook_info *info)
769 SERVER_START_REQ( get_hook_info )
771 req->handle = wine_server_user_handle( info->handle );
774 req->window = wine_server_user_handle( hwnd );
775 req->object_id = object_id;
776 req->child_id = child_id;
777 wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
778 ret = !wine_server_call( req );
781 info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
782 info->handle = wine_server_ptr_handle( reply->handle );
783 info->proc = wine_server_get_ptr( reply->proc );
784 info->tid = reply->tid;
791 static inline void find_hook_close(DWORD id)
793 SERVER_START_REQ( finish_hook_chain )
796 wine_server_call( req );
801 /***********************************************************************
802 * NotifyWinEvent [USER32.@]
804 * Inform the OS that an event has occurred.
807 * event [I] Id of the event
808 * hwnd [I] Window holding the object that created the event
809 * object_id [I] Type of object that created the event
810 * child_id [I] Child object of nId, or CHILDID_SELF.
815 void WINAPI NotifyWinEvent(DWORD event, HWND hwnd, LONG object_id, LONG child_id)
817 struct hook_info info;
819 TRACE("%04x,%p,%d,%d\n", event, hwnd, object_id, child_id);
823 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
830 if (event & 0x80000000)
832 /* FIXME: on 64-bit platforms we need to invent some other way for
833 * passing parameters, nId and nChildId can't hold full [W|L]PARAM.
834 * struct call_hook *hook = (LRESULT *)hWnd;
835 * wparam = hook->wparam;
836 * lparam = hook->lparam;
838 LRESULT *ret = (LRESULT *)hwnd;
839 INT id, code, unicode;
841 id = (dwEvent & 0x7fff0000) >> 16;
842 code = event & 0x7fff;
843 unicode = event & 0x8000;
844 *ret = HOOK_CallHooks(id, code, object_id, child_id, unicode);
849 if (!find_first_hook(WH_WINEVENT, event, hwnd, object_id, child_id, &info)) return;
853 WINEVENTPROC proc = info.proc;
856 TRACE( "calling WH_WINEVENT hook %p event %x hwnd %p %x %x module %s\n",
857 proc, event, hwnd, object_id, child_id, debugstr_w(info.module) );
859 if (!info.module[0] || (proc = get_hook_proc( proc, info.module )) != NULL)
862 DPRINTF( "%04x:Call winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
863 GetCurrentThreadId(), proc, info.handle, event, hwnd, object_id,
864 child_id, GetCurrentThreadId(), GetCurrentTime());
866 proc( info.handle, event, hwnd, object_id, child_id,
867 GetCurrentThreadId(), GetCurrentTime());
870 DPRINTF( "%04x:Ret winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
871 GetCurrentThreadId(), proc, info.handle, event, hwnd, object_id,
872 child_id, GetCurrentThreadId(), GetCurrentTime());
878 while (find_next_hook(event, hwnd, object_id, child_id, &info));
880 find_hook_close(WH_WINEVENT);
884 /***********************************************************************
885 * IsWinEventHookInstalled [USER32.@]
887 * Determine if an event hook is installed for an event.
890 * dwEvent [I] Id of the event
893 * TRUE, If there are any hooks installed for the event.
899 BOOL WINAPI IsWinEventHookInstalled(DWORD dwEvent)
901 /* FIXME: Needed by Office 2007 installer */
902 WARN("(%d)-stub!\n", dwEvent);