Revert "clean up hookman some more"

This reverts commit 1fb66ddc04cec7b2d31bdab4b8992e61d0696a43.
This commit is contained in:
Akash Mozumdar 2018-05-24 05:35:54 -04:00
parent fe552f6e19
commit 2591a8c124
3 changed files with 34 additions and 1 deletions

View File

@ -211,6 +211,8 @@ HookManager::~HookManager()
TextThread *HookManager::FindSingle(DWORD number) TextThread *HookManager::FindSingle(DWORD number)
{ return (number & 0x80008000) ? nullptr : thread_table->FindThread(number); } { return (number & 0x80008000) ? nullptr : thread_table->FindThread(number); }
void HookManager::DetachProcess(DWORD pid) {}
void HookManager::SetCurrent(TextThread *it) void HookManager::SetCurrent(TextThread *it)
{ {
if (current) if (current)
@ -624,6 +626,25 @@ void HookManager::AddConsoleOutput(LPCWSTR text)
} }
} }
void HookManager::ClearText(DWORD pid, DWORD hook, DWORD retn, DWORD spl)
{
HM_LOCK;
//bool flag=false;
//ConsoleOutput("vnrhost:ClearText: lock");
//EnterCriticalSection(&hmcs);
ThreadParameter tp = {pid, hook, retn, spl};
if (TreeNode<ThreadParameter *, DWORD> *in = Search(&tp))
if (TextThread *it = thread_table->FindThread(in->data)) {
it->Reset();
//SetCurrent(it);
if (reset)
reset(it);
//it->ResetEditText();
}
//LeaveCriticalSection(&hmcs);
//ConsoleOutput("vnrhost:ClearText: unlock");
}
void HookManager::ClearCurrent() void HookManager::ClearCurrent()
{ {
HM_LOCK; HM_LOCK;

View File

@ -57,12 +57,14 @@ public:
void UnLink(WORD from); void UnLink(WORD from);
void UnLinkAll(WORD from); void UnLinkAll(WORD from);
void SelectCurrent(DWORD num); void SelectCurrent(DWORD num);
void DetachProcess(DWORD pid);
void SetCurrent(TextThread *it); void SetCurrent(TextThread *it);
void AddConsoleOutput(LPCWSTR text); void AddConsoleOutput(LPCWSTR text);
// jichi 10/27/2013: Add const; add space. // jichi 10/27/2013: Add const; add space.
void DispatchText(DWORD pid, const BYTE *text, DWORD hook, DWORD retn, DWORD split, int len, bool space); void DispatchText(DWORD pid, const BYTE *text, DWORD hook, DWORD retn, DWORD split, int len, bool space);
void ClearText(DWORD pid, DWORD hook, DWORD retn, DWORD split); // private
void RemoveProcessContext(DWORD pid); // private void RemoveProcessContext(DWORD pid); // private
void RemoveSingleHook(DWORD pid, DWORD addr); void RemoveSingleHook(DWORD pid, DWORD addr);
void RegisterThread(TextThread*, DWORD); // private void RegisterThread(TextThread*, DWORD); // private
@ -76,6 +78,9 @@ public:
ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf) ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf)
{ return (ConsoleCallback)_InterlockedExchange((long*)&console,(long)cf); } { return (ConsoleCallback)_InterlockedExchange((long*)&console,(long)cf); }
ConsoleWCallback RegisterConsoleWCallback(ConsoleWCallback cf)
{ return (ConsoleWCallback)_InterlockedExchange((long*)&wconsole,(long)cf); }
ThreadEventCallback RegisterThreadCreateCallback(ThreadEventCallback cf) ThreadEventCallback RegisterThreadCreateCallback(ThreadEventCallback cf)
{ return (ThreadEventCallback)_InterlockedExchange((long*)&create,(long)cf); } { return (ThreadEventCallback)_InterlockedExchange((long*)&create,(long)cf); }
@ -102,6 +107,13 @@ public:
ProcessRecord *Records() { return record; } // private ProcessRecord *Records() { return record; } // private
ThreadTable *Table() { return thread_table; } // private ThreadTable *Table() { return thread_table; } // private
//DWORD& SplitTime() { return split_time; }
//DWORD& RepeatCount() { return repeat_count; }
//DWORD& CyclicRemove() { return cyclic_remove; }
//DWORD& GlobalFilter() { return global_filter; }
void ConsoleOutput(LPCSTR text) { if (console) console(text); } // not thread safe
void ConsoleOutputW(LPCWSTR text) { if (wconsole) wconsole(text); } // not thread safe
void OnThreadCreate(pugi::xml_node profile_node, TextThread* thread); void OnThreadCreate(pugi::xml_node profile_node, TextThread* thread);
void GetProfile(DWORD pid, pugi::xml_node profile_node); void GetProfile(DWORD pid, pugi::xml_node profile_node);