From 73246f7eea70cc4b69d23ef7e570c673f63fe840 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Fri, 15 Jun 2018 05:51:11 -0400 Subject: [PATCH] bugfixes --- vnr/ithsys/ithsys.cc | 5 ++- vnr/ithsys/ithsys.h | 1 - vnr/vnrhook/src/engine/match.cc | 73 +++++++++++++++++---------------- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/vnr/ithsys/ithsys.cc b/vnr/ithsys/ithsys.cc index d552598..4216967 100644 --- a/vnr/ithsys/ithsys.cc +++ b/vnr/ithsys/ithsys.cc @@ -81,13 +81,14 @@ BOOL IthIsWine() // jichi 9/28/2013: prevent parallelization in wine void IthCoolDown() { + return; // http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtDelayExecution.html //const LONGLONG timeout = -10000; // in 100ns, i.e. 1ms //NtDelayExecution(FALSE, (PLARGE_INTEGER)&timeout); //NtFlushInstructionCache(NtCurrentProcess(), (LPVOID)hp.addr, hp.recover_len); // Flush the instruction cache line, and prevent wine from rending things in parallel - if (IthIsWine()) - IthSleep(1); // sleep for 1 ms + //if (IthIsWine()) + // IthSleep(1); // sleep for 1 ms //__asm //{ // //mov eax,0x2710 // = 10000 diff --git a/vnr/ithsys/ithsys.h b/vnr/ithsys/ithsys.h index de28d0b..836060e 100644 --- a/vnr/ithsys/ithsys.h +++ b/vnr/ithsys/ithsys.h @@ -17,7 +17,6 @@ int FillRange(LPCWSTR name,DWORD *lower, DWORD *upper); DWORD SearchPattern(DWORD base, DWORD base_length, LPCVOID search, DWORD search_length); // KMP DWORD IthGetMemoryRange(LPCVOID mem, DWORD *base, DWORD *size); -BOOL IthGetFileInfo(LPCWSTR file, LPVOID info, DWORD size = 0x1000); DWORD GetExportAddress(DWORD hModule,DWORD hash); } // extern "C" diff --git a/vnr/vnrhook/src/engine/match.cc b/vnr/vnrhook/src/engine/match.cc index 52eb0f3..0e02246 100644 --- a/vnr/vnrhook/src/engine/match.cc +++ b/vnr/vnrhook/src/engine/match.cc @@ -544,41 +544,42 @@ bool DetermineEngineOther() } // jichi 8/24/2013: Move into functions - static BYTE static_file_info[0x1000]; - if (IthGetFileInfo(L"*01", static_file_info)) - if (*(DWORD*)static_file_info == 0) { - STATUS_INFO_LENGTH_MISMATCH; - static WCHAR static_search_name[MAX_PATH]; - LPWSTR name=(LPWSTR)(static_file_info+0x5E); - int len = wcslen(name); - name[len-2] = L'.'; - name[len-1] = L'e'; - name[len] = L'x'; - name[len+1] = L'e'; - name[len+2] = 0; - if (Util::CheckFile(name)) { - sizeof(FILE_BOTH_DIR_INFORMATION); - name[len-2] = L'*'; - name[len-1] = 0; - wcscpy(static_search_name,name); - IthGetFileInfo(static_search_name,static_file_info); - union { - FILE_BOTH_DIR_INFORMATION *both_info; - DWORD addr; - }; - both_info = (FILE_BOTH_DIR_INFORMATION *)static_file_info; - //BYTE* ptr=static_file_info; - len=0; - while (both_info->NextEntryOffset) { - addr += both_info->NextEntryOffset; - len++; - } - if (len > 3) { - InsertAbelHook(); - return true; - } - } - } + // Artikash 6/15/2018: Removed this detection for Abel Software games. IthGetFileInfo no longer works correctly + //static BYTE static_file_info[0x1000]; + //if (IthGetFileInfo(L"*01", static_file_info)) + // if (*(DWORD*)static_file_info == 0) { + // STATUS_INFO_LENGTH_MISMATCH; + // static WCHAR static_search_name[MAX_PATH]; + // LPWSTR name=(LPWSTR)(static_file_info+0x5E); + // int len = wcslen(name); + // name[len-2] = L'.'; + // name[len-1] = L'e'; + // name[len] = L'x'; + // name[len+1] = L'e'; + // name[len+2] = 0; + // if (Util::CheckFile(name)) { + // sizeof(FILE_BOTH_DIR_INFORMATION); + // name[len-2] = L'*'; + // name[len-1] = 0; + // wcscpy(static_search_name,name); + // IthGetFileInfo(static_search_name,static_file_info); + // union { + // FILE_BOTH_DIR_INFORMATION *both_info; + // DWORD addr; + // }; + // both_info = (FILE_BOTH_DIR_INFORMATION *)static_file_info; + // //BYTE* ptr=static_file_info; + // len=0; + // while (both_info->NextEntryOffset) { + // addr += both_info->NextEntryOffset; + // len++; + // } + // if (len > 3) { + // InsertAbelHook(); + // return true; + // } + // } + // } return false; } @@ -589,7 +590,7 @@ bool DetermineEngineAtLast() { if (Util::CheckFile(L"MovieTexture.dll") && (InsertPensilHook() || Insert2RMHook())) // MovieTexture.dll also exists in 2RM games such as 母子愛2体験版, which is checked first return true; - if (Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) { // jichi 7/31/2015 + if ((Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) || Util::CheckFile(L"*01")) { // jichi 7/31/2015 & Artikash 6/15/2018 InsertAbelHook(); return true; }