From 58d90aef00ae307dd68ab4f2e6f34e94aef46bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 27 May 2024 14:54:59 +0800 Subject: [PATCH] issues/44 --- LunaHook/engine32/CoffeeMaker.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/LunaHook/engine32/CoffeeMaker.cpp b/LunaHook/engine32/CoffeeMaker.cpp index 24cd927..7e6457e 100644 --- a/LunaHook/engine32/CoffeeMaker.cpp +++ b/LunaHook/engine32/CoffeeMaker.cpp @@ -1,6 +1,6 @@ #include "CoffeeMaker.h" -bool CoffeeMaker::attach_function() +bool CoffeeMaker_attach_function() { // https://vndb.org/v4025 // こころナビ @@ -39,4 +39,33 @@ bool CoffeeMaker::attach_function() }; return NewHook(hp, "CoffeeMaker"); +} + +bool CoffeeMaker_attach_function2() +{ + // https://vndb.org/v4025 + // こころナビ + const BYTE bytes[] = { + 0x55,0x8B,0xEC,0x57,0x56,0x8B,0x75,0x0C,0x8B,0x4D,0x10,0x8B,0x7D,0x08,0x8B,0xC1, + 0x8B,0xD1,0x03,0xC6,0x3B,0xFE,0x76,0x08,0x3B,0xF8,0x0F,0x82,XX4, + 0xF7,0xC7,0x03,0x00,0x00,0x00,0x75,XX,0xC1,0xE9,0x02,0x83,0xE2,0x03,0x83,0xF9,0x08 + }; + auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress); + if (!addr) + return false; + HookParam hp; + hp.address = addr; + hp.offset=get_stack(1);//get_reg(regs::ecx);//void *__cdecl memcpy(void *a1, const void *Src, size_t Size) + hp.type = USING_STRING; + hp.filter_fun=[](void* data, size_t* len, HookParam* hp){ + auto s=std::string((char*)data,*len); + strReplace(s,R"(\w\w\w)",""); + return write_string_overwrite(data,len,s); + }; + return NewHook(hp, "CoffeeMaker"); +} + +bool CoffeeMaker::attach_function() +{ + return CoffeeMaker_attach_function2()||CoffeeMaker_attach_function(); } \ No newline at end of file