From 902ded684dc53976a0314f47fba6440b14864e06 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 19 Nov 2018 08:17:00 -0500 Subject: [PATCH] small fixes --- GUI/host/host.cc | 10 ++-------- GUI/mainwindow.cpp | 2 +- include/text.h | 9 ++++++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/GUI/host/host.cc b/GUI/host/host.cc index 5a67da8..9e8668f 100644 --- a/GUI/host/host.cc +++ b/GUI/host/host.cc @@ -127,9 +127,7 @@ namespace break; default: { - ThreadParam tp = *(ThreadParam*)buffer; - buffer[bytesRead] = 0; - buffer[bytesRead + 1] = 0; + auto tp = *(ThreadParam*)buffer; DispatchText(tp, buffer + sizeof(tp), bytesRead - sizeof(tp)); } break; @@ -163,14 +161,10 @@ namespace { std::thread([] { - std::wstring last; - while (true) - { - Sleep(50); + for (std::wstring last; true; Sleep(50)) if (auto text = GetClipboardText()) if (last != text.value()) Host::GetThread(CLIPBOARD)->AddSentence(last = text.value()); - } }).detach(); } } diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index dcdff4c..c6e9d1a 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -176,7 +176,7 @@ void MainWindow::on_attachButton_clicked() QStringList processList(allProcesses.uniqueKeys()); processList.sort(Qt::CaseInsensitive); bool ok; - QString process = QInputDialog::getItem(this, SELECT_PROCESS, INJECT_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint); + QString process = QInputDialog::getItem(this, SELECT_PROCESS, ATTACH_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint); if (!ok) return; if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0)); else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId); diff --git a/include/text.h b/include/text.h index 2535256..274cb3f 100644 --- a/include/text.h +++ b/include/text.h @@ -1,7 +1,7 @@ #pragma once constexpr auto SELECT_PROCESS = u8"Select Process"; -constexpr auto INJECT_INFO = u8"If you don't see the process you want to inject, try running with admin rights\r\n" +constexpr auto ATTACH_INFO = u8"If you don't see the process you want to attach, try running with admin rights\r\n" "You can also type in the process id"; constexpr auto ADD_HOOK = u8"Add hook"; constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n" @@ -20,8 +20,11 @@ constexpr auto UNHOOK = u8"Unhook"; constexpr auto REMOVE_HOOK = u8"Which hook to remove?"; constexpr auto SELECT_EXTENSION = u8"Select Extension"; constexpr auto EXTENSIONS = u8"Extensions (*.dll)"; -constexpr auto ABOUT = L"Textractor beta v3.4.1 by Artikash\r\n" -"Source code and more information available under GPLv3 at https://github.com/Artikash/Textractor"; +constexpr auto ABOUT = L"Textractor beta v3.5.0 (project homepage: https://github.com/Artikash/Textractor)\r\n" +"Made with <3 by Artikash (email: akashmozumdar@gmail.com)\r\n" +"Please contact Artikash with any problems, feature requests, or questions relating to Textractor\r\n" +"You can do so via the project homepage (issues section) or via email\r\n" +"Source code available under GPLv3 at project homepage"; constexpr auto TOO_MANY_THREADS = L"Textractor: too many text threads: can't create more"; constexpr auto ALREADY_INJECTED = L"Textractor: already injected"; constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead";