Zebediah Figura : ntdll: Factor out in_wow64_call().

Alexandre Julliard julliard at winehq.org
Fri Dec 10 15:07:52 CST 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Fri Dec 10 11:27:31 2021 -0600

ntdll: Factor out in_wow64_call().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/unix_private.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 9b79b712b1e..d9ce8300fa9 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -342,11 +342,19 @@ static inline NTSTATUS wait_async( HANDLE handle, BOOL alertable )
     return NtWaitForSingleObject( handle, alertable, NULL );
 }
 
+static inline BOOL in_wow64_call(void)
+{
+#ifdef _WIN64
+    return !!NtCurrentTeb()->WowTebOffset;
+#endif
+    return FALSE;
+}
+
 static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR info )
 {
     if (!iosb) return;
-#ifdef _WIN64
-    if (NtCurrentTeb()->WowTebOffset)
+
+    if (in_wow64_call())
     {
         struct iosb32
         {
@@ -357,7 +365,6 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR
         io->Information = info;
     }
     else
-#endif
     {
         IO_STATUS_BLOCK *io = wine_server_get_ptr( iosb );
 #ifdef NONAMELESSUNION
@@ -371,12 +378,10 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR
 
 static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
 {
-#ifdef _WIN64
 #ifdef NONAMELESSUNION
-    if (io && NtCurrentTeb()->WowTebOffset) return wine_server_client_ptr( io->u.Pointer );
+    if (io && in_wow64_call()) return wine_server_client_ptr( io->u.Pointer );
 #else
-    if (io && NtCurrentTeb()->WowTebOffset) return wine_server_client_ptr( io->Pointer );
-#endif
+    if (io && in_wow64_call()) return wine_server_client_ptr( io->Pointer );
 #endif
     return wine_server_client_ptr( io );
 }




More information about the wine-cvs mailing list