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.

The CertControlStore 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.

BOOL WINAPI CertControlStore(
DWORD dwFlags,
DWORD dwCtrlType,
void const *pvCtrlPara


  • hCertStore
    [in] Handle of the certificate store.

  • dwFlags
    [in] If the dwCtrlType parameter is set to CERT_STORE_CTRL_COMMIT, the following dwFlags are defined:

    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 the 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] 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 lists 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] The parameter is not used and must be set to NULL. If the dwCtrlType parameter is CERT_STORE_CTRL_COMMIT, the pvCtrlPara parameter is not used and must be set to NULL.

Return Values

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.


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


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


 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.