kernel32: Fix handling of LOAD_WITH_ALTERED_SEARCH_PATH when other search flags are specified.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46809 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9019c12fac
commit
0d9d816fc3
|
@ -941,11 +941,20 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags )
|
|||
const DWORD unsupported_flags = (LOAD_IGNORE_CODE_AUTHZ_LEVEL |
|
||||
LOAD_LIBRARY_REQUIRE_SIGNED_TARGET);
|
||||
|
||||
if (!(flags & load_library_search_flags)) flags |= default_search_flags;
|
||||
|
||||
if( flags & unsupported_flags)
|
||||
FIXME("unsupported flag(s) used (flags: 0x%08x)\n", flags);
|
||||
|
||||
if (flags & LOAD_WITH_ALTERED_SEARCH_PATH)
|
||||
{
|
||||
if (flags & load_library_search_flags)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
if (default_search_flags) flags |= default_search_flags | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
|
||||
}
|
||||
else if (!(flags & load_library_search_flags)) flags |= default_search_flags;
|
||||
|
||||
if (flags & load_library_search_flags)
|
||||
load_path = get_dll_load_path_search_flags( libname->Buffer, flags );
|
||||
else
|
||||
|
|
|
@ -565,6 +565,31 @@ static void test_LoadLibraryEx_search_flags(void)
|
|||
mod = LoadLibraryExA( path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32 );
|
||||
ok( mod != NULL, "LoadLibrary failed err %u\n", GetLastError() );
|
||||
FreeLibrary( mod );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
ok( !mod, "LoadLibrary succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
ok( !mod, "LoadLibrary succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
ok( !mod, "LoadLibrary succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
ok( !mod, "LoadLibrary succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
mod = LoadLibraryExA( "winetestdll.dll", 0, LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
ok( !mod, "LoadLibrary succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
}
|
||||
|
||||
SetCurrentDirectoryA( curdir );
|
||||
|
|
Loading…
Reference in New Issue