Alexandre Julliard : kernel32: Set the path environment variables according to the WoW64 environment.

Alexandre Julliard julliard at winehq.org
Sat Jul 6 16:01:24 CDT 2019


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Jul  6 17:05:47 2019 +0200

kernel32: Set the path environment variables according to the WoW64 environment.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47467
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/process.c | 52 +++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 2dcd53b..23e2316 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -714,31 +714,12 @@ static void set_additional_environment(void)
     static const WCHAR allusersW[] = {'A','L','L','U','S','E','R','S','P','R','O','F','I','L','E',0};
     static const WCHAR programdataW[] = {'P','r','o','g','r','a','m','D','a','t','a',0};
     static const WCHAR publicW[] = {'P','U','B','L','I','C',0};
-    static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0};
-    static const WCHAR winehomedirW[] = {'W','I','N','E','H','O','M','E','D','I','R',0};
-    static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0};
-    static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
-    static const WCHAR wineconfigdirW[] = {'W','I','N','E','C','O','N','F','I','G','D','I','R',0};
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING nameW;
-    const char *path;
     WCHAR *profile_dir = NULL, *program_data_dir = NULL, *public_dir = NULL;
     WCHAR buf[32];
     HANDLE hkey;
-    DWORD len, i;
-
-    /* wine paths */
-    set_wine_path_variable( winedatadirW, wine_get_data_dir() );
-    set_wine_path_variable( winehomedirW, getenv("HOME") );
-    set_wine_path_variable( winebuilddirW, wine_get_build_dir() );
-    set_wine_path_variable( wineconfigdirW, wine_get_config_dir() );
-    for (i = 0; (path = wine_dll_enum_load_path( i )); i++)
-    {
-        sprintfW( buf, winedlldirW, i );
-        set_wine_path_variable( buf, path );
-    }
-    sprintfW( buf, winedlldirW, i );
-    set_wine_path_variable( buf, NULL );
+    DWORD len;
 
     /* ComputerName */
     len = ARRAY_SIZE( buf );
@@ -802,28 +783,49 @@ static void set_wow64_environment(void)
     static const WCHAR commondir86W[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
     static const WCHAR commonfilesW[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s',0};
     static const WCHAR commonw6432W[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','W','6','4','3','2',0};
+    static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0};
+    static const WCHAR winehomedirW[] = {'W','I','N','E','H','O','M','E','D','I','R',0};
+    static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0};
+    static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
+    static const WCHAR wineconfigdirW[] = {'W','I','N','E','C','O','N','F','I','G','D','I','R',0};
 
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING nameW;
-    WCHAR arch[64];
+    const char *path;
+    WCHAR buf[64];
     WCHAR *value;
     HANDLE hkey;
+    DWORD i;
+
+    /* set the Wine paths */
+
+    set_wine_path_variable( winedatadirW, wine_get_data_dir() );
+    set_wine_path_variable( winehomedirW, getenv("HOME") );
+    set_wine_path_variable( winebuilddirW, wine_get_build_dir() );
+    set_wine_path_variable( wineconfigdirW, wine_get_config_dir() );
+    for (i = 0; (path = wine_dll_enum_load_path( i )); i++)
+    {
+        sprintfW( buf, winedlldirW, i );
+        set_wine_path_variable( buf, path );
+    }
+    sprintfW( buf, winedlldirW, i );
+    set_wine_path_variable( buf, NULL );
 
     /* set the PROCESSOR_ARCHITECTURE variable */
 
-    if (GetEnvironmentVariableW( arch6432W, arch, ARRAY_SIZE( arch )))
+    if (GetEnvironmentVariableW( arch6432W, buf, ARRAY_SIZE( buf )))
     {
         if (is_win64)
         {
-            SetEnvironmentVariableW( archW, arch );
+            SetEnvironmentVariableW( archW, buf );
             SetEnvironmentVariableW( arch6432W, NULL );
         }
     }
-    else if (GetEnvironmentVariableW( archW, arch, ARRAY_SIZE( arch )))
+    else if (GetEnvironmentVariableW( archW, buf, ARRAY_SIZE( buf )))
     {
         if (is_wow64)
         {
-            SetEnvironmentVariableW( arch6432W, arch );
+            SetEnvironmentVariableW( arch6432W, buf );
             SetEnvironmentVariableW( archW, x86W );
         }
     }




More information about the wine-cvs mailing list