Leaked source code of windows server 2003
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.

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