From fa6b64d6fc4f7d0ae93734ec1b1dbfa9fdd5d45d Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 26 Nov 2007 11:59:51 -0800 Subject: [PATCH] crypt32: Add CERT_STORE_ADD_NEWER support to CertAddCertificateContextToStore. --- dlls/crypt32/store.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 7f79ec9b553..1158febfdc0 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -837,6 +837,22 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, else toAdd = CertDuplicateCertificateContext(pCertContext); break; + case CERT_STORE_ADD_NEWER: + if (existing) + { + if (CompareFileTime(&existing->pCertInfo->NotBefore, + &pCertContext->pCertInfo->NotBefore) >= 0) + { + TRACE("existing certificate is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + ret = FALSE; + } + else + toAdd = CertDuplicateCertificateContext(pCertContext); + } + else + toAdd = CertDuplicateCertificateContext(pCertContext); + break; default: FIXME("Unimplemented add disposition %d\n", dwAddDisposition); ret = FALSE;