crypt32: Fix CertDuplicateCertificateContext for a passed NULL context.

This commit is contained in:
Paul Vriens 2009-01-29 13:32:59 +01:00 committed by Alexandre Julliard
parent ff8bd24ec2
commit 8218518695
2 changed files with 15 additions and 0 deletions

View File

@ -115,6 +115,10 @@ PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(
PCCERT_CONTEXT pCertContext)
{
TRACE("(%p)\n", pCertContext);
if (!pCertContext)
return NULL;
Context_AddRef((void *)pCertContext, sizeof(CERT_CONTEXT));
return pCertContext;
}

View File

@ -3136,6 +3136,16 @@ static void testGetPublicKeyLength(void)
ok(ret == 56, "Expected length 56, got %d\n", ret);
}
static void testCertDuplicateCertificateContext(void)
{
PCCERT_CONTEXT context;
SetLastError(0xdeadbeef);
context = CertDuplicateCertificateContext(NULL);
ok(context == NULL, "Expected context to be NULL\n");
}
START_TEST(cert)
{
init_function_pointers();
@ -3163,4 +3173,5 @@ START_TEST(cert)
testVerifyRevocation();
testAcquireCertPrivateKey();
testGetPublicKeyLength();
testCertDuplicateCertificateContext();
}