command line help text

This commit is contained in:
Akash Mozumdar 2019-02-21 13:18:37 -05:00
parent 107544df70
commit 121eddc290
3 changed files with 6 additions and 1 deletions

View File

@ -58,6 +58,9 @@ MainWindow::MainWindow(QWidget *parent) :
current = &Host::GetThread(Host::console); current = &Host::GetThread(Host::console);
Host::AddConsoleOutput(ABOUT); Host::AddConsoleOutput(ABOUT);
DWORD DUMMY;
AttachConsole(ATTACH_PARENT_PROCESS);
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), CL_OPTIONS, wcslen(CL_OPTIONS), &DUMMY, NULL);
std::vector<DWORD> processIds = Util::GetAllProcessIds(); std::vector<DWORD> processIds = Util::GetAllProcessIds();
std::vector<std::wstring> processNames; std::vector<std::wstring> processNames;
for (auto processId : processIds) processNames.emplace_back(Util::GetModuleFilename(processId).value_or(L"")); for (auto processId : processIds) processNames.emplace_back(Util::GetModuleFilename(processId).value_or(L""));
@ -65,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent) :
std::unique_ptr<LPWSTR[], Functor<LocalFree>> argv(CommandLineToArgvW(GetCommandLineW(), &argc)); std::unique_ptr<LPWSTR[], Functor<LocalFree>> argv(CommandLineToArgvW(GetCommandLineW(), &argc));
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
if (std::wstring arg = argv[i]; arg[0] == L'/' || arg[0] == L'-') 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); if (DWORD processId = _wtoi(arg.substr(2).c_str())) Host::InjectProcess(processId);
else for (int i = 0; i < processIds.size(); ++i) else for (int i = 0; i < processIds.size(); ++i)
if (processNames[i].find(L"\\" + arg.substr(2)) != std::wstring::npos) Host::InjectProcess(processIds[i]); if (processNames[i].find(L"\\" + arg.substr(2)) != std::wstring::npos) Host::InjectProcess(processIds[i]);

View File

@ -25,6 +25,7 @@ extern const char* MAX_BUFFER_SIZE;
extern const wchar_t* CONSOLE; extern const wchar_t* CONSOLE;
extern const wchar_t* CLIPBOARD; extern const wchar_t* CLIPBOARD;
extern const wchar_t* ABOUT; extern const wchar_t* ABOUT;
extern const wchar_t* CL_OPTIONS;
extern const wchar_t* UPDATE_AVAILABLE; extern const wchar_t* UPDATE_AVAILABLE;
extern const wchar_t* ALREADY_INJECTED; extern const wchar_t* ALREADY_INJECTED;
extern const wchar_t* ARCHITECTURE_MISMATCH; extern const wchar_t* ARCHITECTURE_MISMATCH;

View File

@ -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 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 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 :))"; 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* 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* ALREADY_INJECTED = L"Textractor: already injected";
const wchar_t* ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead"; const wchar_t* ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead";