[ros-diffs] [cfinck] 40581: Hack: Add the APPDATA variable to the environment when logging in. Used to be in trunk, but was reverted there, because it's also accessible via CreateEnvironmentBlock under Windows. Need more time for researching the right thing to do here.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sat Apr 18 17:08:53 CEST 2009


Author: cfinck
Date: Sat Apr 18 19:08:52 2009
New Revision: 40581

URL: http://svn.reactos.org/svn/reactos?rev=40581&view=rev
Log:
Hack: Add the APPDATA variable to the environment when logging in.
Used to be in trunk, but was reverted there, because it's also accessible via CreateEnvironmentBlock under Windows. Need more time for researching the right thing to do here.

Modified:
    branches/ros-branch-0_3_9/reactos/base/system/winlogon/sas.c
    branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.h
    branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.rbuild

Modified: branches/ros-branch-0_3_9/reactos/base/system/winlogon/sas.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_9/reactos/base/system/winlogon/sas.c?rev=40581&r1=40580&r2=40581&view=diff
==============================================================================
--- branches/ros-branch-0_3_9/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_9/reactos/base/system/winlogon/sas.c [iso-8859-1] Sat Apr 18 19:08:52 2009
@@ -175,6 +175,9 @@
 	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);
@@ -218,6 +221,18 @@
 		WARN("WL: CreateEnvironmentBlock() failed\n");
 		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)
 	{
@@ -263,6 +278,8 @@
 
 	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))

Modified: branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.h?rev=40581&r1=40580&r2=40581&view=diff
==============================================================================
--- branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.h [iso-8859-1] (original)
+++ branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.h [iso-8859-1] Sat Apr 18 19:08:52 2009
@@ -39,6 +39,7 @@
 #include <ntsecapi.h>
 #include <accctrl.h>
 #include <aclapi.h>
+#include <shlobj.h>
 
 #include <reactos/winlogon.h>
 

Modified: branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.rbuild?rev=40581&r1=40580&r2=40581&view=diff
==============================================================================
--- branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.rbuild [iso-8859-1] (original)
+++ branches/ros-branch-0_3_9/reactos/base/system/winlogon/winlogon.rbuild [iso-8859-1] Sat Apr 18 19:08:52 2009
@@ -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>



More information about the Ros-diffs mailing list