delete unused code
This commit is contained in:
parent
393341a443
commit
29e6229326
@ -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));
|
||||
|
@ -369,58 +369,6 @@ void ClickButton(HWND hWnd, HWND h)
|
||||
}
|
||||
}
|
||||
|
||||
// Artikash 6/10/2018: Removed because unused. Left commented to make cleaning up gui code easier later.
|
||||
//DWORD ThreadFilter(TextThread* thread, BYTE* out, DWORD len, DWORD new_line, PVOID data, bool space)
|
||||
//{
|
||||
// DWORD status = thread->Status();
|
||||
// if (global_filter && !new_line && thread->Number() != 0)
|
||||
// {
|
||||
// if (status & USING_UNICODE)
|
||||
// {
|
||||
// DWORD i, j;
|
||||
// len /= 2;
|
||||
// LPWSTR str = (LPWSTR)out;
|
||||
// for (i = 0, j = 0; i < len; i++)
|
||||
// {
|
||||
// WCHAR c = str[i];
|
||||
// if (!uni_filter->Find(c))
|
||||
// str[j++] = c;
|
||||
// }
|
||||
// memset(str + j, 0, (len - j) * 2);
|
||||
// len = j * 2;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DWORD i, j;
|
||||
// for (i = 0, j = 0; i < len; i++)
|
||||
// {
|
||||
// WORD c = out[i];
|
||||
// if (!IsDBCSLeadByte(c & 0xFF))
|
||||
// {
|
||||
// if (!mb_filter->Find(c))
|
||||
// out[j++] = c & 0xFF;
|
||||
// }
|
||||
// else if (i + 1 < len)
|
||||
// {
|
||||
//
|
||||
// c = out[i + 1];
|
||||
// c <<= 8;
|
||||
// c |= out[i];
|
||||
// if (!mb_filter->Find(c))
|
||||
// {
|
||||
// out[j++] = c & 0xFF;
|
||||
// out[j++] = c >> 8;
|
||||
// }
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// memset(out + j, 0, len - j);
|
||||
// len = j;
|
||||
// }
|
||||
// }
|
||||
// return len;
|
||||
//}
|
||||
|
||||
DWORD ThreadOutput(TextThread* thread, BYTE* out, DWORD len, DWORD new_line)
|
||||
{
|
||||
if (len == 0)
|
||||
@ -701,7 +649,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
man->RegisterProcessDetachCallback(RemoveProcessList);
|
||||
//man->RegisterProcessNewHookCallback(RefreshProfileOnNewHook); Artikash 5/30/2018 TODO: Finish implementing this.
|
||||
man->RegisterAddRemoveLinkCallback(AddRemoveLink);
|
||||
man->RegisterConsoleCallback(ConsoleOutput);
|
||||
StartHost();
|
||||
{
|
||||
static const WCHAR program_name[] = L"Interactive Text Hooker";
|
||||
|
@ -89,7 +89,6 @@ HookManager::HookManager() :
|
||||
, attach(nullptr)
|
||||
, detach(nullptr)
|
||||
, hook(nullptr)
|
||||
, current_pid(0)
|
||||
, new_thread_number(0)
|
||||
, threadTable()
|
||||
, processRecordsByIds()
|
||||
|
@ -64,12 +64,6 @@ public:
|
||||
|
||||
HANDLE GetHostPipeByPID(DWORD pid);
|
||||
|
||||
ConsoleCallback RegisterConsoleCallback(ConsoleCallback cf)
|
||||
{ return (ConsoleCallback)_InterlockedExchange((long*)&console,(long)cf); }
|
||||
|
||||
ConsoleWCallback RegisterConsoleWCallback(ConsoleWCallback cf)
|
||||
{ return (ConsoleWCallback)_InterlockedExchange((long*)&wconsole,(long)cf); }
|
||||
|
||||
ThreadEventCallback RegisterThreadCreateCallback(ThreadEventCallback cf)
|
||||
{ return (ThreadEventCallback)_InterlockedExchange((long*)&create,(long)cf); }
|
||||
|
||||
@ -98,8 +92,6 @@ private:
|
||||
CRITICAL_SECTION hmcs;
|
||||
|
||||
TextThread *current;
|
||||
ConsoleCallback console; // jichi 12/25/2013: add console output callback
|
||||
ConsoleWCallback wconsole;
|
||||
ThreadEventCallback create,
|
||||
remove,
|
||||
reset,
|
||||
@ -107,12 +99,6 @@ private:
|
||||
ProcessEventCallback attach,
|
||||
detach,
|
||||
hook;
|
||||
DWORD current_pid;
|
||||
HANDLE destroy_event;
|
||||
ProcessRecord record[MAX_REGISTER + 1];
|
||||
HANDLE text_pipes[MAX_REGISTER + 1],
|
||||
cmd_pipes[MAX_REGISTER + 1],
|
||||
recv_threads[MAX_REGISTER + 1];
|
||||
WORD register_count,
|
||||
new_thread_number;
|
||||
|
||||
|
@ -46,7 +46,5 @@
|
||||
// Events
|
||||
|
||||
#define ITH_REMOVEHOOK_EVENT ITH_PATH_ L"VNR_REMOVE_HOOK" // ITH_REMOVE_HOOK
|
||||
#define ITH_MODIFYHOOK_EVENT ITH_PATH_ L"VNR_MODIFY_HOOK" // ITH_MODIFY_HOOK
|
||||
#define ITH_PIPEEXISTS_EVENT ITH_PATH_ L"VNR_PIPE_EXISTS" // ITH_PIPE_EXIST
|
||||
|
||||
// EOF
|
||||
|
@ -292,15 +292,6 @@ int ProcessHook(DWORD dwDataBase, DWORD dwRetn, TextHook *hook) // Use SEH to en
|
||||
}
|
||||
#endif // 1
|
||||
|
||||
// jichi 12/13/2013: return if the retn address is within the filter dlls
|
||||
inline bool HookFilter(DWORD retn)
|
||||
{
|
||||
for (DWORD i = 0; ::filter[i].lower; i++)
|
||||
if (retn > ::filter[i].lower && retn < ::filter[i].upper)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return false if all text are ascii
|
||||
bool NoAsciiFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
||||
{
|
||||
|
@ -258,86 +258,4 @@ DWORD SwitchTrigger(DWORD t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//} // extern "C"
|
||||
|
||||
|
||||
namespace { // unnamed
|
||||
|
||||
BOOL SafeFillRange(LPCWSTR dll, DWORD *lower, DWORD *upper)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
ITH_WITH_SEH(ret = FillRange(dll, lower, upper));
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
// jichi 12/13/2013
|
||||
// Use listdlls from SystemInternals
|
||||
void InitFilterTable()
|
||||
{
|
||||
LPCWSTR l[] = { IHF_FILTER_DLL_LIST };
|
||||
enum { capacity = sizeof(l)/sizeof(*l) };
|
||||
|
||||
size_t count = 0;
|
||||
//for (auto p : l)
|
||||
for (size_t i = 0; i < capacity; i++)
|
||||
if (SafeFillRange(l[i], &::filter[count].lower, &::filter[count].upper))
|
||||
count++;
|
||||
}
|
||||
|
||||
// EOF
|
||||
/*
|
||||
|
||||
static DWORD recv_esp, recv_addr;
|
||||
static CONTEXT recover_context;
|
||||
static __declspec(naked) void MySEH()
|
||||
{
|
||||
__asm{
|
||||
mov eax, [esp+0xC]
|
||||
mov edi,eax
|
||||
mov ecx,0xB3
|
||||
mov esi, offset recover_context
|
||||
rep movs
|
||||
mov ecx, [recv_esp]
|
||||
mov [eax+0xC4],ecx
|
||||
mov edx, [recv_addr]
|
||||
mov [eax+0xB8],edx
|
||||
xor eax,eax
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
EXCEPTION_DISPOSITION ExceptHandler(
|
||||
EXCEPTION_RECORD *ExceptionRecord,
|
||||
void * EstablisherFrame,
|
||||
CONTEXT *ContextRecord,
|
||||
void * DispatcherContext )
|
||||
{
|
||||
ContextRecord->Esp=recv_esp;
|
||||
ContextRecord->Eip=recv_addr;
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
int GuardRange(LPWSTR module, DWORD *a, DWORD *b)
|
||||
{
|
||||
int flag=0;
|
||||
__asm
|
||||
{
|
||||
mov eax,seh_recover
|
||||
mov recv_addr,eax
|
||||
push ExceptHandler
|
||||
push fs:[0]
|
||||
mov recv_esp,esp
|
||||
mov fs:[0],esp
|
||||
}
|
||||
flag = FillRange(module, a, b);
|
||||
__asm
|
||||
{
|
||||
seh_recover:
|
||||
mov eax,[esp]
|
||||
mov fs:[0],eax
|
||||
add esp,8
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user