[MSGINA]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 20 Jan 2014 21:23:17 +0000 (21:23 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 20 Jan 2014 21:23:17 +0000 (21:23 +0000)
Save the password in the gina-context after successful logon and use it to check the password when unlocking the computer.

svn path=/trunk/; revision=61741

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

index 8f8d17a..32d08fb 100644 (file)
@@ -527,6 +527,12 @@ LoggedOutWindowProc(
                     if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) &&
                         DoLoginTasks(pgContext, UserName, NULL, Password))
                     {
+                        pgContext->Password = HeapAlloc(GetProcessHeap(),
+                                                        HEAP_ZERO_MEMORY,
+                                                        (wcslen(Password) + 1) * sizeof(WCHAR));
+                        if (pgContext->Password != NULL)
+                            wcscpy(pgContext->Password, Password);
+
                         result = WLX_SAS_ACTION_LOGON;
                     }
                     HeapFree(GetProcessHeap(), 0, UserName);
@@ -648,22 +654,23 @@ UnlockWindowProc(
             {
                 case IDOK:
                 {
-#if 0
                     LPWSTR UserName = NULL, Password = NULL;
                     INT result = WLX_SAS_ACTION_NONE;
 
                     if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
                         break;
-                    if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) &&
-                        DoLoginTasks(pgContext, UserName, NULL, Password))
+                    if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password))
                     {
-                        result = WLX_SAS_ACTION_LOGON;
+                        if (UserName != NULL && Password != NULL &&
+                            wcscmp(UserName, pgContext->UserName) == 0 &&
+                            wcscmp(Password, pgContext->Password) == 0)
+                        {
+                            result = WLX_SAS_ACTION_UNLOCK_WKSTA;
+                        }
                     }
                     HeapFree(GetProcessHeap(), 0, UserName);
                     HeapFree(GetProcessHeap(), 0, Password);
                     EndDialog(hwndDlg, result);
-#endif
-                    EndDialog(hwndDlg, WLX_SAS_ACTION_UNLOCK_WKSTA);
                     return TRUE;
                 }
 
index fd8da6e..8a9ed43 100644 (file)
@@ -817,7 +817,15 @@ DoAutoLogon(
         result = DoLoginTasks(pgContext, UserName, DomainName, Password);
 
         if (result == TRUE)
+        {
+            pgContext->Password = HeapAlloc(GetProcessHeap(),
+                                            HEAP_ZERO_MEMORY,
+                                            (wcslen(Password) + 1) * sizeof(WCHAR));
+            if (pgContext->Password != NULL)
+                wcscpy(pgContext->Password, Password);
+
             NotifyBootConfigStatus(TRUE);
+        }
     }
 
 cleanup:
@@ -852,7 +860,6 @@ WlxDisplaySASNotice(
         return;
     }
 
-//    if (CheckAutoAdminLogon(pgContext))
     if (pgContext->bAutoAdminLogon == TRUE)
     {
         /* Don't display the window, we want to do an automatic logon */
index 389db60..5dde555 100644 (file)
@@ -42,6 +42,7 @@ typedef struct
     /* Information to be filled during logon */
     WCHAR UserName[256];
     WCHAR Domain[256];
+    LPWSTR Password;
     SYSTEMTIME LogonTime;
     HANDLE UserToken;
     PLUID pAuthenticationId;