[USERENV] Add %HOMEDRIVE% and %HOMEPATH% environment variables. Brought to you by Radek Liška. CORE-9875

svn path=/trunk/; revision=68284
This commit is contained in:
Amine Khaldi 2015-06-26 18:59:25 +00:00
parent ea61881cf9
commit 78f1c4a361
2 changed files with 21 additions and 0 deletions

View file

@ -510,10 +510,30 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
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,

View file

@ -15,6 +15,7 @@
#define NTOS_MODE_USER
#include <ndk/rtlfuncs.h>
#include <userenv.h>
#include <strsafe.h>
#include "internal.h"