Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function destroys the hash object referenced by the hHashparameter. Once a hash object has been destroyed, it can no longer be used and its handle is useless from then on.
All hash objects should be destroyed with the CryptDestroyHashfunction when the application is finished with them.
Syntax
BOOL CRYPTFUNC CryptDestroyHash( HCRYPTHASH hHash ); |
Parameters
- hHash
-
[in] HCRYPTHASHhandle to the hash object to be destroyed.
Return Value
TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastErrorfunction.
The following table shows the common values for the GetLastErrorfunction. The error values prefaced by NTE are generated by the particular cryptographic service provider (CSP) you are using.
Value | Description |
---|---|
ERROR_BUSY |
The hash object specified by hHashis currently being used by another process. |
ERROR_INVALID_HANDLE |
The hHashparameter specifies an invalid handle. |
ERROR_INVALID_PARAMETER |
The hHashparameter contains an invalid value. |
NTE_BAD_ALGID |
The hHashhandle specifies an algorithm that this CSP does not support. |
NTE_BAD_HASH |
The hash object specified by the hHashparameter is invalid. |
NTE_BAD_UID |
The CSP context that was specified when the hash object was created cannot be found. |
Remarks
When a hash object is destroyed, many CSPs will scrub the memory in the CSP where the hash object was held. The CSP memory is then freed.
There should be a one-to-one relationship between calls to the CryptCreateHashfunction and calls to the CryptDestroyHashfunction.
Example Code
See CryptHashSessionKey.
Requirements
Header | wincrypt.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 2.10 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |