Rémi Bernon : ntdll: Use the status to tell user APC from system APC.

Alexandre Julliard julliard at winehq.org
Wed Feb 5 16:53:35 CST 2020


Module: wine
Branch: master
Commit: 3ffa355d2b9d270e794f4d8f6d2aa5e3f9f6557b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3ffa355d2b9d270e794f4d8f6d2aa5e3f9f6557b

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Feb  5 11:49:38 2020 +0100

ntdll: Use the status to tell user APC from system APC.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/ntdll_misc.h |  2 +-
 dlls/ntdll/server.c     | 14 ++++++--------
 dlls/ntdll/sync.c       |  5 +++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index e1fb1e9eba..bec88e6f07 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -115,7 +115,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o
                                          data_size_t *ret_len ) DECLSPEC_HIDDEN;
 extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
 extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN;
-extern BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN;
+extern void invoke_apc( const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN;
 
 /* module handling */
 extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 18ee41790f..c17ab964d5 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -384,11 +384,11 @@ int wait_select_reply( void *cookie )
 /***********************************************************************
  *              invoke_apc
  *
- * Invoke a single APC. Return TRUE if a user APC has been run.
+ * Invoke a single APC.
+ *
  */
-BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
+void invoke_apc( const apc_call_t *call, apc_result_t *result )
 {
-    BOOL user_apc = FALSE;
     SIZE_T size;
     void *addr;
     pe_image_info_t image_info;
@@ -403,7 +403,6 @@ BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
     {
         void (WINAPI *func)(ULONG_PTR,ULONG_PTR,ULONG_PTR) = wine_server_get_ptr( call->user.func );
         func( call->user.args[0], call->user.args[1], call->user.args[2] );
-        user_apc = TRUE;
         break;
     }
     case APC_TIMER:
@@ -411,7 +410,6 @@ BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
         void (WINAPI *func)(void*, unsigned int, unsigned int) = wine_server_get_ptr( call->timer.func );
         func( wine_server_get_ptr( call->timer.arg ),
               (DWORD)call->timer.time, (DWORD)(call->timer.time >> 32) );
-        user_apc = TRUE;
         break;
     }
     case APC_ASYNC_IO:
@@ -587,7 +585,6 @@ BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
         server_protocol_error( "get_apc_request: bad type %d\n", call->type );
         break;
     }
-    return user_apc;
 }
 
 
@@ -628,9 +625,10 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
         if (size >= sizeof(select_op->signal_and_wait) && select_op->op == SELECT_SIGNAL_AND_WAIT)
             size = offsetof( select_op_t, signal_and_wait.signal );
 
-        if ((ret == STATUS_USER_APC || ret == STATUS_KERNEL_APC) &&
-            invoke_apc( &call, &result ))
+        if (ret == STATUS_KERNEL_APC) invoke_apc( &call, &result );
+        if (ret == STATUS_USER_APC)
         {
+            invoke_apc( &call, &result );
             /* if we ran a user apc we have to check once more if additional apcs are queued,
              * but we don't want to wait */
             abs_timeout = 0;
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 3b8b4f4eaa..3e670f47f7 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -2496,9 +2496,10 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
 
         RtlLeaveCriticalSection( &addr_section );
 
-        if ((ret == STATUS_USER_APC || ret == STATUS_KERNEL_APC) &&
-            invoke_apc( &call, &result ))
+        if (ret == STATUS_KERNEL_APC) invoke_apc( &call, &result );
+        if (ret == STATUS_USER_APC)
         {
+            invoke_apc( &call, &result );
             /* if we ran a user apc we have to check once more if additional apcs are queued,
              * but we don't want to wait */
             abs_timeout = 0;




More information about the wine-cvs mailing list