[WINLOGON]

- Use the states STATE_INIT and SATE_LOGGED_OFF_SAS.
- State machine clean-up.

svn path=/trunk/; revision=61630
This commit is contained in:
Eric Kohl 2014-01-14 22:27:34 +00:00
parent 9f254f9838
commit a4ff1dbc49
4 changed files with 113 additions and 94 deletions

View file

@ -844,23 +844,29 @@ DoGenericAction(
switch (wlxAction)
{
case WLX_SAS_ACTION_LOGON: /* 0x01 */
if (HandleLogon(Session))
if (Session->LogonState == STATE_LOGGED_OFF_SAS)
{
SwitchDesktop(Session->ApplicationDesktop);
Session->LogonState = STATE_LOGGED_ON;
if (HandleLogon(Session))
{
SwitchDesktop(Session->ApplicationDesktop);
Session->LogonState = STATE_LOGGED_ON;
}
else
{
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
}
}
else
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
break;
case WLX_SAS_ACTION_NONE: /* 0x02 */
if (Session->LogonState == STATE_LOGGED_ON_SAS)
if (Session->LogonState == STATE_LOGGED_OFF_SAS)
{
Session->LogonState = STATE_LOGGED_OFF;
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
}
else if (Session->LogonState == STATE_LOGGED_ON_SAS)
{
Session->LogonState = STATE_LOGGED_ON;
}
else if (Session->LogonState == STATE_LOGGED_OFF)
{
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
}
else if (Session->LogonState == STATE_LOCKED_SAS)
{
Session->LogonState = STATE_LOCKED;
@ -928,82 +934,95 @@ DispatchSAS(
{
DWORD wlxAction = WLX_SAS_ACTION_NONE;
HWND hwnd;
PSID LogonSid = NULL; /* FIXME */
BOOL bSecure = TRUE;
/* Ignore SAS if we are already in an SAS state */
if (Session->LogonState == STATE_LOGGED_OFF_SAS ||
Session->LogonState == STATE_LOGGED_ON_SAS ||
Session->LogonState == STATE_LOCKED_SAS)
return;
if (Session->LogonState == STATE_LOGGED_ON)
switch (dwSasType)
{
Session->LogonState = STATE_LOGGED_ON_SAS;
wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType, NULL);
}
else if (Session->LogonState == STATE_LOCKED)
{
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
{
SendMessage(hwnd, WM_USER, 0, 0);
}
Session->LogonState = STATE_LOCKED_SAS;
wlxAction = (DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
}
else
{
/* Display a new dialog (if necessary) */
switch (dwSasType)
{
case WLX_SAS_TYPE_TIMEOUT: /* 0x00 */
case WLX_SAS_TYPE_CTRL_ALT_DEL:
switch (Session->LogonState)
{
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
return;
case STATE_INIT:
Session->LogonState = STATE_LOGGED_OFF;
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
return;
case STATE_LOGGED_OFF:
Session->LogonState = STATE_LOGGED_OFF_SAS;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
SendMessage(hwnd, WLX_WM_SAS, 0, 0);
Session->Options = 0;
wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOutSAS(
Session->Gina.Context,
Session->SASAction,
&Session->LogonId,
LogonSid,
&Session->Options,
&Session->UserToken,
&Session->MprNotifyInfo,
(PVOID*)&Session->Profile);
break;
case STATE_LOGGED_OFF_SAS:
/* Ignore SAS if we are already in an SAS state */
return;
case STATE_LOGGED_ON:
Session->LogonState = STATE_LOGGED_ON_SAS;
wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType, NULL);
break;
case STATE_LOGGED_ON_SAS:
/* Ignore SAS if we are already in an SAS state */
return;
case STATE_LOCKED:
Session->LogonState = STATE_LOCKED_SAS;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
SendMessage(hwnd, WLX_WM_SAS, 0, 0);
wlxAction = (DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
break;
case STATE_LOCKED_SAS:
/* Ignore SAS if we are already in an SAS state */
return;
default:
return;
}
default:
{
PSID LogonSid = NULL; /* FIXME */
break;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
case WLX_SAS_TYPE_TIMEOUT:
return;
case WLX_SAS_TYPE_SCRNSVR_TIMEOUT:
if (!Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
{
/* Skip start of screen saver */
SetEvent(Session->hEndOfScreenSaver);
}
else
{
StartScreenSaver(Session);
if (bSecure)
{
SendMessage(hwnd, WM_USER, 0, 0);
wlxAction = WLX_SAS_ACTION_LOCK_WKSTA;
// DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
}
Session->Options = 0;
wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOutSAS(
Session->Gina.Context,
Session->SASAction,
&Session->LogonId,
LogonSid,
&Session->Options,
&Session->UserToken,
&Session->MprNotifyInfo,
(PVOID*)&Session->Profile);
break;
}
}
}
break;
if (dwSasType == WLX_SAS_TYPE_SCRNSVR_TIMEOUT)
{
BOOL bSecure = TRUE;
if (!Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
{
/* Skip start of screen saver */
SetEvent(Session->hEndOfScreenSaver);
}
else
{
StartScreenSaver(Session);
if (bSecure)
DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
}
case WLX_SAS_TYPE_SCRNSVR_ACTIVITY:
SetEvent(Session->hUserActivity);
break;
}
else if (dwSasType == WLX_SAS_TYPE_SCRNSVR_ACTIVITY)
SetEvent(Session->hUserActivity);
DoGenericAction(Session, wlxAction);
}

View file

@ -429,7 +429,7 @@ WinMain(
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGCOMPUTERSETTINGS);
/* Display logged out screen */
WLSession->LogonState = STATE_LOGGED_OFF;
WLSession->LogonState = STATE_INIT;
RemoveStatusMessage(WLSession);
/* Check for pending setup */
@ -442,7 +442,7 @@ WinMain(
RunSetup();
}
else
PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_TIMEOUT, 0);
PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_CTRL_ALT_DEL, 0);
/* Tell kernel that CurrentControlSet is good (needed
* to support Last good known configuration boot) */

View file

@ -155,16 +155,6 @@ typedef struct _GINAINSTANCE
* STATE_LOCKED. Pressing "Shutdown" changes the state to
* STATE_SHUTTING_DOWN.
*
* STATE_SCREENSAVER
* Winlogon runs the screen saver. Upon user activity, the screensaver
* terminates and the state changes back to STATE_LOGGED_ON if the secure
* screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
*
* STATE_LOGGING_OFF
* Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
* the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
* and changes the state to STATE_LOGGED_OFF.
*
* STATE_LOCKED
* Winlogon shows the locked message dialog. When the user presses "Ctrl-
* Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
@ -177,6 +167,11 @@ typedef struct _GINAINSTANCE
* pressing "OK" unlocks the computer and changes the state to
* STATE_LOGGED_ON.
*
* STATE_LOGGING_OFF
* Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
* the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
* and changes the state to STATE_LOGGED_OFF.
*
* STATE_SHUTTING_DOWN
* Winlogon shows the shutdown dialog. Presing "Cancel" or a timeout will
* change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
@ -184,20 +179,25 @@ typedef struct _GINAINSTANCE
*
* STATE_SHUT_DOWN
* Terminates Winlogon and initiates shut-down.
*
* STATE_SCREENSAVER
* Winlogon runs the screen saver. Upon user activity, the screensaver
* terminates and the state changes back to STATE_LOGGED_ON if the secure
* screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
*/
typedef enum _LOGON_STATE
{
STATE_INIT, // not used yet
STATE_INIT,
STATE_LOGGED_OFF,
STATE_LOGGED_OFF_SAS, // not used yet
STATE_LOGGED_OFF_SAS,
STATE_LOGGED_ON,
STATE_LOGGED_ON_SAS,
STATE_SCREENSAVER, // not used yet
STATE_LOCKED,
STATE_LOCKED_SAS,
STATE_LOGGING_OFF, // not used yet
STATE_SHUTTING_DOWN, // not used yet
STATE_SHUT_DOWN // not used yet
STATE_SHUT_DOWN, // not used yet
STATE_SCREENSAVER // not used yet
} LOGON_STATE, *PLOGON_STATE;
#define LockWorkstation(Session)

View file

@ -155,9 +155,9 @@ DefaultWlxWindowProc(
return FALSE;
}
if (uMsg == WM_USER)
if (uMsg == WLX_WM_SAS)
{
EndDialog(hwndDlg, 0);
EndDialog(hwndDlg, WLX_DLG_SAS);
return 0;
}