1 /* radare2 - LGPL - Copyright 2016 - Davis, Alex Kornitzer */
2 
3 #ifndef MDMP_SPECS_H
4 #define MDMP_SPECS_H
5 
6 
7 #include <r_types_base.h>
8 
9 #include "mdmp_windefs.h"
10 
11 #define MDMP_MEM_COMMIT	0x01000
12 #define MDMP_MEM_FREE 	0x10000
13 #define MDMP_MEM_RESERVE 0x02000
14 
15 #define MDMP_MEM_IMAGE	0x1000000
16 #define MDMP_MEM_MAPPED	0x0040000
17 #define MDMP_MEM_PRIVATE 	0x0020000
18 
19 #define MDMP_PROCESSOR_ARCHITECTURE_INTEL		0x0000
20 #define MDMP_PROCESSOR_ARCHITECTURE_ARM		0x0005
21 #define MDMP_PROCESSOR_ARCHITECTURE_IA64		0x0006
22 #define MDMP_PROCESSOR_ARCHITECTURE_AMD64		0x0009
23 #define MDMP_PROCESSOR_ARCHITECTURE_UNKNOWN		0xFFFF
24 
25 #define MDMP_VER_NT_WORKSTATION		0x0000001
26 #define MDMP_VER_NT_DOMAIN_CONTROLLER	0x0000002
27 #define MDMP_VER_NT_SERVER			0x0000003
28 
29 #define MDMP_VER_PLATFORM_WIN32s		0x0000
30 #define MDMP_VER_PLATFORM_WIN32_WINDOWS	0x0001
31 #define MDMP_VER_PLATFORM_WIN32_NT		0x0002
32 
33 #define MDMP_VER_SUITE_SMALLBUSINESS			0x00000001
34 #define MDMP_VER_SUITE_ENTERPRISE			0x00000002
35 #define MDMP_VER_SUITE_BACKOFFICE			0x00000004
36 #define MDMP_VER_SUITE_TERMINAL			0x00000010
37 #define MDMP_VER_SUITE_SMALLBUSINESS_RESTRICTED 	0x00000020
38 #define MDMP_VER_SUITE_EMBEDDEDNT			0x00000040
39 #define MDMP_VER_SUITE_DATACENTER			0x00000080
40 #define MDMP_VER_SUITE_SINGLEUSERTS			0x00000100
41 #define MDMP_VER_SUITE_PERSONAL			0x00000200
42 #define MDMP_VER_SUITE_BLADE				0x00000400
43 #define MDMP_VER_SUITE_STORAGE_SERVER		0x00002000
44 #define MDMP_VER_SUITE_COMPUTE_SERVER		0x00004000
45 
46 #define MDMP_MAGIC	"\x4D\x44\x4D\x50\x93\xA7"
47 
48 #define AVRF_MAX_TRACES 32
49 
50 #define MINIDUMP_PAGE_NOACCESS			0x00000001
51 #define MINIDUMP_PAGE_READONLY			0x00000002
52 #define MINIDUMP_PAGE_READWRITE			0x00000004
53 #define MINIDUMP_PAGE_WRITECOPY			0x00000008
54 #define MINIDUMP_PAGE_EXECUTE			0x00000010
55 #define MINIDUMP_PAGE_EXECUTE_READ		0x00000020
56 #define MINIDUMP_PAGE_EXECUTE_READWRITE 	0x00000040
57 #define MINIDUMP_PAGE_EXECUTE_WRITECOPY 	0x00000080
58 #define MINIDUMP_PAGE_GUARD			0x00000100
59 #define MINIDUMP_PAGE_NOCACHE			0x00000200
60 #define MINIDUMP_PAGE_WRITECOMBINE		0x00000400
61 #define MINIDUMP_PAGE_TARGETS_INVALID		0x40000000
62 #define MINIDUMP_PAGE_TARGETS_NO_UPDATE 	0x40000000
63 
64 #define MINIDUMP_MISC1_PROCESS_ID		0x00000001
65 #define MINIDUMP_MISC1_PROCESS_TIMES		0x00000002
66 #define MINIDUMP_MISC1_PROCESSOR_POWER_INFO 	0x00000004
67 
68 #define MINIDUMP_THREAD_INFO_ERROR_THREAD	0x00000001
69 #define MINIDUMP_THREAD_INFO_WRITING_THREAD	0x00000002
70 #define MINIDUMP_THREAD_INFO_EXITED_THREAD	0x00000004
71 #define MINIDUMP_THREAD_INFO_INVALID_INFO	0x00000008
72 #define MINIDUMP_THREAD_INFO_INVALID_CONTEXT	0x00000010
73 #define MINIDUMP_THREAD_INFO_INVALID_TEB	0x00000020
74 
75 
76 typedef ut32 rva_t;
77 typedef ut64 rva64_t;
78 
79 
80 /* Identifies the type of information returned by the MiniDumpCallback
81  * function. */
82 typedef enum minidump_callback_type_t {
83 	MODULE_CALLBACK,
84 	THREAD_CALLBACK,
85 	THREAD_EX_CALLBACK,
86 	INCLUDE_THREAD_CALLBACK,
87 	INCLUDE_MODULE_CALLBACK,
88 	MEMORY_CALLBACK,
89 	CANCEL_CALLBACK,
90 	WRITE_KERNEL_MINIDUMP_CALLBACK,
91 	KERNEL_MINIDUMP_STATUS_CALLBACK,
92 	REMOVE_MEMORY_CALLBACK,
93 	INCLUDE_VM_REGION_CALLBACK,
94 	IO_START_CALLBACK,
95 	IO_WRITE_ALL_CALLBACK,
96 	IO_FINISH_CALLBACK,
97 	READ_MEMORY_FAILURE_CALLBACK,
98 	SECONDARY_FLAGS_CALLBACK
99 } minidump_callback_type;
100 
101 /* Identifies the type of object-specific information. */
102 typedef enum minidump_handle_object_information_type_t {
103 	MINI_HANDLE_OBJECT_INFORMATION_NONE,
104 	MINI_THREAD_INFORMATION_1,
105 	MINI_MUTANT_INFORMATION_1,
106 	MINI_MUTANT_INFORMATION_2,
107 	MINI_PROCESS_INFORMATION_1,
108 	MINI_PROCESS_INFORMATION_2
109 } minidump_handle_object_information_type;
110 
111 typedef enum minidump_secondary_flags_t {
112 	MINI_SECONDARY_WITHOUT_POWER_INFO  = 0X00000001
113 } minidump_secondary_flags;
114 
115 /* Represents the type of a minidump data stream. */
116 typedef enum minidump_stream_type_t {
117 	UNUSED_STREAM			= 0,
118 	RESERVED_STREAM_0 		= 1,
119 	RESERVED_STREAM_1		= 2,
120 	THREAD_LIST_STREAM		= 3,
121 	MODULE_LIST_STREAM		= 4,
122 	MEMORY_LIST_STREAM		= 5,
123 	EXCEPTION_STREAM		= 6,
124 	SYSTEM_INFO_STREAM		= 7,
125 	THREAD_EX_LIST_STREAM		= 8,
126 	MEMORY_64_LIST_STREAM		= 9,
127 	COMMENT_STREAM_A		= 10,
128 	COMMENT_STREAM_W		= 11,
129 	HANDLE_DATA_STREAM		= 12,
130 	FUNCTION_TABLE_STREAM		= 13,
131 	UNLOADED_MODULE_LIST_STREAM	= 14,
132 	MISC_INFO_STREAM		= 15,
133 	MEMORY_INFO_LIST_STREAM		= 16,
134 	THREAD_INFO_LIST_STREAM		= 17,
135 	HANDLE_OPERATION_LIST_STREAM	= 18,
136 	TOKEN_STREAM	= 19,
137 	JAVASCRIPT_DATA_STREAM	= 20,
138 	SYSTEM_MEMORY_INFO_STREAM	= 21,
139 	PROCESS_VM_COUNTERS_STREAM	= 22,
140 	IPT_TRACE_STREAM	= 23,
141 	THREAD_NAMES_STREAM	= 24,
142 	LAST_RESERVED_STREAM		= 0xffff
143 } minidump_stream_type;
144 
145 /* Identifies the type of information that will be written to the minidump file
146  * by the MiniDumpWriteDump function. */
147 typedef enum minidump_type_t {
148 	MINI_DUMP_NORMAL				= 0x00000000,
149 	MINI_DUMP_WITH_DATA_SEGS			= 0x00000001,
150 	MINI_DUMP_WITH_FULL_MEMORY			= 0x00000002,
151 	MINI_DUMP_WITH_HANDLE_DATA			= 0x00000004,
152 	MINI_DUMP_FILTER_MEMORY				= 0x00000008,
153 	MINI_DUMP_SCAN_MEMORY				= 0x00000010,
154 	MINI_DUMP_WITH_UNLOADED_MODULES			= 0x00000020,
155 	MINI_DUMP_WITHIN_DIRECTLY_REFERENCED_MEMORY 	= 0x00000040,
156 	MINI_DUMP_FILTER_MODULE_PATHS			= 0x00000080,
157 	MINI_DUMP_WITH_PROCESS_THREAD_DATA		= 0x00000100,
158 	MINI_DUMP_WITH_PRIVATE_READ_WRITE_MEMORY	= 0x00000200,
159 	MINI_DUMP_WITHOUT_OPTIONAL_DATA			= 0x00000400,
160 	MINI_DUMP_WITH_FULL_MEMORY_INFO			= 0x00000800,
161 	MINI_DUMP_WITH_THREAD_INFO			= 0x00001000,
162 	MINI_DUMP_WITH_CODE_SEGS			= 0x00002000,
163 	MINI_DUMP_WITHOUT_AUXILIARY_STATE		= 0x00004000,
164 	MINI_DUMP_WITH_FULL_AUXILIARY_STATE		= 0x00008000,
165 	MINI_DUMP_WITH_PRIVATE_WRITE_COPY_MEMORY 	= 0x00010000,
166 	MINI_DUMP_IGNORE_INACCESSIBLE_MEMORY		= 0x00020000,
167 	MINI_DUMP_WITH_TOKEN_INFORMATION		= 0x00040000,
168 	MINI_DUMP_WITH_MODULE_HEADERS			= 0x00080000,
169 	MINI_DUMP_FILTER_TRIAGE				= 0x00100000,
170 	MINI_DUMP_VALID_TYPE_FLAGS			= 0x001fffff
171 } minidump_type;
172 
173 /* Identifies the type of module information that will be written to the
174  * minidump file by the MiniDumpWriteDump function. */
175 typedef enum module_write_flags_t {
176 	MODULE_WRITE_MODULE		= 0x0001,
177 	MODULE_WRITE_DATA_SEG		= 0x0002,
178 	MODULE_WRITE_MISC_RECORD	= 0x0004,
179 	MODULE_WRITE_CV_RECORD		= 0x0008,
180 	MODULE_REFERENCED_BY_MEMORY  	= 0x0010,
181 	MODULE_WRITE_TLS_DATA		= 0x0020,
182 	MODULE_WRITE_CODE_SEGS		= 0x0040
183 } module_write_flags;
184 
185 /* Identifies the type of thread information that will be written to the
186  * minidump file by the MiniDumpWriteDump function. */
187 typedef enum thread_write_flags_t {
188 	THREAD_WRITE_THREAD			= 0x0001,
189 	THREAD_WRITE_STACK			= 0x0002,
190 	THREAD_WRITE_CONTEXT			= 0x0004,
191 	THREAD_WRITE_BACKING_STORE		= 0x0008,
192 	THREAD_WRITE_INSTRUCTION_WINDOW  	= 0x0010,
193 	THREAD_WRITE_THREAD_DATA		= 0x0020,
194 	THREAD_WRITE_THREAD_INFO		= 0x0040
195 } thread_write_flags;
196 
197 /* Contains header information for the minidump file. */
198 R_PACKED (
199 struct minidump_header {
200 	ut32 	signature;
201 	ut32	version;
202 	ut32	number_of_streams;
203 	rva_t	stream_directory_rva;
204 	ut32	check_sum;
205 
206 	union {
207 		ut32 	reserved;
208 		ut32	time_date_stamp;
209 	};
210 
211 	ut64	flags;
212 });
213 
214 /* Contains information describing the location of a data stream within a
215  * minidump file. */
216 R_PACKED (
217 struct minidump_location_descriptor {
218 	ut32	data_size;
219 	rva_t	rva;
220 });
221 
222 /* Contains information describing the location of a data stream within a
223  * minidump file. */
224 R_PACKED (
225 struct minidump_location_descriptor64 {
226 	ut64 	data_size;
227 	rva64_t	rva;
228 });
229 
230 /* Describes a range of memory. */
231 R_PACKED (
232 struct minidump_memory_descriptor {
233 	ut64 start_of_memory_range;
234 	struct minidump_location_descriptor memory;
235 });
236 
237 /* Describes a range of memory. */
238 R_PACKED (
239 struct minidump_memory_descriptor64 {
240 	ut64	start_of_memory_range;
241 	ut64	data_size;
242 });
243 
244 /* Contains the information needed to access a specific data stream in a minidump file. */
245 R_PACKED (
246 struct minidump_directory {
247 	ut32	stream_type;
248 	struct minidump_location_descriptor location;
249 });
250 
251 /* Contains exception information. */
252 R_PACKED (
253 struct minidump_exception {
254 	ut32 	exception_code;
255 	ut32	exception_flags;
256 	ut64	exception_record;
257 	ut64	exception_address;
258 	ut32	number_parameters;
259 	ut32	__unused_alignment;
260 	ut64	exception_information[EXCEPTION_MAXIMUM_PARAMETERS];
261 });
262 
263 /* Contains exception information. */
264 R_PACKED (
265 struct minidump_exception_stream {
266 	ut32	thread_id;
267 	ut32	 __alignment;
268 
269 	struct minidump_exception exception_record;
270 	struct minidump_location_descriptor thread_context;
271 });
272 
273 /* Describes an exception. */
274 R_PACKED (
275 struct minidump_exception_record {
276 	ut32	exception_code;
277 	ut32	exception_flags;
278 
279 	struct minidump_exception_record *exception_record;
280 
281 	void 	*exception_address;
282 	ut32	number_parameters;
283 	void /*ULONG_PTR*/ *exception_information[EXCEPTION_MAXIMUM_PARAMETERS];
284 });
285 
286 /* Contains an exception record with a machine-independent description of an
287  * exception and a context record with a machine-dependent description of the
288  * processor context at the time of the exception. */
289 R_PACKED (
290 struct minidump_exception_pointers {
291 	struct minidump_exception_record exception_record;
292 	void /* struct context */ *context_record;
293 });
294 
295 /* Contains the exception information written to the minidump file by the
296  * MiniDumpWriteDump function. */
297 R_PACKED (
298 struct minidump_exception_information {
299 	ut32	thread_id;
300 
301 	struct minidump_exception_pointers *exception_pointers;
302 
303 	ut8 /*bool*/ client_pointers;
304 });
305 
306 /* Represents a function table stream. */
307 R_PACKED (
308 struct minidump_function_table_descriptor {
309 	ut64	minimum_address;
310 	ut64	maximum_address;
311 	ut64	base_address;
312 	ut32	entry_count;
313 	ut32	size_of_align_pad;
314 });
315 
316 /* Represents the header for the function table stream. */
317 R_PACKED (
318 struct minidump_function_table_stream {
319 	ut32	size_of_header;
320 	ut32	size_of_descriptor;
321 	ut32	size_of_native_descriptor;
322 	ut32	size_of_function_entry;
323 	ut32	number_of_descriptors;
324 	ut32	size_of_align_pad;
325 });
326 
327 /* Represents the header for a handle data stream. */
328 R_PACKED (
329 struct minidump_handle_data_stream {
330 	ut32	size_of_header;
331 	ut32	size_of_descriptor;
332 	ut32	number_of_descriptors;
333 	ut32	reserved;
334 });
335 
336 /* Contains the state of an individual system handle at the time the minidump
337  * was written. */
338 R_PACKED (
339 struct minidump_handle_descriptor {
340 	ut64	handle;
341 	rva_t	type_name_rva;
342 	rva_t	object_name_rva;
343 	ut32	attributes;
344 	ut32	granted_access;
345 	ut32	handle_count;
346 	ut32	pointer_count;
347 });
348 
349 /* Contains the state of an individual system handle at the time the minidump
350  * was written. */
351 R_PACKED (
352 struct minidump_handle_descriptor_2 {
353 	ut64	handle;
354 	rva_t	type_name_rva;
355 	rva_t	object_name_rva;
356 	ut32	attributes;
357 	ut32	granted_access;
358 	ut32	handle_count;
359 	ut32	pointer_count;
360 	rva_t	object_info_rva;
361 	ut32	reserved_0;
362 });
363 
364 /* Contains object-specific information for a handle. */
365 R_PACKED (
366 struct minidump_handle_object_information {
367 	rva_t	next_info_rva;
368 	ut32	info_type;
369 	ut32	size_of_info;
370 });
371 
372 /* Contains a list of memory ranges. */
373 R_PACKED (
374 struct minidump_memory_list {
375 	ut32	number_of_memory_ranges;
376 	struct minidump_memory_descriptor memory_ranges[];
377 });
378 
379 /* Contains a list of memory ranges. */
380 R_PACKED (
381 struct minidump_memory64_list {
382 	ut64	number_of_memory_ranges;
383 	rva64_t	base_rva;
384 	struct minidump_memory_descriptor64 memory_ranges[];
385 });
386 
387 /* Describes a region of memory. */
388 R_PACKED (
389 struct minidump_memory_info {
390 	ut64	base_address;
391 	ut64	allocation_base;
392 	ut32	allocation_protect;
393 	ut32	__alignment_1;
394 	ut64	region_size;
395 	ut32	state;
396 	ut32	protect;
397 	ut32	type;
398 	ut32	__alignment_2;
399 });
400 
401 /* Contains a list of memory regions. */
402 R_PACKED (
403 struct minidump_memory_info_list {
404 	ut32	size_of_header;
405 	ut32	size_of_entry;
406 	ut64	number_of_entries;
407 	struct minidump_memory_info entries[];
408 });
409 
410 /* Contains a variety of information. */
411 R_PACKED (
412 struct minidump_misc_info {
413 	ut32	size_of_info;
414 	ut32	flags_1;
415 	ut32	process_id;
416 	ut32	process_create_time;
417 	ut32	process_user_time;
418 	ut32	process_kernel_time;
419 });
420 
421 /* Represents information in the miscellaneous information stream. */
422 R_PACKED (
423 struct minidump_misc_info_2 {
424 	ut32	size_of_info;
425 	ut32	flags_1;
426 	ut32	process_id;
427 	ut32	process_create_time;
428 	ut32	process_user_time;
429 	ut32	process_kernel_time;
430 	ut32	processor_max_mhz;
431 	ut32	processor_current_mhz;
432 	ut32	processor_mhz_limit;
433 	ut32	processor_max_idle_state;
434 	ut32	processor_current_idle_state;
435 });
436 
437 /* Contains version information for a file. This information is language and
438  * code page independent. */
439 R_PACKED (
440 struct vs_fixedfileinfo {
441 	ut32	dw_signature;
442 	ut32	dw_struc_version;
443 	ut32	dw_file_version_ms;
444 	ut32	dw_file_version_ls;
445 	ut32	dw_product_version_ms;
446 	ut32	dw_product_version_ls;
447 	ut32	dw_file_flags_mask;
448 	ut32	dw_file_flags;
449 	ut32	dw_file_os;
450 	ut32	dw_file_type;
451 	ut32	dw_file_subtype;
452 	ut32	dw_file_date_ms;
453 	ut32	dw_file_date_ls;
454 });
455 
456 /* Contains information for a specific module. */
457 R_PACKED (
458 struct minidump_module {
459 	ut64	base_of_image;
460 	ut32	size_of_image;
461 	ut32	check_sum;
462 	ut32	time_date_stamp;
463 	rva_t	module_name_rva;
464 
465 	struct vs_fixedfileinfo version_info;
466 	struct minidump_location_descriptor cv_record;
467 	struct minidump_location_descriptor misc_record;
468 
469 	ut64	reserved_0;
470 	ut64	reserved_1;
471 });
472 
473 /* Contains a list of modules. */
474 R_PACKED (
475 struct minidump_module_list {
476 	ut32 number_of_modules;
477 	struct minidump_module modules[];
478 });
479 
480 /* Describes a string. */
481 R_PACKED (
482 struct minidump_string {
483 	ut32 length;
484 	ut16 *buffer;
485 });
486 
487 /* Contains processor and operating system information. */
488 R_PACKED (
489 struct minidump_system_info {
490 	ut16 processor_architecture;
491 	ut16 processor_level;
492 	ut16 processor_revision;
493 
494 	union {
495 		ut16 reserved_0;
496 		struct {
497 			ut8 number_of_processors;
498 			ut8 product_type;
499 		};
500 	};
501 
502 	ut32 major_version;
503 	ut32 minor_version;
504 	ut32 build_number;
505 	ut32 platform_id;
506 	rva_t csd_version_rva;
507 
508 	union {
509 		ut32 reserved_1;
510 		struct {
511 			ut16 suite_mask;
512 			ut16 reserved_2;
513 		};
514 	};
515 
516 	union {
517 		struct {
518 			ut32 vendor_id[3];
519 			ut32 version_information;
520 			ut32 feature_information;
521 			ut32 amd_extended_cpu_features;
522 		} x86_cpu_info;
523 		struct {
524 			ut64 processor_features[2];
525 		} other_cpu_info;
526 	} cpu;
527 });
528 
529 /* Contains information for a specific thread. */
530 R_PACKED (
531 struct minidump_thread {
532 	ut32 thread_id;
533 	ut32 suspend_count;
534 	ut32 priority_class;
535 	ut32 priority;
536 	ut64 teb;
537 	struct minidump_memory_descriptor stack;
538 	struct minidump_location_descriptor thread_context;
539 });
540 
541 /* Contains a list of threads. */
542 R_PACKED (
543 struct minidump_thread_list {
544 	ut32 number_of_threads;
545 	struct minidump_thread threads[0];
546 });
547 
548 /* Contains extended information for a specific thread. */
549 R_PACKED (
550 struct minidump_thread_ex {
551 	ut32	thread_id;
552 	ut32	suspend_count;
553 	ut32	priority_class;
554 	ut32	priority;
555 	ut64	teb;
556 
557 	struct minidump_memory_descriptor stack;
558 	struct minidump_location_descriptor thread_context;
559 	struct minidump_memory_descriptor backing_store;
560 });
561 
562 /* Contains a list of threads. */
563 R_PACKED (
564 struct minidump_thread_ex_list {
565 	ut32	number_of_threads;
566 	struct minidump_thread_ex threads[];
567 });
568 
569 /* Contains thread state information. */
570 R_PACKED (
571 struct minidump_thread_info {
572 	ut32	thread_id;
573 	ut32	dump_flags;
574 	ut32	dump_error;
575 	ut32	exit_status;
576 	ut64	create_time;
577 	ut64	exit_time;
578 	ut64	kernel_time;
579 	ut64	user_time;
580 	ut64	start_address;
581 	ut64	affinity;
582 });
583 
584 /* Contains a list of threads. */
585 R_PACKED (
586 struct minidump_thread_info_list {
587 	ut32	size_of_header;
588 	ut32	size_of_entry;
589 	ut32	number_of_entries;
590 	struct minidump_thread_info entries[];
591 });
592 
593 /* Contains a token information. */
594 R_PACKED (
595 struct minidump_token_info {
596 	ut32	token_size;
597 	ut32	token_id;
598 	ut64	token_handle;
599 });
600 
601 /* Contains a list of token information. */
602 R_PACKED (
603 struct minidump_token_info_list {
604 	ut32	size_of_list;
605 	ut32	number_of_entries;
606 	ut32	list_header_size;
607 	ut32	element_header_size;
608 	struct minidump_token_info entries[];
609 });
610 
611 /* Contains information about a module that has been unloaded. This information
612  * can help diagnose problems calling code that is no longer loaded. */
613 R_PACKED (
614 struct minidump_unloaded_module {
615 	ut64	base_of_image;
616 	ut32	size_of_image;
617 	ut32	check_sum;
618 	ut32	time_date_stamp;
619 	rva_t	module_name_rva;
620 });
621 
622 /* Contains a list of unloaded modules. */
623 R_PACKED (
624 struct minidump_unloaded_module_list {
625 	ut32	size_of_header;
626 	ut32	size_of_entry;
627 	ut32	number_of_entries;
628 	struct minidump_unloaded_module entries[];
629 });
630 
631 /* Contains user-defined information stored in a data stream. */
632 R_PACKED (
633 struct minidump_user_stream {
634 	ut32	type;
635 	ut32	buffer_size;
636 	void /*PVOID*/ *buffer;
637 });
638 
639 /* Contains a list of user data streams used by the MiniDumpWriteDump function. */
640 R_PACKED (
641 struct minidump_user_stream_information {
642 	ut32	user_stream_count;
643 
644 	struct minidump_user_stream *user_stream_array;
645 });
646 
647 /* Contains information for the MiniDumpCallback function when the callback
648  * type is IncludeThreadCallback. */
649 R_PACKED (
650 struct minidump_include_thread_callback {
651 	ut32	thread_id;
652 });
653 
654 /* Contains module information for the MiniDumpCallback function when the
655  * callback type is ModuleCallback. */
656 R_PACKED (
657 struct minidump_module_callback {
658 	ut16	/*pwchar*/ *full_path;
659 	ut64	base_of_image;
660 	ut32	size_of_image;
661 	ut32	check_sum;
662 	ut32	time_date_stamp;
663 
664 	struct vs_fixedfileinfo version_info;
665 
666 	void	/*pvoid*/ *cv_record;
667 	ut32	size_of_cv_record;
668 	void	/*pvoid*/ *misc_record;
669 	ut32	size_of_misc_record;
670 });
671 
672 /* Contains information for the MiniDumpCallback function when the callback
673  * type is IncludeModuleCallback. */
674 R_PACKED (
675 struct minidump_include_module_callback {
676 	ut64	base_of_image;
677 });
678 
679 /* Contains I/O callback information. This structure is used by the
680  * MiniDumpCallback function when the callback type is IoStartCallback,
681  * IoWriteAllCallback, or IoFinishCallback. */
682 R_PACKED (
683 struct minidump_io_callback {
684 	void	/*handle*/ *Handle;
685 	ut64	offset;
686 	void	/*pvoid*/ *buffer;
687 	ut32	buffer_bytes;
688 });
689 
690 /* Contains information about a failed memory read operation. This structure is
691  * used by the MiniDumpCallback function when the callback type is
692  * ReadMemoryFailureCallback. */
693 R_PACKED (
694 struct minidump_read_memory_failure_callback {
695 	ut64	offset;
696 	ut32	bytes;
697 	st32	/* HRESULT */ failure_status;
698 });
699 
700 /* Contains information returned by the MiniDumpCallback function. */
701 R_PACKED (
702 struct minidump_callback_output {
703 	union {
704 		ut32	module_write_flags;
705 		ut32	thread_write_flags;
706 		ut32	secondary_flags;
707 		struct {
708 			ut64 memory_base;
709 			ut32 memory_size;
710 		};
711 		struct {
712 			ut8  /*bool*/ check_cancel;
713 			ut8  /*bool*/ cancel;
714 		};
715 		void	/*handle*/ *handle;
716 	};
717 
718 	struct {
719 		struct minidump_memory_info vm_region;
720 		ut8  /*bool*/ should_continue;
721 	};
722 
723 	st32 /* HRESULT */ status;
724 });
725 
726 R_PACKED (
727 struct avrf_backtrace_information {
728 	ut32	 depth;
729 	ut32	 index;
730 	ut64	 return_addresses[AVRF_MAX_TRACES];
731 });
732 
733 R_PACKED (
734 struct avrf_handle_operation {
735 	ut64	handle;
736 	ut32	process_id;
737 	ut32	thread_id;
738 	ut32	operation_type;
739 	ut32	spare_0;
740 
741 	struct avrf_backtrace_information back_trace_information;
742 });
743 
744 /* Contains a list of handle operations. */
745 R_PACKED (
746 struct minidump_handle_operation_list {
747 	ut32 size_of_header;
748 	ut32 size_of_entry;
749 	ut32 number_of_entries;
750 	ut32 reserved;
751 	struct avrf_handle_operation entries[];
752 });
753 
754 #endif /* MDMP_SPECS_H */
755