Paul Gofman : ntdll: Do not force 2G stack limit for the main thread of 64 bit process.

Alexandre Julliard julliard at winehq.org
Wed Feb 23 16:00:06 CST 2022


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Feb 23 19:16:32 2022 +0300

ntdll: Do not force 2G stack limit for the main thread of 64 bit process.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/loader.c | 2 +-
 dlls/ntdll/unix/thread.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index ab12a4ea1c0..5eb201bd90b 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -2169,7 +2169,7 @@ static void start_main_thread(void)
     if (p___wine_main_wargv) *p___wine_main_wargv = main_wargv;
     *(ULONG_PTR *)&peb->CloudFileFlags = get_image_address();
     set_load_order_app_name( main_wargv[0] );
-    init_thread_stack( teb, is_win64 ? 0x7fffffff : 0, 0, 0 );
+    init_thread_stack( teb, 0, 0, 0 );
     NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
     load_ntdll();
     if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine );
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 618ebb82bfb..0488129aa4c 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -1156,7 +1156,8 @@ NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR zero_bits, SIZE_T reserve_size,
 
 #ifdef _WIN64
         /* 32-bit stack */
-        if ((status = virtual_alloc_thread_stack( &stack, zero_bits, reserve_size, commit_size, 0 )))
+        if ((status = virtual_alloc_thread_stack( &stack, zero_bits ? zero_bits : 0x7fffffff,
+                                                  reserve_size, commit_size, 0 )))
             return status;
         wow_teb->Tib.StackBase = PtrToUlong( stack.StackBase );
         wow_teb->Tib.StackLimit = PtrToUlong( stack.StackLimit );




More information about the wine-cvs mailing list