Alexandre Julliard : ntdll: Set the TEB offset for Wow64 mode also in 64-bit.

Alexandre Julliard julliard at winehq.org
Thu Dec 2 15:30:15 CST 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec  2 11:23:16 2021 +0100

ntdll: Set the TEB offset for Wow64 mode also in 64-bit.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/env.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index ca3e0a9dc81..30d8ac1553c 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -2128,6 +2128,15 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
     peb->ImageSubSystemMajorVersion = main_image_info.MajorSubsystemVersion;
     peb->ImageSubSystemMinorVersion = main_image_info.MinorSubsystemVersion;
 
+#ifdef _WIN64
+    if (main_image_info.Machine != current_machine)
+    {
+        NtCurrentTeb()->WowTebOffset = teb_offset;
+        NtCurrentTeb()->Tib.ExceptionList = (void *)((char *)NtCurrentTeb() + teb_offset);
+        set_thread_id( NtCurrentTeb(),  GetCurrentProcessId(), GetCurrentThreadId() );
+    }
+#endif
+
     load_global_options( &params->ImagePathName );
 
     if (NtCurrentTeb()->WowTebOffset)




More information about the wine-cvs mailing list