Set the APPDATA environment variable when logging in based on the information SHGetFolderPathW returns for the passed User Token.

Windows seems to do this the same way (verified with GNU strings)

svn path=/trunk/; revision=39295
This commit is contained in:
Colin Finck 2009-02-02 23:08:51 +00:00
parent 0228866724
commit d7ca3b27e6
3 changed files with 19 additions and 0 deletions

View file

@ -175,6 +175,9 @@ HandleLogon(
SIZE_T EnvBlockSize = 0, ProfileSize = 0;
BOOLEAN Old;
BOOL ret = FALSE;
UNICODE_STRING VariableName;
UNICODE_STRING VariableValue;
WCHAR AppDataPath[MAX_PATH];
/* Loading personal settings */
DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS);
@ -219,6 +222,18 @@ HandleLogon(
goto cleanup;
}
/* Use SHGetFolderPathW for getting the AppData path */
if(SHGetFolderPathW(NULL, CSIDL_APPDATA, Session->UserToken, SHGFP_TYPE_CURRENT, AppDataPath) == E_FAIL)
{
WARN("WL: SHGetFolderPathW() failed\n");
goto cleanup;
}
/* Some environment variables need to be set by winlogon (verified against Windows XP winlogon) */
RtlInitUnicodeString(&VariableName, L"APPDATA");
RtlInitUnicodeString(&VariableValue, AppDataPath);
RtlSetEnvironmentVariable((PWSTR*)&lpEnvironment, &VariableName, &VariableValue);
if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment)
{
/* Count required size for full environment */
@ -264,6 +279,8 @@ HandleLogon(
DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
UpdatePerUserSystemParameters(0, TRUE);
/* FIXME: Set the "Volatile Environment" key for the new user */
/* Set default language */
if (!SetDefaultLanguage(TRUE))
{

View file

@ -39,6 +39,7 @@
#include <ntsecapi.h>
#include <accctrl.h>
#include <aclapi.h>
#include <shlobj.h>
#include <reactos/winlogon.h>

View file

@ -9,6 +9,7 @@
<library>advapi32</library>
<library>userenv</library>
<library>secur32</library>
<library>shell32</library>
<file>sas.c</file>
<file>screensaver.c</file>
<file>setup.c</file>