From 4c0103e58c0731f798c6a676376fcc6ea69f891b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 15 Nov 2024 16:22:14 +0100 Subject: [PATCH] server: Use an explicit union instead of a typedef for APC results. --- dlls/ntdll/unix/server.c | 8 ++++---- dlls/ntdll/unix/thread.c | 2 +- dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 24 ++++++++++++------------ include/wine/server_protocol.h | 6 +++--- server/protocol.def | 6 +++--- server/request_handlers.h | 2 +- server/request_trace.h | 2 +- server/thread.c | 4 ++-- server/trace.c | 4 ++-- tools/make_requests | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 25618b22ca0..900d6f0746f 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -364,7 +364,7 @@ static NTSTATUS invoke_user_apc( CONTEXT *context, const user_apc_t *apc, NTSTAT /*********************************************************************** * 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; void *addr; @@ -694,7 +694,7 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT int cookie; obj_handle_t apc_handle = 0; BOOL suspend_context = !!context; - apc_result_t result; + union apc_result result; sigset_t old_set; int signaled; data_size_t reply_size; @@ -823,7 +823,7 @@ NTSTATUS WINAPI NtTestAlert(void) /*********************************************************************** * 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 (;;) { @@ -1760,7 +1760,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE if ((options & DUPLICATE_CLOSE_SOURCE) && source_process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index a46749b1ca7..186224b812c 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1324,7 +1324,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 7366ffb5268..34682070a11 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -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, const LARGE_INTEGER *timeout ); 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, int *needs_close, enum server_fd_type *type, unsigned int *options ); extern void wine_server_send_fd( int fd ); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index a8883b35fed..6c9b2b3ccc2 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4672,7 +4672,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; unsigned int status; memset( &call, 0, sizeof(call) ); @@ -4818,7 +4818,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -4865,7 +4865,7 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -4963,7 +4963,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5147,7 +5147,7 @@ static unsigned int get_basic_memory_info( HANDLE process, LPCVOID addr, if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5560,7 +5560,7 @@ NTSTATUS WINAPI NtLockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size, if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5597,7 +5597,7 @@ NTSTATUS WINAPI NtUnlockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *size if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5673,7 +5673,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5745,7 +5745,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5789,7 +5789,7 @@ static NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr, ULONG flags ) if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -5974,7 +5974,7 @@ NTSTATUS WINAPI NtFlushVirtualMemory( HANDLE process, LPCVOID *addr_ptr, if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); @@ -6360,7 +6360,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL if (process != NtCurrentProcess()) { union apc_call call; - apc_result_t result; + union apc_result result; memset( &call, 0, sizeof(call) ); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 98b4fa9ba59..3f147a5b999 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -622,7 +622,7 @@ union apc_call } dup_handle; }; -typedef union +union apc_result { enum apc_type type; struct @@ -732,7 +732,7 @@ typedef union enum apc_type type; unsigned int status; } break_process; -} apc_result_t; +}; enum irp_type { @@ -1343,7 +1343,7 @@ struct get_apc_result_request struct get_apc_result_reply { struct reply_header __header; - apc_result_t result; + union apc_result result; }; diff --git a/server/protocol.def b/server/protocol.def index 9a5a232f0ae..014542a48f5 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -638,7 +638,7 @@ union apc_call } dup_handle; }; -typedef union +union apc_result { enum apc_type type; struct @@ -748,7 +748,7 @@ typedef union enum apc_type type; /* APC_BREAK_PROCESS */ unsigned int status; /* status returned by call */ } break_process; -} apc_result_t; +}; enum irp_type { @@ -1232,7 +1232,7 @@ typedef struct @REQ(get_apc_result) obj_handle_t handle; /* handle to the APC */ @REPLY - apc_result_t result; /* result of the APC */ + union apc_result result; /* result of the APC */ @END diff --git a/server/request_handlers.h b/server/request_handlers.h index 3c7d545ce58..251f8ef6ca5 100644 --- a/server/request_handlers.h +++ b/server/request_handlers.h @@ -598,7 +598,6 @@ 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_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 ); @@ -641,6 +640,7 @@ C_ASSERT( sizeof(thread_id_t) == 4 ); C_ASSERT( sizeof(timeout_t) == 8 ); C_ASSERT( sizeof(udp_endpoint) == 32 ); C_ASSERT( sizeof(union apc_call) == 64 ); +C_ASSERT( sizeof(union apc_result) == 40 ); C_ASSERT( sizeof(unsigned __int64) == 8 ); C_ASSERT( sizeof(unsigned char) == 1 ); C_ASSERT( sizeof(unsigned int) == 4 ); diff --git a/server/request_trace.h b/server/request_trace.h index 4a940382ede..da7cc60591d 100644 --- a/server/request_trace.h +++ b/server/request_trace.h @@ -6,7 +6,7 @@ */ 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_generic_map( const char *prefix, const generic_map_t *val ); static void dump_hw_input( const char *prefix, const hw_input_t *val ); diff --git a/server/thread.c b/server/thread.c index ca1d361e4e5..a25dc025257 100644 --- a/server/thread.c +++ b/server/thread.c @@ -80,7 +80,7 @@ struct thread_apc struct object *owner; /* object that queued this apc */ int executed; /* has it been executed by the client? */ 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 ); @@ -1584,7 +1584,7 @@ DECL_HANDLER(select) data_size_t op_size, ctx_size; struct context *ctx; struct thread_apc *apc; - const apc_result_t *result = get_req_data(); + const union apc_result *result = get_req_data(); unsigned int ctx_count; if (get_req_data_size() < sizeof(*result)) goto invalid_param; diff --git a/server/trace.c b/server/trace.c index a6aac03b9a3..b1206d7d2cb 100644 --- a/server/trace.c +++ b/server/trace.c @@ -293,7 +293,7 @@ static void dump_apc_call( const char *prefix, const union apc_call *call ) 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 ); 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 ) { - const apc_result_t *result = cur_data; + const union apc_result *result = cur_data; if (size >= sizeof(*result)) { diff --git a/tools/make_requests b/tools/make_requests index 3e1ec918b1d..321eea70615 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -38,7 +38,6 @@ my %formats = "timeout_t" => [ 8, 8 ], "abstime_t" => [ 8, 8 ], "rectangle_t" => [ 16, 4 ], - "apc_result_t" => [ 40, 8 ], "async_data_t" => [ 40, 8 ], "irp_params_t" => [ 32, 8 ], "generic_map_t" => [ 16, 4 ], @@ -58,6 +57,7 @@ my %formats = "udp_endpoint" => [ 32, 4 ], "user_apc_t" => [ 40, 8 ], "union apc_call" => [ 64, 8 ], + "union apc_result" => [ 40, 8 ], "struct filesystem_event" => [ 12, 4 ], "struct handle_info" => [ 20, 4 ], "struct luid" => [ 8, 4 ],