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.

742 lines
19 KiB

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