LunaHook-mirror/LunaHook/engine32/Jisatu101.cpp

27 lines
692 B
C++
Raw Normal View History

2024-02-07 20:59:24 +08:00
#include"Jisatu101.h"
bool Jisatu101::attach_function() {
const BYTE bytes[] = {
//ジサツのための101の方法
//https://vndb.org/v6475
0x8b,0x44,0x24,0x10,
0x66,0x0f,0xb6,0x08,
0x66,0x0f,0xb6,0x50,0x01,
0xC1 ,0xE1 ,0x08 ,
0x03 ,0xCA,
0x66 ,0x81 ,0xF9 ,0x0A ,0x0D ,
0x74
};
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (addr == 0)return false;
addr = MemDbg::findEnclosingAlignedFunction(addr,0x100);
if (addr == 0)return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(4);
hp.type = DATA_INDIRECT;
hp.index = 0;
return NewHook(hp, "Jisatu101");
}