1 /*++ BUILD Version: 0000        Increment this if a change has global effects
2
3 Copyright (c) Microsoft Corporation. All rights reserved.
4
5 Module Name:
6
7       dbghelp.h
8
9 Abstract:
10
11       This module defines the prototypes and constants required for the image
12       help routines.
13
14       Contains debugging support routines that are redistributable.
15
16 Revision History:
17
18 --*/
19
20 #ifndef _DBGHELP_
21 #define _DBGHELP_
22
23 #if _MSC_VER > 1020
24 #pragma once
25 #endif
26
27
28 // As a general principal always call the 64 bit version
29 // of every API, if a choice exists.  The 64 bit version
30 // works great on 32 bit platforms, and is forward
31 // compatible to 64 bit platforms.
32
33 #ifdef _WIN64
34 #ifndef _IMAGEHLP64
35 #define _IMAGEHLP64
36 #endif
37 #endif
38
39 // for those without specstrings.h
40
41 #ifndef __specstrings
42  #define __in
43  #define __out
44  #define __inout
45  #define __in_opt
46  #define __out_opt
47  #define __inout_opt
48  #define __in_ecount(x)
49  #define __out_ecount(x)
50  #define __inout_ecount(x)
51  #define __in_bcount(x)
52  #define __out_bcount(x)
53  #define __inout_bcount(x)
54  #define __out_xcount(x)
55  #define __deref_opt_out
56  #define __deref_out
57 #endif
58
59
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63
64 #ifdef _IMAGEHLP_SOURCE_
65  #define IMAGEAPI __stdcall
66  #define DBHLP_DEPRECIATED
67 #else
68  #define IMAGEAPI DECLSPEC_IMPORT __stdcall
69  #if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
70   #define DBHLP_DEPRECIATED     __declspec(deprecated)
71  #else
72   #define DBHLP_DEPRECIATED
73  #endif
74 #endif
75
76 #define DBHLPAPI IMAGEAPI
77
78 #define IMAGE_SEPARATION (64*1024)
79
80 // Observant readers may notice that 2 new fields,
81 // 'fReadOnly' and 'Version' have been added to
82 // the LOADED_IMAGE structure after 'fDOSImage'.
83 // This does not change the size of the structure 
84 // from previous headers.  That is because while 
85 // 'fDOSImage' is a byte, it is padded by the 
86 // compiler to 4 bytes.  So the 2 new fields are 
87 // slipped into the extra space.
88
89 typedef struct _LOADED_IMAGE {
90       PSTR                              ModuleName;
91       HANDLE                          hFile;
92       PUCHAR                          MappedAddress;
93 #ifdef _IMAGEHLP64
94       PIMAGE_NT_HEADERS64     FileHeader;
95 #else
96       PIMAGE_NT_HEADERS32     FileHeader;
97 #endif
98       PIMAGE_SECTION_HEADER LastRvaSection;
99       ULONG                            NumberOfSections;
100       PIMAGE_SECTION_HEADER Sections;
101       ULONG                            Characteristics;
102       BOOLEAN                         fSystemImage;
103       BOOLEAN                         fDOSImage;
104       BOOLEAN                         fReadOnly;
105       UCHAR                            Version;
106       LIST_ENTRY                    Links;
Lines 107 ... 4311 are skipped.
4312 //        A pointer to the desired data.
4313 //
4314 //--
4315
4316 #define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva)))
4317
4318 BOOL
4319 WINAPI
4320 MiniDumpWriteDump(
4321       IN HANDLE hProcess,
4322       IN DWORD ProcessId,
4323       IN HANDLE hFile,
4324       IN MINIDUMP_TYPE DumpType,
4325       IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL
4326       IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL
4327       IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
4328       );
4329
4330 BOOL
4331 WINAPI
4332 MiniDumpReadDumpStream(
4333       IN PVOID BaseOfDump,
4334       IN ULONG StreamNumber,
4335       OUT PMINIDUMP_DIRECTORY * Dir, OPTIONAL
4336       OUT PVOID * StreamPointer, OPTIONAL
4337       OUT ULONG * StreamSize OPTIONAL
4338       );
4339
4340 #if defined(_MSC_VER)
4341 #if _MSC_VER >= 800
4342 #if _MSC_VER >= 1200
4343 #pragma warning(pop)
4344 #else
4345 #pragma warning(default:4200)      /* Zero length array */
4346 #pragma warning(default:4201)      /* Nameless struct/union */
4347 #endif
4348 #endif
4349 #endif
4350
4351 #include <poppack.h>
4352
4353 #ifdef __cplusplus
4354 }
4355 #endif
4356
4357
4358 #endif // _DBGHELP_
4359
4360