restore shinario hook

This commit is contained in:
Akash Mozumdar 2022-08-08 23:13:21 -04:00
parent 5eb0440f01
commit 39fcfaf644

View File

@ -5730,21 +5730,21 @@ void SpecialHookShina2(DWORD esp_base, HookParam *, BYTE, DWORD *data, DWORD *sp
// Used to merge correct text thread. // Used to merge correct text thread.
// 1. Only keep threads with 0 and -1 split // 1. Only keep threads with 0 and -1 split
// 2. Skip the thread withb 0 split and with minimum return address // 2. Skip the thread withb 0 split and with minimum return address
void SpecialHookShina1(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len) //void SpecialHookShina1(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
{ //{
static DWORD min_retaddr = -1; // static DWORD min_retaddr = -1;
DWORD s = *(DWORD *)(esp_base + hp->split); // DWORD s = *(DWORD *)(esp_base + hp->split);
if (s == 0 || (s & 0xffff) == 0xffff) { // only keep threads with 0 and -1 split // if (s == 0 || (s & 0xffff) == 0xffff) { // only keep threads with 0 and -1 split
if (s == 0 && retof(esp_base) <= min_retaddr) { // if (s == 0 && retof(esp_base) <= min_retaddr) {
min_retaddr = retof(esp_base); // min_retaddr = retof(esp_base);
return; // return;
} // }
*split = FIXED_SPLIT_VALUE; // *split = FIXED_SPLIT_VALUE;
// Follow the same logic as the hook. // // Follow the same logic as the hook.
*data = *(DWORD *)*data; // DATA_INDIRECT // *data = *(DWORD *)*data; // DATA_INDIRECT
*len = LeadByteTable[*data & 0xff]; // *len = LeadByteTable[*data & 0xff];
} // }
} //}
// jichi 8/27/2013 // jichi 8/27/2013
// Return ShinaRio version number // Return ShinaRio version number
@ -5825,9 +5825,8 @@ bool InsertShinaHook()
return ret; return ret;
}; };
ConsoleOutput("Textractor: ShinaRio 2.50+: adding trigger"); ConsoleOutput("Textractor: ShinaRio 2.50+: adding trigger");
return true;
} }
else if (ver >= 48) { // v2.48, v2.49 if (ver >= 48) { // v2.48, v2.49
HookParam hp = {}; HookParam hp = {};
hp.address = (DWORD)::GetTextExtentPoint32A; hp.address = (DWORD)::GetTextExtentPoint32A;
hp.text_fun = SpecialHookShina2; hp.text_fun = SpecialHookShina2;