remove unused code

This commit is contained in:
Akash Mozumdar 2018-05-24 03:49:05 -04:00
parent 1fb66ddc04
commit b3496222ec
3 changed files with 21 additions and 13 deletions

View File

@ -36,15 +36,6 @@ void ConsoleOutput(LPCWSTR text)
man->AddConsoleOutput(text);
}
void ConsoleOutput(LPCSTR text)
{
int wc_length = MB_WC_count(text, -1);
LPWSTR wc = new WCHAR[wc_length];
MB_WC(text, wc, wc_length);
man->AddConsoleOutput(wc);
delete wc;
}
std::wstring GetProcessPath(DWORD pid)
{
UniqueHandle hProc(OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));

View File

@ -752,7 +752,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
man->RegisterProcessDetachCallback(RemoveProcessList);
man->RegisterProcessNewHookCallback(RefreshProfileOnNewHook);
man->RegisterAddRemoveLinkCallback(AddRemoveLink);
man->RegisterConsoleCallback(ConsoleOutput);
StartHost();
{
static const WCHAR program_name[] = L"Interactive Text Hooker";

View File

@ -7,6 +7,7 @@
#include "host/avl_p.h"
#include "host/textthread.h"
#include "winmutex/winmutex.h"
#include <unordered_map>
namespace pugi {
class xml_node;
@ -25,6 +26,9 @@ struct ProcessRecord {
HANDLE hookman_mutex;
HANDLE hookman_section;
LPVOID hookman_map;
HANDLE hostPipe;
HANDLE hookPipe;
HANDLE processThread;
};
class ThreadTable : public MyVector<TextThread *, 0x40>
@ -40,6 +44,19 @@ struct IHFSERVICE TLen { int operator()(const ThreadParameter *t); };
typedef DWORD (*ProcessEventCallback)(DWORD pid);
struct ThreadParameterHasher
{
size_t operator()(const ThreadParameter& threadParam) const
{
return std::hash<DWORD>()((threadParam.pid << 4) + threadParam.hook + threadParam.retn + threadParam.spl);
}
};
//bool operator==(const ThreadParameter& one, const ThreadParameter& two)
//{
// return one.pid == two.pid && one.hook == two.hook && one.retn == two.retn && one.spl == two.spl;
//}
class IHFSERVICE HookManager : public AVLTree<ThreadParameter, DWORD, TCmp, TCpy, TLen>
{
public:
@ -73,9 +90,6 @@ public:
HANDLE GetCmdHandleByPID(DWORD pid);
ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf)
{ return (ConsoleCallback)_InterlockedExchange((long*)&console,(long)cf); }
ThreadEventCallback RegisterThreadCreateCallback(ThreadEventCallback cf)
{ return (ThreadEventCallback)_InterlockedExchange((long*)&create,(long)cf); }
@ -106,6 +120,10 @@ public:
void GetProfile(DWORD pid, pugi::xml_node profile_node);
private:
std::unordered_map<DWORD, ProcessRecord*> processRecords;
std::unordered_map<ThreadParameter, TextThread*, ThreadParameterHasher> threadTable;
typedef win_mutex<CRITICAL_SECTION> mutex_type;
mutex_type hmcs;