From: "Roman Pišl" Subject: [PATCH] ntdll: Allow loading of native libraries for Win16. Message-Id: <20210605195206.30942-1-rpisl@seznam.cz> Date: Sat, 5 Jun 2021 21:52:06 +0200 This change allows to load Win16 modules with override set to native from the prefix. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51224 Signed-off-by: Roman Pišl --- 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 f3a37d4e8a6..d8e009cdf8d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2828,12 +2828,6 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con status = STATUS_SUCCESS; goto done; } - /* 16-bit files can't be loaded from the prefix */ - if (libname[0] && libname[1] && !wcscmp( libname + wcslen(libname) - 2, L"16" )) - { - status = find_builtin_without_file( libname, nt_name, pwm, mapping, image_info, id ); - goto done; - } } } @@ -2842,6 +2836,12 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con 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: -- 2.20.1