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 && dwType == REG_DWORD)
+ *pValue = dwValue;
+
+ return ERROR_SUCCESS;
+}
+
static VOID
ChooseGinaUI(VOID)
{
HeapFree(GetProcessHeap(), 0, SystemStartOptions);
}
+
+static
+BOOL
+GetRegistrySettings(PGINA_CONTEXT pgContext)
+{
+ HKEY hKey = NULL;
+ LPWSTR lpAutoAdminLogon = NULL;
+ LPWSTR lpDontDisplayLastUserName = NULL;
+ LPWSTR lpShutdownWithoutLogon = NULL;
+ DWORD dwDisableCAD = 0;
+ DWORD dwSize;
+ 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");
+
+ pgContext->bShutdownWithoutLogon = TRUE;
+ rc = ReadRegSzKey(hKey,
+ L"ShutdownWithoutLogon",
+ &lpShutdownWithoutLogon);
+ if (rc == ERROR_SUCCESS)
+ {
+ if (wcscmp(lpShutdownWithoutLogon, L"0") == 0)
+ pgContext->bShutdownWithoutLogon = FALSE;
+ }
+
+ rc = ReadRegSzKey(hKey,
+ L"DontDisplayLastUserName",
+ &lpDontDisplayLastUserName);
+ if (rc == ERROR_SUCCESS)
+ {
+ if (wcscmp(lpDontDisplayLastUserName, L"1") == 0)
+ pgContext->bDontDisplayLastUserName = TRUE;
+ }
+
+ dwSize = 256 * sizeof(WCHAR);
+ rc = RegQueryValueExW(hKey,
+ L"DefaultUserName",
+ NULL,
+ NULL,
+ (LPBYTE)&pgContext->UserName,
+ &dwSize);
+
+ dwSize = 256 * sizeof(WCHAR);
+ rc = RegQueryValueExW(hKey,
+ L"DefaultDomainName",
+ NULL,
+ NULL,
+ (LPBYTE)&pgContext->Domain,
+ &dwSize);
+
+ if (lpShutdownWithoutLogon != NULL)
+ HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon);
+
+ if (lpDontDisplayLastUserName != NULL)
+ HeapFree(GetProcessHeap(), 0, lpDontDisplayLastUserName);
+
+ if (lpAutoAdminLogon != NULL)
+ HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon);
+
+ if (hKey != NULL)
+ RegCloseKey(hKey);
+
+ return TRUE;
+}
+
+
/*
* @implemented
*/
return FALSE;
}
+ if (!GetRegistrySettings(pgContext))
+ {
+ WARN("GetRegistrySettings() failed\n");
+ LocalFree(pgContext);
+ return FALSE;
+ }
+
/* Return the context to winlogon */
*pWlxContext = (PVOID)pgContext;
pgContext->hDllInstance = hDllInstance;
return FALSE;
}
+#if 0
+static
+BOOL
+CheckAutoAdminLogon(
+ IN PGINA_CONTEXT pgContext)
+{
+ HKEY WinLogonKey = NULL;
+ LPWSTR AutoLogon = NULL;
+ BOOL result = FALSE;
+ LONG rc;
+
+ if (pgContext->AutoLogonState == AUTOLOGON_DISABLED)
+ return FALSE;
+
+ rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
+ 0,
+ KEY_QUERY_VALUE,
+ &WinLogonKey);
+ if (rc != ERROR_SUCCESS)
+ goto cleanup;
+
+ rc = ReadRegSzKey(WinLogonKey,
+ L"AutoAdminLogon",
+ &AutoLogon);
+
+ if (rc != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (wcscmp(AutoLogon, L"1") == 0)
+ result = TRUE;
+
+cleanup:
+ if (WinLogonKey != NULL)
+ RegCloseKey(WinLogonKey);
+ HeapFree(GetProcessHeap(), 0, AutoLogon);
+
+ return result;
+}
+#endif
+
static BOOL
DoAutoLogon(
IN PGINA_CONTEXT pgContext)
return;
}
- if (DoAutoLogon(pgContext))
+// if (CheckAutoAdminLogon(pgContext))
+ if (pgContext->bAutoAdminLogon == TRUE)
{
/* Don't display the window, we want to do an automatic logon */
pgContext->AutoLogonState = AUTOLOGON_ONCE;
else
pgContext->AutoLogonState = AUTOLOGON_DISABLED;
+ if (pgContext->bDisableCAD == TRUE)
+ {
+ pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
+ return;
+ }
+
pGinaUI->DisplaySASNotice(pgContext);
TRACE("WlxDisplaySASNotice() done\n");
TRACE("WlxDisplayLockedNotice()\n");
+ if (pgContext->bDisableCAD == TRUE)
+ {
+ pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
+ return;
+ }
+
pGinaUI->DisplayLockedNotice(pgContext);
}