Commit 28c33903 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Pass APC in async_data_t.

Also don't pass callback pointer that's not used anymore. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d92bb525
......@@ -422,12 +422,12 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND
PIO_APC_ROUTINE apc, void *apc_context, IO_STATUS_BLOCK *io )
{
async_data_t async;
async.handle = wine_server_obj_handle( handle );
async.callback = wine_server_client_ptr( user ? user->callback : 0 );
async.arg = wine_server_client_ptr( user );
async.iosb = wine_server_client_ptr( io );
async.event = wine_server_obj_handle( event );
async.cvalue = wine_server_client_ptr( apc ? 0 : apc_context );
async.handle = wine_server_obj_handle( handle );
async.user = wine_server_client_ptr( user );
async.iosb = wine_server_client_ptr( io );
async.event = wine_server_obj_handle( event );
async.apc = wine_server_client_ptr( apc );
async.apc_context = wine_server_client_ptr( apc_context );
return async;
}
......
......@@ -572,13 +572,13 @@ static NTSTATUS register_async( int type, HANDLE handle, struct ws2_async_io *as
SERVER_START_REQ( register_async )
{
req->type = type;
req->async.handle = wine_server_obj_handle( handle );
req->async.callback = wine_server_client_ptr( async->callback );
req->async.arg = wine_server_client_ptr( async );
req->async.iosb = wine_server_client_ptr( io );
req->async.event = wine_server_obj_handle( event );
req->async.cvalue = wine_server_client_ptr( apc ? 0 : apc_context );
req->type = type;
req->async.handle = wine_server_obj_handle( handle );
req->async.user = wine_server_client_ptr( async );
req->async.iosb = wine_server_client_ptr( io );
req->async.event = wine_server_obj_handle( event );
req->async.apc = wine_server_client_ptr( apc );
req->async.apc_context = wine_server_client_ptr( apc_context );
status = wine_server_call( req );
}
SERVER_END_REQ;
......
......@@ -252,10 +252,10 @@ typedef struct
{
obj_handle_t handle;
obj_handle_t event;
client_ptr_t callback;
client_ptr_t iosb;
client_ptr_t arg;
apc_param_t cvalue;
client_ptr_t user;
client_ptr_t apc;
apc_param_t apc_context;
} async_data_t;
......@@ -463,7 +463,6 @@ typedef union
{
enum apc_type type;
unsigned int status;
client_ptr_t func;
client_ptr_t user;
client_ptr_t sb;
} async_io;
......@@ -6412,6 +6411,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 524
#define SERVER_PROTOCOL_VERSION 525
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -180,14 +180,13 @@ void async_terminate( struct async *async, unsigned int status )
async->status = status;
if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status;
if (async->data.callback)
if (async->data.user)
{
apc_call_t data;
memset( &data, 0, sizeof(data) );
data.type = APC_ASYNC_IO;
data.async_io.func = async->data.callback;
data.async_io.user = async->data.arg;
data.async_io.user = async->data.user;
data.async_io.sb = async->data.iosb;
data.async_io.status = status;
thread_queue_apc( async->thread, &async->obj, &data );
......@@ -328,8 +327,8 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
async->status = status;
if (status == STATUS_MORE_PROCESSING_REQUIRED) return; /* don't report the completion */
if (async->queue && async->data.cvalue)
add_async_completion( async->queue, async->data.cvalue, status, total );
if (async->queue && !async->data.apc && async->data.apc_context)
add_async_completion( async->queue, async->data.apc_context, status, total );
if (apc)
{
apc_call_t data;
......@@ -504,7 +503,7 @@ DECL_HANDLER(get_async_result)
struct async *async;
LIST_FOR_EACH_ENTRY( async, &current->process->asyncs, struct async, process_entry )
if (async->data.arg == req->user_arg)
if (async->data.user == req->user_arg)
{
iosb = async->iosb;
break;
......
......@@ -268,10 +268,10 @@ typedef struct
{
obj_handle_t handle; /* object to perform I/O on */
obj_handle_t event; /* event to signal when done */
client_ptr_t callback; /* client-side callback to call upon end of async */
client_ptr_t iosb; /* I/O status block in client addr space */
client_ptr_t arg; /* opaque user data to pass to callback */
apc_param_t cvalue; /* completion value to use for completion events */
client_ptr_t user; /* opaque user data containing callback pointer and async-specific data */
client_ptr_t apc; /* user APC to call */
apc_param_t apc_context; /* user APC context or completion value */
} async_data_t;
/* structures for extra message data */
......@@ -479,7 +479,6 @@ typedef union
{
enum apc_type type; /* APC_ASYNC_IO */
unsigned int status; /* I/O status */
client_ptr_t func; /* unsigned int (*func)(void*, void*, unsigned int, void**, void**); */
client_ptr_t user; /* user pointer */
client_ptr_t sb; /* status block */
} async_io;
......
......@@ -158,8 +158,7 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
dump_uint64( ",arg=", &call->timer.arg );
break;
case APC_ASYNC_IO:
dump_uint64( "APC_ASYNC_IO,func=", &call->async_io.func );
dump_uint64( ",user=", &call->async_io.user );
dump_uint64( "APC_ASYNC_IO,user=", &call->async_io.user );
dump_uint64( ",sb=", &call->async_io.sb );
fprintf( stderr, ",status=%s", get_status_name(call->async_io.status) );
break;
......@@ -305,10 +304,10 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result )
static void dump_async_data( const char *prefix, const async_data_t *data )
{
fprintf( stderr, "%s{handle=%04x,event=%04x", prefix, data->handle, data->event );
dump_uint64( ",callback=", &data->callback );
dump_uint64( ",iosb=", &data->iosb );
dump_uint64( ",arg=", &data->arg );
dump_uint64( ",cvalue=", &data->cvalue );
dump_uint64( ",user=", &data->user );
dump_uint64( ",apc=", &data->apc );
dump_uint64( ",apc_context=", &data->apc_context );
fputc( '}', stderr );
}
......@@ -5367,6 +5366,7 @@ static const struct
{ "HANDLE_NOT_CLOSABLE", STATUS_HANDLE_NOT_CLOSABLE },
{ "HOST_UNREACHABLE", STATUS_HOST_UNREACHABLE },
{ "ILLEGAL_FUNCTION", STATUS_ILLEGAL_FUNCTION },
{ "INFO_LENGTH_MISMATCH", STATUS_INFO_LENGTH_MISMATCH },
{ "INSTANCE_NOT_AVAILABLE", STATUS_INSTANCE_NOT_AVAILABLE },
{ "INSUFFICIENT_RESOURCES", STATUS_INSUFFICIENT_RESOURCES },
{ "INVALID_CID", STATUS_INVALID_CID },
......@@ -5413,6 +5413,7 @@ static const struct
{ "OBJECT_PATH_SYNTAX_BAD", STATUS_OBJECT_PATH_SYNTAX_BAD },
{ "OBJECT_TYPE_MISMATCH", STATUS_OBJECT_TYPE_MISMATCH },
{ "PENDING", STATUS_PENDING },
{ "PIPE_BROKEN", STATUS_PIPE_BROKEN },
{ "PIPE_CONNECTED", STATUS_PIPE_CONNECTED },
{ "PIPE_DISCONNECTED", STATUS_PIPE_DISCONNECTED },
{ "PIPE_LISTENING", STATUS_PIPE_LISTENING },
......
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