我在同一个地址进行hook 为什么用ce的自动汇编写进去没有问题 用我的程序写进去就会秒速崩掉呢?
以下是CE代码:
alloc(newmem,2048) //2kb should be enough
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
originalcode:
mov eax,[Daybreak.bin+39A3C4]
exit:
jmp 41b5dd
"Daybreak.bin"+1B5D8:
jmp newmem
//我只是单纯的hook过去啥事也没做 原代码跳回来的 游戏没有崩盘
下面是我的dll的写法
__declspec(naked) __cdecl AutoGo()
{
_asm
{
mov eax,[0x79A3C4]
jmp exit1
}
}//这是hook的代码
//下面是写入hook
void Hook()
{
AfxMessageBox("start to hook");
LPVOID MessDayBase=(LPVOID)0x400100;
LPVOID MessDayBase1=(LPVOID)0x400101;
DWORD MainID;
DWORD pd_oldproc;
HANDLE proHan;
HWND GameHwnd;
char ch_gameName[20];
CString cs_dlln;
CString cs_gameID;
char ch_gameID[20];
DWORD GameID;
int ini_dlln;
int ini_calldll;
int ini_gameID;
int dlldec;//设置计次数
char ch_dlln[20];//配置项里的一共注入多少Dlll了
char ch_calldll[4];//配置项里的游戏是否已经注入CallDll
char ch_pit[20];
LPVOID jump=(LPVOID)0xE9;
LPDWORD returnWri;
DWORD autogobase;
LPVOID MessDayBase_1;
//写HOOK
//GameHwnd=FindWindow(NULL,"巧克力1");
//GameID=GetWindowThreadProcessId(GameHwnd,NULL);
//proHan=OpenProcess(PROCESS_ALL_ACCESS,false,GameID);
byte a[1]={0xe9};
PWORD s=(PWORD)(0x0041b5d8);
PWORD s1=(PWORD)(0x0041b5d9);
//PWORD s=(PWORD)(0x00400100);
//PWORD s1=(PWORD)(0x00400101);
VirtualProtect(MessDayBase,1,64,&pd_oldproc);
memcpy(s,&a,1);
autogobase=(DWORD)((DWORD)&AutoGo-(DWORD)MessDayBase1-4);
memcpy(s1,&autogobase,4);
VirtualProtect(MessDayBase,1,pd_oldproc,&pd_oldproc);
AfxMessageBox("1");
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)