MapFileAndCheckSumW function (imagehlp.h)
Computes the checksum of the specified file.
DWORD IMAGEAPI MapFileAndCheckSumW( [in] PCWSTR Filename, [out] PDWORD HeaderSum, [out] PDWORD CheckSum );
The file name of the file for which the checksum is to be computed.
A pointer to a variable that receives the original checksum from the image file, or zero if there is an error.
A pointer to a variable that receives the computed checksum.
If the function succeeds, the return value is CHECKSUM_SUCCESS (0).
If the function fails, the return value is one of the following.
||Could not map the file.|
||Could not map a view of the file.|
||Could not open the file.|
||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.
Passing a Filename parameter that does not point to a valid executable image will produce unpredictable results. Any user of this function is encouraged to make sure that a valid executable image is being passed.
All ImageHlp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.
The imagehlp.h header defines MapFileAndCheckSum as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|