credui: Correctly check for duplicated username entries in CredDialogFillUsernameCombo.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-10-12 14:50:25 +02:00 committed by Alexandre Julliard
parent 43275fb178
commit 3acde309ed
1 changed files with 12 additions and 5 deletions

View File

@ -160,20 +160,27 @@ static void CredDialogFillUsernameCombo(HWND hwndUsername, const struct cred_dia
DWORD j;
BOOL duplicate = FALSE;
if (!credentials[i]->UserName)
continue;
if (params->dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS)
{
if ((credentials[i]->Type != CRED_TYPE_GENERIC) || !credentials[i]->UserName)
if (credentials[i]->Type != CRED_TYPE_GENERIC)
{
credentials[i]->UserName = NULL;
continue;
}
}
else
else if (credentials[i]->Type == CRED_TYPE_GENERIC)
{
if (credentials[i]->Type == CRED_TYPE_GENERIC)
continue;
credentials[i]->UserName = NULL;
continue;
}
/* don't add another item with the same name if we've already added it */
for (j = 0; j < i; j++)
if (!strcmpW(credentials[i]->UserName, credentials[j]->UserName))
if (credentials[j]->UserName
&& !strcmpW(credentials[i]->UserName, credentials[j]->UserName))
{
duplicate = TRUE;
break;