This commit is contained in:
恍兮惚兮 2024-12-02 21:18:29 +08:00
parent 7f1cc7cad6
commit b7c173fb47
2 changed files with 100 additions and 52 deletions

View File

@ -14,7 +14,8 @@ bool bishopmbcjmstojis()
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress); auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (!addr) return false; if (!addr)
return false;
HookParam hp; HookParam hp;
hp.address = addr; hp.address = addr;
@ -23,33 +24,70 @@ bool bishopmbcjmstojis()
return NewHook(hp, "bishop"); return NewHook(hp, "bishop");
} }
bool Bishop::attach_function() { bool Bishop::attach_function()
{
return bishopmbcjmstojis(); return bishopmbcjmstojis();
} }
bool embedbishop()
{
// 黒の教室
const BYTE bytes[] = {
0x53,
0x8b, 0x5c, 0x24, 0x0c,
0x56,
0x8b, 0xf7,
0xe8, XX4,
0xd9, 0xee,
0xdd, 0x9f, XX4,
0x8b, 0xc3,
0xdb, 0x44, 0x24, 0x0c,
0x8d, 0x50, 0x02,
0xdd, 0x9f, XX4,
0x66, 0x8b, 0x08,
0x83, 0xc0, 0x02,
0x66, 0x85, 0xc9};
bool Bishop2::attach_function(){ auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (!addr)
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(2);
hp.type = USING_STRING | CODEC_UTF16 | EMBED_ABLE | EMBED_AFTER_NEW;
hp.embed_hook_font = F_GetGlyphOutlineW;
hp.lineSeparator = L"\\n";
return NewHook(hp, "bishop");
}
bool Bishop2attach_function()
{
// 三射面談~連鎖する恥辱・調教の学園~ // 三射面談~連鎖する恥辱・調教の学園~
// 特別授業3SLG // 特別授業3SLG
auto entry = Util::FindImportEntry(processStartAddress, (DWORD)GetGlyphOutlineW); auto entry = Util::FindImportEntry(processStartAddress, (DWORD)GetGlyphOutlineW);
if(entry==0)return false; if (entry == 0)
return false;
bool ok = false; bool ok = false;
for(auto addr:Util::SearchMemory(&entry, 4, PAGE_EXECUTE, processStartAddress, processStopAddress)){ for (auto addr : Util::SearchMemory(&entry, 4, PAGE_EXECUTE, processStartAddress, processStopAddress))
{
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr)
continue;
auto xrefs = findxref_reverse_checkcallop(addr, max(processStartAddress, addr - 0x100000), min(processStopAddress, addr + 0x100000), 0xe8); auto xrefs = findxref_reverse_checkcallop(addr, max(processStartAddress, addr - 0x100000), min(processStopAddress, addr + 0x100000), 0xe8);
for(auto addrx:xrefs){ for (auto addrx : xrefs)
{
// ConsoleOutput("xref %p",addrx); // ConsoleOutput("xref %p",addrx);
const BYTE aligned[] = {0xCC, 0xCC}; const BYTE aligned[] = {0xCC, 0xCC};
auto addrx1 = reverseFindBytes(aligned, sizeof(aligned), addrx - 0x200, addrx); auto addrx1 = reverseFindBytes(aligned, sizeof(aligned), addrx - 0x200, addrx);
// ConsoleOutput("Aligned %p",addrx1); // ConsoleOutput("Aligned %p",addrx1);
if (!addrx1) continue; if (!addrx1)
continue;
addrx1 += 2; addrx1 += 2;
BYTE __1[] = {0xDC, 0x0D, XX, XX, XX, 0x00}; BYTE __1[] = {0xDC, 0x0D, XX, XX, XX, 0x00};
auto _1 = MemDbg::findBytes(__1, 6, addrx - 0x30, addrx); auto _1 = MemDbg::findBytes(__1, 6, addrx - 0x30, addrx);
// ConsoleOutput("sig %p",_1); // ConsoleOutput("sig %p",_1);
if(_1==0 )continue; if (_1 == 0)
continue;
BYTE checkthiscall[] = {0x8B, 0xF9}; // mov edi, ecx BYTE checkthiscall[] = {0x8B, 0xF9}; // mov edi, ecx
auto _3 = MemDbg::findBytes(checkthiscall, 2, addrx1, addrx); auto _3 = MemDbg::findBytes(checkthiscall, 2, addrx1, addrx);
HookParam hp; HookParam hp;
@ -65,3 +103,8 @@ bool Bishop2::attach_function(){
} }
return ok; return ok;
} }
bool Bishop2::attach_function()
{
return Bishop2attach_function() | embedbishop();
}

View File

@ -137,6 +137,11 @@ namespace
case HOST_NOTIFICATION_RMVHOOK: case HOST_NOTIFICATION_RMVHOOK:
{ {
auto info = *(HookRemovedNotif*)buffer; auto info = *(HookRemovedNotif*)buffer;
auto sm = Host::GetCommonSharedMem(processId);
if (sm)
for (int i = 0; i < ARRAYSIZE(sm->embedtps); i++)
if (sm->embedtps[i].use && (sm->embedtps[i].tp.addr==info.address)&&(sm->embedtps[i].tp.processId==processId))
ZeroMemory(sm->embedtps + i, sizeof(sm->embedtps[i]));
RemoveThreads([&](ThreadParam tp) { return tp.processId == processId && tp.addr == info.address; }); RemoveThreads([&](ThreadParam tp) { return tp.processId == processId && tp.addr == info.address; });
} }
break; break;