Commit ce5b6c84 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

credui: Add a banner and message box to the dialog presented by CredUIPromptForCredentials.

parent cecc7ab7
...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@ ...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = credui.dll MODULE = credui.dll
IMPORTLIB = libcredui.$(IMPLIBEXT) IMPORTLIB = libcredui.$(IMPLIBEXT)
IMPORTS = user32 kernel32 IMPORTS = comctl32 user32 kernel32
C_SRCS = \ C_SRCS = \
credui_main.c credui_main.c
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include "winnls.h" #include "winnls.h"
#include "credui_resources.h" #include "credui_resources.h"
/* @makedep: banner.bmp */
IDB_BANNER BITMAP LOADONCALL DISCARDABLE banner.bmp
#include "credui_De.rc" #include "credui_De.rc"
#include "credui_En.rc" #include "credui_En.rc"
#include "credui_Ko.rc" #include "credui_Ko.rc"
......
...@@ -20,17 +20,21 @@ ...@@ -20,17 +20,21 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Benutzername und Passwort eingeben" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "&Benutzername:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "&Passwort:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Benutzername:",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "&Domnenname:",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "OK",IDOK,7,61,50,14 LTEXT "&Passwort:",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "Abbrechen",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "OK",IDOK,97,128,50,14
PUSHBUTTON "Abbrechen",IDCANCEL,156,128,50,14
END END
...@@ -20,17 +20,27 @@ ...@@ -20,17 +20,27 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Enter User Name and Password" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "&User Name:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "&Password:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&User name:",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "&Domain Name:",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "OK",IDOK,7,61,50,14 LTEXT "&Password:",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "Cancel",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "OK",IDOK,97,128,50,14
PUSHBUTTON "Cancel",IDCANCEL,156,128,50,14
END END
STRINGTABLE DISCARDABLE
{
IDS_TITLEFORMAT "Connect to %s"
IDS_MESSAGEFORMAT "Connecting to %s"
}
...@@ -21,17 +21,21 @@ ...@@ -21,17 +21,21 @@
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "사용자 이름과 암호 입력" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "사용자 이름(&U):",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "암호(&P):",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "사용자 이름(&U):",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "도메인 이름(&D):",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "확인",IDOK,7,61,50,14 LTEXT "암호(&P):",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "취소",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "확인",IDOK,97,128,50,14
PUSHBUTTON "취소",IDCANCEL,156,128,50,14
END END
...@@ -20,17 +20,21 @@ ...@@ -20,17 +20,21 @@
LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Skriv inn brukernavn og passord" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "Br&ukernavn:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "&Passord:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "Br&ukernavn:",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "&Domene:",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "OK",IDOK,7,61,50,14 LTEXT "&Passord:",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "Avbryt",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "OK",IDOK,97,128,50,14
PUSHBUTTON "Avbryt",IDCANCEL,156,128,50,14
END END
...@@ -21,17 +21,21 @@ ...@@ -21,17 +21,21 @@
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Enter User Name and Password" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "&Uytkownik:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "&Haso:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Uytkownik:",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "&Domena:",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "&OK",IDOK,7,61,50,14 LTEXT "&Haso:",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "&Anuluj",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "&OK",IDOK,97,128,50,14
PUSHBUTTON "&Anuluj",IDCANCEL,156,128,50,14
END END
...@@ -20,17 +20,21 @@ ...@@ -20,17 +20,21 @@
LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 213, 149
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ange anvndarnamn och lsenord" CAPTION "IDS_TITLEFORMAT"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "A&nvndarnamn:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE CONTROL IDB_BANNER,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,0,
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL 0,213,37
LTEXT "&Lsenord:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE LTEXT "IDS_MESSAGEFORMAT",IDC_MESSAGE,8,48,199,8,NOT WS_GROUP
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "A&nvndarnamn:",IDC_STATIC,8,62,72,12,SS_CENTERIMAGE
LTEXT "&Domnnamn:",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE CONTROL "",IDC_USERNAME,"ComboBoxEx32",CBS_DROPDOWN |
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL CBS_NOINTEGRALHEIGHT | WS_TABSTOP,80,62,126,12
DEFPUSHBUTTON "OK",IDOK,7,61,50,14 LTEXT "&Lsenord:",IDC_STATIC,8,80,72,12,SS_CENTERIMAGE
PUSHBUTTON "Avbryt",IDCANCEL,67,61,50,14 EDITTEXT IDC_PASSWORD,80,80,126,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "&Remember my password",IDC_SAVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,80,98,126,12
DEFPUSHBUTTON "OK",IDOK,97,128,50,14
PUSHBUTTON "Avbryt",IDCANCEL,156,128,50,14
END END
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "winnt.h" #include "winnt.h"
#include "winuser.h" #include "winuser.h"
#include "wincred.h" #include "wincred.h"
#include "commctrl.h"
#include "credui_resources.h" #include "credui_resources.h"
...@@ -66,6 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -66,6 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
DisableThreadLibraryCalls(hinstDLL); DisableThreadLibraryCalls(hinstDLL);
hinstCredUI = hinstDLL; hinstCredUI = hinstDLL;
InitCommonControls();
} }
else if (fdwReason == DLL_PROCESS_DETACH) else if (fdwReason == DLL_PROCESS_DETACH)
{ {
...@@ -102,6 +104,7 @@ struct cred_dialog_params ...@@ -102,6 +104,7 @@ struct cred_dialog_params
PWSTR pszPassword; PWSTR pszPassword;
ULONG ulPasswordMaxChars; ULONG ulPasswordMaxChars;
BOOL fSave; BOOL fSave;
DWORD dwFlags;
}; };
static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
...@@ -112,26 +115,42 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, ...@@ -112,26 +115,42 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
struct cred_dialog_params *params = (struct cred_dialog_params *)lParam; 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); SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)params);
ret = CredUIParseUserNameW(params->pszUsername, user, 256, domain, 256); if (params->pszMessageText)
if (ret == ERROR_SUCCESS) SetDlgItemTextW(hwndDlg, IDC_MESSAGE, params->pszMessageText);
else
{ {
SetDlgItemTextW(hwndDlg, IDC_USERNAME, user); WCHAR format[256];
SetDlgItemTextW(hwndDlg, IDC_DOMAIN, domain); WCHAR message[256];
LoadStringW(hinstCredUI, IDS_MESSAGEFORMAT, format, sizeof(format)/sizeof(format[0]));
snprintfW(message, sizeof(message)/sizeof(message[0]), format, params->pszTargetName);
SetDlgItemTextW(hwndDlg, IDC_MESSAGE, message);
} }
SetDlgItemTextW(hwndDlg, IDC_USERNAME, params->pszUsername);
SetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword); SetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword);
if (ret == ERROR_SUCCESS && user[0]) if (params->pszUsername[0])
SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD)); SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD));
else else
SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME)); SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
if (params->pszCaptionText) if (params->pszCaptionText)
SetWindowTextW(hwndDlg, params->pszCaptionText); SetWindowTextW(hwndDlg, params->pszCaptionText);
else
{
WCHAR format[256];
WCHAR title[256];
LoadStringW(hinstCredUI, IDS_TITLEFORMAT, format, sizeof(format)/sizeof(format[0]));
snprintfW(title, sizeof(title)/sizeof(title[0]), format, params->pszTargetName);
SetWindowTextW(hwndDlg, title);
}
if (params->dwFlags & (CREDUI_FLAGS_DO_NOT_PERSIST|CREDUI_FLAGS_PERSIST))
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE);
else if (params->fSave)
CheckDlgButton(hwndDlg, IDC_SAVE, BST_CHECKED);
return FALSE; return FALSE;
} }
case WM_COMMAND: case WM_COMMAND:
...@@ -139,22 +158,40 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, ...@@ -139,22 +158,40 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
{ {
case MAKELONG(IDOK, BN_CLICKED): case MAKELONG(IDOK, BN_CLICKED):
{ {
ULONG domainlen;
struct cred_dialog_params *params = struct cred_dialog_params *params =
(struct cred_dialog_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER); (struct cred_dialog_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
HWND hwndUsername = GetDlgItem(hwndDlg, IDC_USERNAME);
LPWSTR user;
INT len;
INT len2;
domainlen = GetDlgItemTextW(hwndDlg, IDC_DOMAIN, len = GetWindowTextLengthW(hwndUsername);
params->pszUsername, user = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
params->ulUsernameMaxChars); GetWindowTextW(hwndUsername, user, len + 1);
if (domainlen && (domainlen < params->ulUsernameMaxChars))
if (!user[0])
return TRUE;
if (!strchrW(user, '\\') && !strchrW(user, '@'))
{ {
params->pszUsername[domainlen++] = '\\'; INT len_target = strlenW(params->pszTargetName);
params->pszUsername[domainlen] = '\0'; memcpy(params->pszUsername, params->pszTargetName,
min(len_target, params->ulUsernameMaxChars) * sizeof(WCHAR));
if (len_target + 1 < params->ulUsernameMaxChars)
params->pszUsername[len_target] = '\\';
if (len_target + 2 < params->ulUsernameMaxChars)
params->pszUsername[len_target + 1] = '\0';
} }
if (domainlen < params->ulUsernameMaxChars) else if (params->ulUsernameMaxChars > 0)
GetDlgItemTextW(hwndDlg, IDC_USERNAME, params->pszUsername[0] = '\0';
params->pszUsername + domainlen,
params->ulUsernameMaxChars - domainlen); len2 = strlenW(params->pszUsername);
memcpy(params->pszUsername + len2, user, min(len, params->ulUsernameMaxChars - len2) * sizeof(WCHAR));
if (params->ulUsernameMaxChars)
params->pszUsername[len2 + min(len, params->ulUsernameMaxChars - len2 - 1)] = '\0';
HeapFree(GetProcessHeap(), 0, user);
GetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword, GetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword,
params->ulPasswordMaxChars); params->ulPasswordMaxChars);
...@@ -219,6 +256,7 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo, ...@@ -219,6 +256,7 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
params.pszPassword = pszPassword; params.pszPassword = pszPassword;
params.ulPasswordMaxChars = ulPasswordMaxChars; params.ulPasswordMaxChars = ulPasswordMaxChars;
params.fSave = pfSave ? *pfSave : FALSE; params.fSave = pfSave ? *pfSave : FALSE;
params.dwFlags = dwFlags;
ret = DialogBoxParamW(hinstCredUI, MAKEINTRESOURCEW(IDD_CREDDIALOG), ret = DialogBoxParamW(hinstCredUI, MAKEINTRESOURCEW(IDD_CREDDIALOG),
pUIInfo ? pUIInfo->hwndParent : NULL, pUIInfo ? pUIInfo->hwndParent : NULL,
......
...@@ -19,5 +19,11 @@ ...@@ -19,5 +19,11 @@
#define IDD_CREDDIALOG 100 #define IDD_CREDDIALOG 100
#define IDC_USERNAME 101 #define IDC_USERNAME 101
#define IDC_PASSWORD 102 #define IDC_PASSWORD 102
#define IDC_DOMAIN 103 #define IDC_MESSAGE 103
#define IDC_STATIC 104 #define IDC_STATIC 104
#define IDC_SAVE 105
#define IDB_BANNER 200
#define IDS_TITLEFORMAT 300
#define IDS_MESSAGEFORMAT 301
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment