将写代码过程比较重要的一些代码收藏起来,下边资料是关于C++ 获取PE文件自校验值的代码。
#include
#include <imagehlp.h>
#pragma comment(lib,"imagehlp")
{
char szFileName[] = "d:\newupdate.exe";
DWORD dwCheckSum1,dwCheckSum2;
if (MapFileAndCheckSum(szFileName,&dwCheckSum1,&dwCheckSum2) == CHECKSUM_SUCCESS)
{
std::cout<<hex<<"PIMAGE_OPTIONAL_HEADER.CheckSum = "<<dwCheckSum1<<std::endl;
std::cout<<hex<<"重新计算得到CheckSum = "<<dwCheckSum2<<std::endl;
}
return 0;
}
原文地址:https://www.cnblogs.com/uigrls/p/10223906.html
时间: 2024-10-12 22:05:35