Brendan Shanks : wow64: Respect the large address aware flag.

Alexandre Julliard julliard at winehq.org
Mon Jul 25 16:19:29 CDT 2022


Module: wine
Branch: master
Commit: a3de8d191b7034ec47e3ed27f91fc7b1eb61d069
URL:    https://gitlab.winehq.org/wine/wine/-/commit/a3de8d191b7034ec47e3ed27f91fc7b1eb61d069

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Mon Jun 27 13:47:41 2022 -0700

wow64: Respect the large address aware flag.

---

 dlls/wow64/process.c       | 2 +-
 dlls/wow64/syscall.c       | 4 ++++
 dlls/wow64/wow64_private.h | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wow64/process.c b/dlls/wow64/process.c
index 0c6726b9c6e..55cb19c6a17 100644
--- a/dlls/wow64/process.c
+++ b/dlls/wow64/process.c
@@ -1118,7 +1118,7 @@ NTSTATUS WINAPI wow64_NtSetInformationProcess( UINT *args )
             PROCESS_STACK_ALLOCATION_INFORMATION info;
 
             info.ReserveSize = stack->ReserveSize;
-            info.ZeroBits = stack->ZeroBits ? stack->ZeroBits : 0x7fffffff;
+            info.ZeroBits = get_zero_bits( stack->ZeroBits );
             if (!(status = NtSetInformationProcess( handle, class, &info, sizeof(info) )))
                 stack->StackBase = PtrToUlong( info.StackBase );
             return status;
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c
index 7cab0894738..80c4bf73d8b 100644
--- a/dlls/wow64/syscall.c
+++ b/dlls/wow64/syscall.c
@@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wow);
 USHORT native_machine = 0;
 USHORT current_machine = 0;
 ULONG_PTR args_alignment = 0;
+ULONG_PTR default_zero_bits = 0x7fffffff;
 
 typedef NTSTATUS (WINAPI *syscall_thunk)( UINT *args );
 
@@ -566,10 +567,13 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
 {
     HMODULE module;
     UNICODE_STRING str;
+    SYSTEM_BASIC_INFORMATION info;
 
     RtlWow64GetProcessMachines( GetCurrentProcess(), &current_machine, &native_machine );
     if (!current_machine) current_machine = native_machine;
     args_alignment = (current_machine == IMAGE_FILE_MACHINE_I386) ? sizeof(ULONG) : sizeof(ULONG64);
+    NtQuerySystemInformation( SystemEmulationBasicInformation, &info, sizeof(info), NULL );
+    default_zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff;
 
 #define GET_PTR(name) p ## name = RtlFindExportedRoutineByName( module, #name )
 
diff --git a/dlls/wow64/wow64_private.h b/dlls/wow64/wow64_private.h
index b26148023db..c089a6ec4aa 100644
--- a/dlls/wow64/wow64_private.h
+++ b/dlls/wow64/wow64_private.h
@@ -39,6 +39,7 @@ extern BOOL get_file_redirect( OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
 extern USHORT native_machine DECLSPEC_HIDDEN;
 extern USHORT current_machine DECLSPEC_HIDDEN;
 extern ULONG_PTR args_alignment DECLSPEC_HIDDEN;
+extern ULONG_PTR default_zero_bits DECLSPEC_HIDDEN;
 extern SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock DECLSPEC_HIDDEN;
 
 struct object_attr64
@@ -83,7 +84,7 @@ static inline ULONG64 get_ulong64( UINT **args )
 
 static inline ULONG_PTR get_zero_bits( ULONG_PTR zero_bits )
 {
-    return zero_bits ? zero_bits : 0x7fffffff;
+    return zero_bits ? zero_bits : default_zero_bits;
 }
 
 static inline void **addr_32to64( void **addr, ULONG *addr32 )




More information about the wine-cvs mailing list