[WINLOGON]

- Implement the STATE_LOCKED and STATE_LOCKED_SAS states and their transitions.

[MSGINA]
- Disable the logoff button of the security dialog if the AutoAdminLogon option is enabled.
- Implement the unlock computer dialog. The user name and password check is not implemented yet. Just press OK to unlock the computer.
- Simulate an SAS when the DisableCAD option is enabled and the computer is locked. The unlock dialog appears immediately.

svn path=/trunk/; revision=61622
This commit is contained in:
Eric Kohl 2014-01-13 22:15:27 +00:00
parent 2a380017c9
commit c633b79451
4 changed files with 123 additions and 8 deletions

View file

@ -861,6 +861,11 @@ DoGenericAction(
{
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
}
else if (Session->LogonState == STATE_LOCKED_SAS)
{
Session->LogonState = STATE_LOCKED;
Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
}
break;
case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
@ -922,10 +927,12 @@ DispatchSAS(
IN DWORD dwSasType)
{
DWORD wlxAction = WLX_SAS_ACTION_NONE;
HWND hwnd;
/* 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_LOGGED_ON_SAS ||
Session->LogonState == STATE_LOCKED_SAS)
return;
if (Session->LogonState == STATE_LOGGED_ON)
@ -934,7 +941,16 @@ DispatchSAS(
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) */
@ -948,7 +964,6 @@ DispatchSAS(
default:
{
PSID LogonSid = NULL; /* FIXME */
HWND hwnd;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)

View file

@ -194,7 +194,7 @@ typedef enum _LOGON_STATE
STATE_LOGGED_ON_SAS,
STATE_SCREENSAVER, // not used yet
STATE_LOCKED,
STATE_LOCKED_SAS, // not used yet
STATE_LOCKED_SAS,
STATE_LOGGING_OFF, // not used yet
STATE_SHUTTING_DOWN, // not used yet
STATE_SHUT_DOWN // not used yet

View file

@ -282,6 +282,9 @@ OnInitSecurityDlg(HWND hwnd,
wsprintfW(Buffer4, Buffer1, Buffer2, Buffer3);
SetDlgItemTextW(hwnd, IDC_LOGONDATE, Buffer4);
if (pgContext->bAutoAdminLogon == TRUE)
EnableWindow(GetDlgItem(hwnd, IDC_LOGOFF), FALSE);
}
@ -518,16 +521,109 @@ GUILoggedOutSAS(
return WLX_SAS_ACTION_NONE;
}
static
INT_PTR
CALLBACK
UnlockWindowProc(
IN HWND hwndDlg,
IN UINT uMsg,
IN WPARAM wParam,
IN LPARAM lParam)
{
PGINA_CONTEXT pgContext;
pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
switch (uMsg)
{
case WM_INITDIALOG:
pgContext = (PGINA_CONTEXT)lParam;
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
if (pgContext->bDisableCAD == TRUE)
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
if (pgContext->hBitmap)
{
hdc = BeginPaint(hwndDlg, &ps);
DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
EndPaint(hwndDlg, &ps);
}
return TRUE;
}
case WM_DESTROY:
DeleteObject(pgContext->hBitmap);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
#if 0
LPWSTR UserName = NULL, Password = NULL;
INT result = WLX_SAS_ACTION_NONE;
if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
break;
if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) &&
DoLoginTasks(pgContext, UserName, NULL, Password))
{
result = WLX_SAS_ACTION_LOGON;
}
HeapFree(GetProcessHeap(), 0, UserName);
HeapFree(GetProcessHeap(), 0, Password);
EndDialog(hwndDlg, result);
#endif
EndDialog(hwndDlg, WLX_SAS_ACTION_UNLOCK_WKSTA);
return TRUE;
}
case IDCANCEL:
EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
return TRUE;
}
break;
}
return FALSE;
}
static INT
GUILockedSAS(
IN OUT PGINA_CONTEXT pgContext)
{
int result;
TRACE("GUILockedSAS()\n");
UNREFERENCED_PARAMETER(pgContext);
result = pgContext->pWlxFuncs->WlxDialogBoxParam(
pgContext->hWlx,
pgContext->hDllInstance,
MAKEINTRESOURCEW(IDD_UNLOCK_DLG),
GetDesktopWindow(),
UnlockWindowProc,
(LPARAM)pgContext);
if (result >= WLX_SAS_ACTION_LOGON &&
result <= WLX_SAS_ACTION_SWITCH_CONSOLE)
{
WARN("GUILockedSAS() returns 0x%x\n", result);
return result;
}
UNIMPLEMENTED;
return WLX_SAS_ACTION_UNLOCK_WKSTA;
WARN("GUILockedSAS() failed (0x%x)\n", result);
return WLX_SAS_ACTION_NONE;
}

View file

@ -819,8 +819,6 @@ WlxDisplaySASNotice(
else
pgContext->AutoLogonState = AUTOLOGON_DISABLED;
TRACE("pgContext->bDisableCAD: %lu\n", pgContext->bDisableCAD);
if (pgContext->bDisableCAD == TRUE)
{
pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
@ -902,6 +900,12 @@ WlxDisplayLockedNotice(PVOID pWlxContext)
TRACE("WlxDisplayLockedNotice()\n");
if (pgContext->bDisableCAD == TRUE)
{
pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
return;
}
pGinaUI->DisplayLockedNotice(pgContext);
}