Better resource freeing

Fix a bug introduced in r29644, when WM_CREATE was sometimes leaking to WM_DESTROY

svn path=/trunk/; revision=29651
This commit is contained in:
Hervé Poussineau 2007-10-17 19:35:41 +00:00
parent cfcee17413
commit b81c161f7d

View file

@ -220,13 +220,8 @@ HandleLogon(
} }
/* FIXME: Append variables of Session->Profile->pszEnvironment */ /* FIXME: Append variables of Session->Profile->pszEnvironment */
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS); DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
/* FIXME: UpdatePerUserSystemParameters(0, TRUE); */ UpdatePerUserSystemParameters(0, TRUE);
/* 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 */ /* Set default language */
if (!SetDefaultLanguage(TRUE)) if (!SetDefaultLanguage(TRUE))
@ -235,6 +230,11 @@ HandleLogon(
goto cleanup; 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);
if (!Session->Gina.Functions.WlxActivateUserShell( if (!Session->Gina.Functions.WlxActivateUserShell(
Session->Gina.Context, Session->Gina.Context,
L"Default", L"Default",
@ -255,7 +255,11 @@ HandleLogon(
ret = TRUE; ret = TRUE;
cleanup: cleanup:
HeapFree(GetProcessHeap(), 0, Session->Profile); if (Session->Profile)
{
HeapFree(GetProcessHeap(), 0, Session->Profile->pszProfile);
HeapFree(GetProcessHeap(), 0, Session->Profile);
}
Session->Profile = NULL; Session->Profile = NULL;
if (!ret if (!ret
&& ProfileInfo.hProfile != INVALID_HANDLE_VALUE) && ProfileInfo.hProfile != INVALID_HANDLE_VALUE)
@ -487,9 +491,9 @@ HandleLogoff(
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
//UnloadUserProfile(Session->UserToken, Session->hProfileInfo); UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
//CloseHandle(Session->UserToken); CloseHandle(Session->UserToken);
//UpdatePerUserSystemParameters(0, FALSE); UpdatePerUserSystemParameters(0, FALSE);
Session->LogonStatus = WKSTA_IS_LOGGED_OFF; Session->LogonStatus = WKSTA_IS_LOGGED_OFF;
Session->UserToken = NULL; Session->UserToken = NULL;
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -869,10 +873,9 @@ SASWindowProc(
/* Save the Session pointer */ /* Save the Session pointer */
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session); SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session);
if (!GetSetupType()) if (GetSetupType() == 0)
{ return TRUE;
return RegisterHotKeys(Session, hwndDlg); return RegisterHotKeys(Session, hwndDlg);
}
} }
case WM_DESTROY: case WM_DESTROY:
{ {