Author: akhaldi Date: Sat Sep 14 21:48:59 2013 New Revision: 60120
URL: http://svn.reactos.org/svn/reactos?rev=60120&view=rev Log: [CREDUI] * Sync with Wine 1.7.1.
Modified: trunk/reactos/dll/win32/credui/CMakeLists.txt trunk/reactos/dll/win32/credui/credui.spec trunk/reactos/dll/win32/credui/credui_main.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/credui/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/credui/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/credui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/credui/CMakeLists.txt [iso-8859-1] Sat Sep 14 21:48:59 2013 @@ -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)
Modified: trunk/reactos/dll/win32/credui/credui.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/credui/credui.spe... ============================================================================== --- trunk/reactos/dll/win32/credui/credui.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/credui/credui.spec [iso-8859-1] Sat Sep 14 21:48:59 2013 @@ -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
Modified: trunk/reactos/dll/win32/credui/credui_main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/credui/credui_mai... ============================================================================== --- trunk/reactos/dll/win32/credui/credui_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/credui/credui_main.c [iso-8859-1] Sat Sep 14 21:48:59 2013 @@ -82,6 +82,7 @@ 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 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 @@ 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 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 @@ 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 @@ 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 @@ *ppszUsername = NULL; return ERROR_NOT_FOUND; } + +/****************************************************************************** + * CredUIInitControls [CREDUI.@] + */ +BOOL WINAPI CredUIInitControls(void) +{ + FIXME("() stub\n"); + return TRUE; +}
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=6... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Sep 14 21:48:59 2013 @@ -62,7 +62,7 @@ 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