CertControlStore (Compact 2013)

3/28/2014

This function allows an application to be notified when there is a difference between the contents of a cached store in use and the contents of that store as it is persisted to storage. Differences can occur as another process makes a change that affects the store as it is persisted.

This function can be used to synchronize a cached store if necessary and provides a means to commit changes made in the cached store to persisted storage.

Syntax

BOOL WINAPI CertControlStore(
  HCERTSTORE hCertStore,
  DWORD dwFlags,
  DWORD dwCtrlType,
  void const* pvCtrlPara
);

Parameters

  • hCertStore
    [in] Handle to the certificate store.
  • dwFlags
    [in] Bitmask of flags. The following table shows possible values for this parameter, if the dwCtrlType parameter is set to CERT_STORE_CTRL_COMMIT.

    Value

    Description

    CERT_STORE_CTRL_COMMIT_FORCE_FLAG

    Forces the contents of the cache memory store to be copied to permanent storage even if the cache has not been changed

    CERT_STORE_CTRL_COMMIT_CLEAR_FLAG

    Inhibits copying the contents of the cache memory store to permanent storage even when the store is closed.

    CERT_STORE_CTRL_INHIBIT_DUPLICATE_HANDLE_FLAG

    Inhibits a duplicate handle of the event HANDLE. If this flag is set, CertControlStore with CERT_STORE_CTRL_CANCEL_NOTIFY passed must be called for this event HANDLE before closing the hCertStore handle.

    If the dwCtrlType parameter is set to CERT_STORE_CTRL_NOTIFY_CHANGE or CERT_STORE_CTRL_RESYNC, the dwFlags parameter is not used and must be set to zero.

  • dwCtrlType
    [in] Specifies the control action to be taken by the CertControlStore function. The interpretations of the pvCtrlPara and dwFlags parameters depend on the value of the dwCtrlType parameter. The following table shows the values for the dwCtrlType parameter.

    Value

    Description

    CERT_STORE_CTRL_RESYNC

    The cached store is resynchronized and made to match the persisted store.

    CERT_STORE_CTRL_COMMIT

    Any changes made to the cached store are copied to persisted storage. If no changes were made since the cached store was opened or since the last commit, the call is ignored. The call is also ignored if the store provider is a provider that automatically persists changes immediately.

  • pvCtrlPara
    [in] Not used and must be set to NULL. If the value of the dwCtrlType parameter is CERT_STORE_CTRL_COMMIT, the pvCtrlPara parameter is not used and must be set to NULL.

Return Value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

If the dwCtrlType value is CERT_STORE_NOTIFY_CHANGE, the function returns TRUE if a handle for the event signal was successfully set up. The function returns FALSE if the event handle was not set up.

If the dwCtrlType value is CERT_STORE_CTRL_RESYNC, the function returns TRUE if the resynchronization succeeded and FALSE if the resynchronization failed.

If the dwCtrlType value is CERT_STORE_CTRL_COMMIT, the function returns TRUE to indicate the successful completion of the commit to persisted storage and FALSE if the commit failed.

For extended error information, call the GetLastError function.

Some providers might not support specific control types. In these cases, the CertControlStore function returns FALSE and the GetLastError function is set to the ERROR_NOT_SUPPORTED.

Remarks

Resynchronization of a store can be done at any time. It need not follow a signaled notification change event.

Requirements

Header

wincrypt.h

Library

crypt32.lib

See Also

Reference

Certificates Functions
CreateEvent