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.

757 lines
20 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. //
  103. // CPU information is obtained from one of two places.
  104. //
  105. // 1) On x86 computers, CPU_INFORMATION is obtained from the CPUID
  106. // instruction. You must use the X86 portion of the union for X86
  107. // computers.
  108. //
  109. // 2) On non-x86 architectures, CPU_INFORMATION is obtained by calling
  110. // IsProcessorFeatureSupported().
  111. //
  112. typedef union _CPU_INFORMATION {
  113. //
  114. // X86 platforms use CPUID function to obtain processor information.
  115. //
  116. struct {
  117. //
  118. // CPUID Subfunction 0, register EAX (VendorId [0]),
  119. // EBX (VendorId [1]) and ECX (VendorId [2]).
  120. //
  121. ULONG32 VendorId [ 3 ];
  122. //
  123. // CPUID Subfunction 1, register EAX
  124. //
  125. ULONG32 VersionInformation;
  126. //
  127. // CPUID Subfunction 1, register EDX
  128. //
  129. ULONG32 FeatureInformation;
  130. //
  131. // CPUID, Subfunction 80000001, register EBX. This will only
  132. // be obtained if the vendor id is "AuthenticAMD".
  133. //
  134. ULONG32 AMDExtendedCpuFeatures;
  135. } X86CpuInfo;
  136. //
  137. // Non-x86 platforms use processor feature flags.
  138. //
  139. struct {
  140. ULONG64 ProcessorFeatures [ 2 ];
  141. } OtherCpuInfo;
  142. } CPU_INFORMATION, *PCPU_INFORMATION;
  143. typedef struct _MINIDUMP_SYSTEM_INFO {
  144. //
  145. // ProcessorArchitecture, ProcessorLevel and ProcessorRevision are all
  146. // taken from the SYSTEM_INFO structure obtained by GetSystemInfo( ).
  147. //
  148. UINT16 ProcessorArchitecture;
  149. UINT16 ProcessorLevel;
  150. UINT16 ProcessorRevision;
  151. union {
  152. UINT16 Reserved0;
  153. struct {
  154. UINT8 NumberOfProcessors;
  155. UINT8 ProductType;
  156. };
  157. };
  158. //
  159. // MajorVersion, MinorVersion, BuildNumber, PlatformId and
  160. // CSDVersion are all taken from the OSVERSIONINFO structure
  161. // returned by GetVersionEx( ).
  162. //
  163. ULONG32 MajorVersion;
  164. ULONG32 MinorVersion;
  165. ULONG32 BuildNumber;
  166. ULONG32 PlatformId;
  167. //
  168. // RVA to a CSDVersion string in the string table.
  169. //
  170. RVA CSDVersionRva;
  171. union {
  172. ULONG32 Reserved1;
  173. struct {
  174. UINT16 SuiteMask;
  175. UINT16 Reserved2;
  176. };
  177. };
  178. CPU_INFORMATION Cpu;
  179. } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
  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. typedef struct _MINIDUMP_EXCEPTION_INFORMATION64 {
  293. DWORD ThreadId;
  294. ULONG64 ExceptionRecord;
  295. ULONG64 ContextRecord;
  296. BOOL ClientPointers;
  297. } MINIDUMP_EXCEPTION_INFORMATION64, *PMINIDUMP_EXCEPTION_INFORMATION64;
  298. //
  299. // Support for capturing system handle state at the time of the dump.
  300. //
  301. typedef struct _MINIDUMP_HANDLE_DESCRIPTOR {
  302. ULONG64 Handle;
  303. RVA TypeNameRva;
  304. RVA ObjectNameRva;
  305. ULONG32 Attributes;
  306. ULONG32 GrantedAccess;
  307. ULONG32 HandleCount;
  308. ULONG32 PointerCount;
  309. } MINIDUMP_HANDLE_DESCRIPTOR, *PMINIDUMP_HANDLE_DESCRIPTOR;
  310. typedef struct _MINIDUMP_HANDLE_DATA_STREAM {
  311. ULONG32 SizeOfHeader;
  312. ULONG32 SizeOfDescriptor;
  313. ULONG32 NumberOfDescriptors;
  314. ULONG32 Reserved;
  315. } MINIDUMP_HANDLE_DATA_STREAM, *PMINIDUMP_HANDLE_DATA_STREAM;
  316. //
  317. // Support for capturing dynamic function table state at the time of the dump.
  318. //
  319. typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR {
  320. ULONG64 MinimumAddress;
  321. ULONG64 MaximumAddress;
  322. ULONG64 BaseAddress;
  323. ULONG32 EntryCount;
  324. ULONG32 SizeOfAlignPad;
  325. } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR, *PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
  326. typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM {
  327. ULONG32 SizeOfHeader;
  328. ULONG32 SizeOfDescriptor;
  329. ULONG32 SizeOfNativeDescriptor;
  330. ULONG32 SizeOfFunctionEntry;
  331. ULONG32 NumberOfDescriptors;
  332. ULONG32 SizeOfAlignPad;
  333. } MINIDUMP_FUNCTION_TABLE_STREAM, *PMINIDUMP_FUNCTION_TABLE_STREAM;
  334. //
  335. // The MINIDUMP_UNLOADED_MODULE contains information about a
  336. // a specific module that was previously loaded but no
  337. // longer is. This can help with diagnosing problems where
  338. // callers attempt to call code that is no longer loaded.
  339. //
  340. typedef struct _MINIDUMP_UNLOADED_MODULE {
  341. ULONG64 BaseOfImage;
  342. ULONG32 SizeOfImage;
  343. ULONG32 CheckSum;
  344. ULONG32 TimeDateStamp;
  345. RVA ModuleNameRva;
  346. } MINIDUMP_UNLOADED_MODULE, *PMINIDUMP_UNLOADED_MODULE;
  347. //
  348. // The minidump unloaded module list is a container for unloaded modules.
  349. //
  350. typedef struct _MINIDUMP_UNLOADED_MODULE_LIST {
  351. ULONG32 SizeOfHeader;
  352. ULONG32 SizeOfEntry;
  353. ULONG32 NumberOfEntries;
  354. } MINIDUMP_UNLOADED_MODULE_LIST, *PMINIDUMP_UNLOADED_MODULE_LIST;
  355. //
  356. // The miscellaneous information stream contains a variety
  357. // of small pieces of information. A member is valid if
  358. // it's within the available size and its corresponding
  359. // bit is set.
  360. //
  361. #define MINIDUMP_MISC1_PROCESS_ID 0x00000001
  362. #define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002
  363. typedef struct _MINIDUMP_MISC_INFO {
  364. ULONG32 SizeOfInfo;
  365. ULONG32 Flags1;
  366. ULONG32 ProcessId;
  367. ULONG32 ProcessCreateTime;
  368. ULONG32 ProcessUserTime;
  369. ULONG32 ProcessKernelTime;
  370. } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
  371. //
  372. // Support for arbitrary user-defined information.
  373. //
  374. typedef struct _MINIDUMP_USER_RECORD {
  375. ULONG32 Type;
  376. MINIDUMP_LOCATION_DESCRIPTOR Memory;
  377. } MINIDUMP_USER_RECORD, *PMINIDUMP_USER_RECORD;
  378. typedef struct _MINIDUMP_USER_STREAM {
  379. ULONG32 Type;
  380. ULONG BufferSize;
  381. PVOID Buffer;
  382. } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
  383. typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
  384. ULONG UserStreamCount;
  385. PMINIDUMP_USER_STREAM UserStreamArray;
  386. } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
  387. //
  388. // Callback support.
  389. //
  390. typedef enum _MINIDUMP_CALLBACK_TYPE {
  391. ModuleCallback,
  392. ThreadCallback,
  393. ThreadExCallback,
  394. IncludeThreadCallback,
  395. IncludeModuleCallback,
  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. };
  465. } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
  466. //
  467. // A normal minidump contains just the information
  468. // necessary to capture stack traces for all of the
  469. // existing threads in a process.
  470. //
  471. // A minidump with data segments includes all of the data
  472. // sections from loaded modules in order to capture
  473. // global variable contents. This can make the dump much
  474. // larger if many modules have global data.
  475. //
  476. // A minidump with full memory includes all of the accessible
  477. // memory in the process and can be very large. A minidump
  478. // with full memory always has the raw memory data at the end
  479. // of the dump so that the initial structures in the dump can
  480. // be mapped directly without having to include the raw
  481. // memory information.
  482. //
  483. // Stack and backing store memory can be filtered to remove
  484. // data unnecessary for stack walking. This can improve
  485. // compression of stacks and also deletes data that may
  486. // be private and should not be stored in a dump.
  487. // Memory can also be scanned to see what modules are
  488. // referenced by stack and backing store memory to allow
  489. // omission of other modules to reduce dump size.
  490. // In either of these modes the ModuleReferencedByMemory flag
  491. // is set for all modules referenced before the base
  492. // module callbacks occur.
  493. //
  494. // On some operating systems a list of modules that were
  495. // recently unloaded is kept in addition to the currently
  496. // loaded module list. This information can be saved in
  497. // the dump if desired.
  498. //
  499. // Stack and backing store memory can be scanned for referenced
  500. // pages in order to pick up data referenced by locals or other
  501. // stack memory. This can increase the size of a dump significantly.
  502. //
  503. // Module paths may contain undesired information such as user names
  504. // or other important directory names so they can be stripped. This
  505. // option reduces the ability to locate the proper image later
  506. // and should only be used in certain situations.
  507. //
  508. // Complete operating system per-process and per-thread information can
  509. // be gathered and stored in the dump.
  510. //
  511. // The virtual address space can be scanned for various types
  512. // of memory to be included in the dump.
  513. //
  514. // Code which is concerned with potentially private information
  515. // getting into the minidump can set a flag that automatically
  516. // modifies all existing and future flags to avoid placing
  517. // unnecessary data in the dump. Basic data, such as stack
  518. // information, will still be included but optional data, such
  519. // as indirect memory, will not.
  520. //
  521. typedef enum _MINIDUMP_TYPE {
  522. MiniDumpNormal = 0x0000,
  523. MiniDumpWithDataSegs = 0x0001,
  524. MiniDumpWithFullMemory = 0x0002,
  525. MiniDumpWithHandleData = 0x0004,
  526. MiniDumpFilterMemory = 0x0008,
  527. MiniDumpScanMemory = 0x0010,
  528. MiniDumpWithUnloadedModules = 0x0020,
  529. MiniDumpWithIndirectlyReferencedMemory = 0x0040,
  530. MiniDumpFilterModulePaths = 0x0080,
  531. MiniDumpWithProcessThreadData = 0x0100,
  532. MiniDumpWithPrivateReadWriteMemory = 0x0200,
  533. MiniDumpWithoutOptionalData = 0x0400,
  534. } MINIDUMP_TYPE;
  535. //
  536. // The minidump callback should modify the FieldsToWrite parameter to reflect
  537. // what portions of the specified thread or module should be written to the
  538. // file.
  539. //
  540. typedef
  541. BOOL
  542. (WINAPI * MINIDUMP_CALLBACK_ROUTINE) (
  543. IN PVOID CallbackParam,
  544. IN CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,
  545. IN OUT PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
  546. );
  547. typedef struct _MINIDUMP_CALLBACK_INFORMATION {
  548. MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
  549. PVOID CallbackParam;
  550. } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
  551. //++
  552. //
  553. // PVOID
  554. // RVA_TO_ADDR(
  555. // PVOID Mapping,
  556. // ULONG Rva
  557. // )
  558. //
  559. // Routine Description:
  560. //
  561. // Map an RVA that is contained within a mapped file to it's associated
  562. // flat address.
  563. //
  564. // Arguments:
  565. //
  566. // Mapping - Base address of mapped file containing the RVA.
  567. //
  568. // Rva - An Rva to fixup.
  569. //
  570. // Return Values:
  571. //
  572. // A pointer to the desired data.
  573. //
  574. //--
  575. #define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva)))
  576. BOOL
  577. WINAPI
  578. MiniDumpWriteDump(
  579. IN HANDLE hProcess,
  580. IN DWORD ProcessId,
  581. IN HANDLE hFile,
  582. IN MINIDUMP_TYPE DumpType,
  583. IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL
  584. IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL
  585. IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
  586. );
  587. BOOL
  588. WINAPI
  589. MiniDumpReadDumpStream(
  590. IN PVOID BaseOfDump,
  591. IN ULONG StreamNumber,
  592. OUT PMINIDUMP_DIRECTORY * Dir, OPTIONAL
  593. OUT PVOID * StreamPointer, OPTIONAL
  594. OUT ULONG * StreamSize OPTIONAL
  595. );
  596. #include <poppack.h>
  597. #ifdef __cplusplus
  598. }
  599. #endif