Alexandre Julliard : ntdll: Clear the process stack again after dll init and before calling the main entry point .

Alexandre Julliard julliard at winehq.org
Thu Mar 27 07:21:39 CDT 2008


Module: wine
Branch: master
Commit: 9b49cc289900fab134ba318c4e2859b7585817d1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b49cc289900fab134ba318c4e2859b7585817d1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 26 17:08:57 2008 +0100

ntdll: Clear the process stack again after dll init and before calling the main entry point.

---

 dlls/ntdll/loader.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index f17c0c0..3b60d60 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;
 




More information about the wine-cvs mailing list