Dmitry Timoshkov : kernel32: Set %ALLUSERSPROFILE% variable to the same value as %ProgramData%.

Alexandre Julliard julliard at winehq.org
Mon Aug 20 13:26:11 CDT 2018


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Aug 17 18:14:34 2018 +0800

kernel32: Set %ALLUSERSPROFILE% variable to the same value as %ProgramData%.

This matches what recent Windows versions set in the process environment.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/process.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index d615f06..b12c37f 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -516,7 +516,6 @@ static void set_additional_environment(void)
                                          'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
                                          'P','r','o','f','i','l','e','L','i','s','t',0};
     static const WCHAR profiles_valueW[] = {'P','r','o','f','i','l','e','s','D','i','r','e','c','t','o','r','y',0};
-    static const WCHAR all_users_valueW[] = {'A','l','l','U','s','e','r','s','P','r','o','f','i','l','e','\0'};
     static const WCHAR public_valueW[] = {'P','u','b','l','i','c',0};
     static const WCHAR computernameW[] = {'C','O','M','P','U','T','E','R','N','A','M','E',0};
     static const WCHAR allusersW[] = {'A','L','L','U','S','E','R','S','P','R','O','F','I','L','E',0};
@@ -524,7 +523,7 @@ static void set_additional_environment(void)
     static const WCHAR publicW[] = {'P','U','B','L','I','C',0};
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING nameW;
-    WCHAR *profile_dir = NULL, *all_users_dir = NULL, *program_data_dir = NULL, *public_dir = NULL;
+    WCHAR *profile_dir = NULL, *program_data_dir = NULL, *public_dir = NULL;
     WCHAR buf[MAX_COMPUTERNAME_LENGTH+1];
     HANDLE hkey;
     DWORD len;
@@ -546,28 +545,14 @@ static void set_additional_environment(void)
     if (!NtOpenKey( &hkey, KEY_READ, &attr ))
     {
         profile_dir = get_reg_value( hkey, profiles_valueW );
-        all_users_dir = get_reg_value( hkey, all_users_valueW );
         program_data_dir = get_reg_value( hkey, programdataW );
         public_dir = get_reg_value( hkey, public_valueW );
         NtClose( hkey );
     }
 
-    if (profile_dir && all_users_dir)
-    {
-        WCHAR *value, *p;
-
-        len = strlenW(profile_dir) + strlenW(all_users_dir) + 2;
-        value = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
-        strcpyW( value, profile_dir );
-        p = value + strlenW(value);
-        if (p > value && p[-1] != '\\') *p++ = '\\';
-        strcpyW( p, all_users_dir );
-        SetEnvironmentVariableW( allusersW, value );
-        HeapFree( GetProcessHeap(), 0, value );
-    }
-
     if (program_data_dir)
     {
+        SetEnvironmentVariableW( allusersW, program_data_dir );
         SetEnvironmentVariableW( programdataW, program_data_dir );
     }
 
@@ -576,7 +561,6 @@ static void set_additional_environment(void)
         SetEnvironmentVariableW( publicW, public_dir );
     }
 
-    HeapFree( GetProcessHeap(), 0, all_users_dir );
     HeapFree( GetProcessHeap(), 0, profile_dir );
     HeapFree( GetProcessHeap(), 0, program_data_dir );
     HeapFree( GetProcessHeap(), 0, public_dir );




More information about the wine-cvs mailing list