diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index ef5410a0367..7a8c21f9f0b 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -453,7 +453,7 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, ctl->pbCtlEncoded = data; ctl->cbCtlEncoded = cbCtlEncoded; ctl->pCtlInfo = ctlInfo; - ctl->hCertStore = NULL; + ctl->hCertStore = &empty_store; ctl->hCryptMsg = msg; ctl->pbCtlContext = content; ctl->cbCtlContext = contentSize; diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index ea85dbfab0d..1fa3ffae3eb 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -2531,6 +2531,7 @@ static void testEmptyStore(void) { const CERT_CONTEXT *cert, *cert2, *cert3; const CRL_CONTEXT *crl; + const CTL_CONTEXT *ctl; HCERTSTORE store; BOOL res; @@ -2594,6 +2595,12 @@ static void testEmptyStore(void) CertFreeCRLContext(crl); + ctl = CertCreateCTLContext(X509_ASN_ENCODING, signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent)); + ok(ctl != NULL, "CertCreateCTLContext failed\n"); + ok(ctl->hCertStore == cert->hCertStore, "unexpected hCertStore\n"); + + CertFreeCTLContext(ctl); + CertFreeCertificateContext(cert); }