LunaHook-mirror/LunaHook/engine32/Troy.cpp
2024-02-07 20:59:24 +08:00

24 lines
656 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include"Troy.h"
bool Troy::attach_function() {
//Reverse desire裏返る欲望
auto dll=GetModuleHandleW(L"sfe.dll");
if(dll==0)return false;
auto [minaddr,maxaddr]=Util::QueryModuleLimits(dll);
BYTE bytes[] = {
0x3C,0x82,
XX2,
0x80,0xFB,0x9F,
XX2,
0x80,0xFB,0xF1
};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), minaddr, maxaddr);
if (addr == 0)return false;
addr=MemDbg::findEnclosingAlignedFunction(addr);
if (addr == 0)return false;
HookParam hp;
hp.address = addr;
hp.offset=get_stack(2);
hp.type = CODEC_ANSI_BE;
return NewHook(hp, "Troy");
}