LunaHook-mirror/LunaHook/engine64/Suika2.cpp

21 lines
482 B
C++
Raw Normal View History

2024-10-03 14:53:59 +08:00
#include "Suika2.h"
bool Suika2_msvcrt()
{
auto msvcrt = GetModuleHandle(L"msvcrt.dll");
if (msvcrt == 0)
return 0;
auto _strdup = GetProcAddress(msvcrt, "_strdup");
if (_strdup == 0)
return 0;
2024-02-07 20:59:24 +08:00
HookParam hp;
2024-10-03 14:53:59 +08:00
hp.address = (uintptr_t)_strdup;
hp.type = USING_STRING | CODEC_UTF8;
hp.offset = get_reg(regs::rcx);
return NewHook(hp, "Suika2_msvcrt");
}
bool Suika2::attach_function()
{
auto _1 = Suika2_msvcrt();
return _1;
2024-02-07 20:59:24 +08:00
}