From 666b0a49c02186145171f6aca7d0497fdcd0d04d Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Tue, 11 Feb 2020 23:34:03 -0700 Subject: [PATCH] tiny fixes --- GUI/main.cpp | 2 +- deploy.ps1 | 2 +- include/common.h | 3 ++- texthook/hookfinder.cc | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/GUI/main.cpp b/GUI/main.cpp index 184ddf2..9beb513 100644 --- a/GUI/main.cpp +++ b/GUI/main.cpp @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) char buffer[1000] = {}; WinHttpReceiveResponse(request, NULL); WinHttpReadData(request, buffer, 1000, DUMMY); - if (abs(strstr(buffer, "/tag/") - strstr(buffer, VERSION)) > 10) MESSAGE(UPDATE_AVAILABLE); + if (abs(strstr(buffer, "/tag/") - strstr(buffer, VERSION)) > 10) TEXTRACTOR_MESSAGE(UPDATE_AVAILABLE); } }).detach(); diff --git a/deploy.ps1 b/deploy.ps1 index b6ac233..8707e4e 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -80,5 +80,5 @@ mkdir -Force -Verbose "Textractor"; copy -Force -Recurse -Verbose -Destination "Textractor" -Path @("Runtime/*", "Textractor--$version/*"); cd .. -&"C:\Program Files (x86)\Inno Setup 6\iscc" -DVERSION="$version" installer.iss +&"C:\Program Files (x86)\Inno Setup 6\iscc" -DVERSION="$version" installer.iss; &"C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe" sign /a /v /t "http://timestamp.digicert.com" /fd SHA256 "Builds/Textractor-$version-Setup.exe"; diff --git a/include/common.h b/include/common.h index 014a579..dd4689e 100644 --- a/include/common.h +++ b/include/common.h @@ -113,7 +113,8 @@ inline std::wstring FormatString(const wchar_t* format, const Args&... args) } #pragma warning(pop) -#define MESSAGE(text) MessageBoxW(NULL, FormatArg(text), L"Textractor", MB_OK) +template +inline void TEXTRACTOR_MESSAGE(const wchar_t* format, const Args&... args) { MessageBoxW(NULL, FormatString(format, args...).c_str(), L"Textractor", MB_OK); } #ifdef _DEBUG #define TEST(...) static auto _ = CreateThread(nullptr, 0, [](auto) { __VA_ARGS__; return 0UL; }, NULL, 0, nullptr); diff --git a/texthook/hookfinder.cc b/texthook/hookfinder.cc index 0118114..2f757b8 100644 --- a/texthook/hookfinder.cc +++ b/texthook/hookfinder.cc @@ -232,10 +232,10 @@ void SearchForHooks(SearchParam spUser) Sleep(1000); for (auto addr : addresses) MH_RemoveHook((void*)addr); ConsoleOutput(HOOK_SEARCH_FINISHED, sp.maxRecords - recordsAvailable); - for (int i = 0, j = 0; i < sp.maxRecords; ++i) + for (int i = 0, results = 0; i < sp.maxRecords; ++i) { if (!records[i].address) continue; - if (++j % 100'000 == 0) ConsoleOutput("Textractor: %d results processed", j); + if (++results % 100'000 == 0) ConsoleOutput("Textractor: %d results processed", results); HookParam hp = {}; hp.offset = records[i].offset; hp.type = USING_UNICODE | USING_STRING;