summaryrefslogtreecommitdiff
path: root/src/internal/perk/perk_structs.h
blob: eed16f2b1717db3f8871665027447db27a699625 (plain)
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#ifndef PERK_STRUCTS_H
#define PERK_STRUCTS_H

#ifdef __cplusplus
extern "C" {
#endif

struct pe_raw_image_dos_hdr {
	unsigned char	dos_magic			[0x02];		/* 0x00 */
	unsigned char	dos_cblp			[0x02];		/* 0x02 */
	unsigned char	dos_cp				[0x02];		/* 0x04 */
	unsigned char	dos_crlc			[0x02];		/* 0x06 */
	unsigned char	dos_cparhdr			[0x02];		/* 0x08 */
	unsigned char	dos_minalloc			[0x02];		/* 0x0a */
	unsigned char	dos_maxalloc			[0x02];		/* 0x0c */
	unsigned char	dos_ss				[0x02];		/* 0x0e */
	unsigned char	dos_sp				[0x02];		/* 0x10 */
	unsigned char	dos_csum			[0x02];		/* 0x12 */
	unsigned char	dos_ip				[0x02];		/* 0x14 */
	unsigned char	dos_cs				[0x02];		/* 0x16 */
	unsigned char	dos_lfarlc			[0x02];		/* 0x18 */
	unsigned char	dos_ovno			[0x02];		/* 0x1a */
	unsigned char	dos_res				[0x08];		/* 0x1c */
	unsigned char	dos_oemid			[0x02];		/* 0x24 */
	unsigned char	dos_oeminfo			[0x02];		/* 0x26 */
	unsigned char	dos_res2			[0x14];		/* 0x28 */
	unsigned char	dos_lfanew			[0x04];		/* 0x3c */
};


struct pe_raw_coff_image_hdr {
	unsigned char	cfh_signature			[0x04];		/* 0x00 */
	unsigned char	cfh_machine			[0x02];		/* 0x04 */
	unsigned char	cfh_num_of_sections		[0x02];		/* 0x06 */
	unsigned char	cfh_time_date_stamp		[0x04];		/* 0x08 */
	unsigned char	cfh_ptr_to_sym_tbl		[0x04];		/* 0x0c */
	unsigned char	cfh_num_of_syms			[0x04];		/* 0x10 */
	unsigned char	cfh_size_of_opt_hdr		[0x02];		/* 0x14 */
	unsigned char	cfh_characteristics		[0x02];		/* 0x16 */
};


struct pe_raw_coff_object_hdr {
	unsigned char	cfh_machine			[0x02];		/* 0x00 */
	unsigned char	cfh_num_of_sections		[0x02];		/* 0x02 */
	unsigned char	cfh_time_date_stamp		[0x04];		/* 0x04 */
	unsigned char	cfh_ptr_to_sym_tbl		[0x04];		/* 0x08 */
	unsigned char	cfh_num_of_syms			[0x04];		/* 0x0c */
	unsigned char	cfh_size_of_opt_hdr		[0x02];		/* 0x10 */
	unsigned char	cfh_characteristics		[0x02];		/* 0x12 */
};


struct pe_raw_opt_hdr_std {
	unsigned char	coh_magic			[0x02];		/* 0x00 */
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
};


struct pe_raw_opt_hdr_align {
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
};


struct pe_raw_opt_hdr_vers {
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
};


struct pe_raw_opt_hdr_img {
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
};


struct pe_raw_opt_hdr_ldr {
	unsigned char	coh_loader_flags		[0x04];
	unsigned char	coh_rva_and_sizes		[0x04];
};


struct pe_raw_opt_hdr_dirs {
	unsigned char	coh_export_tbl			[0x08];
	unsigned char	coh_import_tbl			[0x08];
	unsigned char	coh_resource_tbl		[0x08];
	unsigned char	coh_exception_tbl		[0x08];
	unsigned char	coh_certificate_tbl		[0x08];
	unsigned char	coh_base_reloc_tbl		[0x08];
	unsigned char	coh_debug			[0x08];
	unsigned char	coh_arch			[0x08];
	unsigned char	coh_global_ptr			[0x08];
	unsigned char	coh_tls_tbl			[0x08];
	unsigned char	coh_load_config_tbl		[0x08];
	unsigned char	coh_bound_import		[0x08];
	unsigned char	coh_iat				[0x08];
	unsigned char	coh_delay_import_descriptor	[0x08];
	unsigned char	coh_clr_runtime_hdr		[0x08];
	unsigned char	coh_reserved			[0x08];
};


struct pe_raw_data_dirs {
	unsigned char	coh_rva_and_sizes		[0x04];
	unsigned char	coh_export_tbl			[0x08];
	unsigned char	coh_import_tbl			[0x08];
	unsigned char	coh_resource_tbl		[0x08];
	unsigned char	coh_exception_tbl		[0x08];
	unsigned char	coh_certificate_tbl		[0x08];
	unsigned char	coh_base_reloc_tbl		[0x08];
	unsigned char	coh_debug			[0x08];
	unsigned char	coh_arch			[0x08];
	unsigned char	coh_global_ptr			[0x08];
	unsigned char	coh_tls_tbl			[0x08];
	unsigned char	coh_load_config_tbl		[0x08];
	unsigned char	coh_bound_import		[0x08];
	unsigned char	coh_iat				[0x08];
	unsigned char	coh_delay_import_descriptor	[0x08];
	unsigned char	coh_clr_runtime_hdr		[0x08];
	unsigned char	coh_reserved			[0x08];
};


struct pe_raw_opt_hdr_32 {
	unsigned char	coh_magic			[0x02];		/* 0x00 */
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
	unsigned char	coh_base_of_data		[0x04];		/* 0x18 */
	unsigned char	coh_image_base			[0x04];		/* 0x1c */
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
	unsigned char	coh_size_of_stack_reserve	[0x04];		/* 0x48 */
	unsigned char	coh_size_of_stack_commit	[0x04];		/* 0x4c */
	unsigned char	coh_size_of_heap_reserve	[0x04];		/* 0x50 */
	unsigned char	coh_size_of_heap_commit		[0x04];		/* 0x54 */
	unsigned char	coh_loader_flags		[0x04];		/* 0x58 */
	unsigned char	coh_rva_and_sizes		[0x04];		/* 0x5c */
	unsigned char	coh_export_tbl			[0x08];		/* 0x60 */
	unsigned char	coh_import_tbl			[0x08];		/* 0x68 */
	unsigned char	coh_resource_tbl		[0x08];		/* 0x70 */
	unsigned char	coh_exception_tbl		[0x08];		/* 0x78 */
	unsigned char	coh_certificate_tbl		[0x08];		/* 0x80 */
	unsigned char	coh_base_reloc_tbl		[0x08];		/* 0x88 */
	unsigned char	coh_debug			[0x08];		/* 0x90 */
	unsigned char	coh_arch			[0x08];		/* 0x98 */
	unsigned char	coh_global_ptr			[0x08];		/* 0xa0 */
	unsigned char	coh_tls_tbl			[0x08];		/* 0xa8 */
	unsigned char	coh_load_config_tbl		[0x08];		/* 0xb0 */
	unsigned char	coh_bound_import		[0x08];		/* 0xb8 */
	unsigned char	coh_iat				[0x08];		/* 0xc0 */
	unsigned char	coh_delay_import_descriptor	[0x08];		/* 0xc8 */
	unsigned char	coh_clr_runtime_hdr		[0x08];		/* 0xd0 */
	unsigned char	coh_reserved			[0x08];		/* 0xd8 */
};


struct pe_raw_opt_hdr_64 {
	unsigned char	coh_magic			[0x02];		/* 0x00 */
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
	unsigned char	coh_image_base			[0x08];		/* 0x18 */
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
	unsigned char	coh_size_of_stack_reserve	[0x08];		/* 0x48 */
	unsigned char	coh_size_of_stack_commit	[0x08];		/* 0x50 */
	unsigned char	coh_size_of_heap_reserve	[0x08];		/* 0x58 */
	unsigned char	coh_size_of_heap_commit		[0x08];		/* 0x60 */
	unsigned char	coh_loader_flags		[0x04];		/* 0x68 */
	unsigned char	coh_rva_and_sizes		[0x04];		/* 0x6c */
	unsigned char	coh_export_tbl			[0x08];		/* 0x70 */
	unsigned char	coh_import_tbl			[0x08];		/* 0x78 */
	unsigned char	coh_resource_tbl		[0x08];		/* 0x80 */
	unsigned char	coh_exception_tbl		[0x08];		/* 0x88 */
	unsigned char	coh_certificate_tbl		[0x08];		/* 0x90 */
	unsigned char	coh_base_reloc_tbl		[0x08];		/* 0x98 */
	unsigned char	coh_debug			[0x08];		/* 0xa0 */
	unsigned char	coh_arch			[0x08];		/* 0xa8 */
	unsigned char	coh_global_ptr			[0x08];		/* 0xb0 */
	unsigned char	coh_tls_tbl			[0x08];		/* 0xb8 */
	unsigned char	coh_load_config_tbl		[0x08];		/* 0xc0 */
	unsigned char	coh_bound_import		[0x08];		/* 0xc8 */
	unsigned char	coh_iat				[0x08];		/* 0xd0 */
	unsigned char	coh_delay_import_descriptor	[0x08];		/* 0xd8 */
	unsigned char	coh_clr_runtime_hdr		[0x08];		/* 0xe0 */
	unsigned char	coh_reserved			[0x08];		/* 0xe8 */
};


union pe_raw_opt_hdr {
	struct pe_raw_opt_hdr_32    opt_hdr_32;
	struct pe_raw_opt_hdr_64    opt_hdr_64;
};


struct pe_raw_image_data_dir {
	unsigned char	dh_rva				[0x04];		/* 0x00 */
	unsigned char	dh_size				[0x04];		/* 0x04 */
};


struct pe_raw_sec_hdr {
	unsigned char	sh_name				[0x08];		/* 0x00 */
	unsigned char	sh_virtual_size			[0x04];		/* 0x08 */
	unsigned char	sh_virtual_addr			[0x04];		/* 0x0c */
	unsigned char	sh_size_of_raw_data		[0x04];		/* 0x10 */
	unsigned char	sh_ptr_to_raw_data		[0x04];		/* 0x14 */
	unsigned char	sh_ptr_to_relocs		[0x04];		/* 0x18 */
	unsigned char	sh_ptr_to_line_nums		[0x04];		/* 0x1c */
	unsigned char	sh_num_of_relocs		[0x02];		/* 0x20 */
	unsigned char	sh_num_of_line_nums		[0x02];		/* 0x22 */
	unsigned char	sh_characteristics		[0x04];		/* 0x24 */
};


struct pe_raw_export_hdr {
	unsigned char	eh_export_flags			[0x04];		/* 0x00 */
	unsigned char	eh_time_date_stamp		[0x04];		/* 0x04 */
	unsigned char	eh_major_ver			[0x02];		/* 0x08 */
	unsigned char	eh_minor_ver			[0x02];		/* 0x0a */
	unsigned char	eh_name_rva			[0x04];		/* 0x0c */
	unsigned char	eh_ordinal_base			[0x04];		/* 0x10 */
	unsigned char	eh_addr_tbl_entries		[0x04];		/* 0x14 */
	unsigned char	eh_num_of_name_ptrs		[0x04];		/* 0x18 */
	unsigned char	eh_export_addr_tbl_rva		[0x04];		/* 0x1c */
	unsigned char	eh_name_ptr_rva			[0x04];		/* 0x20 */
	unsigned char	eh_ordinal_tbl_rva		[0x04];		/* 0x24 */
};


union pe_raw_export_addr_tbl {
	unsigned char	  ee_export_rva			[0x04];		/* 0x00 */
	unsigned char	  ee_forwarder_rva		[0x04];		/* 0x00 */
};


struct pe_raw_import_hdr {
	unsigned char	ih_import_lookup_tbl_rva	[0x04];		/* 0x00 */
	unsigned char	ih_time_date_stamp		[0x04];		/* 0x04 */
	unsigned char	ih_forwarder_chain		[0x04];		/* 0x08 */
	unsigned char	ih_name_rva			[0x04];		/* 0x0c */
	unsigned char	ih_import_addr_tbl_rva		[0x04];		/* 0x10 */
};


struct pe_raw_import_name {
	unsigned char	ih_name				[0x01];		/* 0x00 */
};


union pe_raw_import_lookup {
	unsigned char	ii_import_lookup_entry_64	[0x08];		/* 0x00 */
	unsigned char	ii_import_lookup_entry_32	[0x04];		/* 0x00 */
};


struct pe_raw_hint_name_entry {
	unsigned char	ii_hint				[0x02];		/* 0x00 */
	unsigned char	ii_name				[0x02];		/* 0x02 */
};


struct pe_raw_coff_symbol {
	unsigned char	cs_name				[0x08];		/* 0x00 */
	unsigned char	cs_value			[0x04];		/* 0x08 */
	unsigned char	cs_section_number		[0x02];		/* 0x0c */
	unsigned char	cs_type				[0x02];		/* 0x0e */
	unsigned char	cs_storage_class		[0x01];		/* 0x10 */
	unsigned char	cs_num_of_aux_symbols		[0x01];		/* 0x11 */
};


struct pe_raw_coff_symbol_name {
	union {
		unsigned char		cs_short_name	[0x08];		/* 0x00 */

		struct {
			unsigned char	cs_zeroes	[0x04];		/* 0x00 */
			unsigned char	cs_offset	[0x04];		/* 0x04 */
		} long_name;
	};
};


struct pe_raw_coff_strtbl {
	unsigned char	cst_size			[0x04];		/* 0x00 */
	unsigned char	cst_data			[0x01];		/* 0x04 */
};


struct pe_raw_coff_reloc {
	unsigned char	rel_rva				[0x04];		/* 0x00 */
	unsigned char	rel_sym				[0x04];		/* 0x04 */
	unsigned char	rel_type			[0x02];		/* 0x08 */
};


struct pe_raw_aux_rec_section {
	unsigned char	aux_size			[0x04];		/* 0x00 */
	unsigned char	aux_num_of_relocs		[0x02];		/* 0x04 */
	unsigned char	aux_num_of_line_nums		[0x02];		/* 0x06 */
	unsigned char	aux_check_sum			[0x04];		/* 0x08 */
	unsigned char	aux_number			[0x02];		/* 0x0c */
	unsigned char	aux_selection			[0x01];		/* 0x0e */
	unsigned char	aux_pad				[0x03];		/* 0x0f */
};

struct pe_raw_archive_common_hdr {
	unsigned char	ar_file_id			[0x10];		/* 0x00 */
	unsigned char	ar_time_date_stamp		[0x0c];		/* 0x10 */
	unsigned char	ar_uid				[0x06];		/* 0x1c */
	unsigned char	ar_gid				[0x06];		/* 0x22 */
	unsigned char	ar_file_mode			[0x08];		/* 0x28 */
	unsigned char	ar_file_size			[0x0a];		/* 0x30 */
	unsigned char	ar_end_tag			[0x02];		/* 0x3a */

};

#ifdef __cplusplus
}
#endif

#endif