Revert "start cleaning up hookman"

This reverts commit dff4ae34630fe46123bced537b78ad793fadef4c.
This commit is contained in:
Akash Mozumdar 2018-05-24 05:36:00 -04:00
parent 2591a8c124
commit 553059ee0f
3 changed files with 17 additions and 1 deletions

View File

@ -144,7 +144,7 @@ protected:
fCopy fCpy; fCopy fCpy;
fLength fLen; fLength fLen;
//public: public:
// - Construction - // - Construction -
AVLTree() {} AVLTree() {}

View File

@ -208,6 +208,15 @@ HookManager::~HookManager()
//DeleteCriticalSection(&hmcs); //DeleteCriticalSection(&hmcs);
} }
TextThread *HookManager::FindSingle(DWORD pid, DWORD hook, DWORD retn, DWORD split)
{
if (pid == 0)
return thread_table->FindThread(0);
ThreadParameter tp = {pid, hook, retn, split};
TreeNode<ThreadParameter *,DWORD> *node = Search(&tp);
return node ? thread_table->FindThread(node->data) : nullptr;
}
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); }
@ -698,6 +707,8 @@ ProcessRecord *HookManager::GetProcessRecord(DWORD pid)
//return pr; //return pr;
} }
DWORD HookManager::GetCurrentPID() { return current_pid; }
HANDLE HookManager::GetCmdHandleByPID(DWORD pid) HANDLE HookManager::GetCmdHandleByPID(DWORD pid)
{ {
HM_LOCK; HM_LOCK;
@ -723,6 +734,8 @@ MK_BASIC_TYPE(LPVOID)
// return hash; // return hash;
//} //}
DWORD GetCurrentPID() { return ::man->GetCurrentPID(); }
HANDLE GetCmdHandleByPID(DWORD pid) { return ::man->GetCmdHandleByPID(pid); } HANDLE GetCmdHandleByPID(DWORD pid) { return ::man->GetCmdHandleByPID(pid); }
//void AddLink(WORD from, WORD to) { ::man->AddLink(from, to); } //void AddLink(WORD from, WORD to) { ::man->AddLink(from, to); }

View File

@ -46,8 +46,10 @@ public:
HookManager(); HookManager();
~HookManager(); ~HookManager();
// jichi 12/26/2013: remove virtual modifiers // jichi 12/26/2013: remove virtual modifiers
TextThread *FindSingle(DWORD pid, DWORD hook, DWORD retn, DWORD split);
TextThread *FindSingle(DWORD number); TextThread *FindSingle(DWORD number);
ProcessRecord *GetProcessRecord(DWORD pid); ProcessRecord *GetProcessRecord(DWORD pid);
DWORD GetProcessIDByPath(LPCWSTR str); // private
void RemoveSingleThread(DWORD number); void RemoveSingleThread(DWORD number);
//void LockHookman(); //void LockHookman();
//void UnlockHookman(); //void UnlockHookman();
@ -73,6 +75,7 @@ public:
void UnRegisterProcess(DWORD pid); void UnRegisterProcess(DWORD pid);
//void SetName(DWORD); //void SetName(DWORD);
DWORD GetCurrentPID(); // private
HANDLE GetCmdHandleByPID(DWORD pid); HANDLE GetCmdHandleByPID(DWORD pid);
ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf) ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf)