Platform SDK: Debugging and Error Handling |
The MapFileAndCheckSum function computes the checksum of the specified file.
DWORD MapFileAndCheckSum( PTSTR Filename, PDWORD HeaderSum, PDWORD CheckSum );
If the function succeeds, the return value is CHECKSUM_SUCCESS.
If the function fails, the return value is one of the following.
Value | Meaning |
---|---|
CHECKSUM_OPEN_FAILURE | Could not open the file. |
CHECKSUM_MAP_FAILURE | Could not map the file. |
CHECKSUM_MAPVIEW_FAILURE | Could not map a view of the file. |
CHECKSUM_UNICODE_FAILURE | Could not convert the file name to Unicode. |
The MapFileAndCheckSum function computes a new checksum for the file and returns it in the CheckSum parameter. This function is used by any application that creates or modifies an executable image. Checksums are required for kernel-mode drivers and some system DLLs. The linker computes the original checksum at link time, if you use the appropriate linker switch. For more details, see your linker documentation.
It is recommended that all images have valid checksums. It is the caller's responsibility to place the newly computed checksum into the mapped image and update the on-disk image of the file.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in Imagehlp.h.
Library: Use Imagehlp.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Image Help Library Overview, ImageHlp Functions, CheckSumMappedFile