Author: ekohl Date: Sun Jan 19 01:33:19 2014 New Revision: 61681
URL: http://svn.reactos.org/svn/reactos?rev=61681&view=rev Log: [MSGINA] - 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.
Modified: trunk/reactos/dll/win32/msgina/gui.c trunk/reactos/dll/win32/msgina/msgina.c trunk/reactos/dll/win32/msgina/msgina.h
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 19 01:33:19 2014 @@ -478,14 +478,20 @@ { 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 @@ }
+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,10 +616,13 @@ 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 @@ }
-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 @@ 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:
Modified: trunk/reactos/dll/win32/msgina/msgina.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?r... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] Sun Jan 19 01:33:19 2014 @@ -162,7 +162,10 @@ { HKEY hKey = NULL; LPWSTR lpAutoAdminLogon = NULL; + LPWSTR lpDontDisplayLastUserName = NULL; + LPWSTR lpShutdownWithoutLogon = NULL; DWORD dwDisableCAD = 0; + DWORD dwSize; LONG rc;
rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -197,6 +200,47 @@ }
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);
Modified: trunk/reactos/dll/win32/msgina/msgina.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.h?r... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] Sun Jan 19 01:33:19 2014 @@ -36,6 +36,8 @@ DWORD AutoLogonState; BOOL bDisableCAD; BOOL bAutoAdminLogon; + BOOL bDontDisplayLastUserName; + BOOL bShutdownWithoutLogon;
/* Information to be filled during logon */ WCHAR UserName[256];