Windows CE 3.0

This function is used to release a handle to a cryptographic service provider (CSP) and a key container.

This should be performed when the application is finished using the CSP. After this function is called, the CSP handle specified by the hProv parameter is no longer valid. Neither the key container nor any key pairs are destroyed by this function.

BOOL WINAPI CryptReleaseContext( 
DWORD dwFlags); 


[in] Handle to the application's CSP. This is the handle the application obtains by using the CryptAcquireContext function.
[in] Specifies a bitmask of flags. This parameter is reserved for future use; set to 0.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. Common values for GetLastError are described in the following table. The error values prefaced by "NTE" are generated by the particular CSP you are using.

Value Description
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 this function has been called, 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 the CryptReleaseContext function is called.


See CryptHashSessionKey.


Runs On Versions Defined in Include Link to
Windows CE OS 2.10 and later Wincrypt.h   Cryptapi.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CryptAcquireContext, CryptDestroyKey, CryptDestroyHash

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.