42 lines
1.3 KiB
C++
Raw Normal View History

2024-03-15 16:08:16 +08:00
#include"lucasystem.h"
2024-03-29 14:27:14 +08:00
2024-02-07 20:59:24 +08:00
bool IG64filter(void* data, size_t* size, HookParam*) {
auto text = reinterpret_cast<LPWSTR>(data);
std::wstring str =std::wstring(text,*size / 2);
std::wregex reg1(L"\\$\\[(.*?)\\$/(.*?)\\$\\]");
std::wstring result1 = std::regex_replace(str, reg1, L"$1");
std::wregex reg2(L"@[^@]*@");
std::wstring result2 = std::regex_replace(result1, reg2, L"");
2024-03-21 17:57:04 +08:00
write_string_overwrite(text,size,result2);
2024-02-07 20:59:24 +08:00
return true;
};
2024-03-29 14:27:14 +08:00
bool InsertIG64Hook2() {
2024-02-07 20:59:24 +08:00
const BYTE BYTES[] = {
0xBA,0x3F,0xFF,0x00,0x00,
XX,0x8B,XX,
0xE8,XX2,0x00,0x00
};
bool ok=false;
auto addrs = Util::SearchMemory(BYTES, sizeof(BYTES), PAGE_EXECUTE, processStartAddress, processStopAddress);
for (auto addr : addrs) {
ConsoleOutput("IG642 %p", addr);
const BYTE aligned[] = { 0xCC,0xCC };
addr = reverseFindBytes(aligned, sizeof(aligned), addr - 0x10000, addr);
if (addr == 0)continue;
addr += 2;
ConsoleOutput("IG642 %p", addr);
HookParam hp;
hp.address = addr;
2024-03-03 21:12:15 +08:00
hp.type = CODEC_UTF16 | USING_STRING |EMBED_ABLE|EMBED_BEFORE_SIMPLE|EMBED_AFTER_NEW;//可以内嵌英文
2024-02-07 20:59:24 +08:00
hp.filter_fun = IG64filter;
hp.offset=get_reg(regs::rdx);//rdx
ok|=NewHook(hp, "IG642");
}
return ok;
2024-03-29 14:27:14 +08:00
}
2024-03-15 16:08:16 +08:00
bool lucasystem::attach_function() {
2024-03-29 14:27:14 +08:00
return InsertIG64Hook2();
2024-02-07 20:59:24 +08:00
}