Textractor/vnrhook/texthook.h

41 lines
964 B
C
Raw Normal View History

2018-08-23 11:53:23 -04: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-24 12:50:20 -04:00
#include "types.h"
2018-08-23 11:53:23 -04:00
2018-11-10 23:29:12 -05:00
void SetTrigger();
2018-08-23 11:53:23 -04:00
// jichi 9/25/2013: This class will be used by NtMapViewOfSectionfor
// interprocedure communication, where constructor/destructor will NOT work.
2018-08-23 15:25:33 -04:00
2018-08-23 11:53:23 -04:00
class TextHook
{
2018-08-25 15:45:25 -04:00
bool InsertHookCode();
bool InsertReadCode();
int GetLength(DWORD base, DWORD in); // jichi 12/25/2013: Return 0 if failed
2018-08-25 15:45:25 -04:00
void RemoveHookCode();
void RemoveReadCode();
2018-11-10 23:29:12 -05:00
2018-08-23 11:53:23 -04:00
public:
2018-08-23 15:25:33 -04:00
HookParam hp;
char hookName[HOOK_NAME_SIZE];
2018-08-26 15:14:45 -04:00
BYTE trampoline[120];
HANDLE readerHandle;
2018-08-23 11:53:23 -04:00
2018-08-25 15:45:25 -04:00
bool InsertHook();
2018-11-10 23:29:12 -05:00
void InitHook(HookParam hp, LPCSTR name, DWORD set_flag);
void Send(DWORD dwDataBase);
2018-08-25 15:45:25 -04:00
void ClearHook();
2018-08-23 11:53:23 -04:00
};
2018-11-10 23:29:12 -05:00
enum { MAX_HOOK = 300, HOOK_BUFFER_SIZE = MAX_HOOK * sizeof(TextHook), HOOK_SECTION_SIZE = HOOK_BUFFER_SIZE * 2 };
2018-08-23 11:53:23 -04:00
// EOF