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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright (c) 1989-1993 Microsoft Corporation
Module Name:
ntxcapi.h
Abstract:
This module contains procedure prototypes and data structures
that support structured exception handling.
Author:
Mark Lucovsky (markl) 29-Jun-1989
Revision History:
--*/
#ifndef _NTXCAPI_
#define _NTXCAPI_
// begin_ntddk
//
// Exception flag definitions.
//
// begin_winnt
#define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception
// end_winnt
// end_ntddk
#define EXCEPTION_UNWINDING 0x2 // Unwind is in progress
#define EXCEPTION_EXIT_UNWIND 0x4 // Exit unwind is in progress
#define EXCEPTION_STACK_INVALID 0x8 // Stack out of limits or unaligned
#define EXCEPTION_NESTED_CALL 0x10 // Nested exception handler call
#define EXCEPTION_TARGET_UNWIND 0x20 // Target unwind in progress
#define EXCEPTION_COLLIDED_UNWIND 0x40 // Collided exception handler call
#define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
#define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
#define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
#define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
// begin_ntddk begin_nthal
//
// Define maximum number of exception parameters.
//
// begin_winnt
#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
//
// Exception record definition.
//
typedef struct _EXCEPTION_RECORD {
/*lint -e18 */ // Don't complain about different definitions
NTSTATUS ExceptionCode;
/*lint +e18 */ // Resume checking for different definitions
ULONG ExceptionFlags;
struct _EXCEPTION_RECORD *ExceptionRecord;
PVOID ExceptionAddress;
ULONG NumberParameters;
ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
} EXCEPTION_RECORD;
typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
//
// Typedef for pointer returned by exception_info()
//
typedef struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
// end_winnt
// end_ntddk end_nthal
//
// Define IEEE exception information.
//
// Define 32-, 64-, 80-, and 128-bit IEEE floating operand structures.
//
typedef struct _FP_32 {
ULONG W[1];
} FP_32, *PFP_32;
typedef struct _FP_64 {
ULONG W[2];
} FP_64, *PFP_64;
typedef struct _FP_80 {
ULONG W[3];
} FP_80, *PFP_80;
typedef struct _FP_128 {
ULONG W[4];
} FP_128, *PFP_128;
//
// Define IEEE compare result values.
//
typedef enum _FP_IEEE_COMPARE_RESULT {
FpCompareEqual,
FpCompareGreater,
FpCompareLess,
FpCompareUnordered
} FP_IEEE_COMPARE_RESULT;
//
// Define IEEE format and result precision values.
//
typedef enum _FP__IEEE_FORMAT {
FpFormatFp32,
FpFormatFp64,
FpFormatFp80,
FpFormatFp128,
FpFormatI16,
FpFormatI32,
FpFormatI64,
FpFormatU16,
FpFormatU32,
FpFormatU64,
FpFormatCompare,
FpFormatString
} FP_IEEE_FORMAT;
//
// Define IEEE operation code values.
//
typedef enum _FP_IEEE_OPERATION_CODE {
FpCodeUnspecified,
FpCodeAdd,
FpCodeSubtract,
FpCodeMultiply,
FpCodeDivide,
FpCodeSquareRoot,
FpCodeRemainder,
FpCodeCompare,
FpCodeConvert,
FpCodeRound,
FpCodeTruncate,
FpCodeFloor,
FpCodeCeil,
FpCodeAcos,
FpCodeAsin,
FpCodeAtan,
FpCodeAtan2,
FpCodeCabs,
FpCodeCos,
FpCodeCosh,
FpCodeExp,
FpCodeFabs,
FpCodeFmod,
FpCodeFrexp,
FpCodeHypot,
FpCodeLdexp,
FpCodeLog,
FpCodeLog10,
FpCodeModf,
FpCodePow,
FpCodeSin,
FpCodeSinh,
FpCodeTan,
FpCodeTanh,
FpCodeY0,
FpCodeY1,
FpCodeYn
} FP_OPERATION_CODE;
//
// Define IEEE rounding modes.
//
typedef enum _FP__IEEE_ROUNDING_MODE {
FpRoundNearest,
FpRoundMinusInfinity,
FpRoundPlusInfinity,
FpRoundChopped
} FP_IEEE_ROUNDING_MODE;
//
// Define IEEE floating exception operand structure.
//
typedef struct _FP_IEEE_VALUE {
union {
SHORT I16Value;
USHORT U16Value;
LONG I32Value;
ULONG U32Value;
PVOID StringValue;
ULONG CompareValue;
FP_32 Fp32Value;
LARGE_INTEGER I64Value;
ULARGE_INTEGER U64Value;
FP_64 Fp64Value;
FP_80 Fp80Value;
FP_128 Fp128Value;
} Value;
struct {
ULONG RoundingMode : 2;
ULONG Inexact : 1;
ULONG Underflow : 1;
ULONG Overflow : 1;
ULONG ZeroDivide : 1;
ULONG InvalidOperation : 1;
ULONG OperandValid : 1;
ULONG Format : 4;
ULONG Precision : 4;
ULONG Operation : 12;
ULONG Spare : 3;
ULONG HardwareException : 1;
} Control;
} FP_IEEE_VALUE, *PFP_IEEE_VALUE;
//
// Define IEEE exception infomation structure.
//
#include "pshpack4.h"
typedef struct _FP_IEEE_RECORD {
FP_IEEE_VALUE Operand1;
FP_IEEE_VALUE Operand2;
FP_IEEE_VALUE Result;
} FP_IEEE_RECORD, *PFP_IEEE_RECORD;
#include "poppack.h"
//
// Exception dispatcher routine definition.
//
NTSYSAPI
BOOLEAN
NTAPI
RtlDispatchException (
IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT ContextRecord
);
//
// Exception handling procedure prototypes.
//
NTSYSAPI
VOID
NTAPI
RtlRaiseStatus (
IN NTSTATUS Status
);
NTSYSAPI
VOID
NTAPI
RtlRaiseException (
IN PEXCEPTION_RECORD
);
NTSYSAPI
VOID
NTAPI
RtlUnwind (
IN PVOID TargetFrame OPTIONAL,
IN PVOID TargetIp OPTIONAL,
IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
IN PVOID ReturnValue
);
#if defined(_ALPHA_)
NTSYSAPI
VOID
NTAPI
RtlUnwindRfp (
IN PVOID TargetRealFrame OPTIONAL,
IN PVOID TargetIp OPTIONAL,
IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
IN PVOID ReturnValue
);
#endif
#if defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_)
NTSYSAPI
VOID
NTAPI
RtlUnwind2 (
IN PVOID TargetFrame OPTIONAL,
IN PVOID TargetIp OPTIONAL,
IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
IN PVOID ReturnValue,
IN PCONTEXT ContextRecord
);
#endif
//
// Continue execution.
//
NTSYSAPI
NTSTATUS
NTAPI
NtContinue (
IN PCONTEXT ContextRecord,
IN BOOLEAN TestAlert
);
//
// Raise exception.
//
NTSYSAPI
NTSTATUS
NTAPI
NtRaiseException (
IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT ContextRecord,
IN BOOLEAN FirstChance
);
#endif //_NTXCAPI_
|