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
use std::mem;
use crate::{util::CStr, Pod};
use super::Ptr;
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct TypeDescriptor {
pub vftable: Ptr,
pub spare: Ptr<CStr>,
#[cfg_attr(feature = "serde", serde(skip))]
pub name: [u8; 0],
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct PMD {
pub mdisp: i32,
pub pdisp: i32,
pub vdisp: i32,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct FuncInfo {
pub magic_number: u32,
pub max_state: i32,
pub unwind_map: Ptr,
pub try_blocks: u32,
pub try_block_map: Ptr<UnwindMapEntry>,
pub ip_map_entries: u32,
pub ip_to_state_map: Ptr,
pub es_type_list: Ptr<ESTypeList>,
pub eh_flags: i32,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct UnwindMapEntry {
pub to_state: i32,
pub action: Ptr,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct TryBlockMapEntry {
pub try_low: i32,
pub try_high: i32,
pub catch_high: i32,
pub catches: i32,
pub handler_array: Ptr<[HandlerType]>,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct HandlerType {
pub adjectives: u32,
pub ty: Ptr<TypeDescriptor>,
pub disp_catch_obj: i32,
pub address_of_handler: Ptr,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct ESTypeList {
pub count: i32,
pub type_array: Ptr<[HandlerType]>,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct ThrowInfo {
pub attributes: u32,
pub unwind: Ptr,
pub forward_compat: Ptr,
pub catchable_type_array: Ptr<CatchableTypeArray>,
}
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct CatchableTypeArray {
pub catchable_types: i32,
#[cfg_attr(feature = "serde", serde(skip))]
pub array: [Ptr<CatchableType>; 0],
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct CatchableType {
pub properties: u32,
pub type_descriptor: Ptr<TypeDescriptor>,
pub pmd: PMD,
pub size_or_offset: i32,
pub copy_function: Ptr,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct RTTICompleteObjectLocator {
pub signature: u32,
pub offset: u32,
pub cd_offset: u32,
pub type_descriptor: Ptr<TypeDescriptor>,
pub class_descriptor: Ptr<RTTIClassHierarchyDescriptor>,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct RTTIClassHierarchyDescriptor {
pub signature: u32,
pub attributes: u32,
pub num_base_classes: u32,
pub base_class_array: Ptr<[Ptr<RTTIBaseClassDescriptor>]>,
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
#[repr(C)]
pub struct RTTIBaseClassDescriptor {
pub type_descriptor: Ptr<TypeDescriptor>,
pub num_contained_bases: u32,
pub pmd: PMD,
pub attributes: u32,
}
unsafe impl Pod for TypeDescriptor {}
unsafe impl Pod for PMD {}
unsafe impl Pod for FuncInfo {}
unsafe impl Pod for UnwindMapEntry {}
unsafe impl Pod for TryBlockMapEntry {}
unsafe impl Pod for HandlerType {}
unsafe impl Pod for ESTypeList {}
unsafe impl Pod for ThrowInfo {}
unsafe impl Pod for CatchableTypeArray {}
unsafe impl Pod for CatchableType {}
unsafe impl Pod for RTTICompleteObjectLocator {}
unsafe impl Pod for RTTIClassHierarchyDescriptor {}
unsafe impl Pod for RTTIBaseClassDescriptor {}
const _: [(); 8] = [(); mem::size_of::<TypeDescriptor>()]; const _: [(); 12] = [(); mem::size_of::<PMD>()];
const _: [(); 36] = [(); mem::size_of::<FuncInfo>()];
const _: [(); 8] = [(); mem::size_of::<UnwindMapEntry>()];
const _: [(); 20] = [(); mem::size_of::<TryBlockMapEntry>()];
const _: [(); 16] = [(); mem::size_of::<HandlerType>()];
const _: [(); 8] = [(); mem::size_of::<ESTypeList>()];
const _: [(); 16] = [(); mem::size_of::<ThrowInfo>()];
const _: [(); 4] = [(); mem::size_of::<CatchableTypeArray>()]; const _: [(); 28] = [(); mem::size_of::<CatchableType>()];
const _: [(); 20] = [(); mem::size_of::<RTTICompleteObjectLocator>()];
const _: [(); 16] = [(); mem::size_of::<RTTIClassHierarchyDescriptor>()];
const _: [(); 24] = [(); mem::size_of::<RTTIBaseClassDescriptor>()];