CertDeleteCertificateFromStore function (wincrypt.h)
BOOL CertDeleteCertificateFromStore( PCCERT_CONTEXT pCertContext );
A pointer to the CERT_CONTEXT structure to be deleted.
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. For extended error information, call GetLastError. One possible error code is the following.
||Indicates the store was opened as read-only and a delete operation is not allowed.|
After a certificate is deleted from a store, all subsequent attempts to get or find that certificate in that store will fail. However, memory allocated for the certificate is not freed until all duplicated contexts have also been freed.
The CertDeleteCertificateFromStore function always frees pCertContext by calling the CertFreeCertificateContext function, even if an error is encountered. Freeing the context reduces the context's reference count by one. If the reference count reaches zero, memory allocated for the certificate is freed.
For an example that uses this function, see Example C Program: Deleting Certificates from a Certificate Store.
|Minimum supported client||Windows XP [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|