LunaHook-mirror/LunaHook/engine64/YOX.cpp

22 lines
606 B
C++
Raw Normal View History

2024-10-03 14:53:59 +08:00
#include "YOX.h"
2024-02-07 20:59:24 +08:00
bool YOX::attach_function()
{
const BYTE BYTES[] = {
2024-10-03 14:53:59 +08:00
0x48, 0x8B, 0x0F,
0x48, 0x8d, 0x54, 0x24, 0x50};
2024-02-07 20:59:24 +08:00
auto addrs = Util::SearchMemory(BYTES, sizeof(BYTES), PAGE_EXECUTE_READ, processStartAddress, processStopAddress);
ConsoleOutput("%p %p", processStartAddress, processStopAddress);
2024-10-03 14:53:59 +08:00
for (auto addr : addrs)
{
if (addr == 0)
continue;
2024-02-07 20:59:24 +08:00
HookParam hp;
hp.address = addr;
2024-10-03 14:53:59 +08:00
hp.type = USING_STRING;
2024-02-07 20:59:24 +08:00
hp.offset = get_stack(26);
ConsoleOutput("yox64 %p", addr);
return NewHook(hp, "yox64");
}
ConsoleOutput("yox64 failed");
return false;
2024-10-03 14:53:59 +08:00
}