server: Return the data for winevent hooks in the varargs part of the get_message request.
diff --git a/server/protocol.def b/server/protocol.def
index 80a4af4..02a95c0 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -172,6 +172,21 @@
int bottom;
} rectangle_t;
+/* structures for extra message data */
+struct winevent_msg_data
+{
+ user_handle_t hook; /* hook handle */
+ thread_id_t tid; /* thread id */
+ void *hook_proc; /* hook proc address */
+ /* followed by module name if any */
+};
+
+typedef union
+{
+ unsigned char bytes[1]; /* raw data for sent messages */
+ struct winevent_msg_data winevent;
+} message_data_t;
+
/* structure for console char/attribute info */
typedef struct
{
@@ -1627,13 +1642,11 @@
unsigned long info; /* extra info (callback argument for MSG_CALLBACK_RESULT) */
int x; /* x position */
int y; /* y position */
- user_handle_t hook; /* winevent hook handle */
- void* hook_proc; /* winevent hook proc address */
unsigned int time; /* message time */
unsigned int hw_id; /* id if hardware message */
unsigned int active_hooks; /* active hooks bitmap */
data_size_t total; /* total size of extra data */
- VARARG(data,bytes); /* message data for sent messages */
+ VARARG(data,message_data); /* message data for sent messages */
@END
#define GET_MSG_REMOVE 1 /* remove the message */
#define GET_MSG_SENT_ONLY 2 /* only get sent messages */
diff --git a/server/queue.c b/server/queue.c
index 90499cc..a7aa5c8 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -76,8 +76,6 @@
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
- user_handle_t hook; /* winevent hook handle */
- void *hook_proc; /* winevent hook proc address */
void *data; /* message data for sent messages */
unsigned int data_size; /* size of message data */
unsigned int unique_id; /* unique id for nested hw message waits */
@@ -550,8 +548,6 @@
callback_msg->x = 0;
callback_msg->y = 0;
callback_msg->info = callback_data;
- callback_msg->hook = 0;
- callback_msg->hook_proc = NULL;
callback_msg->result = NULL;
callback_msg->data = NULL;
callback_msg->data_size = 0;
@@ -596,8 +592,6 @@
reply->y = msg->y;
reply->time = msg->time;
reply->info = msg->info;
- reply->hook = msg->hook;
- reply->hook_proc = msg->hook_proc;
if (msg->data) set_reply_data_ptr( msg->data, msg->data_size );
@@ -1458,8 +1452,6 @@
msg->x = 0;
msg->y = 0;
msg->info = 0;
- msg->hook = 0;
- msg->hook_proc = NULL;
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@@ -1481,6 +1473,8 @@
if (thread->queue && (msg = mem_alloc( sizeof(*msg) )))
{
+ struct winevent_msg_data *data;
+
msg->type = MSG_WINEVENT;
msg->win = get_user_full_handle( win );
msg->msg = event;
@@ -1489,15 +1483,18 @@
msg->time = get_tick_count();
msg->x = 0;
msg->y = 0;
- msg->info = get_thread_id( current );
+ msg->info = 0;
msg->result = NULL;
- msg->hook = hook;
- msg->hook_proc = hook_proc;
- if ((msg->data = malloc( module_size )))
+ if ((data = malloc( sizeof(*data) + module_size )))
{
- msg->data_size = module_size;
- memcpy( msg->data, module, module_size );
+ data->hook = hook;
+ data->tid = get_thread_id( current );
+ data->hook_proc = hook_proc;
+ memcpy( data + 1, module, module_size );
+
+ msg->data = data;
+ msg->data_size = sizeof(*data) + module_size;
if (debug_level > 1)
fprintf( stderr, "post_win_event: tid %04x event %04x win %p object_id %d child_id %d\n",
@@ -1589,8 +1586,6 @@
msg->x = 0;
msg->y = 0;
msg->info = req->info;
- msg->hook = 0;
- msg->hook_proc = NULL;
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@@ -1671,8 +1666,6 @@
msg->x = req->x;
msg->y = req->y;
msg->info = req->info;
- msg->hook = 0;
- msg->hook_proc = NULL;
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
diff --git a/server/trace.c b/server/trace.c
index 8cf7306..03c6a3f 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -389,6 +389,12 @@
remove_data( size );
}
+static void dump_varargs_message_data( data_size_t size )
+{
+ /* FIXME: dump the structured data */
+ dump_varargs_bytes( size );
+}
+
static void dump_varargs_properties( data_size_t size )
{
const property_data_t *prop = cur_data;
@@ -2136,14 +2142,12 @@
fprintf( stderr, " info=%lx,", req->info );
fprintf( stderr, " x=%d,", req->x );
fprintf( stderr, " y=%d,", req->y );
- fprintf( stderr, " hook=%p,", req->hook );
- fprintf( stderr, " hook_proc=%p,", req->hook_proc );
fprintf( stderr, " time=%08x,", req->time );
fprintf( stderr, " hw_id=%08x,", req->hw_id );
fprintf( stderr, " active_hooks=%08x,", req->active_hooks );
fprintf( stderr, " total=%u,", req->total );
fprintf( stderr, " data=" );
- dump_varargs_bytes( cur_size );
+ dump_varargs_message_data( cur_size );
}
static void dump_reply_message_request( const struct reply_message_request *req )