Textractor_test/vnrhook/texthook.h

48 lines
1.0 KiB
C
Raw Normal View History

2018-08-23 23:53:23 +08:00
#pragma once
// texthook.h
// 8/24/2013 jichi
// Branch: IHF_DLL/IHF_CLIENT.h, rev 133
//
// 8/24/2013 TODO:
// - Clean up this file
// - Reduce global variables. Use namespaces or singleton classes instead.
#include "common.h"
2018-08-25 00:50:20 +08:00
#include "types.h"
2018-08-23 23:53:23 +08:00
2018-11-11 12:29:12 +08:00
void SetTrigger();
2018-08-23 23:53:23 +08:00
// jichi 9/25/2013: This class will be used by NtMapViewOfSectionfor
// interprocedure communication, where constructor/destructor will NOT work.
2018-08-24 03:25:33 +08:00
2018-08-23 23:53:23 +08:00
class TextHook
{
public:
HookParam hp;
union
{
uint64_t address;
void* location;
}; // Absolute address
bool Insert(HookParam hp, DWORD set_flag);
void Clear();
private:
static DWORD WINAPI Reader(LPVOID hookPtr);
2018-08-26 03:45:25 +08:00
bool InsertHookCode();
bool InsertReadCode();
void Send(DWORD dwDatabase);
int GetLength(DWORD base, DWORD in); // jichi 12/25/2013: Return 0 if failed
2018-08-26 03:45:25 +08:00
void RemoveHookCode();
void RemoveReadCode();
2018-11-11 12:29:12 +08:00
HANDLE readerThread, readerEvent;
BYTE trampoline[120];
2018-08-23 23:53:23 +08:00
};
2018-11-11 12:29:12 +08:00
enum { MAX_HOOK = 300, HOOK_BUFFER_SIZE = MAX_HOOK * sizeof(TextHook), HOOK_SECTION_SIZE = HOOK_BUFFER_SIZE * 2 };
2018-08-23 23:53:23 +08:00
// EOF