WillPlus6 engine hooks
This commit is contained in:
parent
6a5c794289
commit
14c44ac964
@ -9628,11 +9628,14 @@ static bool InsertNewWillPlusHook()
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WillPlus4Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
bool WillPlusWFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
||||||
{
|
{
|
||||||
auto text = reinterpret_cast<LPWSTR>(data);
|
auto text = reinterpret_cast<LPWSTR>(data);
|
||||||
auto len = reinterpret_cast<size_t *>(size);
|
auto len = reinterpret_cast<size_t *>(size);
|
||||||
|
|
||||||
|
if (*text == L'/' || *text == L'|')
|
||||||
|
return false;
|
||||||
|
|
||||||
WideStringCharReplacer(text, len, L" \\n", 3, L' ');
|
WideStringCharReplacer(text, len, L" \\n", 3, L' ');
|
||||||
WideStringCharReplacer(text, len, L"\\n", 2, L' ');
|
WideStringCharReplacer(text, len, L"\\n", 2, L' ');
|
||||||
WideStringCharReplacer(text, len, L"\\d", 2, L'\"');
|
WideStringCharReplacer(text, len, L"\\d", 2, L'\"');
|
||||||
@ -9640,6 +9643,8 @@ bool WillPlus4Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
|||||||
WideStringFilter(text, len, L"%LC", 3);
|
WideStringFilter(text, len, L"%LC", 3);
|
||||||
WideStringFilter(text, len, L"%K", 2);
|
WideStringFilter(text, len, L"%K", 2);
|
||||||
WideStringFilter(text, len, L"%P", 2);
|
WideStringFilter(text, len, L"%P", 2);
|
||||||
|
WideStringFilter(text, len, L"%XS", 5); // remove %XS followed by 2 chars
|
||||||
|
WideStringFilter(text, len, L"%XE", 3);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -9668,7 +9673,7 @@ static bool InsertWillPlus4()
|
|||||||
hp.address = addr;
|
hp.address = addr;
|
||||||
hp.offset = pusha_edi_off -4;
|
hp.offset = pusha_edi_off -4;
|
||||||
hp.type = USING_UNICODE | USING_STRING;
|
hp.type = USING_UNICODE | USING_STRING;
|
||||||
hp.filter_fun = WillPlus4Filter;
|
hp.filter_fun = WillPlusWFilter;
|
||||||
ConsoleOutput("vnreng: INSERT WillPlus4");
|
ConsoleOutput("vnreng: INSERT WillPlus4");
|
||||||
NewHook(hp, "WillPlus4");
|
NewHook(hp, "WillPlus4");
|
||||||
return true;
|
return true;
|
||||||
@ -9702,12 +9707,57 @@ static bool InsertWillPlus5()
|
|||||||
hp.split = pusha_ebx_off -4;
|
hp.split = pusha_ebx_off -4;
|
||||||
hp.split_index = 0;
|
hp.split_index = 0;
|
||||||
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT | USING_SPLIT;
|
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT | USING_SPLIT;
|
||||||
hp.filter_fun = WillPlus4Filter;
|
hp.filter_fun = WillPlusWFilter;
|
||||||
ConsoleOutput("vnreng: INSERT WillPlus5");
|
ConsoleOutput("vnreng: INSERT WillPlus5");
|
||||||
NewHook(hp, "WillPlus5");
|
NewHook(hp, "WillPlus5");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool InsertWillPlus6()
|
||||||
|
{
|
||||||
|
//by Blu3train
|
||||||
|
/*
|
||||||
|
* Sample games:
|
||||||
|
* https://vndb.org/v47136
|
||||||
|
*/
|
||||||
|
const BYTE bytes[] = {
|
||||||
|
0xCC, // int 3
|
||||||
|
0x53, // push ebx <-- hook here
|
||||||
|
0x8B, 0xDC, // mov ebx,esp
|
||||||
|
0x83, 0xEC, 0x08, // sub esp,08
|
||||||
|
0x83, 0xE4, 0xF8, // and esp,-08
|
||||||
|
0x83, 0xC4, 0x04, // add esp,04
|
||||||
|
0x55, // push ebp
|
||||||
|
0x8B, 0x6B, 0x04, // mov ebp,[ebx+04]
|
||||||
|
0x89, 0x6C, 0x24, 0x04, // mov [esp+04],ebp
|
||||||
|
0x8B, 0xEC, // mov ebp,esp
|
||||||
|
0x6A, 0xFF, // push -01
|
||||||
|
0x68, XX4, // push AdvHD.exe+1965B0
|
||||||
|
0x64, 0xA1, 0x00, 0x00, 0x00, 0x00, // mov eax,fs:[00000000]
|
||||||
|
0x50, // push eax
|
||||||
|
0x53, // push ebx
|
||||||
|
0x81, 0xEC, 0x28, 0x01, 0x00, 0x00 // sub esp,00000128
|
||||||
|
};
|
||||||
|
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
|
||||||
|
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
|
||||||
|
if (!addr) {
|
||||||
|
ConsoleOutput("vnreng:WillPlus6: pattern not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HookParam hp = {};
|
||||||
|
hp.address = addr + 1;
|
||||||
|
hp.offset = pusha_esi_off -4;
|
||||||
|
hp.index = 0;
|
||||||
|
hp.split = pusha_ebx_off -4;
|
||||||
|
hp.split_index = 0;
|
||||||
|
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT | USING_SPLIT;
|
||||||
|
hp.filter_fun = WillPlusWFilter;
|
||||||
|
ConsoleOutput("vnreng: INSERT WillPlus6");
|
||||||
|
NewHook(hp, "WillPlus6");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
bool InsertWillPlusHook()
|
bool InsertWillPlusHook()
|
||||||
@ -9715,6 +9765,7 @@ bool InsertWillPlusHook()
|
|||||||
bool ok = InsertOldWillPlusHook();
|
bool ok = InsertOldWillPlusHook();
|
||||||
ok = InsertWillPlus4() || ok;
|
ok = InsertWillPlus4() || ok;
|
||||||
ok = InsertWillPlus5() || ok;
|
ok = InsertWillPlus5() || ok;
|
||||||
|
ok = InsertWillPlus6() || ok;
|
||||||
ok = InsertWillPlusWHook() || InsertWillPlusAHook() || ok;
|
ok = InsertWillPlusWHook() || InsertWillPlusAHook() || ok;
|
||||||
ok = InsertNewWillPlusHook() || ok;
|
ok = InsertNewWillPlusHook() || ok;
|
||||||
if (!ok) PcHooks::hookOtherPcFunctions();
|
if (!ok) PcHooks::hookOtherPcFunctions();
|
||||||
|
Loading…
Reference in New Issue
Block a user