2016-01-05 23:01:17 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// host.h
|
|
|
|
// 8/23/2013 jichi
|
|
|
|
// Branch: ITH/IHF.h, rev 105
|
|
|
|
|
2018-07-19 12:46:52 +08:00
|
|
|
#define DLLEXPORT __declspec(dllexport)
|
2018-07-24 03:25:02 +08:00
|
|
|
|
|
|
|
#include <Windows.h>
|
|
|
|
#include "textthread.h"
|
2018-07-13 01:59:05 +08:00
|
|
|
#include <string>
|
2018-07-25 01:39:02 +08:00
|
|
|
#include <functional>
|
2018-07-24 03:25:02 +08:00
|
|
|
#include "../vnrhook/include/types.h"
|
|
|
|
|
|
|
|
struct ProcessRecord
|
|
|
|
{
|
|
|
|
HANDLE process_handle;
|
|
|
|
HANDLE hookman_mutex;
|
|
|
|
HANDLE hookman_section;
|
|
|
|
LPVOID hookman_map;
|
|
|
|
HANDLE hostPipe;
|
|
|
|
};
|
|
|
|
|
2018-07-25 01:39:02 +08:00
|
|
|
typedef std::function<void(DWORD)> ProcessEventCallback;
|
|
|
|
typedef std::function<void(TextThread*)> ThreadEventCallback;
|
2018-07-24 03:25:02 +08:00
|
|
|
|
|
|
|
struct ThreadParameterHasher
|
|
|
|
{
|
|
|
|
size_t operator()(const ThreadParameter& tp) const
|
|
|
|
{
|
|
|
|
return std::hash<DWORD>()(tp.pid << 6) + std::hash<DWORD>()(tp.hook) + std::hash<DWORD>()(tp.retn) + std::hash<DWORD>()(tp.spl);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace Host
|
|
|
|
{
|
|
|
|
DLLEXPORT void Open();
|
|
|
|
DLLEXPORT bool Start();
|
|
|
|
DLLEXPORT void Close();
|
|
|
|
DLLEXPORT bool InjectProcess(DWORD pid, DWORD timeout = 5000);
|
|
|
|
DLLEXPORT bool DetachProcess(DWORD pid);
|
|
|
|
|
|
|
|
DLLEXPORT bool InsertHook(DWORD pid, HookParam hp, std::string name = "");
|
|
|
|
DLLEXPORT bool RemoveHook(DWORD pid, DWORD addr);
|
|
|
|
DLLEXPORT HookParam GetHookParam(DWORD pid, DWORD addr);
|
|
|
|
DLLEXPORT std::wstring GetHookName(DWORD pid, DWORD addr);
|
|
|
|
|
|
|
|
DLLEXPORT TextThread* GetThread(DWORD number);
|
|
|
|
DLLEXPORT void AddConsoleOutput(std::wstring text);
|
|
|
|
|
|
|
|
DLLEXPORT void RegisterThreadCreateCallback(ThreadEventCallback cf);
|
|
|
|
DLLEXPORT void RegisterThreadRemoveCallback(ThreadEventCallback cf);
|
|
|
|
DLLEXPORT void RegisterProcessAttachCallback(ProcessEventCallback cf);
|
|
|
|
DLLEXPORT void RegisterProcessDetachCallback(ProcessEventCallback cf);
|
|
|
|
}
|
2016-01-05 23:01:17 +08:00
|
|
|
|
2018-07-24 03:25:02 +08:00
|
|
|
void DispatchText(DWORD pid, DWORD hook, DWORD retn, DWORD split, const BYTE *text, int len);
|
|
|
|
void RemoveThreads(bool(*RemoveIf)(ThreadParameter, ThreadParameter), ThreadParameter cmp);
|
|
|
|
void RegisterProcess(DWORD pid, HANDLE hostPipe);
|
|
|
|
void UnregisterProcess(DWORD pid);
|
2016-01-05 23:01:17 +08:00
|
|
|
|
|
|
|
// EOF
|