Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

750 lines
19 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. minidump.x
  5. Abstract:
  6. Public header file for minidumps.
  7. Author:
  8. Matthew D Hendel (math) 28-Apr-1999
  9. Revision History:
  10. --*/
  11. // HEXTRACT: hide_line begin_dbghelp begin_imagehlp
  12. #include <pshpack4.h>
  13. #pragma warning(disable:4200) // Zero length array
  14. #define MINIDUMP_SIGNATURE ('PMDM')
  15. #define MINIDUMP_VERSION (42899)
  16. typedef DWORD RVA;
  17. typedef ULONG64 RVA64;
  18. typedef struct _MINIDUMP_LOCATION_DESCRIPTOR {
  19. ULONG32 DataSize;
  20. RVA Rva;
  21. } MINIDUMP_LOCATION_DESCRIPTOR;
  22. typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 {
  23. ULONG64 DataSize;
  24. RVA64 Rva;
  25. } MINIDUMP_LOCATION_DESCRIPTOR64;
  26. typedef struct _MINIDUMP_MEMORY_DESCRIPTOR {
  27. ULONG64 StartOfMemoryRange;
  28. MINIDUMP_LOCATION_DESCRIPTOR Memory;
  29. } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
  30. // DESCRIPTOR64 is used for full-memory minidumps where
  31. // all of the raw memory is laid out sequentially at the
  32. // end of the dump. There is no need for individual RVAs
  33. // as the RVA is the base RVA plus the sum of the preceeding
  34. // data blocks.
  35. typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 {
  36. ULONG64 StartOfMemoryRange;
  37. ULONG64 DataSize;
  38. } MINIDUMP_MEMORY_DESCRIPTOR64, *PMINIDUMP_MEMORY_DESCRIPTOR64;
  39. typedef struct _MINIDUMP_HEADER {
  40. ULONG32 Signature;
  41. ULONG32 Version;
  42. ULONG32 NumberOfStreams;
  43. RVA StreamDirectoryRva;
  44. ULONG32 CheckSum;
  45. union {
  46. ULONG32 Reserved;
  47. ULONG32 TimeDateStamp;
  48. };
  49. ULONG64 Flags;
  50. } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
  51. //
  52. // The MINIDUMP_HEADER field StreamDirectoryRva points to
  53. // an array of MINIDUMP_DIRECTORY structures.
  54. //
  55. typedef struct _MINIDUMP_DIRECTORY {
  56. ULONG32 StreamType;
  57. MINIDUMP_LOCATION_DESCRIPTOR Location;
  58. } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
  59. typedef struct _MINIDUMP_STRING {
  60. ULONG32 Length; // Length in bytes of the string
  61. WCHAR Buffer [0]; // Variable size buffer
  62. } MINIDUMP_STRING, *PMINIDUMP_STRING;
  63. //
  64. // The MINIDUMP_DIRECTORY field StreamType may be one of the following types.
  65. // Types will be added in the future, so if a program reading the minidump
  66. // header encounters a stream type it does not understand it should ignore
  67. // the data altogether. Any tag above LastReservedStream will not be used by
  68. // the system and is reserved for program-specific information.
  69. //
  70. typedef enum _MINIDUMP_STREAM_TYPE {
  71. UnusedStream = 0,
  72. ReservedStream0 = 1,
  73. ReservedStream1 = 2,
  74. ThreadListStream = 3,
  75. ModuleListStream = 4,
  76. MemoryListStream = 5,
  77. ExceptionStream = 6,
  78. SystemInfoStream = 7,
  79. ThreadExListStream = 8,
  80. Memory64ListStream = 9,
  81. CommentStreamA = 10,
  82. CommentStreamW = 11,
  83. HandleDataStream = 12,
  84. FunctionTableStream = 13,
  85. UnloadedModuleListStream = 14,
  86. MiscInfoStream = 15,
  87. LastReservedStream = 0xffff
  88. } MINIDUMP_STREAM_TYPE;
  89. //
  90. // The minidump system information contains processor and
  91. // Operating System specific information.
  92. //
  93. #if defined(_MSC_VER)
  94. #if _MSC_VER >= 800
  95. #if _MSC_VER >= 1200
  96. #pragma warning(push)
  97. #endif
  98. #pragma warning(disable:4201) /* Nameless struct/union */
  99. #endif
  100. #endif
  101. typedef struct _MINIDUMP_SYSTEM_INFO {
  102. //
  103. // ProcessorArchitecture, ProcessorLevel and ProcessorRevision are all
  104. // taken from the SYSTEM_INFO structure obtained by GetSystemInfo( ).
  105. //
  106. USHORT ProcessorArchitecture;
  107. USHORT ProcessorLevel;
  108. USHORT ProcessorRevision;
  109. union {
  110. USHORT Reserved0;
  111. struct {
  112. UCHAR NumberOfProcessors;
  113. UCHAR ProductType;
  114. };
  115. };
  116. //
  117. // MajorVersion, MinorVersion, BuildNumber, PlatformId and
  118. // CSDVersion are all taken from the OSVERSIONINFO structure
  119. // returned by GetVersionEx( ).
  120. //
  121. ULONG32 MajorVersion;
  122. ULONG32 MinorVersion;
  123. ULONG32 BuildNumber;
  124. ULONG32 PlatformId;
  125. //
  126. // RVA to a CSDVersion string in the string table.
  127. //
  128. RVA CSDVersionRva;
  129. union {
  130. ULONG32 Reserved1;
  131. struct {
  132. USHORT SuiteMask;
  133. USHORT Reserved2;
  134. };
  135. };
  136. //
  137. // CPU information is obtained from one of two places.
  138. //
  139. // 1) On x86 computers, CPU_INFORMATION is obtained from the CPUID
  140. // instruction. You must use the X86 portion of the union for X86
  141. // computers.
  142. //
  143. // 2) On non-x86 architectures, CPU_INFORMATION is obtained by calling
  144. // IsProcessorFeatureSupported().
  145. //
  146. union _CPU_INFORMATION {
  147. //
  148. // X86 platforms use CPUID function to obtain processor information.
  149. //
  150. struct {
  151. //
  152. // CPUID Subfunction 0, register EAX (VendorId [0]),
  153. // EBX (VendorId [1]) and ECX (VendorId [2]).
  154. //
  155. ULONG32 VendorId [ 3 ];
  156. //
  157. // CPUID Subfunction 1, register EAX
  158. //
  159. ULONG32 VersionInformation;
  160. //
  161. // CPUID Subfunction 1, register EDX
  162. //
  163. ULONG32 FeatureInformation;
  164. //
  165. // CPUID, Subfunction 80000001, register EBX. This will only
  166. // be obtained if the vendor id is "AuthenticAMD".
  167. //
  168. ULONG32 AMDExtendedCpuFeatures;
  169. } X86CpuInfo;
  170. //
  171. // Non-x86 platforms use processor feature flags.
  172. //
  173. struct {
  174. ULONG64 ProcessorFeatures [ 2 ];
  175. } OtherCpuInfo;
  176. } Cpu;
  177. } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
  178. typedef union _CPU_INFORMATION CPU_INFORMATION, *PCPU_INFORMATION;
  179. #if defined(_MSC_VER)
  180. #if _MSC_VER >= 800
  181. #if _MSC_VER >= 1200
  182. #pragma warning(pop)
  183. #else
  184. #pragma warning(disable:4201) /* Nameless struct/union */
  185. #endif
  186. #endif
  187. #endif
  188. //
  189. // The minidump thread contains standard thread
  190. // information plus an RVA to the memory for this
  191. // thread and an RVA to the CONTEXT structure for
  192. // this thread.
  193. //
  194. //
  195. // ThreadId must be 4 bytes on all architectures.
  196. //
  197. C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
  198. typedef struct _MINIDUMP_THREAD {
  199. ULONG32 ThreadId;
  200. ULONG32 SuspendCount;
  201. ULONG32 PriorityClass;
  202. ULONG32 Priority;
  203. ULONG64 Teb;
  204. MINIDUMP_MEMORY_DESCRIPTOR Stack;
  205. MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
  206. } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
  207. //
  208. // The thread list is a container of threads.
  209. //
  210. typedef struct _MINIDUMP_THREAD_LIST {
  211. ULONG32 NumberOfThreads;
  212. MINIDUMP_THREAD Threads [0];
  213. } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
  214. typedef struct _MINIDUMP_THREAD_EX {
  215. ULONG32 ThreadId;
  216. ULONG32 SuspendCount;
  217. ULONG32 PriorityClass;
  218. ULONG32 Priority;
  219. ULONG64 Teb;
  220. MINIDUMP_MEMORY_DESCRIPTOR Stack;
  221. MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
  222. MINIDUMP_MEMORY_DESCRIPTOR BackingStore;
  223. } MINIDUMP_THREAD_EX, *PMINIDUMP_THREAD_EX;
  224. //
  225. // The thread list is a container of threads.
  226. //
  227. typedef struct _MINIDUMP_THREAD_EX_LIST {
  228. ULONG32 NumberOfThreads;
  229. MINIDUMP_THREAD_EX Threads [0];
  230. } MINIDUMP_THREAD_EX_LIST, *PMINIDUMP_THREAD_EX_LIST;
  231. //
  232. // The MINIDUMP_EXCEPTION is the same as EXCEPTION on Win64.
  233. //
  234. typedef struct _MINIDUMP_EXCEPTION {
  235. ULONG32 ExceptionCode;
  236. ULONG32 ExceptionFlags;
  237. ULONG64 ExceptionRecord;
  238. ULONG64 ExceptionAddress;
  239. ULONG32 NumberParameters;
  240. ULONG32 __unusedAlignment;
  241. ULONG64 ExceptionInformation [ EXCEPTION_MAXIMUM_PARAMETERS ];
  242. } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
  243. //
  244. // The exception information stream contains the id of the thread that caused
  245. // the exception (ThreadId), the exception record for the exception
  246. // (ExceptionRecord) and an RVA to the thread context where the exception
  247. // occured.
  248. //
  249. typedef struct MINIDUMP_EXCEPTION_STREAM {
  250. ULONG32 ThreadId;
  251. ULONG32 __alignment;
  252. MINIDUMP_EXCEPTION ExceptionRecord;
  253. MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
  254. } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
  255. //
  256. // The MINIDUMP_MODULE contains information about a
  257. // a specific module. It includes the CheckSum and
  258. // the TimeDateStamp for the module so the module
  259. // can be reloaded during the analysis phase.
  260. //
  261. typedef struct _MINIDUMP_MODULE {
  262. ULONG64 BaseOfImage;
  263. ULONG32 SizeOfImage;
  264. ULONG32 CheckSum;
  265. ULONG32 TimeDateStamp;
  266. RVA ModuleNameRva;
  267. VS_FIXEDFILEINFO VersionInfo;
  268. MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
  269. MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
  270. ULONG64 Reserved0; // Reserved for future use.
  271. ULONG64 Reserved1; // Reserved for future use.
  272. } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
  273. //
  274. // The minidump module list is a container for modules.
  275. //
  276. typedef struct _MINIDUMP_MODULE_LIST {
  277. ULONG32 NumberOfModules;
  278. MINIDUMP_MODULE Modules [ 0 ];
  279. } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
  280. //
  281. // Memory Ranges
  282. //
  283. typedef struct _MINIDUMP_MEMORY_LIST {
  284. ULONG32 NumberOfMemoryRanges;
  285. MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0];
  286. } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
  287. typedef struct _MINIDUMP_MEMORY64_LIST {
  288. ULONG64 NumberOfMemoryRanges;
  289. RVA64 BaseRva;
  290. MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0];
  291. } MINIDUMP_MEMORY64_LIST, *PMINIDUMP_MEMORY64_LIST;
  292. //
  293. // Support for user supplied exception information.
  294. //
  295. typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
  296. DWORD ThreadId;
  297. PEXCEPTION_POINTERS ExceptionPointers;
  298. BOOL ClientPointers;
  299. } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
  300. //
  301. // Support for capturing system handle state at the time of the dump.
  302. //
  303. typedef struct _MINIDUMP_HANDLE_DESCRIPTOR {
  304. ULONG64 Handle;
  305. RVA TypeNameRva;
  306. RVA ObjectNameRva;
  307. ULONG32 Attributes;
  308. ULONG32 GrantedAccess;
  309. ULONG32 HandleCount;
  310. ULONG32 PointerCount;
  311. } MINIDUMP_HANDLE_DESCRIPTOR, *PMINIDUMP_HANDLE_DESCRIPTOR;
  312. typedef struct _MINIDUMP_HANDLE_DATA_STREAM {
  313. ULONG32 SizeOfHeader;
  314. ULONG32 SizeOfDescriptor;
  315. ULONG32 NumberOfDescriptors;
  316. ULONG32 Reserved;
  317. } MINIDUMP_HANDLE_DATA_STREAM, *PMINIDUMP_HANDLE_DATA_STREAM;
  318. //
  319. // Support for capturing dynamic function table state at the time of the dump.
  320. //
  321. typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR {
  322. ULONG64 MinimumAddress;
  323. ULONG64 MaximumAddress;
  324. ULONG64 BaseAddress;
  325. ULONG32 EntryCount;
  326. ULONG32 SizeOfAlignPad;
  327. } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR, *PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
  328. typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM {
  329. ULONG32 SizeOfHeader;
  330. ULONG32 SizeOfDescriptor;
  331. ULONG32 SizeOfNativeDescriptor;
  332. ULONG32 SizeOfFunctionEntry;
  333. ULONG32 NumberOfDescriptors;
  334. ULONG32 SizeOfAlignPad;
  335. } MINIDUMP_FUNCTION_TABLE_STREAM, *PMINIDUMP_FUNCTION_TABLE_STREAM;
  336. //
  337. // The MINIDUMP_UNLOADED_MODULE contains information about a
  338. // a specific module that was previously loaded but no
  339. // longer is. This can help with diagnosing problems where
  340. // callers attempt to call code that is no longer loaded.
  341. //
  342. typedef struct _MINIDUMP_UNLOADED_MODULE {
  343. ULONG64 BaseOfImage;
  344. ULONG32 SizeOfImage;
  345. ULONG32 CheckSum;
  346. ULONG32 TimeDateStamp;
  347. RVA ModuleNameRva;
  348. } MINIDUMP_UNLOADED_MODULE, *PMINIDUMP_UNLOADED_MODULE;
  349. //
  350. // The minidump unloaded module list is a container for unloaded modules.
  351. //
  352. typedef struct _MINIDUMP_UNLOADED_MODULE_LIST {
  353. ULONG32 SizeOfHeader;
  354. ULONG32 SizeOfEntry;
  355. ULONG32 NumberOfEntries;
  356. } MINIDUMP_UNLOADED_MODULE_LIST, *PMINIDUMP_UNLOADED_MODULE_LIST;
  357. //
  358. // The miscellaneous information stream contains a variety
  359. // of small pieces of information. A member is valid if
  360. // it's within the available size and its corresponding
  361. // bit is set.
  362. //
  363. #define MINIDUMP_MISC1_PROCESS_ID 0x00000001
  364. #define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002
  365. typedef struct _MINIDUMP_MISC_INFO {
  366. ULONG32 SizeOfInfo;
  367. ULONG32 Flags1;
  368. ULONG32 ProcessId;
  369. ULONG32 ProcessCreateTime;
  370. ULONG32 ProcessUserTime;
  371. ULONG32 ProcessKernelTime;
  372. } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
  373. //
  374. // Support for arbitrary user-defined information.
  375. //
  376. typedef struct _MINIDUMP_USER_RECORD {
  377. ULONG32 Type;
  378. MINIDUMP_LOCATION_DESCRIPTOR Memory;
  379. } MINIDUMP_USER_RECORD, *PMINIDUMP_USER_RECORD;
  380. typedef struct _MINIDUMP_USER_STREAM {
  381. ULONG32 Type;
  382. ULONG BufferSize;
  383. PVOID Buffer;
  384. } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
  385. typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
  386. ULONG UserStreamCount;
  387. PMINIDUMP_USER_STREAM UserStreamArray;
  388. } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
  389. //
  390. // Callback support.
  391. //
  392. typedef enum _MINIDUMP_CALLBACK_TYPE {
  393. ModuleCallback,
  394. ThreadCallback,
  395. ThreadExCallback,
  396. IncludeThreadCallback,
  397. IncludeModuleCallback,
  398. } MINIDUMP_CALLBACK_TYPE;
  399. typedef struct _MINIDUMP_THREAD_CALLBACK {
  400. ULONG ThreadId;
  401. HANDLE ThreadHandle;
  402. CONTEXT Context;
  403. ULONG SizeOfContext;
  404. ULONG64 StackBase;
  405. ULONG64 StackEnd;
  406. } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
  407. typedef struct _MINIDUMP_THREAD_EX_CALLBACK {
  408. ULONG ThreadId;
  409. HANDLE ThreadHandle;
  410. CONTEXT Context;
  411. ULONG SizeOfContext;
  412. ULONG64 StackBase;
  413. ULONG64 StackEnd;
  414. ULONG64 BackingStoreBase;
  415. ULONG64 BackingStoreEnd;
  416. } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
  417. typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK {
  418. ULONG ThreadId;
  419. } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
  420. typedef enum _THREAD_WRITE_FLAGS {
  421. ThreadWriteThread = 0x0001,
  422. ThreadWriteStack = 0x0002,
  423. ThreadWriteContext = 0x0004,
  424. ThreadWriteBackingStore = 0x0008,
  425. ThreadWriteInstructionWindow = 0x0010,
  426. ThreadWriteThreadData = 0x0020,
  427. } THREAD_WRITE_FLAGS;
  428. typedef struct _MINIDUMP_MODULE_CALLBACK {
  429. PWCHAR FullPath;
  430. ULONG64 BaseOfImage;
  431. ULONG SizeOfImage;
  432. ULONG CheckSum;
  433. ULONG TimeDateStamp;
  434. VS_FIXEDFILEINFO VersionInfo;
  435. PVOID CvRecord;
  436. ULONG SizeOfCvRecord;
  437. PVOID MiscRecord;
  438. ULONG SizeOfMiscRecord;
  439. } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
  440. typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK {
  441. ULONG64 BaseOfImage;
  442. } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
  443. typedef enum _MODULE_WRITE_FLAGS {
  444. ModuleWriteModule = 0x0001,
  445. ModuleWriteDataSeg = 0x0002,
  446. ModuleWriteMiscRecord = 0x0004,
  447. ModuleWriteCvRecord = 0x0008,
  448. ModuleReferencedByMemory = 0x0010
  449. } MODULE_WRITE_FLAGS;
  450. typedef struct _MINIDUMP_CALLBACK_INPUT {
  451. ULONG ProcessId;
  452. HANDLE ProcessHandle;
  453. ULONG CallbackType;
  454. union {
  455. MINIDUMP_THREAD_CALLBACK Thread;
  456. MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
  457. MINIDUMP_MODULE_CALLBACK Module;
  458. MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
  459. MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
  460. };
  461. } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
  462. typedef struct _MINIDUMP_CALLBACK_OUTPUT {
  463. union {
  464. ULONG ModuleWriteFlags;
  465. ULONG ThreadWriteFlags;
  466. };
  467. } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
  468. //
  469. // A normal minidump contains just the information
  470. // necessary to capture stack traces for all of the
  471. // existing threads in a process.
  472. //
  473. // A minidump with data segments includes all of the data
  474. // sections from loaded modules in order to capture
  475. // global variable contents. This can make the dump much
  476. // larger if many modules have global data.
  477. //
  478. // A minidump with full memory includes all of the accessible
  479. // memory in the process and can be very large. A minidump
  480. // with full memory always has the raw memory data at the end
  481. // of the dump so that the initial structures in the dump can
  482. // be mapped directly without having to include the raw
  483. // memory information.
  484. //
  485. // Stack and backing store memory can be filtered to remove
  486. // data unnecessary for stack walking. This can improve
  487. // compression of stacks and also deletes data that may
  488. // be private and should not be stored in a dump.
  489. // Memory can also be scanned to see what modules are
  490. // referenced by stack and backing store memory to allow
  491. // omission of other modules to reduce dump size.
  492. // In either of these modes the ModuleReferencedByMemory flag
  493. // is set for all modules referenced before the base
  494. // module callbacks occur.
  495. //
  496. // On some operating systems a list of modules that were
  497. // recently unloaded is kept in addition to the currently
  498. // loaded module list. This information can be saved in
  499. // the dump if desired.
  500. //
  501. // Stack and backing store memory can be scanned for referenced
  502. // pages in order to pick up data referenced by locals or other
  503. // stack memory. This can increase the size of a dump significantly.
  504. //
  505. // Module paths may contain undesired information such as user names
  506. // or other important directory names so they can be stripped. This
  507. // option reduces the ability to locate the proper image later
  508. // and should only be used in certain situations.
  509. //
  510. // Complete operating system per-process and per-thread information can
  511. // be gathered and stored in the dump.
  512. //
  513. // The virtual address space can be scanned for various types
  514. // of memory to be included in the dump.
  515. //
  516. typedef enum _MINIDUMP_TYPE {
  517. MiniDumpNormal = 0x0000,
  518. MiniDumpWithDataSegs = 0x0001,
  519. MiniDumpWithFullMemory = 0x0002,
  520. MiniDumpWithHandleData = 0x0004,
  521. MiniDumpFilterMemory = 0x0008,
  522. MiniDumpScanMemory = 0x0010,
  523. MiniDumpWithUnloadedModules = 0x0020,
  524. MiniDumpWithIndirectlyReferencedMemory = 0x0040,
  525. MiniDumpFilterModulePaths = 0x0080,
  526. MiniDumpWithProcessThreadData = 0x0100,
  527. MiniDumpWithPrivateReadWriteMemory = 0x0200,
  528. } MINIDUMP_TYPE;
  529. //
  530. // The minidump callback should modify the FieldsToWrite parameter to reflect
  531. // what portions of the specified thread or module should be written to the
  532. // file.
  533. //
  534. typedef
  535. BOOL
  536. (WINAPI * MINIDUMP_CALLBACK_ROUTINE) (
  537. IN PVOID CallbackParam,
  538. IN CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,
  539. IN OUT PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
  540. );
  541. typedef struct _MINIDUMP_CALLBACK_INFORMATION {
  542. MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
  543. PVOID CallbackParam;
  544. } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
  545. //++
  546. //
  547. // PVOID
  548. // RVA_TO_ADDR(
  549. // PVOID Mapping,
  550. // ULONG Rva
  551. // )
  552. //
  553. // Routine Description:
  554. //
  555. // Map an RVA that is contained within a mapped file to it's associated
  556. // flat address.
  557. //
  558. // Arguments:
  559. //
  560. // Mapping - Base address of mapped file containing the RVA.
  561. //
  562. // Rva - An Rva to fixup.
  563. //
  564. // Return Values:
  565. //
  566. // A pointer to the desired data.
  567. //
  568. //--
  569. #define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva)))
  570. BOOL
  571. WINAPI
  572. MiniDumpWriteDump(
  573. IN HANDLE hProcess,
  574. IN DWORD ProcessId,
  575. IN HANDLE hFile,
  576. IN MINIDUMP_TYPE DumpType,
  577. IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL
  578. IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL
  579. IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
  580. );
  581. BOOL
  582. WINAPI
  583. MiniDumpReadDumpStream(
  584. IN PVOID BaseOfDump,
  585. IN ULONG StreamNumber,
  586. OUT PMINIDUMP_DIRECTORY * Dir, OPTIONAL
  587. OUT PVOID * StreamPointer, OPTIONAL
  588. OUT ULONG * StreamSize OPTIONAL
  589. );
  590. #include <poppack.h>
  591. #ifdef __cplusplus
  592. }
  593. #endif
  594. // HEXTRACT: end_dbghelp hide_line end_imagehlp