server: Use an explicit union instead of a typedef for APC results.

This commit is contained in:
Alexandre Julliard 2024-11-15 16:22:14 +01:00
parent 1137a10ef7
commit 4c0103e58c
11 changed files with 31 additions and 31 deletions

View file

@ -364,7 +364,7 @@ static NTSTATUS invoke_user_apc( CONTEXT *context, const user_apc_t *apc, NTSTAT
/*********************************************************************** /***********************************************************************
* invoke_system_apc * invoke_system_apc
*/ */
static void invoke_system_apc( const union apc_call *call, apc_result_t *result, BOOL self ) static void invoke_system_apc( const union apc_call *call, union apc_result *result, BOOL self )
{ {
SIZE_T size, bits; SIZE_T size, bits;
void *addr; void *addr;
@ -694,7 +694,7 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
int cookie; int cookie;
obj_handle_t apc_handle = 0; obj_handle_t apc_handle = 0;
BOOL suspend_context = !!context; BOOL suspend_context = !!context;
apc_result_t result; union apc_result result;
sigset_t old_set; sigset_t old_set;
int signaled; int signaled;
data_size_t reply_size; data_size_t reply_size;
@ -823,7 +823,7 @@ NTSTATUS WINAPI NtTestAlert(void)
/*********************************************************************** /***********************************************************************
* server_queue_process_apc * server_queue_process_apc
*/ */
unsigned int server_queue_process_apc( HANDLE process, const union apc_call *call, apc_result_t *result ) unsigned int server_queue_process_apc( HANDLE process, const union apc_call *call, union apc_result *result )
{ {
for (;;) for (;;)
{ {
@ -1760,7 +1760,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE
if ((options & DUPLICATE_CLOSE_SOURCE) && source_process != NtCurrentProcess()) if ((options & DUPLICATE_CLOSE_SOURCE) && source_process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );

View file

@ -1324,7 +1324,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );

View file

@ -213,7 +213,7 @@ extern unsigned int server_select( const select_op_t *select_op, data_size_t siz
extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags, extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags,
const LARGE_INTEGER *timeout ); const LARGE_INTEGER *timeout );
extern unsigned int server_queue_process_apc( HANDLE process, const union apc_call *call, extern unsigned int server_queue_process_apc( HANDLE process, const union apc_call *call,
apc_result_t *result ); union apc_result *result );
extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd, extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ); int *needs_close, enum server_fd_type *type, unsigned int *options );
extern void wine_server_send_fd( int fd ); extern void wine_server_send_fd( int fd );

View file

@ -4672,7 +4672,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
unsigned int status; unsigned int status;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -4818,7 +4818,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -4865,7 +4865,7 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -4963,7 +4963,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5147,7 +5147,7 @@ static unsigned int get_basic_memory_info( HANDLE process, LPCVOID addr,
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5560,7 +5560,7 @@ NTSTATUS WINAPI NtLockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size,
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5597,7 +5597,7 @@ NTSTATUS WINAPI NtUnlockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5673,7 +5673,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5745,7 +5745,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5789,7 +5789,7 @@ static NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr, ULONG flags )
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -5974,7 +5974,7 @@ NTSTATUS WINAPI NtFlushVirtualMemory( HANDLE process, LPCVOID *addr_ptr,
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );
@ -6360,7 +6360,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL
if (process != NtCurrentProcess()) if (process != NtCurrentProcess())
{ {
union apc_call call; union apc_call call;
apc_result_t result; union apc_result result;
memset( &call, 0, sizeof(call) ); memset( &call, 0, sizeof(call) );

View file

@ -622,7 +622,7 @@ union apc_call
} dup_handle; } dup_handle;
}; };
typedef union union apc_result
{ {
enum apc_type type; enum apc_type type;
struct struct
@ -732,7 +732,7 @@ typedef union
enum apc_type type; enum apc_type type;
unsigned int status; unsigned int status;
} break_process; } break_process;
} apc_result_t; };
enum irp_type enum irp_type
{ {
@ -1343,7 +1343,7 @@ struct get_apc_result_request
struct get_apc_result_reply struct get_apc_result_reply
{ {
struct reply_header __header; struct reply_header __header;
apc_result_t result; union apc_result result;
}; };

View file

@ -638,7 +638,7 @@ union apc_call
} dup_handle; } dup_handle;
}; };
typedef union union apc_result
{ {
enum apc_type type; enum apc_type type;
struct struct
@ -748,7 +748,7 @@ typedef union
enum apc_type type; /* APC_BREAK_PROCESS */ enum apc_type type; /* APC_BREAK_PROCESS */
unsigned int status; /* status returned by call */ unsigned int status; /* status returned by call */
} break_process; } break_process;
} apc_result_t; };
enum irp_type enum irp_type
{ {
@ -1232,7 +1232,7 @@ typedef struct
@REQ(get_apc_result) @REQ(get_apc_result)
obj_handle_t handle; /* handle to the APC */ obj_handle_t handle; /* handle to the APC */
@REPLY @REPLY
apc_result_t result; /* result of the APC */ union apc_result result; /* result of the APC */
@END @END

View file

@ -598,7 +598,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
C_ASSERT( sizeof(abstime_t) == 8 ); C_ASSERT( sizeof(abstime_t) == 8 );
C_ASSERT( sizeof(affinity_t) == 8 ); C_ASSERT( sizeof(affinity_t) == 8 );
C_ASSERT( sizeof(apc_param_t) == 8 ); C_ASSERT( sizeof(apc_param_t) == 8 );
C_ASSERT( sizeof(apc_result_t) == 40 );
C_ASSERT( sizeof(async_data_t) == 40 ); C_ASSERT( sizeof(async_data_t) == 40 );
C_ASSERT( sizeof(atom_t) == 4 ); C_ASSERT( sizeof(atom_t) == 4 );
C_ASSERT( sizeof(char) == 1 ); C_ASSERT( sizeof(char) == 1 );
@ -641,6 +640,7 @@ C_ASSERT( sizeof(thread_id_t) == 4 );
C_ASSERT( sizeof(timeout_t) == 8 ); C_ASSERT( sizeof(timeout_t) == 8 );
C_ASSERT( sizeof(udp_endpoint) == 32 ); C_ASSERT( sizeof(udp_endpoint) == 32 );
C_ASSERT( sizeof(union apc_call) == 64 ); C_ASSERT( sizeof(union apc_call) == 64 );
C_ASSERT( sizeof(union apc_result) == 40 );
C_ASSERT( sizeof(unsigned __int64) == 8 ); C_ASSERT( sizeof(unsigned __int64) == 8 );
C_ASSERT( sizeof(unsigned char) == 1 ); C_ASSERT( sizeof(unsigned char) == 1 );
C_ASSERT( sizeof(unsigned int) == 4 ); C_ASSERT( sizeof(unsigned int) == 4 );

View file

@ -6,7 +6,7 @@
*/ */
static void dump_abstime( const char *prefix, const abstime_t *val ); static void dump_abstime( const char *prefix, const abstime_t *val );
static void dump_apc_result( const char *prefix, const apc_result_t *val ); static void dump_apc_result( const char *prefix, const union apc_result *val );
static void dump_async_data( const char *prefix, const async_data_t *val ); static void dump_async_data( const char *prefix, const async_data_t *val );
static void dump_generic_map( const char *prefix, const generic_map_t *val ); static void dump_generic_map( const char *prefix, const generic_map_t *val );
static void dump_hw_input( const char *prefix, const hw_input_t *val ); static void dump_hw_input( const char *prefix, const hw_input_t *val );

View file

@ -80,7 +80,7 @@ struct thread_apc
struct object *owner; /* object that queued this apc */ struct object *owner; /* object that queued this apc */
int executed; /* has it been executed by the client? */ int executed; /* has it been executed by the client? */
union apc_call call; /* call arguments */ union apc_call call; /* call arguments */
apc_result_t result; /* call results once executed */ union apc_result result; /* call results once executed */
}; };
static void dump_thread_apc( struct object *obj, int verbose ); static void dump_thread_apc( struct object *obj, int verbose );
@ -1584,7 +1584,7 @@ DECL_HANDLER(select)
data_size_t op_size, ctx_size; data_size_t op_size, ctx_size;
struct context *ctx; struct context *ctx;
struct thread_apc *apc; struct thread_apc *apc;
const apc_result_t *result = get_req_data(); const union apc_result *result = get_req_data();
unsigned int ctx_count; unsigned int ctx_count;
if (get_req_data_size() < sizeof(*result)) goto invalid_param; if (get_req_data_size() < sizeof(*result)) goto invalid_param;

View file

@ -293,7 +293,7 @@ static void dump_apc_call( const char *prefix, const union apc_call *call )
fputc( '}', stderr ); fputc( '}', stderr );
} }
static void dump_apc_result( const char *prefix, const apc_result_t *result ) static void dump_apc_result( const char *prefix, const union apc_result *result )
{ {
fprintf( stderr, "%s{", prefix ); fprintf( stderr, "%s{", prefix );
switch(result->type) switch(result->type)
@ -570,7 +570,7 @@ static void dump_varargs_apc_call( const char *prefix, data_size_t size )
static void dump_varargs_apc_result( const char *prefix, data_size_t size ) static void dump_varargs_apc_result( const char *prefix, data_size_t size )
{ {
const apc_result_t *result = cur_data; const union apc_result *result = cur_data;
if (size >= sizeof(*result)) if (size >= sizeof(*result))
{ {

View file

@ -38,7 +38,6 @@ my %formats =
"timeout_t" => [ 8, 8 ], "timeout_t" => [ 8, 8 ],
"abstime_t" => [ 8, 8 ], "abstime_t" => [ 8, 8 ],
"rectangle_t" => [ 16, 4 ], "rectangle_t" => [ 16, 4 ],
"apc_result_t" => [ 40, 8 ],
"async_data_t" => [ 40, 8 ], "async_data_t" => [ 40, 8 ],
"irp_params_t" => [ 32, 8 ], "irp_params_t" => [ 32, 8 ],
"generic_map_t" => [ 16, 4 ], "generic_map_t" => [ 16, 4 ],
@ -58,6 +57,7 @@ my %formats =
"udp_endpoint" => [ 32, 4 ], "udp_endpoint" => [ 32, 4 ],
"user_apc_t" => [ 40, 8 ], "user_apc_t" => [ 40, 8 ],
"union apc_call" => [ 64, 8 ], "union apc_call" => [ 64, 8 ],
"union apc_result" => [ 40, 8 ],
"struct filesystem_event" => [ 12, 4 ], "struct filesystem_event" => [ 12, 4 ],
"struct handle_info" => [ 20, 4 ], "struct handle_info" => [ 20, 4 ],
"struct luid" => [ 8, 4 ], "struct luid" => [ 8, 4 ],