-
Notifications
You must be signed in to change notification settings - Fork 2
/
PointerHandler.h
82 lines (72 loc) · 2.66 KB
/
PointerHandler.h
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
82
#pragma once
#include <list>
#include <string>
#include "Pointer.h"
#include "GenericVariable.h"
using namespace std;
class PointerHandler
{
public:
PointerHandler(VariableMap* Map);
bool CreatePointer(string& PtrId, string& AddressType,
__int64 Offsetting, unsigned int Size, unsigned int HeaderSize);
unsigned int GetPtrAddress(string& PtrId, unsigned int ScriptPos, unsigned int& Size);
bool CreatePointerList(string& ListId, const char* Filename, string& PtrId);
bool CreatePointerTable(string& TblId, unsigned int Start, unsigned int Increment,
string& PtrId);
bool CreateEmbPointerTable(string& TblId, unsigned int Start, unsigned int PtrCount, string& PtrId);
unsigned int GetListAddress(string& ListId, unsigned int ScriptPos,
unsigned int& Size, unsigned int& WritePos);
unsigned int GetTableAddress(string& TblId, unsigned int ScriptPos,
unsigned int& Size, unsigned int& WritePos);
unsigned int GetTableAddress(string& TblId, unsigned int ScriptPos,
unsigned int PtrNum, unsigned int& Size, unsigned int& WritePos);
unsigned int GetEmbTableAddress(string& TblId, unsigned int ScriptPos, unsigned int& Size, unsigned int& WritePos);
unsigned int GetEmbTableAddress(string& TblId, unsigned int ScriptPos, unsigned int PtrNum,
unsigned int& Size, unsigned int& WritePos);
unsigned int GetPtrSize(string& PtrId);
private:
VariableMap* Map;
};
class PointerList
{
public:
PointerList();
~PointerList();
bool Create(const char* Filename, CustomPointer& CustPointer);
unsigned int GetAddress(unsigned int TextPosition, unsigned int& Size, unsigned int& WritePos);
private:
std::list<unsigned int> LocationList;
std::list<unsigned int>::iterator LocationIt;
unsigned int Location;
CustomPointer Pointer;
};
class PointerTable
{
public:
PointerTable();
~PointerTable();
bool Create(unsigned int Inc, unsigned int StartOffset, CustomPointer& CustPointer);
unsigned int GetAddress(unsigned int TextPosition, unsigned int& Size, unsigned int& WritePos);
unsigned int GetAddress(unsigned int TextPosition, unsigned int PtrNum, unsigned int& Size, unsigned int& WritePos);
private:
unsigned int Increment;
unsigned int CurOffset;
unsigned int TableStart;
CustomPointer Pointer;
};
class EmbPointerTable
{
public:
EmbPointerTable();
~EmbPointerTable();
bool Create(unsigned int StartOffset, unsigned int PointerCount, CustomPointer& CustPointer);
unsigned int GetAddress(unsigned int TextPosition, unsigned int& Size, unsigned int& WritePos);
unsigned int GetAddress(unsigned int TextPosition, unsigned int PtrNum,
unsigned int &Size, unsigned int &WritePos);
private:
unsigned int TableStart;
unsigned int CurPointer;
unsigned int PtrCount;
CustomPointer Pointer;
};