天天看点

实现程序完整性检验方法

#include <imagehlp.h>

#pragma comment(lib, "imagehlp.lib")

DWORD HeadChksum=1,Chksum=0;

char Fn[512];

GetModuleFileName(GetModuleHandle(NULL),Fn,512);

if(MapFileAndCheckSum(Fn,&HeadChksum,&Chksum)!=CHECKSUM_SUCCESS)

{

    MessageBox(NULL,"Check error!","Error",MB_OK);

}else{

    if(HeadChksum!=Chksum)

        MessageBox(NULL,"File changed.","Warning",MB_OK);

}

Release版有效

继续阅读