server: Pass the data for message callbacks as vararg from the client side.
This commit is contained in:
parent
29a3ce9f3a
commit
3ad9798263
|
@ -2169,6 +2169,7 @@ static void wait_message_reply( UINT flags )
|
|||
static BOOL put_message_in_queue( const struct send_message_info *info, size_t *reply_size )
|
||||
{
|
||||
struct packed_message data;
|
||||
message_data_t msg_data;
|
||||
unsigned int res;
|
||||
int i, timeout = 0;
|
||||
|
||||
|
@ -2191,6 +2192,15 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t *
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (info->type == MSG_CALLBACK)
|
||||
{
|
||||
msg_data.callback.callback = info->callback;
|
||||
msg_data.callback.data = info->data;
|
||||
msg_data.callback.result = 0;
|
||||
data.data[0] = &msg_data;
|
||||
data.size[0] = sizeof(msg_data.callback);
|
||||
data.count = 1;
|
||||
}
|
||||
else if (info->type == MSG_POSTED && info->msg >= WM_DDE_FIRST && info->msg <= WM_DDE_LAST)
|
||||
{
|
||||
return post_dde_message( &data, info );
|
||||
|
@ -2207,12 +2217,6 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t *
|
|||
req->lparam = info->lparam;
|
||||
req->timeout = timeout;
|
||||
|
||||
if (info->type == MSG_CALLBACK)
|
||||
{
|
||||
req->callback = info->callback;
|
||||
req->info = info->data;
|
||||
}
|
||||
|
||||
if (info->flags & SMTO_ABORTIFHUNG) req->flags |= SEND_MSG_ABORT_IF_HUNG;
|
||||
for (i = 0; i < data.count; i++) wine_server_add_data( req, data.data[i], data.size[i] );
|
||||
if ((res = wine_server_call( req )))
|
||||
|
@ -2569,7 +2573,6 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
|
|||
call_sendmsg_callback( callback, hwnd, msg, data, result );
|
||||
return TRUE;
|
||||
}
|
||||
FIXME( "callback will not be called\n" );
|
||||
return send_inter_thread_message( &info, &result );
|
||||
}
|
||||
|
||||
|
|
|
@ -2224,10 +2224,8 @@ struct send_message_request
|
|||
unsigned int msg;
|
||||
unsigned long wparam;
|
||||
unsigned long lparam;
|
||||
unsigned long info;
|
||||
int timeout;
|
||||
void* callback;
|
||||
/* VARARG(data,bytes); */
|
||||
/* VARARG(data,message_data); */
|
||||
};
|
||||
struct send_message_reply
|
||||
{
|
||||
|
@ -4428,6 +4426,6 @@ union generic_reply
|
|||
struct query_symlink_reply query_symlink_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 249
|
||||
#define SERVER_PROTOCOL_VERSION 250
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -1596,10 +1596,8 @@ enum char_info_mode
|
|||
unsigned int msg; /* message code */
|
||||
unsigned long wparam; /* parameters */
|
||||
unsigned long lparam; /* parameters */
|
||||
unsigned long info; /* extra info */
|
||||
int timeout; /* timeout for reply */
|
||||
void* callback; /* callback address */
|
||||
VARARG(data,bytes); /* message data for sent messages */
|
||||
VARARG(data,message_data); /* message data for sent messages */
|
||||
@END
|
||||
|
||||
@REQ(post_quit_message)
|
||||
|
|
|
@ -180,6 +180,7 @@ static const struct object_ops thread_input_ops =
|
|||
static struct thread_input *foreground_input;
|
||||
static unsigned int last_input_time;
|
||||
|
||||
static void free_message( struct message *msg );
|
||||
|
||||
/* set the caret window in a given thread input */
|
||||
static void set_caret_window( struct thread_input *input, user_handle_t win )
|
||||
|
@ -404,11 +405,7 @@ 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->data );
|
||||
free( result->callback_msg );
|
||||
}
|
||||
if (result->callback_msg) free_message( result->callback_msg );
|
||||
free( result );
|
||||
}
|
||||
|
||||
|
@ -522,8 +519,7 @@ static void result_timeout( void *private )
|
|||
/* allocate and fill a message result structure */
|
||||
static struct message_result *alloc_message_result( struct msg_queue *send_queue,
|
||||
struct msg_queue *recv_queue,
|
||||
struct message *msg, int timeout,
|
||||
void *callback, unsigned long callback_data )
|
||||
struct message *msg, int timeout )
|
||||
{
|
||||
struct message_result *result = mem_alloc( sizeof(*result) );
|
||||
if (result)
|
||||
|
@ -538,7 +534,6 @@ 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)
|
||||
|
@ -546,12 +541,6 @@ static struct message_result *alloc_message_result( struct msg_queue *send_queue
|
|||
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;
|
||||
|
@ -562,10 +551,11 @@ static struct message_result *alloc_message_result( struct msg_queue *send_queue
|
|||
callback_msg->y = 0;
|
||||
callback_msg->info = 0;
|
||||
callback_msg->result = NULL;
|
||||
callback_msg->data = data;
|
||||
callback_msg->data_size = sizeof(*data);
|
||||
data->callback = callback;
|
||||
data->data = callback_data;
|
||||
/* steal the data from the original message */
|
||||
callback_msg->data = msg->data;
|
||||
callback_msg->data_size = msg->data_size;
|
||||
msg->data = NULL;
|
||||
msg->data_size = 0;
|
||||
|
||||
result->callback_msg = callback_msg;
|
||||
list_add_head( &send_queue->callback_result, &result->sender_entry );
|
||||
|
@ -1600,26 +1590,25 @@ DECL_HANDLER(send_message)
|
|||
msg->time = get_tick_count();
|
||||
msg->x = 0;
|
||||
msg->y = 0;
|
||||
msg->info = req->info;
|
||||
msg->info = 0;
|
||||
msg->result = NULL;
|
||||
msg->data = NULL;
|
||||
msg->data_size = 0;
|
||||
msg->data_size = get_req_data_size();
|
||||
|
||||
if (msg->data_size && !(msg->data = memdup( get_req_data(), msg->data_size )))
|
||||
{
|
||||
free( msg );
|
||||
release_object( thread );
|
||||
return;
|
||||
}
|
||||
|
||||
switch(msg->type)
|
||||
{
|
||||
case MSG_OTHER_PROCESS:
|
||||
msg->data_size = get_req_data_size();
|
||||
if (msg->data_size && !(msg->data = memdup( get_req_data(), msg->data_size )))
|
||||
{
|
||||
free( msg );
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case MSG_ASCII:
|
||||
case MSG_UNICODE:
|
||||
case MSG_CALLBACK:
|
||||
if (!(msg->result = alloc_message_result( send_queue, recv_queue, msg,
|
||||
req->timeout, req->callback, req->info )))
|
||||
if (!(msg->result = alloc_message_result( send_queue, recv_queue, msg, req->timeout )))
|
||||
{
|
||||
free_message( msg );
|
||||
break;
|
||||
|
@ -1630,13 +1619,6 @@ DECL_HANDLER(send_message)
|
|||
set_queue_bits( recv_queue, QS_SENDMESSAGE );
|
||||
break;
|
||||
case MSG_POSTED:
|
||||
/* needed for posted DDE messages */
|
||||
msg->data_size = get_req_data_size();
|
||||
if (msg->data_size && !(msg->data = memdup( get_req_data(), msg->data_size )))
|
||||
{
|
||||
free( msg );
|
||||
break;
|
||||
}
|
||||
list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry );
|
||||
set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
|
||||
break;
|
||||
|
|
|
@ -2098,11 +2098,9 @@ static void dump_send_message_request( const struct send_message_request *req )
|
|||
fprintf( stderr, " msg=%08x,", req->msg );
|
||||
fprintf( stderr, " wparam=%lx,", req->wparam );
|
||||
fprintf( stderr, " lparam=%lx,", req->lparam );
|
||||
fprintf( stderr, " info=%lx,", req->info );
|
||||
fprintf( stderr, " timeout=%d,", req->timeout );
|
||||
fprintf( stderr, " callback=%p,", req->callback );
|
||||
fprintf( stderr, " data=" );
|
||||
dump_varargs_bytes( cur_size );
|
||||
dump_varargs_message_data( cur_size );
|
||||
}
|
||||
|
||||
static void dump_post_quit_message_request( const struct post_quit_message_request *req )
|
||||
|
|
Loading…
Reference in New Issue