CertAddEncodedCertificateToSystemStore function
The CertAddEncodedCertificateToSystemStore function opens the specified system store and adds the encoded certificate to it.
Syntax
BOOL WINAPI CertAddEncodedCertificateToSystemStore(
_In_ LPCSTR szCertStoreName,
_In_ const BYTE *pbCertEncoded,
_In_ DWORD cbCertEncoded
);
Parameters
- szCertStoreName [in]
-
A null-terminated string that contains the name of the system store for the encoded certificate.
- pbCertEncoded [in]
-
A pointer to a buffer that contains the encoded certificate to add.
- cbCertEncoded [in]
-
The size, in bytes, of the pbCertEncoded buffer.
Return value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. CertAddEncodedCertificateToSystemStore depends on the functions listed in the following remarks for error handling. Refer to those function topics for their respective error handling behaviors. For extended error information, call GetLastError.
Remarks
Internally, CertAddEncodedCertificateToSystemStore calls CertOpenSystemStore and CertAddEncodedCertificateToStore with the following parameters.
| CertOpenSystemStore Parameter | Value |
|---|---|
| szSubsystemProtocol | szCertStoreName |
If CertAddEncodedCertificateToSystemStore obtains a handle to the specified system store, it calls CertCloseStore to close the handle before it returns.
| CertAddEncodedCertificateToStore Parameter | Value |
|---|---|
| dwCertEncodingType | X509_ASN_ENCODING |
| dwAddDisposition | CERT_STORE_ADD_USE_EXISTING |
| ppCertContext | NULL |
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
CertAddEncodedCertificateToSystemStoreW (Unicode) and CertAddEncodedCertificateToSystemStoreA (ANSI) |