Author: akhaldi Date: Fri Jun 26 18:59:25 2015 New Revision: 68284
URL: http://svn.reactos.org/svn/reactos?rev=68284&view=rev Log: [USERENV] Add %HOMEDRIVE% and %HOMEPATH% environment variables. Brought to you by Radek Liška. CORE-9875
Modified: trunk/reactos/dll/win32/userenv/environment.c trunk/reactos/dll/win32/userenv/precomp.h
Modified: trunk/reactos/dll/win32/userenv/environment.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/environme... ============================================================================== --- trunk/reactos/dll/win32/userenv/environment.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/userenv/environment.c [iso-8859-1] Fri Jun 26 18:59:25 2015 @@ -510,10 +510,30 @@ Buffer, &Length)) { + DWORD MinLen = 2; + SetUserEnvironmentVariable(lpEnvironment, L"USERPROFILE", Buffer, FALSE); + + /* At least <drive letter>:<path> */ + if (Length > MinLen) + { + /* Set 'HOMEDRIVE' variable */ + StringCchCopyNW(szValue, MAX_PATH, Buffer, MinLen); + SetUserEnvironmentVariable(lpEnvironment, + L"HOMEDRIVE", + szValue, + FALSE); + + /* Set 'HOMEPATH' variable */ + StringCchCopyNW(szValue, MAX_PATH, Buffer + MinLen, Length - MinLen); + SetUserEnvironmentVariable(lpEnvironment, + L"HOMEPATH", + szValue, + FALSE); + } }
if (GetUserAndDomainName(hToken,
Modified: trunk/reactos/dll/win32/userenv/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/precomp.h... ============================================================================== --- trunk/reactos/dll/win32/userenv/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/userenv/precomp.h [iso-8859-1] Fri Jun 26 18:59:25 2015 @@ -15,6 +15,7 @@ #define NTOS_MODE_USER #include <ndk/rtlfuncs.h> #include <userenv.h> +#include <strsafe.h>
#include "internal.h"