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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 3 09:42:10 CST 2015


Module: wine
Branch: master
Commit: 8843bc144ddade9edf90d22d092bed16d77644ff
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8843bc144ddade9edf90d22d092bed16d77644ff

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Mar  3 15:52:23 2015 +0900

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

---

 dlls/ntdll/server.c            | 1 +
 include/wine/server_protocol.h | 3 ++-
 server/async.c                 | 5 +++--
 server/file.h                  | 2 +-
 server/protocol.def            | 1 +
 server/thread.c                | 4 ++--
 server/trace.c                 | 1 +
 7 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index aabda4f..e3f1694 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -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;
     }
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index e0c3474..9d645d7 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 */
diff --git a/server/async.c b/server/async.c
index 017419d..e403955 100644
--- a/server/async.c
+++ b/server/async.c
@@ -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 );
diff --git a/server/file.h b/server/file.h
index ed6096f..85e4257 100644
--- a/server/file.h
+++ b/server/file.h
@@ -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 );
diff --git a/server/protocol.def b/server/protocol.def
index fc6bec5..f2a5a9a 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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
diff --git a/server/thread.c b/server/thread.c
index ba3f1d5..906b79d 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -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 );
diff --git a/server/trace.c b/server/trace.c
index dd20c04..1bda4cd 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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",




More information about the wine-cvs mailing list