[MSGINA]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 8 Feb 2014 21:33:13 +0000 (21:33 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 8 Feb 2014 21:33:13 +0000 (21:33 +0000)
- Display the current domain in the logon dialog and pass it to the logon routine.
- Fix wrong default domain registry value name.

svn path=/trunk/; revision=62059

reactos/dll/win32/msgina/gui.c
reactos/dll/win32/msgina/msgina.c

index 71290b6..e0ef679 100644 (file)
@@ -707,6 +707,9 @@ LoggedOutWindowProc(
             if (pgContext->bShutdownWithoutLogon == FALSE)
                 EnableWindow(GetDlgItem(hwndDlg, IDC_SHUTDOWN), FALSE);
 
+            SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_ADDSTRING, 0, (LPARAM)pgContext->Domain);
+            SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_SETCURSEL, 0, 0);
+
             SetFocus(GetDlgItem(hwndDlg, pgContext->bDontDisplayLastUserName ? IDC_USERNAME : IDC_PASSWORD));
 
             pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
@@ -735,13 +738,15 @@ LoggedOutWindowProc(
             {
                 case IDOK:
                 {
-                    LPWSTR UserName = NULL, Password = NULL;
+                    LPWSTR UserName = NULL, Password = NULL, Domain = NULL;
                     INT result = WLX_SAS_ACTION_NONE;
 
                     if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
                         break;
+                    if (GetTextboxText(hwndDlg, IDC_LOGON_TO, &Domain) && *Domain == '\0')
+                        break;
                     if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) &&
-                        DoLoginTasks(pgContext, UserName, NULL, Password))
+                        DoLoginTasks(pgContext, UserName, Domain, Password))
                     {
                         pgContext->Password = HeapAlloc(GetProcessHeap(),
                                                         HEAP_ZERO_MEMORY,
@@ -753,6 +758,7 @@ LoggedOutWindowProc(
                     }
                     HeapFree(GetProcessHeap(), 0, UserName);
                     HeapFree(GetProcessHeap(), 0, Password);
+                    HeapFree(GetProcessHeap(), 0, Domain);
                     EndDialog(hwndDlg, result);
                     return TRUE;
                 }
index 04482f3..f00cdc8 100644 (file)
@@ -237,7 +237,7 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
 
     dwSize = 256 * sizeof(WCHAR);
     rc = RegQueryValueExW(hKey,
-                          L"DefaultDomainName",
+                          L"DefaultDomain",
                           NULL,
                           NULL,
                           (LPBYTE)&pgContext->Domain,
@@ -801,7 +801,7 @@ DoAutoLogon(
     LPWSTR AutoCount = NULL;
     LPWSTR IgnoreShiftOverride = NULL;
     LPWSTR UserName = NULL;
-    LPWSTR DomainName = NULL;
+    LPWSTR Domain = NULL;
     LPWSTR Password = NULL;
     BOOL result = FALSE;
     LONG rc;
@@ -860,14 +860,14 @@ DoAutoLogon(
         rc = ReadRegSzKey(WinLogonKey, L"DefaultUserName", &UserName);
         if (rc != ERROR_SUCCESS)
             goto cleanup;
-        rc = ReadRegSzKey(WinLogonKey, L"DefaultDomainName", &DomainName);
+        rc = ReadRegSzKey(WinLogonKey, L"DefaultDomain", &Domain);
         if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND)
             goto cleanup;
         rc = ReadRegSzKey(WinLogonKey, L"DefaultPassword", &Password);
         if (rc != ERROR_SUCCESS)
             goto cleanup;
 
-        result = DoLoginTasks(pgContext, UserName, DomainName, Password);
+        result = DoLoginTasks(pgContext, UserName, Domain, Password);
 
         if (result == TRUE)
         {
@@ -888,7 +888,7 @@ cleanup:
     HeapFree(GetProcessHeap(), 0, AutoCount);
     HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride);
     HeapFree(GetProcessHeap(), 0, UserName);
-    HeapFree(GetProcessHeap(), 0, DomainName);
+    HeapFree(GetProcessHeap(), 0, Domain);
     HeapFree(GetProcessHeap(), 0, Password);
     TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
         pgContext->AutoLogonState, result);