server: Allow passing an argument for the user APC async I/O callbacks.

This commit is contained in:
Alexandre Julliard 2015-03-03 15:52:23 +09:00
parent 4273b0d938
commit 8843bc144d
7 changed files with 11 additions and 6 deletions

View File

@ -401,6 +401,7 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
{
result->async_io.total = iosb->Information;
result->async_io.apc = wine_server_client_ptr( apc );
result->async_io.arg = call->async_io.user;
}
break;
}

View File

@ -554,6 +554,7 @@ typedef union
enum apc_type type;
unsigned int status;
client_ptr_t apc;
client_ptr_t arg;
unsigned int total;
} async_io;
struct
@ -5847,6 +5848,6 @@ union generic_reply
struct set_suspend_context_reply set_suspend_context_reply;
};
#define SERVER_PROTOCOL_VERSION 458
#define SERVER_PROTOCOL_VERSION 459
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -262,7 +262,8 @@ static void add_async_completion( struct async_queue *queue, apc_param_t cvalue,
}
/* store the result of the client-side async callback */
void async_set_result( struct object *obj, unsigned int status, apc_param_t total, client_ptr_t apc )
void async_set_result( struct object *obj, unsigned int status, apc_param_t total,
client_ptr_t apc, client_ptr_t apc_arg )
{
struct async *async = (struct async *)obj;
@ -293,7 +294,7 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
memset( &data, 0, sizeof(data) );
data.type = APC_USER;
data.user.func = apc;
data.user.args[0] = async->data.arg;
data.user.args[0] = apc_arg;
data.user.args[1] = async->data.iosb;
data.user.args[2] = 0;
thread_queue_apc( async->thread, NULL, &data );

View File

@ -159,7 +159,7 @@ extern struct async *create_async( struct thread *thread, struct async_queue *qu
const async_data_t *data );
extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status );
extern void async_set_result( struct object *obj, unsigned int status,
apc_param_t total, client_ptr_t apc );
apc_param_t total, client_ptr_t apc, client_ptr_t apc_arg );
extern int async_queued( struct async_queue *queue );
extern int async_waiting( struct async_queue *queue );
extern void async_terminate( struct async *async, unsigned int status );

View File

@ -570,6 +570,7 @@ typedef union
enum apc_type type; /* APC_ASYNC_IO */
unsigned int status; /* new status of async operation */
client_ptr_t apc; /* user APC to call */
client_ptr_t arg; /* user APC argument */
unsigned int total; /* bytes transferred */
} async_io;
struct

View File

@ -1451,8 +1451,8 @@ DECL_HANDLER(select)
else if (apc->result.type == APC_ASYNC_IO)
{
if (apc->owner)
async_set_result( apc->owner, apc->result.async_io.status,
apc->result.async_io.total, apc->result.async_io.apc );
async_set_result( apc->owner, apc->result.async_io.status, apc->result.async_io.total,
apc->result.async_io.apc, apc->result.async_io.arg );
}
wake_up( &apc->obj, 0 );
close_handle( current->process, req->prev_apc );

View File

@ -227,6 +227,7 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result )
fprintf( stderr, "APC_ASYNC_IO,status=%s,total=%u",
get_status_name( result->async_io.status ), result->async_io.total );
dump_uint64( ",apc=", &result->async_io.apc );
dump_uint64( ",arg=", &result->async_io.arg );
break;
case APC_VIRTUAL_ALLOC:
fprintf( stderr, "APC_VIRTUAL_ALLOC,status=%s",