LunaHook-mirror/LunaHook/engine32/Stronger.cpp

31 lines
871 B
C++
Raw Normal View History

2024-09-13 09:23:39 +08:00
#include "Stronger.h"
namespace
{
// https://vndb.org/v1334
// Pygmalion ~The Dark Romance~
bool h1()
{
auto addr = findiatcallormov((DWORD)GetGlyphOutlineA, processStartAddress, processStartAddress, processStopAddress, false, 0x3d); // mov edi, ds:GetGlyphOutlineA
if (!addr)
return false;
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return false;
auto addrs = findxref_reverse_checkcallop(addr, processStartAddress, processStopAddress, 0xe8);
if (addrs.size() != 1)
return false;
addr = addrs[0];
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.type = DATA_INDIRECT | USING_CHAR;
return NewHook(hp, "Stronger");
}
}
bool Stronger::attach_function()
{
return h1();
}