From: Konstantin Kharlamov Hi-Angel@yandex.ru
When `import_dll` function gets `STATUS_DLL_NOT_FOUND` from `load_dll()`, it has no way of distinguishing whether it's a dependency for the dll wasn't found, or the dll itself is missing.
That results in confusing ERR messages, where a dll is found, but wine claims it isn't. Fix this by moving the print to the actual place that is aware of whether it's the parent or the child dll haven't been found.
Log before:
0024:err:module:import_dll Library lib2.dll (which is needed by L"Z:\tmp\lib1.dll") not found 0024:err:module:import_dll Library lib1.dll (which is needed by L"Z:\tmp\a.exe") not found
Log after:
0024:err:module:load_dll Library L"lib2.dll" (which is needed by L"Z:\tmp\foo\lib1.dll") not found 0024:err:module:import_dll Loading library lib2.dll (which is needed by L"Z:\tmp\foo\lib1.dll") failed (error c0000135). 0024:err:module:import_dll Loading library lib1.dll (which is needed by L"Z:\tmp\foo\a.exe") failed (error c0000135).
Signed-off-by: Konstantin Kharlamov Hi-Angel@yandex.ru --- dlls/ntdll/loader.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index ae7d0ecaa73..266be08e700 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1066,12 +1066,8 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
if (status) { - if (status == STATUS_DLL_NOT_FOUND) - ERR("Library %s (which is needed by %s) not found\n", - name, debugstr_w(current_modref->ldr.FullDllName.Buffer)); - else - ERR("Loading library %s (which is needed by %s) failed (error %x).\n", - name, debugstr_w(current_modref->ldr.FullDllName.Buffer), status); + ERR("Loading library %s (which is needed by %s) failed (error %x).\n", + name, debugstr_w(current_modref->ldr.FullDllName.Buffer), status); return FALSE; }
@@ -3134,7 +3130,19 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, DWORD fl return STATUS_SUCCESS; }
- if (nts && nts != STATUS_INVALID_IMAGE_NOT_MZ) goto done; + if (nts && nts != STATUS_INVALID_IMAGE_NOT_MZ) + { + if (nts == STATUS_DLL_NOT_FOUND) + { + if (current_modref) + ERR("Library %s (which is needed by %s) not found\n", + debugstr_w(libname), + debugstr_w(current_modref->ldr.FullDllName.Buffer)); + else + ERR("Library %s not found\n", debugstr_w(libname)); + } + goto done; + }
if (NtCurrentTeb64()) {