Commit 9ced5b05 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Use User32CallWinEventHook in peek_message.

parent 1e5dc840
......@@ -451,14 +451,14 @@ BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params,
TRACE_(relay)( "\1Call winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
proc, params->handle, params->event, params->hwnd, params->object_id,
params->child_id, GetCurrentThreadId(), GetCurrentTime() );
params->child_id, params->tid, params->time );
proc( params->handle, params->event, params->hwnd, params->object_id, params->child_id,
GetCurrentThreadId(), GetCurrentTime() );
params->tid, params->time );
TRACE_(relay)( "\1Ret winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
proc, params->handle, params->event, params->hwnd, params->object_id,
params->child_id, GetCurrentThreadId(), GetCurrentTime() );
params->child_id, params->tid, params->time );
if (free_module) FreeLibrary( free_module );
return TRUE;
......
......@@ -2716,38 +2716,27 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
case MSG_WINEVENT:
if (size >= sizeof(msg_data->winevent))
{
WINEVENTPROC hook_proc;
HMODULE free_module = 0;
struct win_event_hook_params params;
hook_proc = wine_server_get_ptr( msg_data->winevent.hook_proc );
params.proc = wine_server_get_ptr( msg_data->winevent.hook_proc );
size -= sizeof(msg_data->winevent);
if (size)
{
WCHAR module[MAX_PATH];
size = min( size, (MAX_PATH - 1) * sizeof(WCHAR) );
memcpy( module, &msg_data->winevent + 1, size );
module[size / sizeof(WCHAR)] = 0;
if (!(hook_proc = get_hook_proc( hook_proc, module, &free_module )))
{
ERR( "invalid winevent hook module name %s\n", debugstr_w(module) );
continue;
size = min( size, sizeof(params.module) - sizeof(WCHAR) );
memcpy( params.module, &msg_data->winevent + 1, size );
}
}
TRACE_(relay)( "\1Call winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
hook_proc, msg_data->winevent.hook, info.msg.message, info.msg.hwnd,
info.msg.wParam, info.msg.lParam, msg_data->winevent.tid, info.msg.time);
hook_proc( wine_server_ptr_handle( msg_data->winevent.hook ), info.msg.message,
info.msg.hwnd, info.msg.wParam, info.msg.lParam,
msg_data->winevent.tid, info.msg.time );
params.module[size / sizeof(WCHAR)] = 0;
size = FIELD_OFFSET( struct win_hook_params, module[size / sizeof(WCHAR) + 1] );
TRACE_(relay)( "\1Ret winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
hook_proc, msg_data->winevent.hook, info.msg.message, info.msg.hwnd,
info.msg.wParam, info.msg.lParam, msg_data->winevent.tid, info.msg.time);
params.handle = wine_server_ptr_handle( msg_data->winevent.hook );
params.event = info.msg.message;
params.hwnd = info.msg.hwnd;
params.object_id = info.msg.wParam;
params.child_id = info.msg.lParam;
params.tid = msg_data->winevent.tid;
params.time = info.msg.time;
if (free_module) FreeLibrary(free_module);
User32CallWinEventHook( &params, size );
}
continue;
case MSG_HOOK_LL:
......
......@@ -476,6 +476,7 @@ void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG c
info.hwnd = hwnd;
info.object_id = object_id;
info.child_id = child_id;
info.tid = GetCurrentThreadId();
SERVER_START_REQ( start_hook_chain )
{
......@@ -502,6 +503,7 @@ void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG c
TRACE( "calling WH_WINEVENT hook %p event %x hwnd %p %x %x module %s\n",
info.proc, event, hwnd, object_id, child_id, debugstr_w(info.module) );
info.time = NtGetTickCount();
KeUserModeCallback( NtUserCallWinEventHook, &info,
FIELD_OFFSET( struct win_hook_params, module[lstrlenW(info.module) + 1] ),
&ret_ptr, &ret_len );
......
......@@ -58,6 +58,8 @@ struct win_event_hook_params
LONG object_id;
LONG child_id;
void *handle;
DWORD tid;
DWORD time;
WINEVENTPROC proc;
WCHAR module[MAX_PATH];
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment