From 7a1ed2e1219a5048653cf163018d317d6c99bf75 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 3 Apr 2021 13:00:46 +0200 Subject: [PATCH] ntdll: Remove path from application name to open loadorder key. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50914 Signed-off-by: Alexandre Julliard --- dlls/ntdll/unix/loadorder.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/loadorder.c b/dlls/ntdll/unix/loadorder.c index 49af8eb6adb..5285bb58007 100644 --- a/dlls/ntdll/unix/loadorder.c +++ b/dlls/ntdll/unix/loadorder.c @@ -384,16 +384,20 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) enum loadorder ret = LO_INVALID; HANDLE std_key, app_key = 0; const WCHAR *path = nt_name->Buffer; - const WCHAR *app_name = NULL; + const WCHAR *p, *app_name = NULL; WCHAR *module, *basename; int len; + if (!init_done) init_load_order(); + std_key = get_standard_key(); + if (NtCurrentTeb()->Peb->ImageBaseAddress) + { app_name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; + if ((p = wcsrchr( app_name, '\\' ))) app_name = p + 1; + app_key = get_app_key( app_name ); + } - if (!init_done) init_load_order(); - std_key = get_standard_key(); - if (app_name) app_key = get_app_key( app_name ); if (!wcsncmp( path, prefixW, 4 )) path += 4; TRACE("looking for %s\n", debugstr_w(path)); @@ -402,7 +406,7 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) */ if (!wcsnicmp( system_dir + 4, path, wcslen(system_dir) - 4 )) { - const WCHAR *p = path + wcslen( system_dir ) - 4; + p = path + wcslen( system_dir ) - 4; while (*p == '\\' || *p == '/') p++; if (!wcschr( p, '\\' ) && !wcschr( p, '/' )) path = p; } -- 2.11.4.GIT