credui: Implement CredUIPromptForCredentialsW and CredUIConfirmCredentialsW.
This commit is contained in:
parent
c82fde4058
commit
9d4b8d33e0
|
@ -146,6 +146,7 @@ dlls/comm.drv16
|
|||
dlls/commdlg.dll16
|
||||
dlls/compobj.dll16
|
||||
dlls/compstui/libcompstui.def
|
||||
dlls/credui/credui.res
|
||||
dlls/crtdll/libcrtdll.def
|
||||
dlls/crypt32/crypt32.res
|
||||
dlls/crypt32/libcrypt32.def
|
||||
|
|
|
@ -3,11 +3,13 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = credui.dll
|
||||
IMPORTS = kernel32
|
||||
IMPORTS = user32 kernel32
|
||||
|
||||
C_SRCS = \
|
||||
credui_main.c
|
||||
|
||||
RC_SRCS = credui.rc
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
||||
### Dependencies:
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Top level resource file for Credentials UI
|
||||
*
|
||||
* Copyright 2007 Robert Shearman (for CodeWeavers)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "credui_resources.h"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82
|
||||
STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Enter User Name and Password"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,7,61,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,67,61,50,14
|
||||
LTEXT "&User Name:",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE
|
||||
LTEXT "&Password:",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE
|
||||
LTEXT "&Domain Name",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE
|
||||
EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL
|
||||
END
|
|
@ -1,12 +1,12 @@
|
|||
@ stub CredUICmdLinePromptForCredentialsA
|
||||
@ stub CredUICmdLinePromptForCredentialsW
|
||||
@ stub CredUIConfirmCredentialsA
|
||||
@ stub CredUIConfirmCredentialsW
|
||||
@ stdcall CredUIConfirmCredentialsW(wstr long)
|
||||
@ stub CredUIInitControls
|
||||
@ stub CredUIParseUserNameA
|
||||
@ stub CredUIParseUserNameW
|
||||
@ stub CredUIPromptForCredentialsA
|
||||
@ stub CredUIPromptForCredentialsW
|
||||
@ stdcall CredUIPromptForCredentialsW(ptr wstr ptr long ptr long ptr long ptr long)
|
||||
@ stub CredUIReadSSOCredA
|
||||
@ stub CredUIReadSSOCredW
|
||||
@ stub CredUIStoreSSOCredA
|
||||
|
|
|
@ -23,11 +23,17 @@
|
|||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
#include "winuser.h"
|
||||
#include "wincred.h"
|
||||
|
||||
#include "credui_resources.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(credui);
|
||||
|
||||
static HINSTANCE hinstCredUI;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
|
||||
|
@ -35,7 +41,138 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
if (fdwReason == DLL_WINE_PREATTACH) return FALSE; /* prefer native version */
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
{
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
hinstCredUI = hinstDLL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct cred_dialog_params
|
||||
{
|
||||
PCWSTR pszTargetName;
|
||||
PCWSTR pszMessageText;
|
||||
PCWSTR pszCaptionText;
|
||||
HBITMAP hbmBanner;
|
||||
PWSTR pszUsername;
|
||||
ULONG ulUsernameMaxChars;
|
||||
PWSTR pszPassword;
|
||||
ULONG ulPasswordMaxChars;
|
||||
BOOL fSave;
|
||||
};
|
||||
|
||||
static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
struct cred_dialog_params *params = (struct cred_dialog_params *)lParam;
|
||||
SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)params);
|
||||
if (params->pszCaptionText)
|
||||
SetWindowTextW(hwndDlg, params->pszCaptionText);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
{
|
||||
case MAKELONG(IDOK, BN_CLICKED):
|
||||
{
|
||||
ULONG domainlen;
|
||||
struct cred_dialog_params *params =
|
||||
(struct cred_dialog_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
||||
|
||||
domainlen = GetDlgItemTextW(hwndDlg, IDC_DOMAIN,
|
||||
params->pszUsername,
|
||||
params->ulUsernameMaxChars);
|
||||
if (domainlen && (domainlen < params->ulUsernameMaxChars))
|
||||
{
|
||||
params->pszUsername[domainlen++] = '\\';
|
||||
params->pszUsername[domainlen] = '\0';
|
||||
}
|
||||
if (domainlen < params->ulUsernameMaxChars)
|
||||
GetDlgItemTextW(hwndDlg, IDC_USERNAME,
|
||||
params->pszUsername + domainlen,
|
||||
params->ulUsernameMaxChars - domainlen);
|
||||
GetDlgItemTextW(hwndDlg, IDC_PASSWORD, params->pszPassword,
|
||||
params->ulPasswordMaxChars);
|
||||
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
case MAKELONG(IDCANCEL, BN_CLICKED):
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CredUIPromptForCredentialsW [CREDUI.@]
|
||||
*/
|
||||
DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
|
||||
PCWSTR pszTargetName,
|
||||
PCtxtHandle Reserved,
|
||||
DWORD dwAuthError,
|
||||
PWSTR pszUsername,
|
||||
ULONG ulUsernameMaxChars,
|
||||
PWSTR pszPassword,
|
||||
ULONG ulPasswordMaxChars, BOOL *pfSave,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
INT_PTR ret;
|
||||
struct cred_dialog_params params;
|
||||
|
||||
TRACE("(%p, %s, %p, %d, %p, %d, %p, %d, %p, 0x%08x)\n", pUIInfo,
|
||||
debugstr_w(pszTargetName), Reserved, dwAuthError, pszUsername,
|
||||
ulUsernameMaxChars, pszPassword, ulPasswordMaxChars, pfSave, dwFlags);
|
||||
|
||||
params.pszTargetName = pszTargetName;
|
||||
if (pUIInfo)
|
||||
{
|
||||
params.pszMessageText = pUIInfo->pszMessageText;
|
||||
params.pszCaptionText = pUIInfo->pszCaptionText;
|
||||
params.hbmBanner = pUIInfo->hbmBanner;
|
||||
}
|
||||
else
|
||||
{
|
||||
params.pszMessageText = NULL;
|
||||
params.pszCaptionText = NULL;
|
||||
params.hbmBanner = NULL;
|
||||
}
|
||||
params.pszUsername = pszUsername;
|
||||
params.ulUsernameMaxChars = ulUsernameMaxChars;
|
||||
params.pszPassword = pszPassword;
|
||||
params.ulPasswordMaxChars = ulPasswordMaxChars;
|
||||
params.fSave = *pfSave;
|
||||
|
||||
ret = DialogBoxParamW(hinstCredUI, MAKEINTRESOURCEW(IDD_CREDDIALOG),
|
||||
pUIInfo->hwndParent, CredDialogProc, (LPARAM)¶ms);
|
||||
if (ret <= 0)
|
||||
return GetLastError();
|
||||
|
||||
if (ret == IDCANCEL)
|
||||
{
|
||||
TRACE("dialog cancelled\n");
|
||||
return ERROR_CANCELLED;
|
||||
}
|
||||
|
||||
*pfSave = params.fSave;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CredUIConfirmCredentialsW [CREDUI.@]
|
||||
*/
|
||||
DWORD WINAPI CredUIConfirmCredentialsW(PCWSTR pszTargetName, BOOL bConfirm)
|
||||
{
|
||||
FIXME("(%s, %s): stub\n", debugstr_w(pszTargetName),
|
||||
bConfirm ? "TRUE" : "FALSE");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright 2007 Robert Shearman (for CodeWeavers)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define IDD_CREDDIALOG 100
|
||||
#define IDC_USERNAME 101
|
||||
#define IDC_PASSWORD 102
|
||||
#define IDC_DOMAIN 103
|
||||
#define IDC_STATIC 104
|
Loading…
Reference in New Issue