mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[CREDUI]
* Sync with Wine 1.7.1. svn path=/trunk/; revision=60120
This commit is contained in:
parent
6e5bdff3a6
commit
86442ad8b9
4 changed files with 58 additions and 9 deletions
|
@ -1,15 +1,15 @@
|
|||
|
||||
add_definitions(-D__WINESRC__)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||
|
||||
spec2def(credui.dll credui.spec ADD_IMPORTLIB)
|
||||
|
||||
list(APPEND SOURCE
|
||||
credui_main.c
|
||||
credui.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/credui_stubs.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/credui.def)
|
||||
|
||||
add_library(credui SHARED ${SOURCE})
|
||||
add_library(credui SHARED ${SOURCE} credui.rc)
|
||||
set_module_type(credui win32dll)
|
||||
target_link_libraries(credui wine)
|
||||
add_importlibs(credui advapi32 user32 comctl32 msvcrt kernel32 ntdll)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
@ stub CredUICmdLinePromptForCredentialsW
|
||||
@ stub CredUIConfirmCredentialsA
|
||||
@ stdcall CredUIConfirmCredentialsW(wstr long)
|
||||
@ stub CredUIInitControls
|
||||
@ stdcall CredUIInitControls()
|
||||
@ stub CredUIParseUserNameA
|
||||
@ stdcall CredUIParseUserNameW(wstr ptr long ptr long)
|
||||
@ stub CredUIPromptForCredentialsA
|
||||
|
|
|
@ -82,6 +82,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (lpvReserved) break;
|
||||
LIST_FOR_EACH_ENTRY_SAFE(entry, cursor2, &pending_credentials_list, struct pending_credentials, entry)
|
||||
{
|
||||
list_remove(&entry->entry);
|
||||
|
@ -339,7 +340,7 @@ static void CredDialogHideBalloonTip(HWND hwndDlg, struct cred_dialog_params *pa
|
|||
|
||||
static inline BOOL CredDialogCapsLockOn(void)
|
||||
{
|
||||
return GetKeyState(VK_CAPITAL) & 0x1 ? TRUE : FALSE;
|
||||
return (GetKeyState(VK_CAPITAL) & 0x1) != 0;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK CredDialogPasswordSubclassProc(HWND hwnd, UINT uMsg,
|
||||
|
@ -412,7 +413,9 @@ static BOOL CredDialogInit(HWND hwndDlg, struct cred_dialog_params *params)
|
|||
SetWindowTextW(hwndDlg, title);
|
||||
}
|
||||
|
||||
if (params->dwFlags & (CREDUI_FLAGS_DO_NOT_PERSIST|CREDUI_FLAGS_PERSIST))
|
||||
if (params->dwFlags & CREDUI_FLAGS_PERSIST ||
|
||||
(params->dwFlags & CREDUI_FLAGS_DO_NOT_PERSIST &&
|
||||
!(params->dwFlags & CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX)))
|
||||
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_HIDE);
|
||||
else if (params->fSave)
|
||||
CheckDlgButton(hwndDlg, IDC_SAVE, BST_CHECKED);
|
||||
|
@ -548,6 +551,38 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL find_existing_credential(const WCHAR *target, WCHAR *username, ULONG len_username,
|
||||
WCHAR *password, ULONG len_password)
|
||||
{
|
||||
DWORD count, i;
|
||||
CREDENTIALW **credentials;
|
||||
|
||||
if (!CredEnumerateW(target, 0, &count, &credentials)) return FALSE;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (credentials[i]->Type != CRED_TYPE_DOMAIN_PASSWORD)
|
||||
{
|
||||
FIXME("no support for type %u credentials\n", credentials[i]->Type);
|
||||
continue;
|
||||
}
|
||||
if ((!*username || !strcmpW(username, credentials[i]->UserName)) &&
|
||||
strlenW(credentials[i]->UserName) < len_username &&
|
||||
credentials[i]->CredentialBlobSize / sizeof(WCHAR) < len_password)
|
||||
{
|
||||
TRACE("found existing credential for %s\n", debugstr_w(credentials[i]->UserName));
|
||||
|
||||
strcpyW(username, credentials[i]->UserName);
|
||||
memcpy(password, credentials[i]->CredentialBlob, credentials[i]->CredentialBlobSize);
|
||||
password[credentials[i]->CredentialBlobSize / sizeof(WCHAR)] = 0;
|
||||
|
||||
CredFree(credentials);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
CredFree(credentials);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CredUIPromptForCredentialsW [CREDUI.@]
|
||||
*/
|
||||
|
@ -578,6 +613,11 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
|
|||
if ((dwFlags & CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX) && !pfSave)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (!(dwFlags & CREDUI_FLAGS_ALWAYS_SHOW_UI) &&
|
||||
!(dwFlags & CREDUI_FLAGS_INCORRECT_PASSWORD) &&
|
||||
find_existing_credential(pszTargetName, pszUsername, ulUsernameMaxChars, pszPassword, ulPasswordMaxChars))
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
params.pszTargetName = pszTargetName;
|
||||
if (pUIInfo)
|
||||
{
|
||||
|
@ -651,13 +691,13 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
|
|||
len = strlenW(params.pszPassword);
|
||||
entry->pszPassword = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
||||
memcpy(entry->pszPassword, params.pszPassword, (len + 1)*sizeof(WCHAR));
|
||||
entry->generic = dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS ? TRUE : FALSE;
|
||||
entry->generic = (dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) != 0;
|
||||
|
||||
LeaveCriticalSection(&csPendingCredentials);
|
||||
}
|
||||
else
|
||||
else if (!(dwFlags & CREDUI_FLAGS_DO_NOT_PERSIST))
|
||||
result = save_credentials(pszTargetName, pszUsername, pszPassword,
|
||||
dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS ? TRUE : FALSE);
|
||||
(dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) != 0);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -802,3 +842,12 @@ DWORD WINAPI CredUIReadSSOCredW(PCWSTR pszRealm, PWSTR *ppszUsername)
|
|||
*ppszUsername = NULL;
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CredUIInitControls [CREDUI.@]
|
||||
*/
|
||||
BOOL WINAPI CredUIInitControls(void)
|
||||
{
|
||||
FIXME("() stub\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ reactos/dll/win32/comcat # Synced to Wine-1.7.1
|
|||
reactos/dll/win32/comctl32 # Synced to Wine 1.7.1
|
||||
reactos/dll/win32/comdlg32 # Synced to Wine 1.3.37
|
||||
reactos/dll/win32/compstui # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/credui # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/credui # Synced to Wine-1.7.1
|
||||
reactos/dll/win32/crypt32 # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/cryptdlg # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/cryptdll # Synced to Wine-1.5.26
|
||||
|
|
Loading…
Reference in a new issue