Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function is a simplified function used to open the most common system certificate store. To open certificate stores with more complex requirements, such as file-based or memory-based stores, use the CertOpenStorefunction.

Syntax

HCERTSTORE WINAPI CertOpenSystemStore(
  HCRYPTPROV 
hProv,
  LPCTSTR 
szSubsystemProtocol
);

Parameters

hProv

[in] HCRYPTPROVhandle to a cryptographic service provider (CSP). Set the hProvparameter to NULL to use the default CSP. If hProvis not NULL, it must be a CSP handle created using the CryptAcquireContextfunction.

szSubsystemProtocol

[in] Null-terminated string that contains the name of a system store. The following table shows example system stores.

Predefined system store Description

CA

Certifying authority certificates.

MY

A certificate store holding MY certificates and their associated private keys.

ROOT

Root certificates.

If the system store name provided in this parameter is not the name of an existing system store, a new system store will be created and used. The CertEnumSystemStorefunction can be used to list the names of existing system stores.

Return Value

If the function succeeds, the return value is a read-only handle to the certificate store.

If the function fails, the return value is NULL. For extended error information, call the GetLastErrorfunction. Note that errors from the called CertOpenStorefunction are propagated to this function.

Remarks

After the system store is opened, all the standard certificate store functions can be used to manipulate the certificates.

If certificates need to be deleted, use CertOpenStoreinstead.

After use, the store should be closed by using the CertCloseStorefunction.

Requirements

Header wincrypt.h
Library crypt32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also