Author: ekohl
Date: Mon Jan 13 22:15:27 2014
New Revision: 61622
URL:
http://svn.reactos.org/svn/reactos?rev=61622&view=rev
Log:
[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.
Modified:
trunk/reactos/base/system/winlogon/sas.c
trunk/reactos/base/system/winlogon/winlogon.h
trunk/reactos/dll/win32/msgina/gui.c
trunk/reactos/dll/win32/msgina/msgina.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 [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] Mon Jan 13 22:15:27 2014
@@ -861,6 +861,11 @@
{
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 @@
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 @@
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 @@
default:
{
PSID LogonSid = NULL; /* FIXME */
- HWND hwnd;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
Modified: trunk/reactos/base/system/winlogon/winlogon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] Mon Jan 13 22:15:27 2014
@@ -194,7 +194,7 @@
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
Modified: trunk/reactos/dll/win32/msgina/gui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/gui.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] Mon Jan 13 22:15:27 2014
@@ -282,6 +282,9 @@
wsprintfW(Buffer4, Buffer1, Buffer2, Buffer3);
SetDlgItemTextW(hwnd, IDC_LOGONDATE, Buffer4);
+
+ if (pgContext->bAutoAdminLogon == TRUE)
+ EnableWindow(GetDlgItem(hwnd, IDC_LOGOFF), FALSE);
}
@@ -518,16 +521,109 @@
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);
-
- UNIMPLEMENTED;
- return WLX_SAS_ACTION_UNLOCK_WKSTA;
+ 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;
+ }
+
+ WARN("GUILockedSAS() failed (0x%x)\n", result);
+ return WLX_SAS_ACTION_NONE;
}
Modified: trunk/reactos/dll/win32/msgina/msgina.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
==============================================================================
--- trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] Mon Jan 13 22:15:27 2014
@@ -819,8 +819,6 @@
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 @@
TRACE("WlxDisplayLockedNotice()\n");
+ if (pgContext->bDisableCAD == TRUE)
+ {
+ pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx,
WLX_SAS_TYPE_CTRL_ALT_DEL);
+ return;
+ }
+
pGinaUI->DisplayLockedNotice(pgContext);
}