From e7fff79f8fee9ca829cdef77938f713ab03b6547 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 13 Jun 2019 03:19:08 -0400 Subject: [PATCH] XX = 0x11 is officially the wildcard --- GUI/mainwindow.cpp | 4 ++-- include/const.h | 3 ++- texthook/engine/engine.cc | 1 - texthook/util/ithsys/ithsys.cc | 3 ++- texthook/util/util.cc | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 5e124fe..3833839 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -270,7 +270,7 @@ void MainWindow::LaunchProcess() std::wstring path = std::wstring(process).erase(process.rfind(L'\\')); PROCESS_INFORMATION info = {}; - if (QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes) + if (!x64 && QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes) { if (HMODULE localeEmulator = LoadLibraryOnce(L"LoaderDll")) { @@ -405,7 +405,7 @@ void MainWindow::FindHooks() connect(save, &QPushButton::clicked, this, &QDialog::accept); connect(save, &QPushButton::clicked, [this, patternInput, filterInput] { - QByteArray pattern = QByteArray::fromHex(patternInput->text().replace("??", "11").toUtf8()); + QByteArray pattern = QByteArray::fromHex(patternInput->text().replace("??", QString::number(XX, 16)).toUtf8()); if (pattern.size() < 3) return; std::wregex filter(L"."); if (!filterInput->text().isEmpty()) try { filter = std::wregex(S(filterInput->text())); } catch (std::regex_error) {}; diff --git a/include/const.h b/include/const.h index 16fc358..1c795ea 100644 --- a/include/const.h +++ b/include/const.h @@ -4,7 +4,8 @@ // 8/23/2013 jichi // Branch: ITH/common.h, rev 128 -enum Misc { STRING = 12, MESSAGE_SIZE = 500, PIPE_BUFFER_SIZE = 2000, SHIFT_JIS = 932, MAX_MODULE_SIZE = 120, HOOK_NAME_SIZE = 30, FIXED_SPLIT_VALUE = 0x10001 }; +enum { STRING = 12, MESSAGE_SIZE = 500, PIPE_BUFFER_SIZE = 2000, SHIFT_JIS = 932, MAX_MODULE_SIZE = 120, HOOK_NAME_SIZE = 30, FIXED_SPLIT_VALUE = 0x10001 }; +enum WildcardByte { XX = 0x11 }; enum HostCommandType { HOST_COMMAND_NEW_HOOK, HOST_COMMAND_REMOVE_HOOK, HOST_COMMAND_FIND_HOOK, HOST_COMMAND_MODIFY_HOOK, HOST_COMMAND_HIJACK_PROCESS, HOST_COMMAND_DETACH }; diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index 49f4e20..1591933 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -95,7 +95,6 @@ enum : DWORD { //, step = 0x00010000 // crash otoboku PSP on 0.9.9 since 5pb is wrongly inserted }; -enum : BYTE { XX = 0x11 }; // 0x11 #define XX2 XX,XX // WORD #define XX4 XX2,XX2 // DWORD #define XX8 XX4,XX4 // QWORD diff --git a/texthook/util/ithsys/ithsys.cc b/texthook/util/ithsys/ithsys.cc index 8c3daf4..8a2cdf2 100644 --- a/texthook/util/ithsys/ithsys.cc +++ b/texthook/util/ithsys/ithsys.cc @@ -7,6 +7,7 @@ // - Move my old create remote thread for ITH2 here #include "ithsys/ithsys.h" +#include "const.h" // - Global variables - @@ -51,7 +52,7 @@ DWORD SearchPattern(DWORD base, DWORD base_length, LPCVOID search, DWORD search_ for (int i = 0; i < base_length - search_length; ++i) for (int j = 0; j <= search_length; ++j) if (j == search_length) return i; // not sure about this algorithm... - else if (*((BYTE*)base + i + j) != *((BYTE*)search + j) && *((BYTE*)search + j) != 0x11) break; // 0x11 = wildcard + else if (*((BYTE*)base + i + j) != *((BYTE*)search + j) && *((BYTE*)search + j) != XX) break; //if (memcmp((void*)(base + i), search, search_length) == 0) //return i; diff --git a/texthook/util/util.cc b/texthook/util/util.cc index f569fe9..7f344af 100644 --- a/texthook/util/util.cc +++ b/texthook/util/util.cc @@ -31,7 +31,7 @@ uint64_t SafeSearchMemory(uint64_t startAddr, uint64_t endAddr, const BYTE* byte for (int i = 0; i < endAddr - startAddr - length; ++i) for (int j = 0; j <= length; ++j) if (j == length) return startAddr + i; // not sure about this algorithm... - else if (*((BYTE*)startAddr + i + j) != *(bytes + j) && *(bytes + j) != 0x11) break; // 0x11 = wildcard + else if (*((BYTE*)startAddr + i + j) != *(bytes + j) && *(bytes + j) != XX) break; } __except (EXCEPTION_EXECUTE_HANDLER) {