Expand Minimize

CertEnumCTLsInStore function

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.

Syntax


PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(
  _In_  HCERTSTORE hCertStore,
  _In_  PCCTL_CONTEXT pPrevCtlContext
);

Parameters

hCertStore [in]

Handle of a certificate store.

pPrevCtlContext [in]

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.

Return value

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.

Return codeDescription
CRYPT_E_NOT_FOUND

Either no CTLs exist in the store, or the function reached the end of the store's list.

E_INVALIDARG

The handle in the hCertStore parameter is not the same as that in the CTL context pointed to by the pPrevCtlContext parameter.

 

Remarks

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.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Wincrypt.h

Library

Crypt32.lib

DLL

Crypt32.dll

See also

Certificate Trust List Functions
CertDeleteCTLFromStore
CertDuplicateCTLContext
CertFindCTLInStore
CertFreeCTLContext
CTL_CONTEXT

 

 

Community Additions

ADD
Show:
© 2014 Microsoft