Commit 0ffd26ab authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Use the message_data_t union when receiving a message.

parent 358ab470
...@@ -2038,6 +2038,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2038,6 +2038,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
{ {
NTSTATUS res; NTSTATUS res;
size_t size = 0; size_t size = 0;
const message_data_t *msg_data = buffer;
SERVER_START_REQ( get_message ) SERVER_START_REQ( get_message )
{ {
...@@ -2093,27 +2094,24 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2093,27 +2094,24 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
info.flags = ISMEX_CALLBACK; info.flags = ISMEX_CALLBACK;
break; break;
case MSG_CALLBACK_RESULT: case MSG_CALLBACK_RESULT:
if (size >= sizeof(struct callback_msg_data)) if (size >= sizeof(msg_data->callback))
{ call_sendmsg_callback( wine_server_get_ptr(msg_data->callback.callback),
const struct callback_msg_data *data = buffer; info.msg.hwnd, info.msg.message,
call_sendmsg_callback( wine_server_get_ptr(data->callback), info.msg.hwnd, msg_data->callback.data, msg_data->callback.result );
info.msg.message, data->data, data->result );
}
continue; continue;
case MSG_WINEVENT: case MSG_WINEVENT:
if (size >= sizeof(struct winevent_msg_data)) if (size >= sizeof(msg_data->winevent))
{ {
WINEVENTPROC hook_proc; WINEVENTPROC hook_proc;
const struct winevent_msg_data *data = buffer;
hook_proc = wine_server_get_ptr( data->hook_proc ); hook_proc = wine_server_get_ptr( msg_data->winevent.hook_proc );
size -= sizeof(*data); size -= sizeof(msg_data->winevent);
if (size) if (size)
{ {
WCHAR module[MAX_PATH]; WCHAR module[MAX_PATH];
size = min( size, (MAX_PATH - 1) * sizeof(WCHAR) ); size = min( size, (MAX_PATH - 1) * sizeof(WCHAR) );
memcpy( module, buffer, size ); memcpy( module, &msg_data->winevent + 1, size );
module[size / sizeof(WCHAR)] = 0; module[size / sizeof(WCHAR)] = 0;
if (!(hook_proc = get_hook_proc( hook_proc, module ))) if (!(hook_proc = get_hook_proc( hook_proc, module )))
{ {
...@@ -2125,17 +2123,18 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2125,17 +2123,18 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%04x:Call winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n", DPRINTF( "%04x:Call winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
GetCurrentThreadId(), hook_proc, GetCurrentThreadId(), hook_proc,
data->hook, info.msg.message, info.msg.hwnd, info.msg.wParam, msg_data->winevent.hook, info.msg.message, info.msg.hwnd, info.msg.wParam,
info.msg.lParam, data->tid, info.msg.time); info.msg.lParam, msg_data->winevent.tid, info.msg.time);
hook_proc( wine_server_ptr_handle( data->hook ), info.msg.message, hook_proc( wine_server_ptr_handle( msg_data->winevent.hook ), info.msg.message,
info.msg.hwnd, info.msg.wParam, info.msg.lParam, data->tid, info.msg.time ); info.msg.hwnd, info.msg.wParam, info.msg.lParam,
msg_data->winevent.tid, info.msg.time );
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%04x:Ret winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n", DPRINTF( "%04x:Ret winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
GetCurrentThreadId(), hook_proc, GetCurrentThreadId(), hook_proc,
data->hook, info.msg.message, info.msg.hwnd, info.msg.wParam, msg_data->winevent.hook, info.msg.message, info.msg.hwnd, info.msg.wParam,
info.msg.lParam, data->tid, info.msg.time); info.msg.lParam, msg_data->winevent.tid, info.msg.time);
} }
continue; continue;
case MSG_OTHER_PROCESS: case MSG_OTHER_PROCESS:
...@@ -2149,13 +2148,12 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2149,13 +2148,12 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
} }
break; break;
case MSG_HARDWARE: case MSG_HARDWARE:
if (size >= sizeof(struct hardware_msg_data)) if (size >= sizeof(msg_data->hardware))
{ {
const struct hardware_msg_data *data = buffer; info.msg.pt.x = msg_data->hardware.x;
info.msg.pt.x = data->x; info.msg.pt.y = msg_data->hardware.y;
info.msg.pt.y = data->y; hw_id = msg_data->hardware.hw_id;
hw_id = data->hw_id; if (!process_hardware_message( &info.msg, hw_id, msg_data->hardware.info,
if (!process_hardware_message( &info.msg, hw_id, data->info,
hwnd, first, last, flags & PM_REMOVE )) hwnd, first, last, flags & PM_REMOVE ))
{ {
TRACE("dropping msg %x\n", info.msg.message ); TRACE("dropping msg %x\n", info.msg.message );
...@@ -2164,7 +2162,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2164,7 +2162,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
*msg = info.msg; *msg = info.msg;
thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y ); thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y );
thread_info->GetMessageTimeVal = info.msg.time; thread_info->GetMessageTimeVal = info.msg.time;
thread_info->GetMessageExtraInfoVal = data->info; thread_info->GetMessageExtraInfoVal = msg_data->hardware.info;
if (buffer != local_buffer) HeapFree( GetProcessHeap(), 0, buffer ); if (buffer != local_buffer) HeapFree( GetProcessHeap(), 0, buffer );
HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE );
return TRUE; return TRUE;
......
...@@ -202,6 +202,7 @@ struct winevent_msg_data ...@@ -202,6 +202,7 @@ struct winevent_msg_data
typedef union typedef union
{ {
unsigned char bytes[1]; unsigned char bytes[1];
struct hardware_msg_data hardware;
struct callback_msg_data callback; struct callback_msg_data callback;
struct winevent_msg_data winevent; struct winevent_msg_data winevent;
} message_data_t; } message_data_t;
......
...@@ -218,6 +218,7 @@ struct winevent_msg_data ...@@ -218,6 +218,7 @@ struct winevent_msg_data
typedef union typedef union
{ {
unsigned char bytes[1]; /* raw data for sent messages */ unsigned char bytes[1]; /* raw data for sent messages */
struct hardware_msg_data hardware;
struct callback_msg_data callback; struct callback_msg_data callback;
struct winevent_msg_data winevent; struct winevent_msg_data winevent;
} message_data_t; } message_data_t;
......
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