+ ok(GetLastError() == CRYPT_E_NOT_FOUND, "Expected CRYPT_E_NOT_FOUND, got %08X\n", GetLastError());
+
+ /* Self-sign a certificate, add to the store and test getting the issuer */
+ size = 0;
+ ok(CertStrToNameW(X509_ASN_ENCODING, certname, CERT_X500_NAME_STR, NULL, NULL, &size, NULL),
+ "CertStrToName should have worked\n");
+ certencoded = HeapAlloc(GetProcessHeap(), 0, size);
+ ok(CertStrToNameW(X509_ASN_ENCODING, certname, CERT_X500_NAME_STR, NULL, certencoded, &size, NULL),
+ "CertStrToName should have worked\n");
+ certsubject.pbData = certencoded;
+ certsubject.cbData = size;
+ cert3 = CertCreateSelfSignCertificate(0, &certsubject, 0, NULL, NULL, NULL, NULL, NULL);
+ ok(cert3 != NULL, "CertCreateSelfSignCertificate should have worked\n");
+ ret = CertAddCertificateContextToStore(store, cert3, CERT_STORE_ADD_REPLACE_EXISTING, 0);
+ ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
+ CertFreeCertificateContext(cert3);
+ cert3 = CertEnumCertificatesInStore(store, NULL);
+ ok(cert3 != NULL, "CertEnumCertificatesInStore should have worked\n");
+ SetLastError(0xdeadbeef);
+ flags = 0;
+ parent = CertGetIssuerCertificateFromStore(store, cert3, NULL, &flags);
+ ok(!parent, "Expected NULL\n");
+ ok(GetLastError() == CRYPT_E_SELF_SIGNED,
+ "Expected CRYPT_E_SELF_SIGNED, got %08X\n", GetLastError());