From 2d08465b81d90e8cf1389b5abf5abefee7ba6462 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 18 Jan 2006 14:22:19 +0100 Subject: [PATCH] ntdll: Loader optimization. Optimize for the case where a DLL with no path is requested and it is already loaded. --- dlls/ntdll/loader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 47cc1da4627..5996523b3ca 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -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; } }