Index: dll/win32/userenv/environment.c =================================================================== --- dll/win32/userenv/environment.c (revision 68269) +++ dll/win32/userenv/environment.c (working copy) @@ -510,10 +510,30 @@ Buffer, &Length)) { + LONG lMinLen = 2; + SetUserEnvironmentVariable(lpEnvironment, L"USERPROFILE", Buffer, FALSE); + + /* At least : */ + if (Length > lMinLen) + { + /* Set 'HOMEDRIVE' variable */ + StringCchCopyNW(szValue, MAX_PATH, Buffer, lMinLen); + SetUserEnvironmentVariable(lpEnvironment, + L"HOMEDRIVE", + szValue, + FALSE); + + /* Set 'HOMEPATH' variable */ + StringCchCopyNW(szValue, MAX_PATH, Buffer + lMinLen, Length - lMinLen); + SetUserEnvironmentVariable(lpEnvironment, + L"HOMEPATH", + szValue, + FALSE); + } } if (GetUserAndDomainName(hToken, Index: dll/win32/userenv/precomp.h =================================================================== --- dll/win32/userenv/precomp.h (revision 68269) +++ dll/win32/userenv/precomp.h (working copy) @@ -15,6 +15,7 @@ #define NTOS_MODE_USER #include #include +#include #include "internal.h"