small fixes

This commit is contained in:
Akash Mozumdar 2018-11-19 08:17:00 -05:00
parent 95ca747912
commit 902ded684d
3 changed files with 9 additions and 12 deletions

View File

@ -127,9 +127,7 @@ namespace
break; break;
default: default:
{ {
ThreadParam tp = *(ThreadParam*)buffer; auto tp = *(ThreadParam*)buffer;
buffer[bytesRead] = 0;
buffer[bytesRead + 1] = 0;
DispatchText(tp, buffer + sizeof(tp), bytesRead - sizeof(tp)); DispatchText(tp, buffer + sizeof(tp), bytesRead - sizeof(tp));
} }
break; break;
@ -163,14 +161,10 @@ namespace
{ {
std::thread([] std::thread([]
{ {
std::wstring last; for (std::wstring last; true; Sleep(50))
while (true)
{
Sleep(50);
if (auto text = GetClipboardText()) if (auto text = GetClipboardText())
if (last != text.value()) if (last != text.value())
Host::GetThread(CLIPBOARD)->AddSentence(last = text.value()); Host::GetThread(CLIPBOARD)->AddSentence(last = text.value());
}
}).detach(); }).detach();
} }
} }

View File

@ -176,7 +176,7 @@ void MainWindow::on_attachButton_clicked()
QStringList processList(allProcesses.uniqueKeys()); QStringList processList(allProcesses.uniqueKeys());
processList.sort(Qt::CaseInsensitive); processList.sort(Qt::CaseInsensitive);
bool ok; 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 (!ok) return;
if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0)); if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0));
else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId); else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId);

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
constexpr auto SELECT_PROCESS = u8"Select Process"; 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"; "You can also type in the process id";
constexpr auto ADD_HOOK = u8"Add hook"; constexpr auto ADD_HOOK = u8"Add hook";
constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n" 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 REMOVE_HOOK = u8"Which hook to remove?";
constexpr auto SELECT_EXTENSION = u8"Select Extension"; constexpr auto SELECT_EXTENSION = u8"Select Extension";
constexpr auto EXTENSIONS = u8"Extensions (*.dll)"; constexpr auto EXTENSIONS = u8"Extensions (*.dll)";
constexpr auto ABOUT = L"Textractor beta v3.4.1 by Artikash\r\n" constexpr auto ABOUT = L"Textractor beta v3.5.0 (project homepage: https://github.com/Artikash/Textractor)\r\n"
"Source code and more information available under GPLv3 at https://github.com/Artikash/Textractor"; "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 TOO_MANY_THREADS = L"Textractor: too many text threads: can't create more";
constexpr auto ALREADY_INJECTED = L"Textractor: already injected"; constexpr auto ALREADY_INJECTED = L"Textractor: already injected";
constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead"; constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead";