[PATCH 3/3] credui: Fill out the username, password and domain edit boxes from the values input to CredUIPromptForCredentialsW.

Robert Shearman rob at codeweavers.com
Fri Jan 26 13:54:24 CST 2007


Set the focus to the password edit box, unless the user edit box is empty.
---
  dlls/credui/credui_main.c |   18 +++++++++++++++++-
  1 files changed, 17 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c
index 5294b21..8c21d13 100644
--- a/dlls/credui/credui_main.c
+++ b/dlls/credui/credui_main.c
@@ -71,10 +71,26 @@ static INT_PTR CALLBACK CredDialogProc(H
         case WM_INITDIALOG:
         {
             struct cred_dialog_params *params = (struct cred_dialog_params *)lParam;
+            DWORD ret;
+            WCHAR user[256];
+            WCHAR domain[256];
+
             SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)params);
+            ret = CredUIParseUserNameW(params->pszUsername, user, 256, domain, 256);
+            if (ret == ERROR_SUCCESS)
+            {
+                SetDlgItemTextW(hwndDlg, IDC_USERNAME, user);
+                SetDlgItemTextW(hwndDlg, IDC_DOMAIN, domain);
+            }
+            SetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword);
+
+            if (ret == ERROR_SUCCESS && user[0])
+                SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD));
+            else
+                SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
+
             if (params->pszCaptionText)
                 SetWindowTextW(hwndDlg, params->pszCaptionText);
-            SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
             return FALSE;
         }
         case WM_COMMAND:


More information about the wine-patches mailing list