Module: wine Branch: master Commit: ef26f7bd5cf36806f7b465dc1942ab6a2e0541b9 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ef26f7bd5cf36806f7b465dc1...
Author: Nick Fox nick@foxsec.net Date: Fri Oct 29 03:17:03 2021 +0000
ntdll: Fix LdrGetDllPath with LOAD_WITH_ALTERED_SEARCH_PATH without a path.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26350 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51821 Signed-off-by: Nick Fox nick@foxsec.net Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/tests/path.c | 2 -- dlls/ntdll/loader.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 86d604f6a96..2955be0da9c 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -2659,7 +2659,6 @@ static void test_LdrGetDllPath(void) ret = pLdrGetDllPath( fooW, LOAD_WITH_ALTERED_SEARCH_PATH, &path, &unknown_ptr ); ok( !ret, "LdrGetDllPath failed %x\n", ret ); ok( !unknown_ptr, "unknown ptr %p\n", unknown_ptr ); - todo_wine build_search_path( buffer, ARRAY_SIZE(buffer), NULL, NULL, TRUE ); ok( path_equal( path, buffer ), "got %s expected %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer)); pRtlReleasePath( path ); @@ -2667,7 +2666,6 @@ static void test_LdrGetDllPath(void) ret = pLdrGetDllPath( L"temp/foo", LOAD_WITH_ALTERED_SEARCH_PATH, &path, &unknown_ptr ); ok( !ret, "LdrGetDllPath failed %x\n", ret ); ok( !unknown_ptr, "unknown ptr %p\n", unknown_ptr ); - todo_wine build_search_path( buffer, ARRAY_SIZE(buffer), NULL, NULL, TRUE ); ok( path_equal( path, buffer ), "got %s expected %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer)); pRtlReleasePath( path ); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index c6d9689f408..a6d5063dcf7 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4329,7 +4329,7 @@ NTSTATUS WINAPI LdrGetDllPath( PCWSTR module, ULONG flags, PWSTR *path, PWSTR *u else { const WCHAR *dlldir = dll_directory.Length ? dll_directory.Buffer : NULL; - if (!(flags & LOAD_WITH_ALTERED_SEARCH_PATH)) + if (!(flags & LOAD_WITH_ALTERED_SEARCH_PATH) || !wcschr( module, L'\' )) module = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; status = get_dll_load_path( module, dlldir, dll_safe_mode, path ); }