资源介绍
直接代码
#include "GuardMemDll.h"
#pragma comment (lib, "GuardMemDll.lib")
int Test( int iTest)
{
if(0 == iTest )
MessageBox(NULL,"Mem Is Modified","",MB_OK);
else
MessageBox(NULL,"Mem is Ok","",MB_OK);
return iTest;
}
int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
int iTest=1;
CHostAssist assist;
Test( iTest );
int iStat= assist.GuardMemDll( hInstance);
if(1024 == iStat )
MessageBox(NULL,"Mem check ok","",MB_OK);
else
MessageBox(NULL,"Mem check false","",MB_OK);
DWORD iWrite=0;
char iData[]={0x90,0x90};
DWORD_PTR iPtr =(DWORD_PTR) hInstance + 0x2d6f0;
void *pAdr = (void *)(iPtr + 0x22);
WriteProcessMemory(GetCurrentProcess(), pAdr, iData, 2, &iWrite);
Test( iTest );
int iStat1= assist.GuardMemDll( hInstance );
if(1024 == iStat1 )
MessageBox(NULL,"Mem check ok","",MB_OK);
else
MessageBox(NULL,"Mem check false","",MB_OK);
return iStat;
}