Commit 8843bc14 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 4273b0d9
...@@ -401,6 +401,7 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) ...@@ -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.total = iosb->Information;
result->async_io.apc = wine_server_client_ptr( apc ); result->async_io.apc = wine_server_client_ptr( apc );
result->async_io.arg = call->async_io.user;
} }
break; break;
} }
......
...@@ -554,6 +554,7 @@ typedef union ...@@ -554,6 +554,7 @@ typedef union
enum apc_type type; enum apc_type type;
unsigned int status; unsigned int status;
client_ptr_t apc; client_ptr_t apc;
client_ptr_t arg;
unsigned int total; unsigned int total;
} async_io; } async_io;
struct struct
...@@ -5847,6 +5848,6 @@ union generic_reply ...@@ -5847,6 +5848,6 @@ union generic_reply
struct set_suspend_context_reply set_suspend_context_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 */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -262,7 +262,8 @@ static void add_async_completion( struct async_queue *queue, apc_param_t cvalue, ...@@ -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 */ /* 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; struct async *async = (struct async *)obj;
...@@ -293,7 +294,7 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota ...@@ -293,7 +294,7 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
memset( &data, 0, sizeof(data) ); memset( &data, 0, sizeof(data) );
data.type = APC_USER; data.type = APC_USER;
data.user.func = apc; 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[1] = async->data.iosb;
data.user.args[2] = 0; data.user.args[2] = 0;
thread_queue_apc( async->thread, NULL, &data ); thread_queue_apc( async->thread, NULL, &data );
......
...@@ -159,7 +159,7 @@ extern struct async *create_async( struct thread *thread, struct async_queue *qu ...@@ -159,7 +159,7 @@ extern struct async *create_async( struct thread *thread, struct async_queue *qu
const async_data_t *data ); const async_data_t *data );
extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); 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, 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_queued( struct async_queue *queue );
extern int async_waiting( struct async_queue *queue ); extern int async_waiting( struct async_queue *queue );
extern void async_terminate( struct async *async, unsigned int status ); extern void async_terminate( struct async *async, unsigned int status );
......
...@@ -570,6 +570,7 @@ typedef union ...@@ -570,6 +570,7 @@ typedef union
enum apc_type type; /* APC_ASYNC_IO */ enum apc_type type; /* APC_ASYNC_IO */
unsigned int status; /* new status of async operation */ unsigned int status; /* new status of async operation */
client_ptr_t apc; /* user APC to call */ client_ptr_t apc; /* user APC to call */
client_ptr_t arg; /* user APC argument */
unsigned int total; /* bytes transferred */ unsigned int total; /* bytes transferred */
} async_io; } async_io;
struct struct
......
...@@ -1451,8 +1451,8 @@ DECL_HANDLER(select) ...@@ -1451,8 +1451,8 @@ DECL_HANDLER(select)
else if (apc->result.type == APC_ASYNC_IO) else if (apc->result.type == APC_ASYNC_IO)
{ {
if (apc->owner) if (apc->owner)
async_set_result( apc->owner, apc->result.async_io.status, async_set_result( apc->owner, apc->result.async_io.status, apc->result.async_io.total,
apc->result.async_io.total, apc->result.async_io.apc ); apc->result.async_io.apc, apc->result.async_io.arg );
} }
wake_up( &apc->obj, 0 ); wake_up( &apc->obj, 0 );
close_handle( current->process, req->prev_apc ); close_handle( current->process, req->prev_apc );
......
...@@ -227,6 +227,7 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result ) ...@@ -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", fprintf( stderr, "APC_ASYNC_IO,status=%s,total=%u",
get_status_name( result->async_io.status ), result->async_io.total ); get_status_name( result->async_io.status ), result->async_io.total );
dump_uint64( ",apc=", &result->async_io.apc ); dump_uint64( ",apc=", &result->async_io.apc );
dump_uint64( ",arg=", &result->async_io.arg );
break; break;
case APC_VIRTUAL_ALLOC: case APC_VIRTUAL_ALLOC:
fprintf( stderr, "APC_VIRTUAL_ALLOC,status=%s", fprintf( stderr, "APC_VIRTUAL_ALLOC,status=%s",
......
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