mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-05 03:25:37 +08:00
27 lines
818 B
C++
27 lines
818 B
C++
#include"Footy2.h"
|
|
bool insertstrcpyhook() {
|
|
const BYTE bytes[] = {
|
|
0x3B,0xD8,0x72,0x45,0x83,0xF9,0x10,0x72,0x04,0x8B,0x16,0xEB,0x02
|
|
};
|
|
auto addrs = Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress);
|
|
const BYTE funcstart[] = {
|
|
0x55,0x8b,0xec,0x53,0x8b,0x5d,0x08
|
|
};
|
|
bool succ=false;
|
|
for (auto addr : addrs) {
|
|
addr = reverseFindBytes(funcstart, sizeof(funcstart), addr - 0x100, addr);
|
|
if (addr == 0)continue;
|
|
HookParam hp;
|
|
hp.address = addr;
|
|
hp.offset=get_stack(1);
|
|
hp.type = USING_STRING;
|
|
ConsoleOutput("strcpy %p", addr);
|
|
succ|=NewHook(hp, "strcpy");
|
|
}
|
|
return succ;
|
|
}
|
|
bool Footy2::attach_function() {
|
|
//ガールズ・ブック・メイカー -幸せのリブレット-
|
|
|
|
return insertstrcpyhook();
|
|
}
|