Commit 7bea24f6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Factor out in_wow64_call().

parent 3821e039
...@@ -342,11 +342,19 @@ static inline NTSTATUS wait_async( HANDLE handle, BOOL alertable ) ...@@ -342,11 +342,19 @@ static inline NTSTATUS wait_async( HANDLE handle, BOOL alertable )
return NtWaitForSingleObject( handle, alertable, NULL ); 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 ) static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR info )
{ {
if (!iosb) return; if (!iosb) return;
#ifdef _WIN64
if (NtCurrentTeb()->WowTebOffset) if (in_wow64_call())
{ {
struct iosb32 struct iosb32
{ {
...@@ -357,7 +365,6 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR ...@@ -357,7 +365,6 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR
io->Information = info; io->Information = info;
} }
else else
#endif
{ {
IO_STATUS_BLOCK *io = wine_server_get_ptr( iosb ); IO_STATUS_BLOCK *io = wine_server_get_ptr( iosb );
#ifdef NONAMELESSUNION #ifdef NONAMELESSUNION
...@@ -371,12 +378,10 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR ...@@ -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 ) static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
{ {
#ifdef _WIN64
#ifdef NONAMELESSUNION #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 #else
if (io && NtCurrentTeb()->WowTebOffset) return wine_server_client_ptr( io->Pointer ); if (io && in_wow64_call()) return wine_server_client_ptr( io->Pointer );
#endif
#endif #endif
return wine_server_client_ptr( io ); return wine_server_client_ptr( io );
} }
......
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