Alexandre Julliard : ntdll: Merge the calls to find_builtin_without_file().

Alexandre Julliard julliard at winehq.org
Wed Nov 24 15:17:17 CST 2021


Module: wine
Branch: master
Commit: f10a85de60ee42bd4abef24396b1f5a0156fae9f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f10a85de60ee42bd4abef24396b1f5a0156fae9f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 24 14:19:50 2021 +0100

ntdll: Merge the calls to find_builtin_without_file().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 508e4214f19..e32df565c64 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2786,6 +2786,14 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
     NTSTATUS status = STATUS_DLL_NOT_FOUND;
     BOOL found_image = FALSE;
 
+    if (contains_path( name )) return status;
+
+    if (!is_prefix_bootstrap)
+    {
+        /* 16-bit files can't be loaded from the prefix */
+        if (!name[1] || wcscmp( name + wcslen(name) - 2, L"16" )) return status;
+    }
+
     if (!get_env_var( L"WINEBUILDDIR", 20 + 2 * wcslen(name), new_name ))
     {
         len = new_name->Length;
@@ -2885,10 +2893,7 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING *
         paths = ptr;
     }
 
-    if (found_image)
-        status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH;
-    else if (is_prefix_bootstrap && !contains_path( search ))
-        status = find_builtin_without_file( search, nt_name, pwm, mapping, image_info, id );
+    if (found_image) status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH;
 
 done:
     RtlFreeHeap( GetProcessHeap(), 0, name );
@@ -2936,14 +2941,14 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI
     }
 
     if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH)
+    {
         status = search_dll_file( load_path, libname, nt_name, pwm, mapping, image_info, id );
+        if (status == STATUS_DLL_NOT_FOUND)
+            status = find_builtin_without_file( libname, nt_name, pwm, mapping, image_info, id );
+    }
     else if (!(status = RtlDosPathNameToNtPathName_U_WithStatus( libname, nt_name, NULL, NULL )))
         status = open_dll_file( nt_name, pwm, mapping, image_info, id );
 
-    /* 16-bit files can't be loaded from the prefix */
-    if (status && libname[0] && libname[1] && !wcscmp( libname + wcslen(libname) - 2, L"16" ) && !contains_path( libname ))
-        status = find_builtin_without_file( libname, nt_name, pwm, mapping, image_info, id );
-
     if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) status = STATUS_INVALID_IMAGE_FORMAT;
 
 done:




More information about the wine-cvs mailing list