Author: hpoussin
Date: Wed Oct 17 23:35:41 2007
New Revision: 29651
URL:
http://svn.reactos.org/svn/reactos?rev=29651&view=rev
Log:
Better resource freeing
Fix a bug introduced in r29644, when WM_CREATE was sometimes leaking to WM_DESTROY
Modified:
trunk/reactos/base/system/winlogon/sas.c
Modified: trunk/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c (original)
+++ trunk/reactos/base/system/winlogon/sas.c Wed Oct 17 23:35:41 2007
@@ -220,20 +220,20 @@
}
/* FIXME: Append variables of Session->Profile->pszEnvironment */
- //DisplayStatusMessage(Session, Session->WinlogonDesktop,
IDS_APPLYINGYOURPERSONALSETTINGS);
- /* FIXME: UpdatePerUserSystemParameters(0, TRUE); */
+ DisplayStatusMessage(Session, Session->WinlogonDesktop,
IDS_APPLYINGYOURPERSONALSETTINGS);
+ UpdatePerUserSystemParameters(0, TRUE);
+
+ /* Set default language */
+ if (!SetDefaultLanguage(TRUE))
+ {
+ WARN("WL: SetDefaultLanguage() failed\n");
+ goto cleanup;
+ }
/* Get privilege */
/* FIXME: who should do it? winlogon or gina? */
/* FIXME: reverting to lower privileges after creating user shell? */
RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &Old);
-
- /* Set default language */
- if (!SetDefaultLanguage(TRUE))
- {
- WARN("WL: SetDefaultLanguage() failed\n");
- goto cleanup;
- }
if (!Session->Gina.Functions.WlxActivateUserShell(
Session->Gina.Context,
@@ -255,7 +255,11 @@
ret = TRUE;
cleanup:
- HeapFree(GetProcessHeap(), 0, Session->Profile);
+ if (Session->Profile)
+ {
+ HeapFree(GetProcessHeap(), 0, Session->Profile->pszProfile);
+ HeapFree(GetProcessHeap(), 0, Session->Profile);
+ }
Session->Profile = NULL;
if (!ret
&& ProfileInfo.hProfile != INVALID_HANDLE_VALUE)
@@ -487,9 +491,9 @@
return STATUS_UNSUCCESSFUL;
}
- //UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
- //CloseHandle(Session->UserToken);
- //UpdatePerUserSystemParameters(0, FALSE);
+ UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
+ CloseHandle(Session->UserToken);
+ UpdatePerUserSystemParameters(0, FALSE);
Session->LogonStatus = WKSTA_IS_LOGGED_OFF;
Session->UserToken = NULL;
return STATUS_SUCCESS;
@@ -869,10 +873,9 @@
/* Save the Session pointer */
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session);
- if (!GetSetupType())
- {
- return RegisterHotKeys(Session, hwndDlg);
- }
+ if (GetSetupType() == 0)
+ return TRUE;
+ return RegisterHotKeys(Session, hwndDlg);
}
case WM_DESTROY:
{