utility.h
2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
* This file is part of the Interactive Text Hooker.
* Interactive Text Hooker is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
#include "..\common.h"
#define ITHMAIN
#include "..\sys.h"
#pragma once
#define HEADER_SIZE 0xC
extern int current_hook;
extern WCHAR dll_mutex[];
extern WCHAR dll_name[];
extern int trigger;
//extern DWORD current_process_id;
template <class T,class D, class fComp, class fCopy, class fLength> class AVLTree;
struct FunctionInfo
{
DWORD addr;
DWORD module;
DWORD size;
LPWSTR name;
};
class SCMP;
class SCPY;
class SLEN;
extern AVLTree<char, FunctionInfo, SCMP, SCPY, SLEN> *tree;
void InitFilterTable();
int disasm(BYTE* opcode0);
class TextHook : public Hook
{
public:
int InsertHook();
int InsertHookCode();
int InitHook(const HookParam&, LPWSTR name=0, WORD set_flag=0);
int InitHook(LPVOID addr, DWORD data, DWORD data_ind,
DWORD split_off, DWORD split_ind, WORD type, DWORD len_off=0);
void Send(DWORD dwDataBase, DWORD dwRetn);
int RecoverHook();
int RemoveHook();
int ClearHook();
int ModifyHook(const HookParam&);
int SetHookName(LPWSTR name);
int GetLength(DWORD base, DWORD in);
};
extern TextHook *hookman,*current_available;
void InitDefaultHook();
struct FilterRange
{
DWORD lower,upper;
};
extern FilterRange filter[8];
int FillRange(LPWSTR name,DWORD* lower, DWORD* upper);
extern bool running,live;
extern HANDLE hPipe,hmMutex;
DWORD WINAPI WaitForPipe(LPVOID lpThreadParameter);
DWORD WINAPI CommandPipe(LPVOID lpThreadParameter);
void RequestRefreshProfile();
typedef DWORD (*IdentifyEngineFun)();
typedef int (*InsertDynamicHookFun)(LPVOID addr, DWORD frame, DWORD stack);
extern IdentifyEngineFun IdentifyEngine;
extern InsertDynamicHookFun InsertDynamicHook;
#include "..\ITHDLL.h"