Alexandre Julliard : kernel32: Make sure the volatile environment is always loaded.

Alexandre Julliard julliard at winehq.org
Thu Jan 28 11:15:37 CST 2010


Module: wine
Branch: master
Commit: 17dea24f480815d292fec9d2f486a3c7930a2633
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=17dea24f480815d292fec9d2f486a3c7930a2633

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jan 28 13:16:40 2010 +0100

kernel32: Make sure the volatile environment is always loaded.

---

 dlls/kernel32/process.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index ae6aa31..993fa6e 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -410,7 +410,7 @@ static void set_registry_variables( HANDLE hkey, ULONG type )
  * %SystemRoot% which are predefined. But Wine defines these in the
  * registry, so we need two passes.
  */
-static BOOL set_registry_environment(void)
+static BOOL set_registry_environment( BOOL volatile_only )
 {
     static const WCHAR env_keyW[] = {'M','a','c','h','i','n','e','\\',
                                      'S','y','s','t','e','m','\\',
@@ -435,7 +435,7 @@ static BOOL set_registry_environment(void)
 
     /* first the system environment variables */
     RtlInitUnicodeString( &nameW, env_keyW );
-    if (NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
+    if (!volatile_only && NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
     {
         set_registry_variables( hkey, REG_SZ );
         set_registry_variables( hkey, REG_EXPAND_SZ );
@@ -446,7 +446,7 @@ static BOOL set_registry_environment(void)
     /* then the ones for the current user */
     if (RtlOpenCurrentUser( KEY_READ, &attr.RootDirectory ) != STATUS_SUCCESS) return ret;
     RtlInitUnicodeString( &nameW, envW );
-    if (NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
+    if (!volatile_only && NtOpenKey( &hkey, KEY_READ, &attr ) == STATUS_SUCCESS)
     {
         set_registry_variables( hkey, REG_SZ );
         set_registry_variables( hkey, REG_EXPAND_SZ );
@@ -1090,7 +1090,7 @@ void CDECL __wine_kernel_init(void)
         /* convert old configuration to new format */
         convert_old_config();
 
-        got_environment = set_registry_environment();
+        got_environment = set_registry_environment( FALSE );
         set_additional_environment();
     }
 
@@ -1140,12 +1140,9 @@ void CDECL __wine_kernel_init(void)
             ERR( "boot event wait timed out\n" );
         CloseHandle( boot_events[0] );
         if (boot_events[1]) CloseHandle( boot_events[1] );
-        /* if we didn't find environment section, try again now that wineboot has run */
-        if (!got_environment)
-        {
-            set_registry_environment();
-            set_additional_environment();
-        }
+        /* reload environment now that wineboot has run */
+        set_registry_environment( got_environment );
+        set_additional_environment();
     }
 
     if (!(peb->ImageBaseAddress = LoadLibraryExW( main_exe_name, 0, DONT_RESOLVE_DLL_REFERENCES )))




More information about the wine-cvs mailing list