2024-11-06 06:46:35 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "textthread.h"
|
|
|
|
namespace Host
|
|
|
|
{
|
2024-11-28 16:59:08 +08:00
|
|
|
using HostInfoHandler = std::function<void(HOSTINFO type, const std::wstring &)>;
|
2024-11-06 06:46:35 +08:00
|
|
|
using ProcessEventHandler = std::function<void(DWORD)>;
|
|
|
|
using ThreadEventHandler = std::function<void(TextThread &)>;
|
|
|
|
using HookEventHandler = std::function<void(const HookParam &, const std::wstring &text)>;
|
|
|
|
using HookInsertHandler = std::function<void(DWORD, uint64_t, const std::wstring &)>;
|
|
|
|
using EmbedCallback = std::function<void(const std::wstring &, const ThreadParam &)>;
|
|
|
|
void Start(ProcessEventHandler Connect, ProcessEventHandler Disconnect, ThreadEventHandler Create, ThreadEventHandler Destroy, TextThread::OutputCallback Output, bool createconsole = true);
|
2024-11-28 16:59:08 +08:00
|
|
|
void StartEx(std::optional<ProcessEventHandler> Connect, std::optional<ProcessEventHandler> Disconnect, std::optional<ThreadEventHandler> Create, std::optional<ThreadEventHandler> Destroy, std::optional<TextThread::OutputCallback> Output, bool consolethread, std::optional<HostInfoHandler> hostinfo, std::optional<HookInsertHandler> hookinsert, std::optional<EmbedCallback> embed);
|
2024-11-06 06:46:35 +08:00
|
|
|
void InjectProcess(DWORD processId, const std::wstring locationX = L"");
|
|
|
|
bool CreatePipeAndCheck(DWORD processId);
|
|
|
|
|
|
|
|
void DetachProcess(DWORD processId);
|
|
|
|
|
|
|
|
void InsertHook(DWORD processId, HookParam hp);
|
2024-12-16 01:48:39 +08:00
|
|
|
void SetLanguage(const char*);
|
2024-11-14 20:32:39 +08:00
|
|
|
void InsertPCHooks(DWORD processId, int which);
|
2024-11-06 06:46:35 +08:00
|
|
|
void RemoveHook(DWORD processId, uint64_t address);
|
|
|
|
void FindHooks(DWORD processId, SearchParam sp, HookEventHandler HookFound = {});
|
|
|
|
CommonSharedMem *GetCommonSharedMem(DWORD pid);
|
|
|
|
TextThread *GetThread(int64_t handle);
|
|
|
|
TextThread &GetThread(ThreadParam tp);
|
2024-11-28 16:59:08 +08:00
|
|
|
void InfoOutput(HOSTINFO type, std::wstring text);
|
2024-11-06 06:46:35 +08:00
|
|
|
void AddConsoleOutput(std::wstring text);
|
|
|
|
|
|
|
|
inline int defaultCodepage = SHIFT_JIS;
|
|
|
|
|
|
|
|
constexpr ThreadParam console{0, 0, 0, 0};
|
2024-11-06 07:27:43 +08:00
|
|
|
bool CheckIsUsingEmbed(ThreadParam tp);
|
|
|
|
|
2024-11-06 06:46:35 +08:00
|
|
|
}
|