2015-04-02 23:27:35 +09:00
|
|
|
/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
|
|
|
|
* This file is part of the Interactive Text Hooker.
|
|
|
|
|
|
|
|
* Interactive Text Hooker is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as published
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ITH.h"
|
2018-07-19 00:09:58 -04:00
|
|
|
#include "host.h"
|
2016-01-06 00:01:17 +09:00
|
|
|
#include "vnrhook/include/const.h"
|
|
|
|
#include "vnrhook/include/types.h"
|
2015-04-02 23:27:35 +09:00
|
|
|
#include "language.h"
|
|
|
|
#include "utility.h"
|
2016-01-06 00:01:17 +09:00
|
|
|
#include "profile/misc.h"
|
2015-04-02 23:27:35 +09:00
|
|
|
|
|
|
|
extern HookManager* man;
|
|
|
|
extern HWND hwndProcessComboBox;
|
|
|
|
|
|
|
|
DWORD ProcessCommand(const std::wstring& cmd, DWORD pid)
|
|
|
|
{
|
|
|
|
using std::wregex;
|
|
|
|
using std::regex_match;
|
|
|
|
std::match_results<std::wstring::const_iterator> m;
|
|
|
|
|
2018-05-11 16:46:05 -04:00
|
|
|
if (regex_match(cmd, m, wregex(L"/p(\\d+)", wregex::icase)))
|
2015-04-02 23:27:35 +09:00
|
|
|
{
|
|
|
|
pid = std::stoul(m[1].str());
|
2018-05-11 16:46:05 -04:00
|
|
|
InjectProcessById(pid);
|
2015-04-02 23:27:35 +09:00
|
|
|
}
|
2016-01-06 00:01:17 +09:00
|
|
|
else if (regex_match(cmd, m, wregex(L"/h(.+)", wregex::icase)))
|
2015-04-02 23:27:35 +09:00
|
|
|
{
|
|
|
|
HookParam hp = {};
|
|
|
|
if (Parse(m[1].str(), hp))
|
2018-07-20 23:43:55 -04:00
|
|
|
InsertHook(pid, &hp);
|
2015-04-02 23:27:35 +09:00
|
|
|
}
|
2017-01-29 03:19:24 +09:00
|
|
|
else if (regex_match(cmd, m, wregex(L":(?:h|help)", wregex::icase)))
|
2015-04-02 23:27:35 +09:00
|
|
|
{
|
|
|
|
ConsoleOutput(Usage);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-29 03:19:24 +09:00
|
|
|
ConsoleOutput(L"Unknown command. Type :h or :help for help.");
|
2015-04-02 23:27:35 +09:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|