kernel32: set username (try 3)

Louis. Lenders xerox_xerox2000 at yahoo.co.uk
Tue Aug 14 09:11:28 CDT 2007


Skipped content of type multipart/alternative-------------- next part --------------
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 1eaf195..8616894 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -418,6 +418,20 @@ static void set_registry_environment(void)
     NtClose( attr.RootDirectory );
 }
 
+/***********************************************************************
+ *           set_additional_environment
+ *
+ * Set some additional environment variables not specified in the registry.
+ */
+static void set_additional_environment(void)
+{
+    static const WCHAR usernameW[] = {'U','S','E','R','N','A','M','E',0};
+    WCHAR lpszName[256];
+    const char *name = wine_get_user_name();
+    DWORD len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
+    MultiByteToWideChar( CP_UNIXCP, 0, name, -1, lpszName, len );
+    SetEnvironmentVariableW(usernameW,lpszName);
+}
 
 /***********************************************************************
  *              set_library_wargv
@@ -745,6 +759,7 @@ static BOOL process_init(void)
         convert_old_config();
 
         set_registry_environment();
+        set_additional_environment();
     }
 
     init_windows_dirs();


More information about the wine-patches mailing list