credui: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bcdbd34f54
commit
bf1bebc3a8
|
@ -2,6 +2,8 @@ MODULE = credui.dll
|
||||||
IMPORTLIB = credui
|
IMPORTLIB = credui
|
||||||
IMPORTS = comctl32 user32 advapi32
|
IMPORTS = comctl32 user32 advapi32
|
||||||
|
|
||||||
|
EXTRADLLFLAGS = -mno-cygwin
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
credui_main.c
|
credui_main.c
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "credui_resources.h"
|
#include "credui_resources.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(credui);
|
WINE_DEFAULT_DEBUG_CHANNEL(credui);
|
||||||
|
@ -89,7 +88,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszTargetName);
|
HeapFree(GetProcessHeap(), 0, entry->pszTargetName);
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
||||||
SecureZeroMemory(entry->pszPassword, strlenW(entry->pszPassword) * sizeof(WCHAR));
|
SecureZeroMemory(entry->pszPassword, lstrlenW(entry->pszPassword) * sizeof(WCHAR));
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
||||||
HeapFree(GetProcessHeap(), 0, entry);
|
HeapFree(GetProcessHeap(), 0, entry);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +110,7 @@ static DWORD save_credentials(PCWSTR pszTargetName, PCWSTR pszUsername,
|
||||||
cred.Type = generic ? CRED_TYPE_GENERIC : CRED_TYPE_DOMAIN_PASSWORD;
|
cred.Type = generic ? CRED_TYPE_GENERIC : CRED_TYPE_DOMAIN_PASSWORD;
|
||||||
cred.TargetName = (LPWSTR)pszTargetName;
|
cred.TargetName = (LPWSTR)pszTargetName;
|
||||||
cred.Comment = NULL;
|
cred.Comment = NULL;
|
||||||
cred.CredentialBlobSize = strlenW(pszPassword) * sizeof(WCHAR);
|
cred.CredentialBlobSize = lstrlenW(pszPassword) * sizeof(WCHAR);
|
||||||
cred.CredentialBlob = (LPBYTE)pszPassword;
|
cred.CredentialBlob = (LPBYTE)pszPassword;
|
||||||
cred.Persist = CRED_PERSIST_ENTERPRISE;
|
cred.Persist = CRED_PERSIST_ENTERPRISE;
|
||||||
cred.AttributeCount = 0;
|
cred.AttributeCount = 0;
|
||||||
|
@ -180,7 +179,7 @@ static void CredDialogFillUsernameCombo(HWND hwndUsername, const struct cred_dia
|
||||||
/* don't add another item with the same name if we've already added it */
|
/* don't add another item with the same name if we've already added it */
|
||||||
for (j = 0; j < i; j++)
|
for (j = 0; j < i; j++)
|
||||||
if (credentials[j]->UserName
|
if (credentials[j]->UserName
|
||||||
&& !strcmpW(credentials[i]->UserName, credentials[j]->UserName))
|
&& !lstrcmpW(credentials[i]->UserName, credentials[j]->UserName))
|
||||||
{
|
{
|
||||||
duplicate = TRUE;
|
duplicate = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -391,7 +390,7 @@ static BOOL CredDialogInit(HWND hwndDlg, struct cred_dialog_params *params)
|
||||||
WCHAR format[256];
|
WCHAR format[256];
|
||||||
WCHAR message[256];
|
WCHAR message[256];
|
||||||
LoadStringW(hinstCredUI, IDS_MESSAGEFORMAT, format, ARRAY_SIZE(format));
|
LoadStringW(hinstCredUI, IDS_MESSAGEFORMAT, format, ARRAY_SIZE(format));
|
||||||
snprintfW(message, ARRAY_SIZE(message), format, params->pszTargetName);
|
swprintf(message, ARRAY_SIZE(message), format, params->pszTargetName);
|
||||||
SetDlgItemTextW(hwndDlg, IDC_MESSAGE, message);
|
SetDlgItemTextW(hwndDlg, IDC_MESSAGE, message);
|
||||||
}
|
}
|
||||||
SetWindowTextW(hwndUsername, params->pszUsername);
|
SetWindowTextW(hwndUsername, params->pszUsername);
|
||||||
|
@ -416,7 +415,7 @@ static BOOL CredDialogInit(HWND hwndDlg, struct cred_dialog_params *params)
|
||||||
WCHAR format[256];
|
WCHAR format[256];
|
||||||
WCHAR title[256];
|
WCHAR title[256];
|
||||||
LoadStringW(hinstCredUI, IDS_TITLEFORMAT, format, ARRAY_SIZE(format));
|
LoadStringW(hinstCredUI, IDS_TITLEFORMAT, format, ARRAY_SIZE(format));
|
||||||
snprintfW(title, ARRAY_SIZE(title), format, params->pszTargetName);
|
swprintf(title, ARRAY_SIZE(title), format, params->pszTargetName);
|
||||||
SetWindowTextW(hwndDlg, title);
|
SetWindowTextW(hwndDlg, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,9 +454,9 @@ static void CredDialogCommandOk(HWND hwndDlg, struct cred_dialog_params *params)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchrW(user, '\\') && !strchrW(user, '@'))
|
if (!wcschr(user, '\\') && !wcschr(user, '@'))
|
||||||
{
|
{
|
||||||
ULONG len_target = strlenW(params->pszTargetName);
|
ULONG len_target = lstrlenW(params->pszTargetName);
|
||||||
memcpy(params->pszUsername, params->pszTargetName,
|
memcpy(params->pszUsername, params->pszTargetName,
|
||||||
min(len_target, params->ulUsernameMaxChars) * sizeof(WCHAR));
|
min(len_target, params->ulUsernameMaxChars) * sizeof(WCHAR));
|
||||||
if (len_target + 1 < params->ulUsernameMaxChars)
|
if (len_target + 1 < params->ulUsernameMaxChars)
|
||||||
|
@ -468,7 +467,7 @@ static void CredDialogCommandOk(HWND hwndDlg, struct cred_dialog_params *params)
|
||||||
else if (params->ulUsernameMaxChars > 0)
|
else if (params->ulUsernameMaxChars > 0)
|
||||||
params->pszUsername[0] = '\0';
|
params->pszUsername[0] = '\0';
|
||||||
|
|
||||||
len2 = strlenW(params->pszUsername);
|
len2 = lstrlenW(params->pszUsername);
|
||||||
memcpy(params->pszUsername + len2, user, min(len, params->ulUsernameMaxChars - len2) * sizeof(WCHAR));
|
memcpy(params->pszUsername + len2, user, min(len, params->ulUsernameMaxChars - len2) * sizeof(WCHAR));
|
||||||
if (params->ulUsernameMaxChars)
|
if (params->ulUsernameMaxChars)
|
||||||
params->pszUsername[len2 + min(len, params->ulUsernameMaxChars - len2 - 1)] = '\0';
|
params->pszUsername[len2 + min(len, params->ulUsernameMaxChars - len2 - 1)] = '\0';
|
||||||
|
@ -573,13 +572,13 @@ static BOOL find_existing_credential(const WCHAR *target, WCHAR *username, ULONG
|
||||||
FIXME("no support for type %u credentials\n", credentials[i]->Type);
|
FIXME("no support for type %u credentials\n", credentials[i]->Type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((!*username || !strcmpW(username, credentials[i]->UserName)) &&
|
if ((!*username || !lstrcmpW(username, credentials[i]->UserName)) &&
|
||||||
strlenW(credentials[i]->UserName) < len_username &&
|
lstrlenW(credentials[i]->UserName) < len_username &&
|
||||||
credentials[i]->CredentialBlobSize / sizeof(WCHAR) < len_password)
|
credentials[i]->CredentialBlobSize / sizeof(WCHAR) < len_password)
|
||||||
{
|
{
|
||||||
TRACE("found existing credential for %s\n", debugstr_w(credentials[i]->UserName));
|
TRACE("found existing credential for %s\n", debugstr_w(credentials[i]->UserName));
|
||||||
|
|
||||||
strcpyW(username, credentials[i]->UserName);
|
lstrcpyW(username, credentials[i]->UserName);
|
||||||
memcpy(password, credentials[i]->CredentialBlob, credentials[i]->CredentialBlobSize);
|
memcpy(password, credentials[i]->CredentialBlob, credentials[i]->CredentialBlobSize);
|
||||||
password[credentials[i]->CredentialBlobSize / sizeof(WCHAR)] = 0;
|
password[credentials[i]->CredentialBlobSize / sizeof(WCHAR)] = 0;
|
||||||
|
|
||||||
|
@ -676,27 +675,27 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
|
||||||
/* find existing pending credentials for the same target and overwrite */
|
/* find existing pending credentials for the same target and overwrite */
|
||||||
/* FIXME: is this correct? */
|
/* FIXME: is this correct? */
|
||||||
LIST_FOR_EACH_ENTRY(entry, &pending_credentials_list, struct pending_credentials, entry)
|
LIST_FOR_EACH_ENTRY(entry, &pending_credentials_list, struct pending_credentials, entry)
|
||||||
if (!strcmpW(pszTargetName, entry->pszTargetName))
|
if (!lstrcmpW(pszTargetName, entry->pszTargetName))
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
||||||
SecureZeroMemory(entry->pszPassword, strlenW(entry->pszPassword) * sizeof(WCHAR));
|
SecureZeroMemory(entry->pszPassword, lstrlenW(entry->pszPassword) * sizeof(WCHAR));
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
|
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
|
||||||
len = strlenW(pszTargetName);
|
len = lstrlenW(pszTargetName);
|
||||||
entry->pszTargetName = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
entry->pszTargetName = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
||||||
memcpy(entry->pszTargetName, pszTargetName, (len + 1)*sizeof(WCHAR));
|
memcpy(entry->pszTargetName, pszTargetName, (len + 1)*sizeof(WCHAR));
|
||||||
list_add_tail(&pending_credentials_list, &entry->entry);
|
list_add_tail(&pending_credentials_list, &entry->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlenW(params.pszUsername);
|
len = lstrlenW(params.pszUsername);
|
||||||
entry->pszUsername = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
entry->pszUsername = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
||||||
memcpy(entry->pszUsername, params.pszUsername, (len + 1)*sizeof(WCHAR));
|
memcpy(entry->pszUsername, params.pszUsername, (len + 1)*sizeof(WCHAR));
|
||||||
len = strlenW(params.pszPassword);
|
len = lstrlenW(params.pszPassword);
|
||||||
entry->pszPassword = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
entry->pszPassword = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
|
||||||
memcpy(entry->pszPassword, params.pszPassword, (len + 1)*sizeof(WCHAR));
|
memcpy(entry->pszPassword, params.pszPassword, (len + 1)*sizeof(WCHAR));
|
||||||
entry->generic = (dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) != 0;
|
entry->generic = (dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) != 0;
|
||||||
|
@ -728,7 +727,7 @@ DWORD WINAPI CredUIConfirmCredentialsW(PCWSTR pszTargetName, BOOL bConfirm)
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(entry, &pending_credentials_list, struct pending_credentials, entry)
|
LIST_FOR_EACH_ENTRY(entry, &pending_credentials_list, struct pending_credentials, entry)
|
||||||
{
|
{
|
||||||
if (!strcmpW(pszTargetName, entry->pszTargetName))
|
if (!lstrcmpW(pszTargetName, entry->pszTargetName))
|
||||||
{
|
{
|
||||||
if (bConfirm)
|
if (bConfirm)
|
||||||
result = save_credentials(entry->pszTargetName, entry->pszUsername,
|
result = save_credentials(entry->pszTargetName, entry->pszUsername,
|
||||||
|
@ -740,7 +739,7 @@ DWORD WINAPI CredUIConfirmCredentialsW(PCWSTR pszTargetName, BOOL bConfirm)
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszTargetName);
|
HeapFree(GetProcessHeap(), 0, entry->pszTargetName);
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
HeapFree(GetProcessHeap(), 0, entry->pszUsername);
|
||||||
SecureZeroMemory(entry->pszPassword, strlenW(entry->pszPassword) * sizeof(WCHAR));
|
SecureZeroMemory(entry->pszPassword, lstrlenW(entry->pszPassword) * sizeof(WCHAR));
|
||||||
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
HeapFree(GetProcessHeap(), 0, entry->pszPassword);
|
||||||
HeapFree(GetProcessHeap(), 0, entry);
|
HeapFree(GetProcessHeap(), 0, entry);
|
||||||
|
|
||||||
|
@ -771,37 +770,37 @@ DWORD WINAPI CredUIParseUserNameW(PCWSTR pszUserName, PWSTR pszUser,
|
||||||
|
|
||||||
/* FIXME: handle marshaled credentials */
|
/* FIXME: handle marshaled credentials */
|
||||||
|
|
||||||
p = strchrW(pszUserName, '\\');
|
p = wcschr(pszUserName, '\\');
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
if (p - pszUserName > ulMaxDomainChars - 1)
|
if (p - pszUserName > ulMaxDomainChars - 1)
|
||||||
return ERROR_INSUFFICIENT_BUFFER;
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
if (strlenW(p + 1) > ulMaxUserChars - 1)
|
if (lstrlenW(p + 1) > ulMaxUserChars - 1)
|
||||||
return ERROR_INSUFFICIENT_BUFFER;
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
strcpyW(pszUser, p + 1);
|
lstrcpyW(pszUser, p + 1);
|
||||||
memcpy(pszDomain, pszUserName, (p - pszUserName)*sizeof(WCHAR));
|
memcpy(pszDomain, pszUserName, (p - pszUserName)*sizeof(WCHAR));
|
||||||
pszDomain[p - pszUserName] = '\0';
|
pszDomain[p - pszUserName] = '\0';
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = strrchrW(pszUserName, '@');
|
p = wcsrchr(pszUserName, '@');
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
if (p + 1 - pszUserName > ulMaxUserChars - 1)
|
if (p + 1 - pszUserName > ulMaxUserChars - 1)
|
||||||
return ERROR_INSUFFICIENT_BUFFER;
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
if (strlenW(p + 1) > ulMaxDomainChars - 1)
|
if (lstrlenW(p + 1) > ulMaxDomainChars - 1)
|
||||||
return ERROR_INSUFFICIENT_BUFFER;
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
strcpyW(pszDomain, p + 1);
|
lstrcpyW(pszDomain, p + 1);
|
||||||
memcpy(pszUser, pszUserName, (p - pszUserName)*sizeof(WCHAR));
|
memcpy(pszUser, pszUserName, (p - pszUserName)*sizeof(WCHAR));
|
||||||
pszUser[p - pszUserName] = '\0';
|
pszUser[p - pszUserName] = '\0';
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlenW(pszUserName) > ulMaxUserChars - 1)
|
if (lstrlenW(pszUserName) > ulMaxUserChars - 1)
|
||||||
return ERROR_INSUFFICIENT_BUFFER;
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
strcpyW(pszUser, pszUserName);
|
lstrcpyW(pszUser, pszUserName);
|
||||||
pszDomain[0] = '\0';
|
pszDomain[0] = '\0';
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -884,8 +883,8 @@ ULONG SEC_ENTRY SspiPromptForCredentialsW( PCWSTR target, void *info,
|
||||||
error, debugstr_w(package), input_id, output_id, save, sspi_flags );
|
error, debugstr_w(package), input_id, output_id, save, sspi_flags );
|
||||||
|
|
||||||
if (!target) return ERROR_INVALID_PARAMETER;
|
if (!target) return ERROR_INVALID_PARAMETER;
|
||||||
if (!package || (strcmpiW( package, basicW ) && strcmpiW( package, ntlmW ) &&
|
if (!package || (wcsicmp( package, basicW ) && wcsicmp( package, ntlmW ) &&
|
||||||
strcmpiW( package, negotiateW )))
|
wcsicmp( package, negotiateW )))
|
||||||
{
|
{
|
||||||
FIXME( "package %s not supported\n", debugstr_w(package) );
|
FIXME( "package %s not supported\n", debugstr_w(package) );
|
||||||
return ERROR_NO_SUCH_PACKAGE;
|
return ERROR_NO_SUCH_PACKAGE;
|
||||||
|
@ -920,19 +919,19 @@ ULONG SEC_ENTRY SspiPromptForCredentialsW( PCWSTR target, void *info,
|
||||||
DWORD size = sizeof(*id), len_domain = 0;
|
DWORD size = sizeof(*id), len_domain = 0;
|
||||||
WCHAR *ptr, *user = username, *domain = NULL;
|
WCHAR *ptr, *user = username, *domain = NULL;
|
||||||
|
|
||||||
if ((ptr = strchrW( username, '\\' )))
|
if ((ptr = wcschr( username, '\\' )))
|
||||||
{
|
{
|
||||||
user = ptr + 1;
|
user = ptr + 1;
|
||||||
len_username = strlenW( user );
|
len_username = lstrlenW( user );
|
||||||
if (!strcmpiW( package, ntlmW ) || !strcmpiW( package, negotiateW ))
|
if (!wcsicmp( package, ntlmW ) || !wcsicmp( package, negotiateW ))
|
||||||
{
|
{
|
||||||
domain = username;
|
domain = username;
|
||||||
len_domain = ptr - username;
|
len_domain = ptr - username;
|
||||||
}
|
}
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
}
|
}
|
||||||
else len_username = strlenW( username );
|
else len_username = lstrlenW( username );
|
||||||
len_password = strlenW( password );
|
len_password = lstrlenW( password );
|
||||||
|
|
||||||
size += (len_username + 1) * sizeof(WCHAR);
|
size += (len_username + 1) * sizeof(WCHAR);
|
||||||
size += (len_domain + 1) * sizeof(WCHAR);
|
size += (len_domain + 1) * sizeof(WCHAR);
|
||||||
|
|
Loading…
Reference in New Issue