Alexandre Julliard : ntdll: Don't fixup imports for executables.

Alexandre Julliard julliard at winehq.org
Mon Feb 17 13:45:15 CST 2014


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb 17 16:25:43 2014 +0100

ntdll: Don't fixup imports for executables.

---

 dlls/kernel32/tests/loader.c |    1 -
 dlls/ntdll/loader.c          |   16 +++++++---------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 55c63ad..cd64a34 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1306,7 +1306,6 @@ static void test_import_resolution(void)
             ok( mod != NULL, "failed to load err %u\n", GetLastError() );
             if (!mod) break;
             ptr = (struct imports *)((char *)mod + page_size);
-            todo_wine
             ok( ptr->thunks[0].u1.Function == 0xdeadbeef, "thunk resolved to %p for %s.%s\n",
                 (void *)ptr->thunks[0].u1.Function, data.module, data.function.name );
             FreeLibrary( mod );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index fedade5..7f36ddd 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1509,12 +1509,8 @@ static void load_builtin_callback( void *module, const char *filename )
     }
     wm->ldr.Flags |= LDR_WINE_INTERNAL;
 
-    if (!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL) &&
-        !NtCurrentTeb()->Peb->ImageBaseAddress)  /* if we already have an executable, ignore this one */
-    {
-        NtCurrentTeb()->Peb->ImageBaseAddress = module;
-    }
-    else
+    if ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
+        nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE)
     {
         /* fixup imports */
 
@@ -1591,7 +1587,11 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
 
     /* fixup imports */
 
-    if (!(flags & DONT_RESOLVE_DLL_REFERENCES))
+    nt = RtlImageNtHeader( module );
+
+    if (!(flags & DONT_RESOLVE_DLL_REFERENCES) &&
+        ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
+         nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE))
     {
         if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS)
         {
@@ -1612,8 +1612,6 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
 
     /* send DLL load event */
 
-    nt = RtlImageNtHeader( module );
-
     SERVER_START_REQ( load_dll )
     {
         req->mapping    = wine_server_obj_handle( mapping );




More information about the wine-cvs mailing list