server: Send the APC call data as vararg in the queue_apc request.

To make it possible to support a larger structure.
This commit is contained in:
Alexandre Julliard 2023-06-06 15:55:51 +02:00
parent 0d4f20ca18
commit e3049f11fa
7 changed files with 31 additions and 15 deletions

View file

@ -819,7 +819,7 @@ unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, a
SERVER_START_REQ( queue_apc )
{
req->handle = wine_server_obj_handle( process );
req->call = *call;
wine_server_add_data( req, call, sizeof(*call) );
if (!(ret = wine_server_call( req )))
{
handle = wine_server_ptr_handle( reply->handle );

View file

@ -1680,19 +1680,20 @@ NTSTATUS WINAPI NtQueueApcThread( HANDLE handle, PNTAPCFUNC func, ULONG_PTR arg1
ULONG_PTR arg2, ULONG_PTR arg3 )
{
unsigned int ret;
apc_call_t call;
SERVER_START_REQ( queue_apc )
{
req->handle = wine_server_obj_handle( handle );
if (func)
{
req->call.type = APC_USER;
req->call.user.func = wine_server_client_ptr( func );
req->call.user.args[0] = arg1;
req->call.user.args[1] = arg2;
req->call.user.args[2] = arg3;
call.type = APC_USER;
call.user.func = wine_server_client_ptr( func );
call.user.args[0] = arg1;
call.user.args[1] = arg2;
call.user.args[2] = arg3;
wine_server_add_data( req, &call, sizeof(call) );
}
else req->call.type = APC_NONE; /* wake up only */
ret = wine_server_call( req );
}
SERVER_END_REQ;

View file

@ -1236,7 +1236,7 @@ struct queue_apc_request
{
struct request_header __header;
obj_handle_t handle;
apc_call_t call;
/* VARARG(call,apc_call); */
};
struct queue_apc_reply
{
@ -6413,7 +6413,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 772
#define SERVER_PROTOCOL_VERSION 773
/* ### protocol_version end ### */

View file

@ -1133,7 +1133,7 @@ typedef struct
/* Queue an APC for a thread or process */
@REQ(queue_apc)
obj_handle_t handle; /* thread or process handle */
apc_call_t call; /* call arguments */
VARARG(call,apc_call); /* call arguments */
@REPLY
obj_handle_t handle; /* APC handle */
int self; /* run APC in caller itself? */

View file

@ -861,8 +861,7 @@ C_ASSERT( sizeof(struct resume_thread_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct resume_thread_reply, count) == 8 );
C_ASSERT( sizeof(struct resume_thread_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct queue_apc_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct queue_apc_request, call) == 16 );
C_ASSERT( sizeof(struct queue_apc_request) == 64 );
C_ASSERT( sizeof(struct queue_apc_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct queue_apc_reply, handle) == 8 );
C_ASSERT( FIELD_OFFSET(struct queue_apc_reply, self) == 12 );
C_ASSERT( sizeof(struct queue_apc_reply) == 16 );

View file

@ -514,7 +514,8 @@ static struct thread_apc *create_apc( struct object *owner, const apc_call_t *ca
if ((apc = alloc_object( &thread_apc_ops )))
{
apc->call = *call_data;
if (call_data) apc->call = *call_data;
else apc->call.type = APC_NONE;
apc->caller = NULL;
apc->owner = owner;
apc->executed = 0;
@ -1701,8 +1702,11 @@ DECL_HANDLER(queue_apc)
struct thread *thread = NULL;
struct process *process = NULL;
struct thread_apc *apc;
const apc_call_t *call = get_req_data();
if (!(apc = create_apc( NULL, &req->call ))) return;
if (get_req_data_size() < sizeof(*call)) call = NULL;
if (!(apc = create_apc( NULL, call ))) return;
switch (apc->call.type)
{

View file

@ -540,6 +540,18 @@ static void dump_varargs_ushorts( const char *prefix, data_size_t size )
remove_data( size );
}
static void dump_varargs_apc_call( const char *prefix, data_size_t size )
{
const apc_call_t *call = cur_data;
if (size >= sizeof(*call))
{
dump_apc_call( prefix, call );
size = sizeof(*call);
}
remove_data( size );
}
static void dump_varargs_apc_result( const char *prefix, data_size_t size )
{
const apc_result_t *result = cur_data;
@ -1640,7 +1652,7 @@ static void dump_resume_thread_reply( const struct resume_thread_reply *req )
static void dump_queue_apc_request( const struct queue_apc_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
dump_apc_call( ", call=", &req->call );
dump_varargs_apc_call( ", call=", cur_size );
}
static void dump_queue_apc_reply( const struct queue_apc_reply *req )