Alexandre Julliard : ntdll: Moved LDR_DONT_RESOLVE_REFS handling into fixup_imports.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 21 13:13:02 CST 2006


Module: wine
Branch: refs/heads/master
Commit: fa5b5102d72ec610c2f401ee529655fccdc8741b
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=fa5b5102d72ec610c2f401ee529655fccdc8741b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Feb 21 19:32:26 2006 +0100

ntdll: Moved LDR_DONT_RESOLVE_REFS handling into fixup_imports.
This ensures that we never fixup imports twice on the same dll.

---

 dlls/ntdll/loader.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 9087ec0..b0e1f1f 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -584,6 +584,9 @@ static NTSTATUS fixup_imports( WINE_MODR
     DWORD size;
     NTSTATUS status;
 
+    if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS;  /* already done */
+    wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
+
     if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE,
                                                   IMAGE_DIRECTORY_ENTRY_IMPORT, &size )))
         return STATUS_SUCCESS;
@@ -634,7 +637,7 @@ static WINE_MODREF *alloc_module( HMODUL
     wm->ldr.BaseAddress   = hModule;
     wm->ldr.EntryPoint    = NULL;
     wm->ldr.SizeOfImage   = nt->OptionalHeader.SizeOfImage;
-    wm->ldr.Flags         = 0;
+    wm->ldr.Flags         = LDR_DONT_RESOLVE_REFS;
     wm->ldr.LoadCount     = 0;
     wm->ldr.TlsIndex      = -1;
     wm->ldr.SectionHandle = NULL;
@@ -1393,7 +1396,6 @@ static NTSTATUS load_native_dll( LPCWSTR
             return status;
         }
     }
-    else wm->ldr.Flags |= LDR_DONT_RESOLVE_REFS;
 
     /* send DLL load event */
 
@@ -1682,12 +1684,8 @@ static NTSTATUS load_dll( LPCWSTR load_p
     {
         if ((*pwm)->ldr.LoadCount != -1) (*pwm)->ldr.LoadCount++;
 
-        if (((*pwm)->ldr.Flags & LDR_DONT_RESOLVE_REFS) &&
-            !(flags & DONT_RESOLVE_DLL_REFERENCES))
-        {
-            (*pwm)->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
-            fixup_imports( *pwm, load_path );
-        }
+        if (!(flags & DONT_RESOLVE_DLL_REFERENCES)) fixup_imports( *pwm, load_path );
+
         TRACE("Found loaded module %s for %s at %p, count=%d\n",
               debugstr_w((*pwm)->ldr.FullDllName.Buffer), debugstr_w(libname),
               (*pwm)->ldr.BaseAddress, (*pwm)->ldr.LoadCount);
@@ -2044,7 +2042,6 @@ void WINAPI LdrInitializeThunk( ULONG un
         goto error;
     }
     wm->ldr.LoadCount = -1;  /* can't unload main exe */
-    wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
 
     peb->ProcessParameters->ImagePathName = wm->ldr.FullDllName;
     version_init( wm->ldr.FullDllName.Buffer );




More information about the wine-cvs mailing list