From 8c8c665a3ca8ee957dfa0818e3f19768dfffac82 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 31 Dec 2008 15:14:29 +0100 Subject: [PATCH] server: Reorganize some requests to avoid padding, and make remaining padding explicit. --- include/wine/server_protocol.h | 22 ++++++++++++---------- server/protocol.def | 20 +++++++++++--------- server/queue.c | 1 + server/trace.c | 22 +++++++++++++--------- tools/make_requests | 1 + 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 727d22c8749..c669d284033 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -180,6 +180,7 @@ struct hardware_msg_data int x; int y; unsigned int hw_id; + int __pad; }; struct callback_msg_data @@ -569,8 +570,8 @@ struct init_thread_reply struct reply_header __header; process_id_t pid; thread_id_t tid; - data_size_t info_size; timeout_t server_start; + data_size_t info_size; int version; }; @@ -747,6 +748,7 @@ struct load_dll_reply struct unload_dll_request { struct request_header __header; + int __pad; mod_handle_t base; }; struct unload_dll_reply @@ -1690,8 +1692,8 @@ struct create_mapping_request struct request_header __header; unsigned int access; unsigned int attributes; - mem_size_t size; unsigned int protect; + mem_size_t size; obj_handle_t file_handle; /* VARARG(objattr,object_attributes); */ }; @@ -2681,8 +2683,8 @@ struct register_async_request { struct request_header __header; int type; - int count; async_data_t async; + int count; }; struct register_async_reply { @@ -2745,11 +2747,11 @@ struct create_named_pipe_request unsigned int attributes; obj_handle_t rootdir; unsigned int options; - unsigned int flags; unsigned int maxinstances; unsigned int outsize; unsigned int insize; timeout_t timeout; + unsigned int flags; /* VARARG(name,unicode_str); */ }; struct create_named_pipe_reply @@ -3932,8 +3934,8 @@ struct create_mailslot_request unsigned int access; unsigned int attributes; obj_handle_t rootdir; - unsigned int max_msgsize; timeout_t read_timeout; + unsigned int max_msgsize; /* VARARG(name,unicode_str); */ }; struct create_mailslot_reply @@ -3948,14 +3950,14 @@ struct set_mailslot_info_request { struct request_header __header; obj_handle_t handle; - unsigned int flags; timeout_t read_timeout; + unsigned int flags; }; struct set_mailslot_info_reply { struct reply_header __header; - unsigned int max_msgsize; timeout_t read_timeout; + unsigned int max_msgsize; }; #define MAILSLOT_SET_READ_TIMEOUT 1 @@ -4126,8 +4128,8 @@ struct create_device_request unsigned int access; unsigned int attributes; obj_handle_t rootdir; - obj_handle_t manager; client_ptr_t user_ptr; + obj_handle_t manager; /* VARARG(name,unicode_str); */ }; struct create_device_reply @@ -4283,8 +4285,8 @@ struct set_completion_info_request { struct request_header __header; obj_handle_t handle; - obj_handle_t chandle; apc_param_t ckey; + obj_handle_t chandle; }; struct set_completion_info_reply { @@ -5061,6 +5063,6 @@ union generic_reply struct set_window_layered_info_reply set_window_layered_info_reply; }; -#define SERVER_PROTOCOL_VERSION 377 +#define SERVER_PROTOCOL_VERSION 378 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index e14aefe3cec..737714f7bc4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -196,6 +196,7 @@ struct hardware_msg_data int x; /* x position */ int y; /* y position */ unsigned int hw_id; /* unique id */ + int __pad; }; struct callback_msg_data @@ -554,8 +555,8 @@ typedef union @REPLY process_id_t pid; /* process id of the new thread's process */ thread_id_t tid; /* thread id of the new thread */ - data_size_t info_size; /* total size of startup info */ timeout_t server_start; /* server start time */ + data_size_t info_size; /* total size of startup info */ int version; /* protocol version */ @END @@ -677,6 +678,7 @@ typedef union /* Notify the server that a dll is being unloaded */ @REQ(unload_dll) + int __pad; mod_handle_t base; /* base address */ @END @@ -1335,8 +1337,8 @@ enum char_info_mode @REQ(create_mapping) unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ - mem_size_t size; /* mapping size */ unsigned int protect; /* protection flags (see below) */ + mem_size_t size; /* mapping size */ obj_handle_t file_handle; /* file handle */ VARARG(objattr,object_attributes); /* object attributes */ @REPLY @@ -1986,8 +1988,8 @@ enum message_type /* Create an async I/O */ @REQ(register_async) int type; /* type of queue to look after */ - int count; /* count - usually # of bytes to be read/written */ async_data_t async; /* async I/O parameters */ + int count; /* count - usually # of bytes to be read/written */ @END #define ASYNC_TYPE_READ 0x01 #define ASYNC_TYPE_WRITE 0x02 @@ -2028,11 +2030,11 @@ enum message_type unsigned int attributes; /* object attributes */ obj_handle_t rootdir; /* root directory */ unsigned int options; - unsigned int flags; unsigned int maxinstances; unsigned int outsize; unsigned int insize; timeout_t timeout; + unsigned int flags; VARARG(name,unicode_str); /* pipe name */ @REPLY obj_handle_t handle; /* handle to the pipe */ @@ -2841,8 +2843,8 @@ enum message_type unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ obj_handle_t rootdir; /* root directory */ - unsigned int max_msgsize; timeout_t read_timeout; + unsigned int max_msgsize; VARARG(name,unicode_str); /* mailslot name */ @REPLY obj_handle_t handle; /* handle to the mailslot */ @@ -2852,11 +2854,11 @@ enum message_type /* Set mailslot information */ @REQ(set_mailslot_info) obj_handle_t handle; /* handle to the mailslot */ + timeout_t read_timeout; unsigned int flags; - timeout_t read_timeout; @REPLY - unsigned int max_msgsize; timeout_t read_timeout; + unsigned int max_msgsize; @END #define MAILSLOT_SET_READ_TIMEOUT 1 @@ -2969,8 +2971,8 @@ enum message_type unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ obj_handle_t rootdir; /* root directory */ - obj_handle_t manager; /* device manager */ client_ptr_t user_ptr; /* opaque ptr for use by client */ + obj_handle_t manager; /* device manager */ VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the device */ @@ -3074,8 +3076,8 @@ enum message_type /* associate object with completion port */ @REQ(set_completion_info) obj_handle_t handle; /* object handle */ - obj_handle_t chandle; /* port handle */ apc_param_t ckey; /* completion key */ + obj_handle_t chandle; /* port handle */ @END diff --git a/server/queue.c b/server/queue.c index 697a268fa33..ab524a7e1e4 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1723,6 +1723,7 @@ DECL_HANDLER(send_hardware_message) release_object( thread ); return; } + memset( data, 0, sizeof(*data) ); data->x = req->x; data->y = req->y; data->info = req->info; diff --git a/server/trace.c b/server/trace.c index 7fc865eaee7..557880d8721 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1004,10 +1004,10 @@ static void dump_init_thread_reply( const struct init_thread_reply *req ) { fprintf( stderr, " pid=%04x,", req->pid ); fprintf( stderr, " tid=%04x,", req->tid ); - fprintf( stderr, " info_size=%u,", req->info_size ); fprintf( stderr, " server_start=" ); dump_timeout( &req->server_start ); fprintf( stderr, "," ); + fprintf( stderr, " info_size=%u,", req->info_size ); fprintf( stderr, " version=%d", req->version ); } @@ -1841,10 +1841,10 @@ static void dump_create_mapping_request( const struct create_mapping_request *re { fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); + fprintf( stderr, " protect=%08x,", req->protect ); fprintf( stderr, " size=" ); dump_uint64( &req->size ); fprintf( stderr, "," ); - fprintf( stderr, " protect=%08x,", req->protect ); fprintf( stderr, " file_handle=%04x,", req->file_handle ); fprintf( stderr, " objattr=" ); dump_varargs_object_attributes( cur_size ); @@ -2606,9 +2606,10 @@ static void dump_set_serial_info_request( const struct set_serial_info_request * static void dump_register_async_request( const struct register_async_request *req ) { fprintf( stderr, " type=%d,", req->type ); - fprintf( stderr, " count=%d,", req->count ); fprintf( stderr, " async=" ); dump_async_data( &req->async ); + fprintf( stderr, "," ); + fprintf( stderr, " count=%d", req->count ); } static void dump_cancel_async_request( const struct cancel_async_request *req ) @@ -2656,13 +2657,13 @@ static void dump_create_named_pipe_request( const struct create_named_pipe_reque fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " rootdir=%04x,", req->rootdir ); fprintf( stderr, " options=%08x,", req->options ); - fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " maxinstances=%08x,", req->maxinstances ); fprintf( stderr, " outsize=%08x,", req->outsize ); fprintf( stderr, " insize=%08x,", req->insize ); fprintf( stderr, " timeout=" ); dump_timeout( &req->timeout ); fprintf( stderr, "," ); + fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } @@ -3650,10 +3651,10 @@ static void dump_create_mailslot_request( const struct create_mailslot_request * fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " rootdir=%04x,", req->rootdir ); - fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize ); fprintf( stderr, " read_timeout=" ); dump_timeout( &req->read_timeout ); fprintf( stderr, "," ); + fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } @@ -3666,16 +3667,18 @@ static void dump_create_mailslot_reply( const struct create_mailslot_reply *req static void dump_set_mailslot_info_request( const struct set_mailslot_info_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); - fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " read_timeout=" ); dump_timeout( &req->read_timeout ); + fprintf( stderr, "," ); + fprintf( stderr, " flags=%08x", req->flags ); } static void dump_set_mailslot_info_reply( const struct set_mailslot_info_reply *req ) { - fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize ); fprintf( stderr, " read_timeout=" ); dump_timeout( &req->read_timeout ); + fprintf( stderr, "," ); + fprintf( stderr, " max_msgsize=%08x", req->max_msgsize ); } static void dump_create_directory_request( const struct create_directory_request *req ) @@ -3817,10 +3820,10 @@ static void dump_create_device_request( const struct create_device_request *req fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " rootdir=%04x,", req->rootdir ); - fprintf( stderr, " manager=%04x,", req->manager ); fprintf( stderr, " user_ptr=" ); dump_uint64( &req->user_ptr ); fprintf( stderr, "," ); + fprintf( stderr, " manager=%04x,", req->manager ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } @@ -3959,9 +3962,10 @@ static void dump_query_completion_reply( const struct query_completion_reply *re static void dump_set_completion_info_request( const struct set_completion_info_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); - fprintf( stderr, " chandle=%04x,", req->chandle ); fprintf( stderr, " ckey=" ); dump_uint64( &req->ckey ); + fprintf( stderr, "," ); + fprintf( stderr, " chandle=%04x", req->chandle ); } static void dump_add_fd_completion_request( const struct add_fd_completion_request *req ) diff --git a/tools/make_requests b/tools/make_requests index 31301ce75c3..00a34205064 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -71,6 +71,7 @@ sub DO_DUMP_FUNC($$@) { my $type = shift; my $var = shift; + next if $var =~ /^__pad/; if (defined($formats{$type})) { my $fmt = ${$formats{$type}}[2];