Windows CE 3.0

This function retrieves the first or next certificate in a certificate store. Used in a loop, this function can retrieve in sequence all certificates in a certificate store.

PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(


[in] Handle of a certificate store.
[in] Pointer to the CERT_CONTEXT structure of the previous certificate context found.

This parameter must be NULL to begin the enumeration and get the first certificate in the store. Successive certificates are enumerated by setting the pPrevCertContext parameter to the pointer returned by a previous call to the function.

The enumeration skips any certificate previously deleted by the CertDeleteCertificateFromStore function.

Return Values

If the function succeeds, the return value is a pointer to the next CERT_CONTEXT structure in the store. If no more certificates exist in the store, the function returns NULL.

For extended error information, call the GetLastError function. The following table lists some possible error codes.

Value Description
E_INVALIDARG The handle in the hCertStore parameter is not the same as that in the certificate context pointed to by the pPrevCertContext parameter.
CRYPT_E_NOT_FOUND No certificates were found. This happens if the store is empty or if the function reached the end of the store's list.


The returned pointer is freed when passed as the pPrevCertContext parameter on a subsequent call. Otherwise, the pointer must be freed by calling the CertFreeCertificateContext function. A pPrevCertContext parameter that is not NULL is always freed by the CertFreeCertificateContext function, even for an error.

A duplicate of the currently enumerated certificate can be made by calling the CertDuplicateCertificateContext function.


Runs on Versions Defined in Include Link to
Windows CE OS 3.0 or later Wincrypt.h   Crypt32.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CertDeleteCertificateFromStore, CertDuplicateCertificateContext, CertFindCertificateInStore, CertFreeCertificateContext, CERT_CONTEXT

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.