ntdll: Skip dll file search when getting module handle from short name.

This commit is contained in:
Paul Gofman 2024-09-28 21:27:27 -06:00 committed by Alexandre Julliard
parent 4f30086c83
commit a62d25e134
Notes: Alexandre Julliard 2024-10-02 23:22:46 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6591
2 changed files with 10 additions and 4 deletions

View file

@ -1412,7 +1412,7 @@ static void test_LdrGetDllHandleEx(void)
bret = MoveFileA( "d01.dll", "d02.dll" );
ok( bret, "got error %lu.\n", GetLastError() );
status = pLdrGetDllHandleEx( LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, NULL, &name, &loaded_mod );
todo_wine ok( status == STATUS_DLL_NOT_FOUND, "got %#lx.\n", status );
ok( status == STATUS_DLL_NOT_FOUND, "got %#lx.\n", status );
CreateDirectoryA( "testdir", NULL );
DeleteFileA( "testdir\\d02.dll" );
bret = MoveFileA( "d02.dll", "testdir\\d02.dll" );

View file

@ -3233,7 +3233,7 @@ done:
*/
static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNICODE_STRING *nt_name,
WINE_MODREF **pwm, HANDLE *mapping, SECTION_IMAGE_INFORMATION *image_info,
struct file_id *id )
struct file_id *id, BOOL find_loaded )
{
WCHAR *fullname = NULL;
NTSTATUS status;
@ -3266,6 +3266,12 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI
status = STATUS_SUCCESS;
goto done;
}
if (find_loaded)
{
TRACE( "Skipping file search for %s.\n", debugstr_w(libname) );
status = STATUS_DLL_NOT_FOUND;
goto done;
}
}
}
@ -3309,7 +3315,7 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, DWORD fl
if (nts)
{
nts = find_dll_file( load_path, libname, &nt_name, pwm, &mapping, &image_info, &id );
nts = find_dll_file( load_path, libname, &nt_name, pwm, &mapping, &image_info, &id, FALSE );
system = FALSE;
}
@ -3499,7 +3505,7 @@ NTSTATUS WINAPI LdrGetDllHandleEx( ULONG flags, LPCWSTR load_path, ULONG *dll_ch
RtlEnterCriticalSection( &loader_section );
status = find_dll_file( load_path, dllname ? dllname : name->Buffer,
&nt_name, &wm, &mapping, &image_info, &id );
&nt_name, &wm, &mapping, &image_info, &id, TRUE );
if (wm) *base = wm->ldr.DllBase;
else