From b9f350b517b15b84065d0430170c613f83a77137 Mon Sep 17 00:00:00 2001 From: Peter Ganten Date: Mon, 7 Aug 2000 17:10:20 +0000 Subject: [PATCH] Set up exe_modref before loading implicitly linked dlls. --- loader/pe_image.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/loader/pe_image.c b/loader/pe_image.c index 7677d722a7a..76105f56685 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -854,6 +854,18 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags, if ( pe_export ) dump_exports( hModule ); + /* The exe_modref must be in place, before implicit linked DLLs are loaded + by fixup_imports, otherwhise GetModuleFileName will not work and modules + in the executables directory can not be found */ + + if (!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL)) + { + if ( PROCESS_Current()->exe_modref ) + FIXME( "Trying to load second .EXE file: %s\n", filename ); + else + PROCESS_Current()->exe_modref = wm; + } + /* Fixup Imports */ if (!(wm->flags & WINE_MODREF_DONT_RESOLVE_REFS) && fixup_imports( wm )) @@ -882,6 +894,7 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags, SNOOP_RegisterDLL( hModule, wm->modname, pe_export->NumberOfFunctions ); /* Send DLL load event */ + /* we don't need to send a dll event for the main exe */ if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL) { @@ -893,13 +906,6 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags, req->name = &wm->filename; server_call_noerr( REQ_LOAD_DLL ); } - else /* we don't need to send a dll event for the main exe */ - { - if ( PROCESS_Current()->exe_modref ) - FIXME( "Trying to load second .EXE file: %s\n", filename ); - else - PROCESS_Current()->exe_modref = wm; - } return wm; } -- 2.11.4.GIT