mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 07:28:19 +00:00
[USERENV]
CreateEnvironmentBlock: Set or overwrite the SystemRoot, SystemDrive and USERPROFILE environment variables of the new environment block. svn path=/trunk/; revision=69834
This commit is contained in:
parent
fbf5850ab6
commit
3b67603f55
1 changed files with 34 additions and 0 deletions
|
@ -431,6 +431,29 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set 'SystemRoot' variable */
|
||||
Length = MAX_PATH;
|
||||
if (GetEnvironmentVariableW(L"SystemRoot",
|
||||
Buffer,
|
||||
Length))
|
||||
{
|
||||
SetUserEnvironmentVariable(lpEnvironment,
|
||||
L"SystemRoot",
|
||||
Buffer,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Set 'SystemDrive' variable */
|
||||
if (GetEnvironmentVariableW(L"SystemDrive",
|
||||
Buffer,
|
||||
Length))
|
||||
{
|
||||
SetUserEnvironmentVariable(lpEnvironment,
|
||||
L"SystemDrive",
|
||||
Buffer,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Set 'COMPUTERNAME' variable */
|
||||
Length = MAX_PATH;
|
||||
if (GetComputerNameW(Buffer,
|
||||
|
@ -453,6 +476,17 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
|
|||
FALSE);
|
||||
}
|
||||
|
||||
/* Set 'USERSPROFILE' variable to the default users profile */
|
||||
Length = MAX_PATH;
|
||||
if (GetDefaultUserProfileDirectory(Buffer,
|
||||
&Length))
|
||||
{
|
||||
SetUserEnvironmentVariable(lpEnvironment,
|
||||
L"USERPROFILE",
|
||||
Buffer,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
|
||||
0,
|
||||
|
|
Loading…
Reference in a new issue