C++ 獲取PE檔案自校驗值的程式碼

ui_grls發表於2019-01-05

將寫程式碼過程比較重要的一些程式碼收藏起來,下邊資料是關於C++ 獲取PE檔案自校驗值的程式碼。

#include
#include <imagehlp.h>
#pragma comment(lib,”imagehlp”)

{
char szFileName[] = “d:
ewupdate.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;
}

相關文章