Platform SDK: Cryptography

CPReleaseContext

The CPReleaseContext function releases a context created by CPAcquireContext.

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

Parameters

hProv
Handle of a key container within the CSP. This handle is obtained by a call to CPAcquireContext.
dwFlags
No flags are currently defined.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE, and the appropriate error code from the following table must be set using 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 executed, the hProv handle becomes invalid. All session keys and hash objects previously created by using the hProv handle can be destroyed at this time. Ideally, the application already did this using CryptDestroyKey and CryptDestroyHash, but a CSP cannot depend upon the keys and hashes being destroyed.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later).
  Header: Declared in Wincrypt.h.

See Also

CPAcquireContext, CryptReleaseContext