ntdll: Loader optimization.

Optimize for the case where a DLL with no path is requested and it is
already loaded.
This commit is contained in:
Robert Shearman 2006-01-18 14:22:19 +01:00 committed by Alexandre Julliard
parent 273470e8ba
commit 2d08465b81
1 changed files with 6 additions and 6 deletions

View File

@ -1487,6 +1487,12 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
}
nt_name.Buffer = NULL;
if (!contains_path( libname ))
{
if ((*pwm = find_basename_module( libname )) != NULL) goto found;
}
if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH)
{
/* we need to search for it */
@ -1496,11 +1502,6 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
if (len >= *size) goto overflow;
if ((*pwm = find_fullname_module( filename )) != NULL) goto found;
/* check for already loaded module in a different path */
if (!contains_path( libname ))
{
if ((*pwm = find_basename_module( file_part )) != NULL) goto found;
}
if (!RtlDosPathNameToNtPathName_U( filename, &nt_name, NULL, NULL ))
{
RtlFreeHeap( GetProcessHeap(), 0, dllname );
@ -1525,7 +1526,6 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
len = strlenW(libname) * sizeof(WCHAR);
if (len >= *size) goto overflow;
strcpyW( filename, libname );
*pwm = find_basename_module( filename );
goto found;
}
}