Author: ekohl
Date: Sat Nov 7 16:40:33 2015
New Revision: 69834
URL:
http://svn.reactos.org/svn/reactos?rev=69834&view=rev
Log:
[USERENV]
CreateEnvironmentBlock: Set or overwrite the SystemRoot, SystemDrive and USERPROFILE
environment variables of the new environment block.
Modified:
trunk/reactos/dll/win32/userenv/environment.c
Modified: trunk/reactos/dll/win32/userenv/environment.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/environm…
==============================================================================
--- trunk/reactos/dll/win32/userenv/environment.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/userenv/environment.c [iso-8859-1] Sat Nov 7 16:40:33 2015
@@ -431,6 +431,29 @@
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,
@@ -451,6 +474,17 @@
L"ALLUSERSPROFILE",
Buffer,
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,