cryptui: Fix destination store for self-signed certs.

This commit is contained in:
Juan Lang 2008-10-28 11:17:50 -07:00 committed by Alexandre Julliard
parent 472984f565
commit b7fa4a7712
2 changed files with 1 additions and 14 deletions

View file

@ -182,27 +182,15 @@ static BOOL is_ca_cert(PCCERT_CONTEXT cert, BOOL defaultIfNotSpecified)
return isCA; return isCA;
} }
static inline BOOL is_cert_self_signed(PCCERT_CONTEXT cert)
{
return CertCompareCertificateName(cert->dwCertEncodingType,
&cert->pCertInfo->Subject, &cert->pCertInfo->Issuer);
}
static HCERTSTORE choose_store_for_cert(PCCERT_CONTEXT cert) static HCERTSTORE choose_store_for_cert(PCCERT_CONTEXT cert)
{ {
static const WCHAR Root[] = {'R','o','o','t',0};
static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s', static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s',
'B','o','o','k',0 }; 'B','o','o','k',0 };
static const WCHAR CA[] = { 'C','A',0 }; static const WCHAR CA[] = { 'C','A',0 };
LPCWSTR storeName; LPCWSTR storeName;
if (is_ca_cert(cert, TRUE)) if (is_ca_cert(cert, TRUE))
{ storeName = CA;
if (is_cert_self_signed(cert))
storeName = Root;
else
storeName = CA;
}
else else
storeName = AddressBook; storeName = AddressBook;
return CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, return CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,

View file

@ -373,7 +373,6 @@ static void test_crypt_ui_wiz_import(void)
info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING, info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey)); v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL); ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
todo_wine
ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError()); ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
if (ret) if (ret)
{ {