33 lines
1.7 KiB
C
Raw Normal View History

2024-02-07 20:59:24 +08:00
#pragma once
#include "textthread.h"
namespace Host
{
2024-10-03 14:53:59 +08:00
using ConsoleHandler = std::function<void(const std::wstring &)>;
2024-02-07 20:59:24 +08:00
using ProcessEventHandler = std::function<void(DWORD)>;
2024-10-03 14:53:59 +08:00
using ThreadEventHandler = std::function<void(TextThread &)>;
using HookEventHandler = std::function<void(const HookParam &, const std::wstring &text)>;
2024-11-03 20:31:46 +08:00
using HookInsertHandler = std::function<void(DWORD, uint64_t, const std::wstring &)>;
2024-10-03 14:53:59 +08:00
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-10-06 00:43:46 +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, std::optional<ConsoleHandler> console, std::optional<HookInsertHandler> hookinsert, std::optional<EmbedCallback> embed, std::optional<ConsoleHandler> warning);
2024-10-03 14:53:59 +08:00
void InjectProcess(DWORD processId, const std::wstring locationX = L"");
2024-02-07 20:59:24 +08:00
bool CreatePipeAndCheck(DWORD processId);
void DetachProcess(DWORD processId);
void InsertHook(DWORD processId, HookParam hp);
void RemoveHook(DWORD processId, uint64_t address);
void FindHooks(DWORD processId, SearchParam sp, HookEventHandler HookFound = {});
2024-11-03 20:31:46 +08:00
CommonSharedMem *GetCommonSharedMem(DWORD pid);
2024-10-03 14:53:59 +08:00
TextThread *GetThread(int64_t handle);
TextThread &GetThread(ThreadParam tp);
2024-02-07 20:59:24 +08:00
void AddConsoleOutput(std::wstring text);
2024-10-03 14:53:59 +08:00
void Warning(std::wstring text);
2024-02-07 20:59:24 +08:00
inline int defaultCodepage = SHIFT_JIS;
2024-10-03 14:53:59 +08:00
constexpr ThreadParam console{0, 0, 0, 0};
2024-02-07 20:59:24 +08:00
}