Alexandre Julliard : ntdll: Remove path from application name to open loadorder key.

Alexandre Julliard julliard at winehq.org
Mon Apr 5 16:28:23 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Apr  3 13:00:46 2021 +0200

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 <julliard at winehq.org>

---

 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;
     }




More information about the wine-cvs mailing list