fix error spam

This commit is contained in:
Akash Mozumdar 2018-12-26 13:07:59 -05:00
parent 978bf2a6b8
commit 4ce7425034
3 changed files with 8 additions and 21 deletions

View File

@ -4502,7 +4502,6 @@ bool InsertRUGP1Hook()
*/ */
bool InsertRUGP2Hook() bool InsertRUGP2Hook()
{ {
DWORD low, high;
if (!Util::CheckFile(L"vm60.dll") /*|| !SafeFillRange(L"vm60.dll", &low, &high)*/) { if (!Util::CheckFile(L"vm60.dll") /*|| !SafeFillRange(L"vm60.dll", &low, &high)*/) {
ConsoleOutput("vnreng:rUGP2: vm60.dll does not exist"); ConsoleOutput("vnreng:rUGP2: vm60.dll does not exist");
return false; return false;
@ -8814,7 +8813,6 @@ bool InsertIGSDynamicHook(LPVOID addr, DWORD frame, DWORD stack)
DWORD i; DWORD i;
i = *(DWORD *)frame; i = *(DWORD *)frame;
i = *(DWORD *)(i+4); i = *(DWORD *)(i+4);
DWORD j, k;
//if (SafeFillRange(L"mscorlib.ni.dll", &j, &k)) { // Artikash 6/30/2018: Dunno why addresses are needed //if (SafeFillRange(L"mscorlib.ni.dll", &j, &k)) { // Artikash 6/30/2018: Dunno why addresses are needed
while (*(BYTE *)i != 0xe8) while (*(BYTE *)i != 0xe8)
i++; i++;
@ -16280,12 +16278,6 @@ bool InsertAIRNovelHook()
hp.split = 0x4; hp.split = 0x4;
hp.index = 0x8; hp.index = 0x8;
hp.split_index = 0x4; hp.split_index = 0x4;
hp.text_fun = [](DWORD stack, auto, auto, DWORD* data, auto, DWORD* count)
{
DWORD string = *(DWORD*)(stack + 4);
*data = IsBadReadPtr((void*)string, 1) ? 0 : *(DWORD*)(string + 8);
*count = IsBadReadPtr((void*)*data, 1) ? 0 : wcslen((wchar_t*)*data) * 2;
};
//hp.filter_fun = [](void* str, DWORD* len, HookParam* hp, BYTE index) // removes some of the garbage threads //hp.filter_fun = [](void* str, DWORD* len, HookParam* hp, BYTE index) // removes some of the garbage threads
//{ //{
// return *len < 4 && // return *len < 4 &&

View File

@ -111,11 +111,11 @@ bool TextHook::Insert(HookParam h, DWORD set_flag)
// jichi 5/11/2014: // jichi 5/11/2014:
// - dwDataBase: the stack address // - dwDataBase: the stack address
#ifndef _WIN64
void TextHook::Send(uintptr_t dwDataBase) void TextHook::Send(uintptr_t dwDataBase)
{ {
__try __try
{ {
#ifndef _WIN64
DWORD dwCount = 0, DWORD dwCount = 0,
dwSplit = 0, dwSplit = 0,
dwDataIn = *(DWORD*)(dwDataBase + hp.offset), // default values dwDataIn = *(DWORD*)(dwDataBase + hp.offset), // default values
@ -156,17 +156,7 @@ void TextHook::Send(uintptr_t dwDataBase)
if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) dwRetn = 0; if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) dwRetn = 0;
TextOutput({ GetCurrentProcessId(), address, dwRetn, dwSplit }, pbData, dwCount); TextOutput({ GetCurrentProcessId(), address, dwRetn, dwSplit }, pbData, dwCount);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
ConsoleOutput("Textractor: Send ERROR (likely an incorrect H-code)");
}
}
#else // _WIN32 #else // _WIN32
void TextHook::Send(uintptr_t dwDataBase)
{
__try
{
int count = 0; int count = 0;
ThreadParam tp = { GetCurrentProcessId(), address, *(uintptr_t*)dwDataBase, 0 }; // first value on stack (if hooked start of function, this is return address) ThreadParam tp = { GetCurrentProcessId(), address, *(uintptr_t*)dwDataBase, 0 }; // first value on stack (if hooked start of function, this is return address)
uintptr_t data = *(uintptr_t*)(dwDataBase + hp.offset); // default value uintptr_t data = *(uintptr_t*)(dwDataBase + hp.offset); // default value
@ -193,13 +183,17 @@ void TextHook::Send(uintptr_t dwDataBase)
if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) tp.ctx = 0; if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) tp.ctx = 0;
TextOutput(tp, pbData, count); TextOutput(tp, pbData, count);
#endif // _WIN64
} }
__except (EXCEPTION_EXECUTE_HANDLER) __except (EXCEPTION_EXECUTE_HANDLER)
{
if (!err)
{ {
ConsoleOutput("Textractor: Send ERROR (likely an incorrect H-code)"); ConsoleOutput("Textractor: Send ERROR (likely an incorrect H-code)");
err = true;
}
} }
} }
#endif // _WIN64
bool TextHook::InsertHookCode() bool TextHook::InsertHookCode()
{ {

View File

@ -38,6 +38,7 @@ private:
void RemoveReadCode(); void RemoveReadCode();
HANDLE readerThread, readerEvent; HANDLE readerThread, readerEvent;
bool err;
BYTE trampoline[130]; BYTE trampoline[130];
}; };