[WINLOGON] Move logoff flags handling code to HandleLogoff

This commit is contained in:
Thamatip Chitpong 2024-12-03 23:55:11 +07:00
parent 18c3f39c18
commit 77bfc12e0f

View file

@ -786,8 +786,8 @@ DestroyLogoffSecurityAttributes(
static static
NTSTATUS NTSTATUS
HandleLogoff( HandleLogoff(
IN OUT PWLSESSION Session, _Inout_ PWLSESSION Session,
IN UINT Flags) _In_ DWORD wlxAction)
{ {
PLOGOFF_SHUTDOWN_DATA LSData; PLOGOFF_SHUTDOWN_DATA LSData;
PSECURITY_ATTRIBUTES psa; PSECURITY_ATTRIBUTES psa;
@ -802,7 +802,13 @@ HandleLogoff(
ERR("Failed to allocate mem for thread data\n"); ERR("Failed to allocate mem for thread data\n");
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }
LSData->Flags = Flags;
LSData->Flags = EWX_LOGOFF;
if (wlxAction == WLX_SAS_ACTION_FORCE_LOGOFF)
{
LSData->Flags |= EWX_FORCE;
}
LSData->Session = Session; LSData->Session = Session;
Status = CreateLogoffSecurityAttributes(&psa); Status = CreateLogoffSecurityAttributes(&psa);
@ -1065,12 +1071,9 @@ DoGenericAction(
case WLX_SAS_ACTION_SHUTDOWN_REBOOT: /* 0x0b */ case WLX_SAS_ACTION_SHUTDOWN_REBOOT: /* 0x0b */
if (Session->LogonState != STATE_LOGGED_OFF) if (Session->LogonState != STATE_LOGGED_OFF)
{ {
UINT LogOffFlags = EWX_LOGOFF;
if (wlxAction == WLX_SAS_ACTION_FORCE_LOGOFF)
LogOffFlags |= EWX_FORCE;
if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context)) if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context))
break; break;
if (!NT_SUCCESS(HandleLogoff(Session, LogOffFlags))) if (!NT_SUCCESS(HandleLogoff(Session, wlxAction)))
{ {
RemoveStatusMessage(Session); RemoveStatusMessage(Session);
break; break;