The CheckSumMappedFile function computes the checksum of the specified image file.
PIMAGE_NT_HEADERS CheckSumMappedFile(
IN LPVOID BaseAddress,
IN DWORD FileLength,
OUT LPDWORD HeaderSum,
OUT LPDWORD CheckSum
);
If the function succeeds, the return value is a pointer to the IMAGE_NT_HEADERS structure contained in the mapped image.
If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError.
The CheckSumMappedFile 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 Windows NT 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: Requires version 4.0 or later.
Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in imagehlp.h.
Import Library: Use imagehlp.lib.
PE Image Helper (ImageHlp) Overview, ImageHlp Image Modification Functions, MapFileAndCheckSum, MapViewOfFile