CertDuplicateCertificateContext
TOC
De inhoudsopgave samenvouwen
De inhoudsopgave uitvouwen
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

CertDuplicateCertificateContext function

The CertDuplicateCertificateContext function duplicates a certificate context by incrementing its reference count.

Syntax


PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(
  _In_ PCCERT_CONTEXT pCertContext
);

Parameters

pCertContext [in]

A pointer to the CERT_CONTEXT structure for which the reference count is incremented.

Return value

Currently, a copy is not made of the context, and the returned pointer to a context has the same value as the pointer to a context that was input. If the pointer passed into this function is NULL, NULL is returned. When you have finished using the duplicate context, decrease its reference count by calling the CertFreeCertificateContext function.

Examples

The following example shows duplicating a certificate context by incrementing its reference count. For another example that uses this function, see Example C Program: Deleting Certificates from a Certificate Store.


#include <windows.h>
#include <stdio.h>
#include <Wincrypt.h>

//--------------------------------------------------------------------
// Declare and initialize variables.
PCCERT_CONTEXT  pDupCertContext = NULL; 

//--------------------------------------------------------------------
//  Create a duplicate pointer to the certificate context. 
//  pCertContext is a previously assigned pointer
//  to a CERT_CONTEXT structure.
if(pDupCertContext = CertDuplicateCertificateContext(
      pCertContext))
{
       printf("A duplicate pointer was created. Continue. \n");
       // Use the context as needed.
       // ...

       // When done with the context, release it.
       CertFreeCertificateContext(pDupCertContext);
 
}
else
{
       printf("Duplication of the certificate pointer failed.\n");
       exit(1);
}


Requirements

Minimum supported client

Windows XP [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2003 [desktop apps | Windows Store apps]

Header

Wincrypt.h

Library

Crypt32.lib

DLL

Crypt32.dll

See also

Certificate Functions
CertDuplicateCRLContext
CertFreeCertificateContext

 

 

Weergeven:
© 2016 Microsoft