mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-23 22:05:36 +08:00
21 lines
595 B
C++
21 lines
595 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;
|
||
|
}
|