server: Return the data for callback results in the varargs part of the get_message request.

This commit is contained in:
Alexandre Julliard 2006-10-04 16:29:45 +02:00
parent 59dc456822
commit 29a3ce9f3a
4 changed files with 49 additions and 12 deletions

View File

@ -1989,8 +1989,12 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags
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))

View File

@ -157,6 +157,14 @@ typedef struct
} 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 @@ struct winevent_msg_data
typedef union
{
unsigned char bytes[1];
struct callback_msg_data callback;
struct winevent_msg_data winevent;
} message_data_t;
@ -4419,6 +4428,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 248
#define SERVER_PROTOCOL_VERSION 249
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -173,6 +173,14 @@ typedef struct
} 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 @@ struct winevent_msg_data
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 @@ enum message_type
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 */

View File

@ -404,7 +404,11 @@ static void free_result( struct message_result *result )
{
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 @@ static void store_message_result( struct message_result *res, unsigned int resul
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 @@ static struct message_result *alloc_message_result( struct msg_queue *send_queue
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 );