From 9b49cc289900fab134ba318c4e2859b7585817d1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Mar 2008 17:08:57 +0100 Subject: [PATCH] ntdll: Clear the process stack again after dll init and before calling the main entry point. --- dlls/ntdll/loader.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index f17c0c0e6b6..3b60d604f10 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2423,6 +2423,11 @@ void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3, status = wine_call_on_stack( attach_process_dlls, wm, NtCurrentTeb()->Tib.StackBase ); if (status != STATUS_SUCCESS) goto error; + /* clear the stack contents before calling the main entry point, some broken apps need that */ + wine_anon_mmap( NtCurrentTeb()->Tib.StackLimit, + (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit, + PROT_READ | PROT_WRITE, MAP_FIXED ); + if (nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) VIRTUAL_UseLargeAddressSpace(); return;