Commit 2705e6c3 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Also enforce the size of varargs data structures.

parent 2f3c8be5
......@@ -456,6 +456,7 @@ typedef union
{
enum select_op op;
obj_handle_t handles[MAXIMUM_WAIT_OBJECTS];
int __pad;
} wait;
struct
{
......@@ -6413,7 +6414,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 774
#define SERVER_PROTOCOL_VERSION 775
/* ### protocol_version end ### */
......
......@@ -472,6 +472,7 @@ typedef union
{
enum select_op op; /* SELECT_WAIT or SELECT_WAIT_ALL */
obj_handle_t handles[MAXIMUM_WAIT_OBJECTS];
int __pad;
} wait;
struct
{
......
......@@ -689,13 +689,17 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
C_ASSERT( sizeof(abstime_t) == 8 );
C_ASSERT( sizeof(affinity_t) == 8 );
C_ASSERT( sizeof(apc_call_t) == 48 );
C_ASSERT( sizeof(apc_param_t) == 8 );
C_ASSERT( sizeof(apc_result_t) == 40 );
C_ASSERT( sizeof(async_data_t) == 40 );
C_ASSERT( sizeof(atom_t) == 4 );
C_ASSERT( sizeof(char) == 1 );
C_ASSERT( sizeof(client_ptr_t) == 8 );
C_ASSERT( sizeof(context_t) == 1720 );
C_ASSERT( sizeof(cursor_pos_t) == 24 );
C_ASSERT( sizeof(data_size_t) == 4 );
C_ASSERT( sizeof(debug_event_t) == 160 );
C_ASSERT( sizeof(file_pos_t) == 8 );
C_ASSERT( sizeof(generic_map_t) == 16 );
C_ASSERT( sizeof(hw_input_t) == 40 );
......@@ -704,17 +708,31 @@ C_ASSERT( sizeof(ioctl_code_t) == 4 );
C_ASSERT( sizeof(irp_params_t) == 32 );
C_ASSERT( sizeof(lparam_t) == 8 );
C_ASSERT( sizeof(mem_size_t) == 8 );
C_ASSERT( sizeof(message_data_t) == 56 );
C_ASSERT( sizeof(mod_handle_t) == 8 );
C_ASSERT( sizeof(obj_handle_t) == 4 );
C_ASSERT( sizeof(pe_image_info_t) == 80 );
C_ASSERT( sizeof(process_id_t) == 4 );
C_ASSERT( sizeof(property_data_t) == 16 );
C_ASSERT( sizeof(rectangle_t) == 16 );
C_ASSERT( sizeof(select_op_t) == 264 );
C_ASSERT( sizeof(short int) == 2 );
C_ASSERT( sizeof(startup_info_t) == 92 );
C_ASSERT( sizeof(struct filesystem_event) == 12 );
C_ASSERT( sizeof(struct handle_info) == 20 );
C_ASSERT( sizeof(struct luid) == 8 );
C_ASSERT( sizeof(struct luid_attr) == 12 );
C_ASSERT( sizeof(struct object_attributes) == 16 );
C_ASSERT( sizeof(struct object_type_info) == 44 );
C_ASSERT( sizeof(struct process_info) == 40 );
C_ASSERT( sizeof(struct rawinput_device) == 12 );
C_ASSERT( sizeof(struct thread_info) == 40 );
C_ASSERT( sizeof(thread_id_t) == 4 );
C_ASSERT( sizeof(timeout_t) == 8 );
C_ASSERT( sizeof(unsigned char) == 1 );
C_ASSERT( sizeof(unsigned int) == 4 );
C_ASSERT( sizeof(unsigned short) == 2 );
C_ASSERT( sizeof(user_apc_t) == 40 );
C_ASSERT( sizeof(user_handle_t) == 4 );
C_ASSERT( FIELD_OFFSET(struct new_process_request, token) == 12 );
C_ASSERT( FIELD_OFFSET(struct new_process_request, debug) == 16 );
......
......@@ -52,6 +52,25 @@ my %formats =
"generic_map_t" => [ 16, 4, "&dump_generic_map" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
"hw_input_t" => [ 40, 8, "&dump_hw_input" ],
# varargs-only structures
"apc_call_t" => [ 48, 8 ],
"context_t" => [ 1720, 8 ],
"cursor_pos_t" => [ 24, 8 ],
"debug_event_t" => [ 160, 8 ],
"message_data_t" => [ 56, 8 ],
"pe_image_info_t" => [ 80, 8 ],
"property_data_t" => [ 16, 8 ],
"select_op_t" => [ 264, 8 ],
"startup_info_t" => [ 92, 4 ],
"user_apc_t" => [ 40, 8 ],
"struct filesystem_event" => [ 12, 4 ],
"struct handle_info" => [ 20, 4 ],
"struct luid_attr" => [ 12, 4 ],
"struct object_attributes" => [ 16, 4 ],
"struct object_type_info" => [ 44, 4 ],
"struct process_info" => [ 40, 8 ],
"struct rawinput_device" => [ 12, 4 ],
"struct thread_info" => [ 40, 8 ],
);
my @requests = ();
......@@ -479,7 +498,8 @@ push @request_lines, "};\n\n";
foreach my $type (sort keys %formats)
{
my $size = ${$formats{$type}}[0];
my ($size, $align) = @{$formats{$type}};
die "$type: invalid size $size for alignment $align" if $size % $align;
push @request_lines, "C_ASSERT( sizeof($type) == $size );\n";
}
push @request_lines, @asserts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment