CertAddStoreToCollection (Compact 2013)

3/28/2014

This function adds a sibling certificate store to a collection certificate store. When a certificate store has been added to a collection store, you can retrieve all of the certificates in the store that have been added to the collection store by using find or enumerate function calls that use the collection store.

Syntax

BOOL WINAPI CertAddStoreToCollection(
    __in HCERTSTORE hCollectionStore,
    __in_opt HCERTSTORE hSiblingStore,
    __in DWORD dwUpdateFlags,
    __in DWORD dwPriority
    );

Parameters

  • hCollectionStore
    [in] Handle of a certificate store.
  • hSiblingStore
    [in, optional] Handle of a sibling store to be added to the collection store. For more information, see Remarks.
  • dwUpdateFlag
    [in] Indicates whether certificates can be added to the new sibling store member of the collection store. To enable addition, set dwUpdateFlag to CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG. To disable additions, set dwUpdateFlag to zero.
  • dwPriority
    [in] Sets a priority level of the new store in the collection, with zero being the lowest priority. If zero is passed for this parameter, the specified store is appended as the last store in the collection. The priority levels of the stores in a collection determine the order in which the stores are enumerated, and the search order of the stores when they attempt to retrieve a certificate, certificate revocation list (CRL), or certificate trust list (CTL). Priority levels also determine to which store of a collection a new certificate, CRL, or CTL is added. For more information, see Remarks.

Return Value

Returns true if the function succeeds and a new store is added to the collection of stores.

Returns false if the function fails and a new store is not added.

Remarks

A collection store has the same HCERTSTORE handle as a single store; thus, almost all functions that apply to any certificate store also apply to any collection store. Enumeration and search processes span all of the stores in a collection store; however, functions such as CertAddCertificateLinkToStore that add links to stores cannot be used with collection stores.

When a certificate is added to a collection store, the list of sibling stores in the collection is searched in priority order to find the first store that allows adding. Adding is enabled if CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG was set in the CertAddStoreToCollection call. With any function that adds elements to a store, if a store that allows adding does not return success, the addition function continues on to the next store without providing notification.

When a collection store and its sibling stores are closed with CertCloseStore using CERT_CLOSE_STORE_FORCE_FLAG, the collection store must be closed before its sibling stores. If CERT_CLOSE_STORE_FORCE_FLAG is not used, the stores can be closed in any order.

Requirements

Header

wincrypt.h

Library

crypt32.lib

See Also

Reference

Certificates Functions