The CertEnumCTLsInStore function retrieves the first or next certificate trust list (CTL) context in a certificate store. Used in a loop, this function can retrieve in sequence all CTL contexts in a certificate store.
PCCTL_CONTEXT CertEnumCTLsInStore( HCERTSTORE hCertStore, PCCTL_CONTEXT pPrevCtlContext );
Handle of a certificate store.
A pointer to the previous CTL_CONTEXT structure found. It must be NULL to get the first CTL in the store. Successive CTLs are enumerated by setting pPrevCtlContext to the pointer returned by a previous call. This function frees the CTL_CONTEXT referenced by non-NULL values of this parameter. The enumeration skips any CTLs previously deleted by CertDeleteCTLFromStore.
If the function succeeds, the return value is a pointer to a read-only CTL_CONTEXT.
If the function fails and a CTL is not found, the return value is NULL. For extended error information, call GetLastError.
Some possible error codes follow.
||Either no CTLs exist in the store, or the function reached the end of the store's list.|
||The handle in the hCertStore parameter is not the same as that in the CTL context pointed to by the pPrevCtlContext parameter.|
The returned pointer is freed when passed as the pPrevCtlContext on a subsequent call. Otherwise, the pointer must be explicitly freed by calling CertFreeCTLContext. A pPrevCtlContext that is not NULL is always freed by this function (through a call to CertFreeCTLContext), even for an error.
A duplicate can be made by calling CertDuplicateCTLContext.
|Minimum supported client||Windows XP [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|