cryptui: Show UI rather than failing if no import source is specified.

This commit is contained in:
Juan Lang 2008-12-22 19:09:28 -08:00 committed by Alexandre Julliard
parent 0db9031465
commit dbab34e8d5
1 changed files with 40 additions and 34 deletions

View File

@ -3941,9 +3941,7 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardT
TRACE("(0x%08x, %p, %s, %p, %p)\n", dwFlags, hwndParent, debugstr_w(pwszWizardTitle), TRACE("(0x%08x, %p, %s, %p, %p)\n", dwFlags, hwndParent, debugstr_w(pwszWizardTitle),
pImportSrc, hDestCertStore); pImportSrc, hDestCertStore);
if (!(dwFlags & CRYPTUI_WIZ_NO_UI)) FIXME("UI not implemented\n"); if (pImportSrc &&
if (!pImportSrc ||
pImportSrc->dwSize != sizeof(CRYPTUI_WIZ_IMPORT_SRC_INFO)) pImportSrc->dwSize != sizeof(CRYPTUI_WIZ_IMPORT_SRC_INFO))
{ {
SetLastError(E_INVALIDARG); SetLastError(E_INVALIDARG);
@ -3953,39 +3951,47 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardT
if (!(dwFlags & CRYPTUI_WIZ_NO_UI)) if (!(dwFlags & CRYPTUI_WIZ_NO_UI))
ret = show_import_ui(dwFlags, hwndParent, pwszWizardTitle, pImportSrc, ret = show_import_ui(dwFlags, hwndParent, pwszWizardTitle, pImportSrc,
hDestCertStore); hDestCertStore);
else if (pImportSrc)
switch (pImportSrc->dwSubjectChoice)
{ {
case CRYPTUI_WIZ_IMPORT_SUBJECT_FILE: switch (pImportSrc->dwSubjectChoice)
ret = import_file(dwFlags, hwndParent, pwszWizardTitle, {
pImportSrc->u.pwszFileName, hDestCertStore); case CRYPTUI_WIZ_IMPORT_SUBJECT_FILE:
break; ret = import_file(dwFlags, hwndParent, pwszWizardTitle,
case CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT: pImportSrc->u.pwszFileName, hDestCertStore);
if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CERT))) break;
ret = import_cert(pImportSrc->u.pCertContext, hDestCertStore); case CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT:
else if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CERT)))
import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle); ret = import_cert(pImportSrc->u.pCertContext, hDestCertStore);
break; else
case CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT: import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle);
if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CRL))) break;
ret = import_crl(pImportSrc->u.pCRLContext, hDestCertStore); case CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT:
else if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CRL)))
import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle); ret = import_crl(pImportSrc->u.pCRLContext, hDestCertStore);
break; else
case CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT: import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle);
if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CTL))) break;
ret = import_ctl(pImportSrc->u.pCTLContext, hDestCertStore); case CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT:
else if ((ret = check_context_type(dwFlags, CERT_QUERY_CONTENT_CTL)))
import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle); ret = import_ctl(pImportSrc->u.pCTLContext, hDestCertStore);
break; else
case CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE: import_warn_type_mismatch(dwFlags, hwndParent, pwszWizardTitle);
ret = import_store(dwFlags, hwndParent, pwszWizardTitle, break;
pImportSrc->u.hCertStore, hDestCertStore); case CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE:
break; ret = import_store(dwFlags, hwndParent, pwszWizardTitle,
default: pImportSrc->u.hCertStore, hDestCertStore);
WARN("unknown source type: %u\n", pImportSrc->dwSubjectChoice); break;
default:
WARN("unknown source type: %u\n", pImportSrc->dwSubjectChoice);
SetLastError(E_INVALIDARG);
ret = FALSE;
}
}
else
{
/* Can't have no UI without specifying source */
SetLastError(E_INVALIDARG); SetLastError(E_INVALIDARG);
return FALSE; ret = FALSE;
} }
return ret; return ret;