oleaut32: Implement OleLoadPictureFile.
[wine.git] / include / minidumpapiset.h
blobfed3e4cac030fb085625a23ce42c7ac97411db15
1 /*
2 * Copyright 2022 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_MINIDUMP_H
20 #define __WINE_MINIDUMP_H
22 #include <pshpack4.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 #define MINIDUMP_SIGNATURE 0x504D444D /* 'MDMP' */
29 #define MINIDUMP_VERSION (42899)
31 typedef DWORD RVA;
32 typedef ULONG64 RVA64;
34 typedef enum _MINIDUMP_TYPE
36 MiniDumpNormal = 0x00000000,
37 MiniDumpWithDataSegs = 0x00000001,
38 MiniDumpWithFullMemory = 0x00000002,
39 MiniDumpWithHandleData = 0x00000004,
40 MiniDumpFilterMemory = 0x00000008,
41 MiniDumpScanMemory = 0x00000010,
42 MiniDumpWithUnloadedModules = 0x00000020,
43 MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
44 MiniDumpFilterModulePaths = 0x00000080,
45 MiniDumpWithProcessThreadData = 0x00000100,
46 MiniDumpWithPrivateReadWriteMemory = 0x00000200,
47 MiniDumpWithoutOptionalData = 0x00000400,
48 MiniDumpWithFullMemoryInfo = 0x00000800,
49 MiniDumpWithThreadInfo = 0x00001000,
50 MiniDumpWithCodeSegs = 0x00002000,
51 MiniDumpValidTypeFlags = 0x01ffffff,
52 } MINIDUMP_TYPE;
54 typedef enum _MINIDUMP_CALLBACK_TYPE
56 ModuleCallback,
57 ThreadCallback,
58 ThreadExCallback,
59 IncludeThreadCallback,
60 IncludeModuleCallback,
61 MemoryCallback,
62 } MINIDUMP_CALLBACK_TYPE;
64 typedef struct _MINIDUMP_THREAD_CALLBACK
66 ULONG ThreadId;
67 HANDLE ThreadHandle;
68 #if defined(__aarch64__)
69 ULONG Pad;
70 #endif
71 CONTEXT Context;
72 ULONG SizeOfContext;
73 ULONG64 StackBase;
74 ULONG64 StackEnd;
75 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
77 typedef struct _MINIDUMP_THREAD_EX_CALLBACK
79 ULONG ThreadId;
80 HANDLE ThreadHandle;
81 #if defined(__aarch64__)
82 ULONG Pad;
83 #endif
84 CONTEXT Context;
85 ULONG SizeOfContext;
86 ULONG64 StackBase;
87 ULONG64 StackEnd;
88 ULONG64 BackingStoreBase;
89 ULONG64 BackingStoreEnd;
90 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
92 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
94 ULONG ThreadId;
95 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
97 typedef enum _THREAD_WRITE_FLAGS
99 ThreadWriteThread = 0x0001,
100 ThreadWriteStack = 0x0002,
101 ThreadWriteContext = 0x0004,
102 ThreadWriteBackingStore = 0x0008,
103 ThreadWriteInstructionWindow = 0x0010,
104 ThreadWriteThreadData = 0x0020,
105 ThreadWriteThreadInfo = 0x0040
106 } THREAD_WRITE_FLAGS;
108 typedef struct _MINIDUMP_MODULE_CALLBACK
110 PWCHAR FullPath;
111 ULONG64 BaseOfImage;
112 ULONG SizeOfImage;
113 ULONG CheckSum;
114 ULONG TimeDateStamp;
115 VS_FIXEDFILEINFO VersionInfo;
116 PVOID CvRecord;
117 ULONG SizeOfCvRecord;
118 PVOID MiscRecord;
119 ULONG SizeOfMiscRecord;
120 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
122 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
124 ULONG64 BaseOfImage;
125 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
127 typedef enum _MODULE_WRITE_FLAGS
129 ModuleWriteModule = 0x0001,
130 ModuleWriteDataSeg = 0x0002,
131 ModuleWriteMiscRecord = 0x0004,
132 ModuleWriteCvRecord = 0x0008,
133 ModuleReferencedByMemory = 0x0010,
134 ModuleWriteTlsData = 0x0020,
135 ModuleWriteCodeSegs = 0x0040,
136 } MODULE_WRITE_FLAGS;
138 typedef struct _MINIDUMP_CALLBACK_INPUT
140 ULONG ProcessId;
141 HANDLE ProcessHandle;
142 ULONG CallbackType;
143 union
145 MINIDUMP_THREAD_CALLBACK Thread;
146 MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
147 MINIDUMP_MODULE_CALLBACK Module;
148 MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
149 MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
150 } DUMMYUNIONNAME;
151 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
153 typedef struct _MINIDUMP_CALLBACK_OUTPUT
155 union
157 ULONG ModuleWriteFlags;
158 ULONG ThreadWriteFlags;
159 struct
161 ULONG64 MemoryBase;
162 ULONG MemorySize;
163 } DUMMYSTRUCTNAME;
164 } DUMMYUNIONNAME;
165 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
167 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID, const PMINIDUMP_CALLBACK_INPUT, PMINIDUMP_CALLBACK_OUTPUT);
169 typedef struct _MINIDUMP_CALLBACK_INFORMATION
171 MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
172 void *CallbackParam;
173 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
175 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR
177 ULONG32 DataSize;
178 RVA Rva;
179 } MINIDUMP_LOCATION_DESCRIPTOR;
181 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64
183 ULONG64 DataSize;
184 RVA64 Rva;
185 } MINIDUMP_LOCATION_DESCRIPTOR64;
187 typedef struct _MINIDUMP_DIRECTORY
189 ULONG32 StreamType;
190 MINIDUMP_LOCATION_DESCRIPTOR Location;
191 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
193 typedef struct _MINIDUMP_EXCEPTION
195 ULONG32 ExceptionCode;
196 ULONG32 ExceptionFlags;
197 ULONG64 ExceptionRecord;
198 ULONG64 ExceptionAddress;
199 ULONG32 NumberParameters;
200 ULONG32 __unusedAlignment;
201 ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
202 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
204 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
206 DWORD ThreadId;
207 PEXCEPTION_POINTERS ExceptionPointers;
208 BOOL ClientPointers;
209 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
211 typedef struct MINIDUMP_EXCEPTION_STREAM
213 ULONG32 ThreadId;
214 ULONG32 __alignment;
215 MINIDUMP_EXCEPTION ExceptionRecord;
216 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
217 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
219 typedef struct _MINIDUMP_HEADER
221 ULONG32 Signature;
222 ULONG32 Version;
223 ULONG32 NumberOfStreams;
224 RVA StreamDirectoryRva;
225 ULONG32 CheckSum;
226 union
228 ULONG32 Reserved;
229 ULONG32 TimeDateStamp;
230 } DUMMYUNIONNAME;
231 ULONG64 Flags;
232 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
234 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR
236 ULONG64 StartOfMemoryRange;
237 MINIDUMP_LOCATION_DESCRIPTOR Memory;
238 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
240 typedef struct _MINIDUMP_MEMORY_LIST
242 ULONG32 NumberOfMemoryRanges;
243 MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges[1]; /* FIXME: 0-sized array not supported */
244 } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
246 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64
248 ULONG64 StartOfMemoryRange;
249 ULONG64 DataSize;
250 } MINIDUMP_MEMORY_DESCRIPTOR64, *PMINIDUMP_MEMORY_DESCRIPTOR64;
252 typedef struct _MINIDUMP_MEMORY64_LIST
254 ULONG64 NumberOfMemoryRanges;
255 RVA64 BaseRva;
256 MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges[1]; /* FIXME: 0-sized array not supported */
257 } MINIDUMP_MEMORY64_LIST, *PMINIDUMP_MEMORY64_LIST;
259 #define MINIDUMP_MISC1_PROCESS_ID 0x00000001
260 #define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002
262 typedef struct _MINIDUMP_MISC_INFO
264 ULONG32 SizeOfInfo;
265 ULONG32 Flags1;
266 ULONG32 ProcessId;
267 ULONG32 ProcessCreateTime;
268 ULONG32 ProcessUserTime;
269 ULONG32 ProcessKernelTime;
270 } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
272 typedef struct _MINIDUMP_MODULE
274 ULONG64 BaseOfImage;
275 ULONG32 SizeOfImage;
276 ULONG32 CheckSum;
277 ULONG32 TimeDateStamp;
278 RVA ModuleNameRva;
279 VS_FIXEDFILEINFO VersionInfo;
280 MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
281 MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
282 ULONG64 Reserved0;
283 ULONG64 Reserved1;
284 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
286 typedef struct _MINIDUMP_MODULE_LIST
288 ULONG32 NumberOfModules;
289 MINIDUMP_MODULE Modules[1]; /* FIXME: 0-sized array not supported */
290 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
292 typedef struct _MINIDUMP_STRING
294 ULONG32 Length;
295 WCHAR Buffer[1]; /* FIXME: O-sized array not supported */
296 } MINIDUMP_STRING, *PMINIDUMP_STRING;
298 typedef union _CPU_INFORMATION
300 struct
302 ULONG32 VendorId[3];
303 ULONG32 VersionInformation;
304 ULONG32 FeatureInformation;
305 ULONG32 AMDExtendedCpuFeatures;
306 } X86CpuInfo;
307 struct
309 ULONG64 ProcessorFeatures[2];
310 } OtherCpuInfo;
311 } CPU_INFORMATION, *PCPU_INFORMATION;
313 typedef struct _MINIDUMP_SYSTEM_INFO
315 USHORT ProcessorArchitecture;
316 USHORT ProcessorLevel;
317 USHORT ProcessorRevision;
318 union
320 USHORT Reserved0;
321 struct
323 UCHAR NumberOfProcessors;
324 UCHAR ProductType;
325 } DUMMYSTRUCTNAME;
326 } DUMMYUNIONNAME;
328 ULONG32 MajorVersion;
329 ULONG32 MinorVersion;
330 ULONG32 BuildNumber;
331 ULONG32 PlatformId;
333 RVA CSDVersionRva;
334 union
336 ULONG32 Reserved1;
337 struct
339 USHORT SuiteMask;
340 USHORT Reserved2;
341 } DUMMYSTRUCTNAME;
342 } DUMMYUNIONNAME1;
343 CPU_INFORMATION Cpu;
344 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
346 typedef struct _MINIDUMP_THREAD
348 ULONG32 ThreadId;
349 ULONG32 SuspendCount;
350 ULONG32 PriorityClass;
351 ULONG32 Priority;
352 ULONG64 Teb;
353 MINIDUMP_MEMORY_DESCRIPTOR Stack;
354 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
355 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
357 typedef struct _MINIDUMP_THREAD_LIST
359 ULONG32 NumberOfThreads;
360 MINIDUMP_THREAD Threads[1]; /* FIXME: no support of 0 sized array */
361 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
363 typedef struct _MINIDUMP_USER_STREAM
365 ULONG32 Type;
366 ULONG BufferSize;
367 void *Buffer;
368 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
370 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
372 ULONG UserStreamCount;
373 PMINIDUMP_USER_STREAM UserStreamArray;
374 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
376 typedef struct _MINIDUMP_HANDLE_DATA_STREAM
378 ULONG32 SizeOfHeader;
379 ULONG32 SizeOfDescriptor;
380 ULONG32 NumberOfDescriptors;
381 ULONG32 Reserved;
382 } MINIDUMP_HANDLE_DATA_STREAM, *PMINIDUMP_HANDLE_DATA_STREAM;
384 typedef struct _MINIDUMP_HANDLE_DESCRIPTOR
386 ULONG64 Handle;
387 RVA TypeNameRva;
388 RVA ObjectNameRva;
389 ULONG32 Attributes;
390 ULONG32 GrantedAccess;
391 ULONG32 HandleCount;
392 ULONG32 PointerCount;
393 } MINIDUMP_HANDLE_DESCRIPTOR, *PMINIDUMP_HANDLE_DESCRIPTOR;
395 typedef struct _MINIDUMP_HANDLE_DESCRIPTOR_2
397 ULONG64 Handle;
398 RVA TypeNameRva;
399 RVA ObjectNameRva;
400 ULONG32 Attributes;
401 ULONG32 GrantedAccess;
402 ULONG32 HandleCount;
403 ULONG32 PointerCount;
404 RVA ObjectInfoRva;
405 ULONG32 Reserved0;
406 } MINIDUMP_HANDLE_DESCRIPTOR_2, *PMINIDUMP_HANDLE_DESCRIPTOR_2;
408 typedef struct _MINIDUMP_THREAD_INFO
410 ULONG32 ThreadId;
411 ULONG32 DumpFlags;
412 ULONG32 DumpError;
413 ULONG32 ExitStatus;
414 ULONG64 CreateTime;
415 ULONG64 ExitTime;
416 ULONG64 KernelTime;
417 ULONG64 UserTime;
418 ULONG64 StartAddress;
419 ULONG64 Affinity;
420 } MINIDUMP_THREAD_INFO, *PMINIDUMP_THREAD_INFO;
422 typedef struct _MINIDUMP_THREAD_INFO_LIST
424 ULONG SizeOfHeader;
425 ULONG SizeOfEntry;
426 ULONG NumberOfEntries;
427 } MINIDUMP_THREAD_INFO_LIST, *PMINIDUMP_THREAD_INFO_LIST;
429 typedef struct _MINIDUMP_UNLOADED_MODULE
431 ULONG64 BaseOfImage;
432 ULONG32 SizeOfImage;
433 ULONG32 CheckSum;
434 ULONG32 TimeDateStamp;
435 RVA ModuleNameRva;
436 } MINIDUMP_UNLOADED_MODULE, *PMINIDUMP_UNLOADED_MODULE;
438 typedef struct _MINIDUMP_UNLOADED_MODULE_LIST
440 ULONG32 SizeOfHeader;
441 ULONG32 SizeOfEntry;
442 ULONG32 NumberOfEntries;
443 } MINIDUMP_UNLOADED_MODULE_LIST, *PMINIDUMP_UNLOADED_MODULE_LIST;
445 typedef enum _MINIDUMP_STREAM_TYPE
447 UnusedStream = 0,
448 ReservedStream0 = 1,
449 ReservedStream1 = 2,
450 ThreadListStream = 3,
451 ModuleListStream = 4,
452 MemoryListStream = 5,
453 ExceptionStream = 6,
454 SystemInfoStream = 7,
455 ThreadExListStream = 8,
456 Memory64ListStream = 9,
457 CommentStreamA = 10,
458 CommentStreamW = 11,
459 HandleDataStream = 12,
460 FunctionTableStream = 13,
461 UnloadedModuleListStream = 14,
462 MiscInfoStream = 15,
463 MemoryInfoListStream = 16,
464 ThreadInfoListStream = 17,
465 HandleOperationListStream = 18,
466 TokenStream = 19,
467 JavaScriptDataStream = 20,
468 SystemMemoryInfoStream = 21,
469 ProcessVmCountersStream = 22,
470 IptTraceStream = 23,
471 ThreadNamesStream = 24,
473 LastReservedStream = 0xffff
474 } MINIDUMP_STREAM_TYPE;
476 BOOL WINAPI MiniDumpWriteDump(HANDLE process, DWORD pid, HANDLE hfile, MINIDUMP_TYPE dumptype,
477 PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
478 PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
479 BOOL WINAPI MiniDumpReadDumpStream(PVOID base, ULONG index, PMINIDUMP_DIRECTORY *dir, void **streamptr,
480 ULONG *stream_size);
482 #ifdef __cplusplus
484 #endif
486 #include <poppack.h>
488 #endif /* __WINE_MINIDUMP_H */