LunaHook-mirror/LunaHook/engine64/YOX.cpp
恍兮惚兮 163835bec9 some
2024-10-04 14:37:06 +08:00

22 lines
606 B
C++

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