Louis Lenders : kernel32: Set USERNAME environment variable.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 17 06:30:49 CDT 2007
Module: wine
Branch: master
Commit: 7475599b4099f1d6b12b2c7885a3f144f13a3792
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7475599b4099f1d6b12b2c7885a3f144f13a3792
Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date: Thu Aug 16 14:50:29 2007 +0100
kernel32: Set USERNAME environment variable.
---
dlls/kernel32/process.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 1eaf195..a08235a 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -418,6 +418,24 @@ 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};
+ const char *name = wine_get_user_name();
+ DWORD len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
+ if (len)
+ {
+ LPWSTR nameW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
+ MultiByteToWideChar( CP_UNIXCP, 0, name, -1, nameW, len );
+ SetEnvironmentVariableW( usernameW, nameW );
+ HeapFree( GetProcessHeap(), 0, nameW );
+ }
+}
/***********************************************************************
* set_library_wargv
@@ -745,6 +763,7 @@ static BOOL process_init(void)
convert_old_config();
set_registry_environment();
+ set_additional_environment();
}
init_windows_dirs();
More information about the wine-cvs
mailing list