diff --git a/reactos/dll/win32/userenv/environment.c b/reactos/dll/win32/userenv/environment.c index ccb36d83664..47af4e0e77a 100644 --- a/reactos/dll/win32/userenv/environment.c +++ b/reactos/dll/win32/userenv/environment.c @@ -510,10 +510,30 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment, Buffer, &Length)) { + DWORD MinLen = 2; + SetUserEnvironmentVariable(lpEnvironment, L"USERPROFILE", Buffer, FALSE); + + /* At least : */ + 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, diff --git a/reactos/dll/win32/userenv/precomp.h b/reactos/dll/win32/userenv/precomp.h index 814688f7e22..ecb00c66eaa 100644 --- a/reactos/dll/win32/userenv/precomp.h +++ b/reactos/dll/win32/userenv/precomp.h @@ -15,6 +15,7 @@ #define NTOS_MODE_USER #include #include +#include #include "internal.h"