The CPReleaseContext function is used to release a context created by CPAcquireContext.
BOOL CPReleaseContext(
HCRYPTPROV hProv, // in
DWORD dwFlags // in
);
If the function succeeds, TRUE should be returned; otherwise, return FALSE. When FALSE is returned, the appropriate error code (see the following table) must be set via SetLastError.
Error | Description |
---|---|
NTE_BAD_FLAGS | The value of the dwFlags parameter is invalid. |
NTE_BAD_UID | The context specified by hProv is invalid. |
After this function has been called, the hProv handle becomes invalid. All session keys and hash objects that have previously been created by using the hProv handle can be destroyed at this time. Ideally, the application has already done this via CryptDestroyKey and CryptDestroyHash (both in the CryptoAPI), but your CSP shouldn't depend on it.
CPAcquireContext, CryptReleaseContext