Author: cfinck
Date: Mon Feb 2 07:55:23 2009
New Revision: 39287
URL:
http://svn.reactos.org/svn/reactos?rev=39287&view=rev
Log:
Merge 39274
Modified:
branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c
Modified: branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c [iso-8859-1] Mon Feb 2
07:55:23 2009
@@ -170,6 +170,9 @@
{
PROFILEINFOW ProfileInfo;
LPVOID lpEnvironment = NULL;
+ LPWSTR lpFullEnv = NULL;
+ LPCWSTR wstr;
+ SIZE_T EnvBlockSize = 0, ProfileSize = 0;
BOOLEAN Old;
BOOL ret = FALSE;
@@ -215,7 +218,48 @@
WARN("WL: CreateEnvironmentBlock() failed\n");
goto cleanup;
}
- /* FIXME: Append variables of Session->Profile->pszEnvironment */
+
+ if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 &&
Session->Profile->pszEnvironment)
+ {
+ /* Count required size for full environment */
+ wstr = (LPCWSTR)lpEnvironment;
+ while (*wstr != UNICODE_NULL)
+ {
+ SIZE_T size = wcslen(wstr) + 1;
+ wstr += size;
+ EnvBlockSize += size;
+ }
+ wstr = Session->Profile->pszEnvironment;
+ while (*wstr != UNICODE_NULL)
+ {
+ SIZE_T size = wcslen(wstr) + 1;
+ wstr += size;
+ ProfileSize += size;
+ }
+
+ /* Allocate enough memory */
+ lpFullEnv = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) *
sizeof(WCHAR));
+ if (!lpFullEnv)
+ {
+ TRACE("HeapAlloc() failed\n");
+ goto cleanup;
+ }
+
+ /* Fill user environment block */
+ CopyMemory(
+ lpFullEnv,
+ lpEnvironment,
+ EnvBlockSize * sizeof(WCHAR));
+ CopyMemory(
+ &lpFullEnv[EnvBlockSize],
+ Session->Profile->pszEnvironment,
+ ProfileSize * sizeof(WCHAR));
+ lpFullEnv[EnvBlockSize + ProfileSize] = UNICODE_NULL;
+ }
+ else
+ {
+ lpFullEnv = (LPWSTR)lpEnvironment;
+ }
DisplayStatusMessage(Session, Session->WinlogonDesktop,
IDS_APPLYINGYOURPERSONALSETTINGS);
UpdatePerUserSystemParameters(0, TRUE);
@@ -236,7 +280,7 @@
Session->Gina.Context,
L"Default",
NULL, /* FIXME */
- lpEnvironment))
+ lpFullEnv))
{
//WCHAR StatusMsg[256];
WARN("WL: WlxActivateUserShell() failed\n");
@@ -263,6 +307,8 @@
{
UnloadUserProfile(WLSession->UserToken, ProfileInfo.hProfile);
}
+ if (lpFullEnv != lpEnvironment)
+ HeapFree(GetProcessHeap(), 0, lpFullEnv);
if (lpEnvironment)
DestroyEnvironmentBlock(lpEnvironment);
RemoveStatusMessage(Session);