forked from fadetrack/KernelMemoryModule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExcept.h
More file actions
164 lines (138 loc) · 3.78 KB
/
Except.h
File metadata and controls
164 lines (138 loc) · 3.78 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
*
* Copyright (c) 2015-2017 by blindtiger ( blindtiger@foxmail.com )
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. SEe the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original e is blindtiger.
*
*/
#ifndef _EXCEPT_H_
#define _EXCEPT_H_
#ifdef __cplusplus
/* Assume C declarations for C++ */
extern "C" {
#endif /* __cplusplus */
#ifndef _WIN64
typedef struct _DISPATCHER_CONTEXT {
PEXCEPTION_REGISTRATION_RECORD RegistrationPointer;
} DISPATCHER_CONTEXT;
#endif // !_WIN64
#define MAXIMUM_USER_FUNCTION_TABLE_SIZE 512
#define MAXIMUM_KERNEL_FUNCTION_TABLE_SIZE 256
typedef struct _FUNCTION_TABLE_ENTRY32 {
ULONG FunctionTable;
ULONG ImageBase;
ULONG SizeOfImage;
ULONG SizeOfTable;
} FUNCTION_TABLE_ENTRY32, *PFUNCTION_TABLE_ENTRY32;
C_ASSERT(sizeof(FUNCTION_TABLE_ENTRY32) == 0x10);
typedef struct _FUNCTION_TABLE_ENTRY64 {
ULONG64 FunctionTable;
ULONG64 ImageBase;
ULONG SizeOfImage;
ULONG SizeOfTable;
} FUNCTION_TABLE_ENTRY64, *PFUNCTION_TABLE_ENTRY64;
C_ASSERT(sizeof(FUNCTION_TABLE_ENTRY64) == 0x18);
typedef struct _FUNCTION_TABLE {
ULONG CurrentSize;
ULONG MaximumSize;
ULONG Epoch;
BOOLEAN Overflow;
ULONG TableEntry[1];
} FUNCTION_TABLE, *PFUNCTION_TABLE;
C_ASSERT(FIELD_OFFSET(FUNCTION_TABLE, TableEntry) == 0x10);
typedef struct _FUNCTION_TABLE_SPECIAL {
ULONG CurrentSize;
ULONG MaximumSize;
BOOLEAN Overflow;
ULONG TableEntry[1];
} FUNCTION_TABLE_SPECIAL, *PFUNCTION_TABLE_SPECIAL;
C_ASSERT(FIELD_OFFSET(FUNCTION_TABLE_SPECIAL, TableEntry) == 0xc);
ULONG
NTAPI
EncodeSystemPointer(
__in ULONG Pointer
);
ULONG
NTAPI
DecodeSystemPointer(
__in ULONG Pointer
);
VOID
NTAPI
CaptureImageExceptionValues(
__in PVOID Base,
__out PVOID * FunctionTable,
__out PULONG TableSize
);
VOID
NTAPI
InsertInvertedFunctionTable(
__in PVOID ImageBase,
__in ULONG SizeOfImage
);
VOID
NTAPI
RemoveInvertedFunctionTable(
__in PVOID ImageBase
);
VOID
NTAPI
InsertUserInvertedFunctionTable(
__in PVOID ImageBase,
__in ULONG SizeOfImage
);
VOID
NTAPI
RemoveUserInvertedFunctionTable(
__in PVOID ImageBase
);
#ifndef _WIN64
VOID
NTAPI
InsertUserSpecialInvertedFunctionTable(
__in PVOID ImageBase,
__in ULONG SizeOfImage
);
VOID
NTAPI
RemoveUserSpecialInvertedFunctionTable(
__in PVOID ImageBase
);
#else
VOID
NTAPI
InsertWx86UserInvertedFunctionTable(
__in PVOID ImageBase,
__in ULONG SizeOfImage
);
VOID
NTAPI
RemoveWx86UserInvertedFunctionTable(
__in PVOID ImageBase
);
VOID
NTAPI
InsertWx86UserSpecialInvertedFunctionTable(
__in PVOID ImageBase,
__in ULONG SizeOfImage
);
VOID
NTAPI
RemoveWx86UserSpecialInvertedFunctionTable(
__in PVOID ImageBase
);
#endif // !_WIN64
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // !_EXCEPT_H_