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>
(cherry picked from commit ef26f7bd5c)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Nick Fox 2021-10-29 03:17:03 +00:00 committed by Michael Stefaniuc
parent 9288f9e22a
commit c133264b69
2 changed files with 1 additions and 3 deletions

View File

@ -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 );

View File

@ -3829,7 +3829,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 );
}