Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An application calls this function after finishing the use of the CSP. After this function is called, the released CSP handle is no longer valid. This function does not destroy key containers or key pairs.
BOOL CryptReleaseContext(
[in] HCRYPTPROV hProv,
[in] DWORD dwFlags
);
[in] hProv
Handle of a cryptographic service provider (CSP) created by a call to CryptAcquireContext.
[in] dwFlags
Reserved for future use and must be zero. If dwFlags is not set to zero, this function returns FALSE but the CSP is released.
If the function succeeds, the return value is nonzero (TRUE).
If the function fails, the return value is zero (FALSE). For extended error information, call GetLastError. Some possible error codes are listed in the following table.
Return code | Description |
---|---|
|
The CSP context specified by hProv is currently being used by another process. |
|
One of the parameters specifies a handle that is not valid. |
|
One of the parameters contains a value that is not valid. This is most often a pointer that is not valid. |
|
The dwFlags parameter is nonzero. |
|
The hProv parameter does not contain a valid context handle. |
After this function has been called, the CSP session is finished and all existing session keys and hash objects created by using the hProv handle are no longer valid. In practice, all of these objects should be destroyed with calls to CryptDestroyKey and CryptDestroyHash before CryptReleaseContext is called.
For an example that uses this function, see Example C Program: Creating and Hashing a Session Key.
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Advapi32.lib |
DLL | Advapi32.dll |
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!