Author: ekohl
Date: Sun Jan 12 10:57:02 2014
New Revision: 61592
URL:
http://svn.reactos.org/svn/reactos?rev=61592&view=rev
Log:
[WINLOGON]
- Change state to STATE_LOGGED_ON_SAS while the security dialog is open.
- Ignore an SAS while winlogon is already in an SAS state.
[MSGINA]
- Read AutoAdminLogon and DisableCAD settings when msgina is initialized.
- LoggedOutWindowProc: Disable the Cancel button on the logon dialog if the DisableCAD
option has been enabled.
- GUILoggedOnSAS: Fix misuse of result variable which caused some really strange effects.
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
trunk/reactos/dll/win32/msgina/msgina.h
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] Sun Jan 12 10:57:02 2014
@@ -845,7 +845,11 @@
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
break;
case WLX_SAS_ACTION_NONE: /* 0x02 */
- if (Session->LogonState == STATE_LOGGED_OFF)
+ 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);
}
@@ -891,6 +895,7 @@
break;
case WLX_SAS_ACTION_TASKLIST: /* 0x07 */
SwitchDesktop(WLSession->ApplicationDesktop);
+ Session->LogonState = STATE_LOGGED_ON;
StartTaskManager(Session);
break;
case WLX_SAS_ACTION_UNLOCK_WKSTA: /* 0x08 */
@@ -910,8 +915,16 @@
{
DWORD wlxAction = WLX_SAS_ACTION_NONE;
+ /* Ignore SAS if we are already in an SAS state */
+ if (Session->LogonState == STATE_LOGGED_OFF_SAS ||
+ Session->LogonState == STATE_LOGGED_ON_SAS)
+ return;
+
if (Session->LogonState == STATE_LOGGED_ON)
+ {
+ Session->LogonState = STATE_LOGGED_ON_SAS;
wlxAction =
(DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType,
NULL);
+ }
else if (Session->LogonState == STATE_LOCKED)
wlxAction =
(DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
else
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] Sun Jan 12 10:57:02 2014
@@ -193,7 +193,7 @@
STATE_LOGGED_OFF,
STATE_LOGGED_OFF_SAS, // not used yet
STATE_LOGGED_ON,
- STATE_LOGGED_ON_SAS, // not used yet
+ STATE_LOGGED_ON_SAS,
STATE_SCREENSAVER, // not used yet
STATE_LOCKED,
STATE_LOCKED_SAS, // 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] Sun Jan 12 10:57:02 2014
@@ -383,7 +383,7 @@
return WLX_SAS_ACTION_NONE;
}
- result = pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
+ pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
pgContext->hWlx);
result = pgContext->pWlxFuncs->WlxDialogBoxParam(
@@ -402,7 +402,7 @@
if (result == WLX_SAS_ACTION_NONE)
{
- result = pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
+ pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
pgContext->hWlx);
}
@@ -427,6 +427,10 @@
/* FIXME: take care of DontDisplayLastUserName, NoDomainUI,
ShutdownWithoutLogon */
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);
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] Sun Jan 12 10:57:02 2014
@@ -86,6 +86,28 @@
return ERROR_SUCCESS;
}
+static LONG
+ReadRegDwordKey(
+ IN HKEY hKey,
+ IN LPCWSTR pszKey,
+ OUT LPDWORD pValue)
+{
+ LONG rc;
+ DWORD dwType;
+ DWORD cbData;
+ DWORD dwValue;
+
+ if (!pValue)
+ return ERROR_INVALID_PARAMETER;
+
+ cbData = sizeof(DWORD);
+ rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, (LPBYTE)&dwValue,
&cbData);
+ if (rc == ERROR_SUCCESS)
+ *pValue = dwValue;
+
+ return ERROR_SUCCESS;
+}
+
static VOID
ChooseGinaUI(VOID)
{
@@ -133,6 +155,59 @@
HeapFree(GetProcessHeap(), 0, SystemStartOptions);
}
+
+static
+BOOL
+GetRegistrySettings(PGINA_CONTEXT pgContext)
+{
+ HKEY hKey = NULL;
+ LPWSTR lpAutoAdminLogon = NULL;
+ DWORD dwDisableCAD = 0;
+ LONG rc;
+
+ rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Winlogon",
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+ if (rc != ERROR_SUCCESS)
+ {
+ WARN("RegOpenKeyExW() failed with error %lu\n", rc);
+ return FALSE;
+ }
+
+ rc = ReadRegSzKey(hKey,
+ L"AutoAdminLogon",
+ &lpAutoAdminLogon);
+ if (rc == ERROR_SUCCESS)
+ {
+ if (wcscmp(lpAutoAdminLogon, L"1") == 0)
+ pgContext->bAutoAdminLogon = TRUE;
+ }
+
+ TRACE("bAutoAdminLogon: %s\n", pgContext->bAutoAdminLogon ?
"TRUE" : "FALSE");
+
+ rc = ReadRegDwordKey(hKey,
+ L"DisableCAD",
+ &dwDisableCAD);
+ if (rc == ERROR_SUCCESS)
+ {
+ if (dwDisableCAD != 0)
+ pgContext->bDisableCAD = TRUE;
+ }
+
+ TRACE("bDisableCAD: %s\n", pgContext->bDisableCAD ? "TRUE" :
"FALSE");
+
+ if (lpAutoAdminLogon != NULL)
+ HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon);
+
+ if (hKey != NULL)
+ RegCloseKey(hKey);
+
+ return TRUE;
+}
+
+
/*
* @implemented
*/
@@ -152,6 +227,13 @@
if(!pgContext)
{
WARN("LocalAlloc() failed\n");
+ return FALSE;
+ }
+
+ if (!GetRegistrySettings(pgContext))
+ {
+ WARN("GetRegistrySettings() failed\n");
+ LocalFree(pgContext);
return FALSE;
}
@@ -572,7 +654,7 @@
return FALSE;
}
-
+#if 0
static
BOOL
CheckAutoAdminLogon(
@@ -611,7 +693,7 @@
return result;
}
-
+#endif
static BOOL
DoAutoLogon(
@@ -726,7 +808,8 @@
return;
}
- if (CheckAutoAdminLogon(pgContext))
+// if (CheckAutoAdminLogon(pgContext))
+ if (pgContext->bAutoAdminLogon == TRUE)
{
/* Don't display the window, we want to do an automatic logon */
pgContext->AutoLogonState = AUTOLOGON_ONCE;
@@ -735,6 +818,14 @@
}
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);
+ return;
+ }
pGinaUI->DisplaySASNotice(pgContext);
Modified: trunk/reactos/dll/win32/msgina/msgina.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.h?…
==============================================================================
--- trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] Sun Jan 12 10:57:02 2014
@@ -34,8 +34,10 @@
HANDLE hDllInstance;
HWND hStatusWindow;
DWORD AutoLogonState;
+ BOOL bDisableCAD;
+ BOOL bAutoAdminLogon;
- /* Informations to be filled during logon */
+ /* Information to be filled during logon */
WCHAR UserName[256];
WCHAR Domain[256];
SYSTEMTIME LogonTime;