CryptReleaseContext (Windows CE 5.0)
This function frees the handle to a cryptographic service provider (CSP) and the key container. At each call to this function, the reference count on the CSP is reduced by one. When the reference count reaches zero, the context is fully freed and it can no longer be used by any function in the application.
The application calls this function when it is finished using the CSP. After this function is called, the CSP handle specified by the hProv parameter is no longer valid; however, the function does not destroy either the key container or any key pairs.
BOOL WINAPI CryptReleaseContext( HCRYPTPROV hProv, DWORD dwFlags );
- [in] HCRYPTPROV handle to a CSP created by a call to the CryptAcquireContext function.
- [in] Reserved for future use and must be set to zero.
TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastError function. The following table shows common values for the GetLastError function. The error values prefaced by NTE are generated by the particular CSP you are using.
|ERROR_BUSY||The CSP context specified by hProv is currently being used by another process.|
|ERROR_INVALID_HANDLE||One of the parameters specifies an invalid handle.|
|ERROR_INVALID_PARAMETER||One of the parameters contains an invalid value. This is most often an illegal pointer.|
|NTE_BAD_FLAGS||The dwFlags parameter is nonzero.|
|NTE_BAD_UID||The hProv parameter does not contain a valid context handle.|
After calling this function, the session is over and all existing session keys and hash objects that were created by using the hProv handle become invalid. In practice, all of these objects should be destroyed with the CryptDestroyKey and CryptDestroyHash functions before calling the CryptReleaseContext function.
OS Versions: Windows CE 2.10 and later.
Link Library: Coredll.lib.
Send Feedback on this topic to the authors