From cbf7a101763790ca03307c72d32dd8969a381be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 28 Jun 2021 10:39:58 +0200 Subject: [PATCH] ntdll: Allow 16-bit executables to be loaded from build directory. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51214 Signed-off-by: Bernhard Übelacker Signed-off-by: Alexandre Julliard --- dlls/ntdll/loader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 14cc105b64d..cfec779dd59 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2675,6 +2675,7 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne if (!get_env_var( L"WINEBUILDDIR", 20 + 2 * wcslen(name), new_name )) { + len = new_name->Length; RtlAppendUnicodeToString( new_name, L"\\dlls\\" ); RtlAppendUnicodeToString( new_name, name ); if ((ext = wcsrchr( name, '.' )) && !wcscmp( ext, L".dll" )) new_name->Length -= 4 * sizeof(WCHAR); @@ -2685,6 +2686,17 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne RtlAppendUnicodeToString( new_name, L".fake" ); status = open_dll_file( new_name, pwm, mapping, image_info, id ); if (status != STATUS_DLL_NOT_FOUND) goto done; + + new_name->Length = len; + RtlAppendUnicodeToString( new_name, L"\\programs\\" ); + RtlAppendUnicodeToString( new_name, name ); + RtlAppendUnicodeToString( new_name, L"\\" ); + RtlAppendUnicodeToString( new_name, name ); + status = open_dll_file( new_name, pwm, mapping, image_info, id ); + if (status != STATUS_DLL_NOT_FOUND) goto done; + RtlAppendUnicodeToString( new_name, L".fake" ); + status = open_dll_file( new_name, pwm, mapping, image_info, id ); + if (status != STATUS_DLL_NOT_FOUND) goto done; RtlFreeUnicodeString( new_name ); }