This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Retrieves the checksum bytes.


HRESULT get_checksum (   
   DWORD  cbData,  
   DWORD* pcbData,  
   BYTE   data[]  


[in] Size of the data buffer, in bytes.

[out] Returns the number of checksum bytes. This parameter cannot be NULL.

[in, out] A buffer that is filled with the checksum bytes. If this parameter is NULL, then pcbData returns the number of bytes required.

Return Value

If successful, returns S_OK; otherwise, returns an error code.


To determine the type of checksum algorithm that was used to generate the checksum bytes, call the IDiaSourceFile::get_checksumType method.

The checksum is typically generated from the image of the source file so changes in the source file are reflected in changes in the checksum bytes. If the checksum bytes do not match a checksum generated from the loaded image of the file, then the file should be considered damaged or tampered with.

Typical checksums are never more than 32 bytes in size but do not assume that is the maximum size of a checksum. Set the data parameter to NULL to get the number of bytes required to retrieve the checksum. Then allocate a buffer of the appropriate size and call this method once more with the new buffer.

See Also