- Display the lock message on the lock and unlock dialogs.
- Implement the DontDisplayLastUserName and ShutdownWithoutLogon options.
- Read the DefaultUserName and DefaultDomain and display the user name on the logon dialog unless the DontDisplayLastUserName option is enabled.

svn path=/trunk/; revision=61681
This commit is contained in:
Eric Kohl 2014-01-19 01:33:19 +00:00
parent 6c05d66386
commit 81b28a2a81
3 changed files with 78 additions and 22 deletions

View file

@ -478,14 +478,20 @@ LoggedOutWindowProc(
{
case WM_INITDIALOG:
{
/* FIXME: take care of DontDisplayLastUserName, NoDomainUI, ShutdownWithoutLogon */
/* FIXME: take care of NoDomainUI */
pgContext = (PGINA_CONTEXT)lParam;
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
if (pgContext->bDontDisplayLastUserName == FALSE)
SetDlgItemTextW(hwndDlg, IDC_USERNAME, pgContext->UserName);
if (pgContext->bDisableCAD == TRUE)
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
if (pgContext->bShutdownWithoutLogon == FALSE)
EnableWindow(GetDlgItem(hwndDlg, IDC_SHUTDOWN), FALSE);
SetFocus(GetDlgItem(hwndDlg, pgContext->bDontDisplayLastUserName ? IDC_USERNAME : IDC_PASSWORD));
pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
return TRUE;
@ -573,6 +579,24 @@ GUILoggedOutSAS(
}
static VOID
SetLockMessage(HWND hwnd,
INT nDlgItem,
PGINA_CONTEXT pgContext)
{
WCHAR Buffer1[256];
WCHAR Buffer2[256];
WCHAR Buffer3[512];
LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, 256);
wsprintfW(Buffer2, L"%s\\%s", pgContext->Domain, pgContext->UserName);
wsprintfW(Buffer3, Buffer1, Buffer2);
SetDlgItemTextW(hwnd, nDlgItem, Buffer3);
}
static
INT_PTR
CALLBACK
@ -592,11 +616,14 @@ UnlockWindowProc(
pgContext = (PGINA_CONTEXT)lParam;
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
SetLockMessage(hwndDlg, IDC_LOCKMSG, pgContext);
SetDlgItemTextW(hwndDlg, IDC_USERNAME, pgContext->UserName);
SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD));
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;
@ -678,23 +705,6 @@ GUILockedSAS(
}
static VOID
OnInitLockedDlg(HWND hwnd,
PGINA_CONTEXT pgContext)
{
WCHAR Buffer1[256];
WCHAR Buffer2[256];
WCHAR Buffer3[512];
LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, 256);
wsprintfW(Buffer2, L"%s\\%s", pgContext->Domain, pgContext->UserName);
wsprintfW(Buffer3, Buffer1, Buffer2);
SetDlgItemTextW(hwnd, IDC_LOCKMSG, Buffer3);
}
static INT_PTR CALLBACK
LockedWindowProc(
IN HWND hwndDlg,
@ -714,7 +724,7 @@ LockedWindowProc(
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
OnInitLockedDlg(hwndDlg, pgContext);
SetLockMessage(hwndDlg, IDC_LOCKMSG, pgContext);
return TRUE;
}
case WM_PAINT:

View file

@ -162,7 +162,10 @@ 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,
@ -198,6 +201,47 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
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);

View file

@ -36,6 +36,8 @@ typedef struct
DWORD AutoLogonState;
BOOL bDisableCAD;
BOOL bAutoAdminLogon;
BOOL bDontDisplayLastUserName;
BOOL bShutdownWithoutLogon;
/* Information to be filled during logon */
WCHAR UserName[256];