Module: wine Branch: master Commit: fd0efd92e077a8098a22f6b0130c36eb9d5347c2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd0efd92e077a8098a22f6b013...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jan 28 13:01:00 2010 +0100
wineboot: Set the USERNAME and USERPROFILE variables in the volatile environment.
---
programs/wineboot/wineboot.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index e6c6e08..7c4b14b 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -291,11 +291,13 @@ static void create_volatile_environment_registry_key(void) static const WCHAR LocalAppDataW[] = {'L','O','C','A','L','A','P','P','D','A','T','A',0}; static const WCHAR LogonServerW[] = {'L','O','G','O','N','S','E','R','V','E','R',0}; static const WCHAR SessionNameW[] = {'S','E','S','S','I','O','N','N','A','M','E',0}; + static const WCHAR UserNameW[] = {'U','S','E','R','N','A','M','E',0}; + static const WCHAR UserProfileW[] = {'U','S','E','R','P','R','O','F','I','L','E',0}; static const WCHAR ConsoleW[] = {'C','o','n','s','o','l','e',0}; static const WCHAR EmptyW[] = {0}; WCHAR path[MAX_PATH]; WCHAR computername[MAX_COMPUTERNAME_LENGTH + 1 + 2]; - DWORD size = MAX_COMPUTERNAME_LENGTH + 1; + DWORD size; HKEY hkey; HRESULT hr;
@@ -313,17 +315,22 @@ static void create_volatile_environment_registry_key(void) hr = SHGetFolderPathW( NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, path ); if (SUCCEEDED(hr)) { + set_reg_value( hkey, UserProfileW, path ); set_reg_value( hkey, HomePathW, path + 2 ); path[2] = '\0'; set_reg_value( hkey, HomeDriveW, path ); }
+ size = sizeof(path); + if (GetUserNameW( path, &size )) set_reg_value( hkey, UserNameW, path ); + set_reg_value( hkey, HomeShareW, EmptyW );
hr = SHGetFolderPathW( NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path ); if (SUCCEEDED(hr)) set_reg_value( hkey, LocalAppDataW, path );
+ size = sizeof(computername) - 2; if (GetComputerNameW(&computername[2], &size)) { computername[0] = computername[1] = '\';