2016-01-06 00:01:17 +09:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// host.h
|
|
|
|
// 8/23/2013 jichi
|
|
|
|
// Branch: ITH/IHF.h, rev 105
|
|
|
|
|
2018-08-22 12:24:55 -04:00
|
|
|
#include "common.h"
|
2018-07-23 12:25:02 -07:00
|
|
|
#include "textthread.h"
|
|
|
|
|
2018-07-24 10:39:02 -07:00
|
|
|
typedef std::function<void(DWORD)> ProcessEventCallback;
|
2018-10-31 01:20:44 -04:00
|
|
|
typedef std::function<void(std::shared_ptr<TextThread>)> ThreadEventCallback;
|
2018-07-23 12:25:02 -07:00
|
|
|
|
|
|
|
namespace Host
|
|
|
|
{
|
2018-10-08 00:26:43 -04:00
|
|
|
void Start(ProcessEventCallback onAttach, ProcessEventCallback onDetach, ThreadEventCallback onCreate, ThreadEventCallback onRemove, TextThread::OutputCallback output);
|
2018-08-24 12:50:20 -04:00
|
|
|
void Close();
|
2018-08-24 14:04:23 -04:00
|
|
|
|
2018-08-24 12:50:20 -04:00
|
|
|
bool InjectProcess(DWORD pid, DWORD timeout = 5000);
|
2018-08-24 14:04:23 -04:00
|
|
|
void DetachProcess(DWORD pid);
|
|
|
|
|
|
|
|
void InsertHook(DWORD pid, HookParam hp, std::string name = "");
|
2018-09-20 21:59:07 -04:00
|
|
|
void RemoveHook(DWORD pid, uint64_t addr);
|
2018-08-24 12:50:20 -04:00
|
|
|
|
2018-09-20 21:59:07 -04:00
|
|
|
HookParam GetHookParam(DWORD pid, uint64_t addr);
|
2018-10-31 01:20:44 -04:00
|
|
|
inline HookParam GetHookParam(ThreadParam tp) { return GetHookParam(tp.pid, tp.hook); }
|
2018-09-20 21:59:07 -04:00
|
|
|
std::wstring GetHookName(DWORD pid, uint64_t addr);
|
2018-10-31 01:20:44 -04:00
|
|
|
inline std::wstring GetHookName(ThreadParam tp) { return GetHookName(tp.pid, tp.hook); }
|
2018-08-24 12:50:20 -04:00
|
|
|
|
2018-10-31 01:20:44 -04:00
|
|
|
std::shared_ptr<TextThread> GetThread(ThreadParam tp);
|
2018-08-24 12:50:20 -04:00
|
|
|
void AddConsoleOutput(std::wstring text);
|
2018-07-23 12:25:02 -07:00
|
|
|
}
|
2018-09-21 21:27:59 -04:00
|
|
|
|
2018-09-23 01:08:33 -04:00
|
|
|
inline std::wstring StringToWideString(const std::string& text, UINT encoding)
|
2018-09-21 21:27:59 -04:00
|
|
|
{
|
2018-09-29 13:10:07 -04:00
|
|
|
std::wstring ret(text.size() + 1, 0);
|
2018-10-04 22:10:27 -04:00
|
|
|
ret.resize(MultiByteToWideChar(encoding, 0, text.c_str(), -1, ret.data(), ret.capacity()) - 1);
|
2018-09-21 21:27:59 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:01:17 +09:00
|
|
|
// EOF
|