server: Return the data for callback results in the varargs part of the get_message request.
diff --git a/dlls/user/message.c b/dlls/user/message.c
index 7ed5b6e..0b4da22 100644
--- a/dlls/user/message.c
+++ b/dlls/user/message.c
@@ -1989,8 +1989,12 @@
info.flags = ISMEX_CALLBACK;
break;
case MSG_CALLBACK_RESULT:
- call_sendmsg_callback( (SENDASYNCPROC)info.msg.wParam, info.msg.hwnd,
- info.msg.message, extra_info, info.msg.lParam );
+ if (size >= sizeof(struct callback_msg_data))
+ {
+ const struct callback_msg_data *data = (const struct callback_msg_data *)buffer;
+ call_sendmsg_callback( data->callback, info.msg.hwnd,
+ info.msg.message, data->data, data->result );
+ }
goto next;
case MSG_WINEVENT:
if (size >= sizeof(struct winevent_msg_data))
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 3c902e9..29aa6b3 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -157,6 +157,14 @@
} rectangle_t;
+
+struct callback_msg_data
+{
+ void *callback;
+ unsigned long data;
+ unsigned long result;
+};
+
struct winevent_msg_data
{
user_handle_t hook;
@@ -168,6 +176,7 @@
typedef union
{
unsigned char bytes[1];
+ struct callback_msg_data callback;
struct winevent_msg_data winevent;
} message_data_t;
@@ -4419,6 +4428,6 @@
struct query_symlink_reply query_symlink_reply;
};
-#define SERVER_PROTOCOL_VERSION 248
+#define SERVER_PROTOCOL_VERSION 249
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index 02a95c0..6358efe 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -173,6 +173,14 @@
} rectangle_t;
/* structures for extra message data */
+
+struct callback_msg_data
+{
+ void *callback; /* callback function */
+ unsigned long data; /* user data for callback */
+ unsigned long result; /* message result */
+};
+
struct winevent_msg_data
{
user_handle_t hook; /* hook handle */
@@ -184,6 +192,7 @@
typedef union
{
unsigned char bytes[1]; /* raw data for sent messages */
+ struct callback_msg_data callback;
struct winevent_msg_data winevent;
} message_data_t;
@@ -1637,9 +1646,9 @@
int type; /* message type */
user_handle_t win; /* window handle */
unsigned int msg; /* message code */
- unsigned long wparam; /* parameters (callback function for MSG_CALLBACK_RESULT) */
- unsigned long lparam; /* parameters (result for MSG_CALLBACK_RESULT) */
- unsigned long info; /* extra info (callback argument for MSG_CALLBACK_RESULT) */
+ unsigned long wparam; /* parameters */
+ unsigned long lparam; /* parameters */
+ unsigned long info; /* extra info */
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
diff --git a/server/queue.c b/server/queue.c
index a7aa5c8..64c29fd 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -404,7 +404,11 @@
{
if (result->timeout) remove_timeout_user( result->timeout );
if (result->data) free( result->data );
- if (result->callback_msg) free( result->callback_msg );
+ if (result->callback_msg)
+ {
+ free( result->callback_msg->data );
+ free( result->callback_msg );
+ }
free( result );
}
@@ -435,7 +439,8 @@
if (res->callback_msg)
{
/* queue the callback message in the sender queue */
- res->callback_msg->lparam = result;
+ struct callback_msg_data *data = res->callback_msg->data;
+ data->result = result;
list_add_tail( &res->sender->msg_list[SEND_MESSAGE], &res->callback_msg->entry );
set_queue_bits( res->sender, QS_SENDMESSAGE );
res->callback_msg = NULL;
@@ -533,24 +538,34 @@
if (msg->type == MSG_CALLBACK)
{
+ struct callback_msg_data *data;
struct message *callback_msg = mem_alloc( sizeof(*callback_msg) );
+
if (!callback_msg)
{
free( result );
return NULL;
}
+ if (!(data = mem_alloc( sizeof(*data ))))
+ {
+ free( callback_msg );
+ free( result );
+ return NULL;
+ }
callback_msg->type = MSG_CALLBACK_RESULT;
callback_msg->win = msg->win;
callback_msg->msg = msg->msg;
- callback_msg->wparam = (unsigned long)callback;
+ callback_msg->wparam = 0;
callback_msg->lparam = 0;
callback_msg->time = get_tick_count();
callback_msg->x = 0;
callback_msg->y = 0;
- callback_msg->info = callback_data;
+ callback_msg->info = 0;
callback_msg->result = NULL;
- callback_msg->data = NULL;
- callback_msg->data_size = 0;
+ callback_msg->data = data;
+ callback_msg->data_size = sizeof(*data);
+ data->callback = callback;
+ data->data = callback_data;
result->callback_msg = callback_msg;
list_add_head( &send_queue->callback_result, &result->sender_entry );