From 121eddc2903a7768dccb9c1444e6d59cd06d4a49 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 21 Feb 2019 13:18:37 -0500 Subject: [PATCH] command line help text --- GUI/mainwindow.cpp | 5 ++++- include/text.h | 1 + text.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index fa9e697..3ecb514 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -58,6 +58,9 @@ MainWindow::MainWindow(QWidget *parent) : current = &Host::GetThread(Host::console); Host::AddConsoleOutput(ABOUT); + DWORD DUMMY; + AttachConsole(ATTACH_PARENT_PROCESS); + WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), CL_OPTIONS, wcslen(CL_OPTIONS), &DUMMY, NULL); std::vector processIds = Util::GetAllProcessIds(); std::vector processNames; for (auto processId : processIds) processNames.emplace_back(Util::GetModuleFilename(processId).value_or(L"")); @@ -65,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent) : std::unique_ptr> argv(CommandLineToArgvW(GetCommandLineW(), &argc)); for (int i = 0; i < argc; ++i) if (std::wstring arg = argv[i]; arg[0] == L'/' || arg[0] == L'-') - if (arg[1] == L'P') + if (arg[1] == L'p') if (DWORD processId = _wtoi(arg.substr(2).c_str())) Host::InjectProcess(processId); else for (int i = 0; i < processIds.size(); ++i) if (processNames[i].find(L"\\" + arg.substr(2)) != std::wstring::npos) Host::InjectProcess(processIds[i]); diff --git a/include/text.h b/include/text.h index 3fcc102..4c284dc 100644 --- a/include/text.h +++ b/include/text.h @@ -25,6 +25,7 @@ extern const char* MAX_BUFFER_SIZE; extern const wchar_t* CONSOLE; extern const wchar_t* CLIPBOARD; extern const wchar_t* ABOUT; +extern const wchar_t* CL_OPTIONS; extern const wchar_t* UPDATE_AVAILABLE; extern const wchar_t* ALREADY_INJECTED; extern const wchar_t* ARCHITECTURE_MISMATCH; diff --git a/text.cpp b/text.cpp index c7cf3c4..08952a4 100644 --- a/text.cpp +++ b/text.cpp @@ -53,6 +53,7 @@ You can do so via the project homepage (issues section) or via email Source code available under GPLv3 at project homepage I'm currently looking for a new job: email me if you know anyone hiring US software engineers If you like this project, please tell everyone about it :))"; +const wchar_t* CL_OPTIONS = LR"(usage: Textractor [-p{process id|"process name"}]...)"; const wchar_t* UPDATE_AVAILABLE = L"Update available: download it from https://github.com/Artikash/Textractor/releases"; const wchar_t* ALREADY_INJECTED = L"Textractor: already injected"; const wchar_t* ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead";