mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
Revert "start implementing hostinterop"
This reverts commit 62b5f5fe8f788629c95cbd2375a0d9845decb4c1.
This commit is contained in:
parent
a8f2ca79a5
commit
a055db4bf8
Binary file not shown.
@ -41,7 +41,7 @@ DWORD ProcessCommand(const std::wstring& cmd, DWORD pid)
|
|||||||
{
|
{
|
||||||
HookParam hp = {};
|
HookParam hp = {};
|
||||||
if (Parse(m[1].str(), hp))
|
if (Parse(m[1].str(), hp))
|
||||||
InsertHook(pid, hp);
|
InsertHook(pid, &hp);
|
||||||
}
|
}
|
||||||
else if (regex_match(cmd, m, wregex(L":(?:h|help)", wregex::icase)))
|
else if (regex_match(cmd, m, wregex(L":(?:h|help)", wregex::icase)))
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
if (StartHost())
|
if (StartHost())
|
||||||
{
|
{
|
||||||
SetUnhandledExceptionFilter(UnhandledExcept);
|
SetUnhandledExceptionFilter(UnhandledExcept);
|
||||||
man = GetHostHookManager();
|
GetHostHookManager(&man);
|
||||||
pfman = new ProfileManager();
|
pfman = new ProfileManager();
|
||||||
DefaultSettings();
|
DefaultSettings();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
@ -488,7 +488,7 @@ void RegisterProcess(DWORD pid)
|
|||||||
{
|
{
|
||||||
for (auto i = pf->Hooks().begin(); i != pf->Hooks().end(); ++i)
|
for (auto i = pf->Hooks().begin(); i != pf->Hooks().end(); ++i)
|
||||||
{
|
{
|
||||||
InsertHook(pid, i->get()->HP(), toMultiByteString(i->get()->Name()));
|
InsertHook(pid, &i->get()->HP(), toMultiByteString(i->get()->Name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,19 +117,19 @@ DLLEXPORT bool DetachProcessById(DWORD processId)
|
|||||||
return WriteFile(man->GetHostPipe(processId), &command, sizeof(command), &unused, nullptr);
|
return WriteFile(man->GetHostPipe(processId), &command, sizeof(command), &unused, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT HookManager* GetHostHookManager()
|
DLLEXPORT void GetHostHookManager(HookManager** hookman)
|
||||||
{
|
{
|
||||||
return man;
|
*hookman = man;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT bool InsertHook(DWORD pid, HookParam hp, std::string name)
|
DLLEXPORT bool InsertHook(DWORD pid, const HookParam *hp, std::string name)
|
||||||
{
|
{
|
||||||
HANDLE commandPipe = man->GetHostPipe(pid);
|
HANDLE commandPipe = man->GetHostPipe(pid);
|
||||||
if (commandPipe == nullptr) return false;
|
if (commandPipe == nullptr) return false;
|
||||||
|
|
||||||
BYTE buffer[PIPE_BUFFER_SIZE] = {};
|
BYTE buffer[PIPE_BUFFER_SIZE] = {};
|
||||||
*(DWORD*)buffer = HOST_COMMAND_NEW_HOOK;
|
*(DWORD*)buffer = HOST_COMMAND_NEW_HOOK;
|
||||||
*(HookParam*)(buffer + sizeof(DWORD)) = hp;
|
*(HookParam*)(buffer + sizeof(DWORD)) = *hp;
|
||||||
if (name.size()) strcpy((char*)buffer + sizeof(DWORD) + sizeof(HookParam), name.c_str());
|
if (name.size()) strcpy((char*)buffer + sizeof(DWORD) + sizeof(HookParam), name.c_str());
|
||||||
DWORD unused;
|
DWORD unused;
|
||||||
return WriteFile(commandPipe, buffer, sizeof(DWORD) + sizeof(HookParam) + name.size(), &unused, nullptr);
|
return WriteFile(commandPipe, buffer, sizeof(DWORD) + sizeof(HookParam) + name.size(), &unused, nullptr);
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
DLLEXPORT void OpenHost();
|
DLLEXPORT void OpenHost();
|
||||||
DLLEXPORT bool StartHost();
|
DLLEXPORT bool StartHost();
|
||||||
DLLEXPORT void CloseHost();
|
DLLEXPORT void CloseHost();
|
||||||
DLLEXPORT HookManager* GetHostHookManager();
|
DLLEXPORT void GetHostHookManager(HookManager **hookman);
|
||||||
DLLEXPORT bool InjectProcessById(DWORD pid, DWORD timeout = 5000);
|
DLLEXPORT bool InjectProcessById(DWORD pid, DWORD timeout = 5000);
|
||||||
DLLEXPORT bool DetachProcessById(DWORD pid);
|
DLLEXPORT bool DetachProcessById(DWORD pid);
|
||||||
DLLEXPORT bool InsertHook(DWORD pid, HookParam hp, std::string name = "");
|
DLLEXPORT bool InsertHook(DWORD pid, const HookParam *hp, std::string name = "");
|
||||||
DLLEXPORT bool RemoveHook(DWORD pid, DWORD addr);
|
DLLEXPORT bool RemoveHook(DWORD pid, DWORD addr);
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user