CPReleaseContext

The CPReleaseContext function is used to release a context created by CPAcquireContext.

BOOL CPReleaseContext(
  HCRYPTPROV hProv,  // in
  DWORD dwFlags      // in
);
 

Parameters

hProv
Handle to a particular key container (or "context") within the CSP. This handle is obtained via a call to CPAcquireContext.
dwFlags
Flag values. No flags are currently defined.

Return Values

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.

Remarks

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.

See Also

CPAcquireContext, CryptReleaseContext