1 /**
2  * ...
3  *
4  * Copyright: Copyright Benjamin Thaut 2010 - 2011.
5  * License: Distributed under the
6  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
7  *    (See accompanying file LICENSE)
8  * Authors:   Benjamin Thaut, Sean Kelly
9  * Source:    $(DRUNTIMESRC core/sys/windows/_dbghelp_types.d)
10  */
11 
12 module core.sys.windows.dbghelp_types;
13 version (Windows):
14 
15 version (ANSI) {} else version = Unicode;
16 
17 import core.sys.windows.windef;
18 import core.sys.windows.imagehlp /+: ADDRESS_MODE+/;
19 
20 public import core.sys.windows.winnt : TCHAR;
21 
22 /*
23 enum ADDRESS_MODE : DWORD
24 {
25     AddrMode1616 = 0,
26     AddrMode1632 = 1,
27     AddrModeReal = 2,
28     AddrModeFlat = 3,
29 }
30 */
31 enum : DWORD
32 {
33     SYMOPT_DEFERRED_LOAD        = 0x00000004,
34     SYMOPT_FAIL_CRITICAL_ERRORS = 0x00000200,
35     SYMOPT_LOAD_LINES           = 0x00000010,
36     SYMOPT_DEBUG                = 0x80000000,
37 }
38 
39 enum : ULONG
40 {
41     CBA_READ_MEMORY             = 0x00000006,
42     CBA_DEBUG_INFO              = 0x10000000,
43 }
44 
45 public import core.sys.windows.basetyps : GUID;
46 
47 struct ADDRESS64
48 {
49     DWORD64      Offset;
50     WORD         Segment;
51     ADDRESS_MODE Mode;
52 }
53 
54 struct KDHELP64
55 {
56     DWORD64 Thread;
57     DWORD   ThCallbackStack;
58     DWORD   ThCallbackBStore;
59     DWORD   NextCallback;
60     DWORD   FramePointer;
61     DWORD64 KiCallUserMode;
62     DWORD64 KeUserCallbackDispatcher;
63     DWORD64 SystemRangeStart;
64     DWORD64 KiUserExceptionDispatcher;
65     DWORD64 StackBase;
66     DWORD64 StackLimit;
67     DWORD64[5] Reserved;
68 }
69 
70 struct STACKFRAME64
71 {
72     ADDRESS64  AddrPC;
73     ADDRESS64  AddrReturn;
74     ADDRESS64  AddrFrame;
75     ADDRESS64  AddrStack;
76     ADDRESS64  AddrBStore;
77     PVOID      FuncTableEntry;
78     DWORD64[4] Params;
79     BOOL       Far;
80     BOOL       Virtual;
81     DWORD64[3] Reserved;
82     KDHELP64   KdHelp;
83 }
84 
85 public import core.sys.windows.winnt : IMAGE_FILE_MACHINE_I386, IMAGE_FILE_MACHINE_IA64, IMAGE_FILE_MACHINE_AMD64;
86 
87 struct IMAGEHLP_LINEA64
88 {
89     DWORD   SizeOfStruct;
90     PVOID   Key;
91     DWORD   LineNumber;
92     PCSTR   FileName;
93     DWORD64 Address;
94 }
95 struct IMAGEHLP_LINEW64
96 {
97     DWORD   SizeOfStruct;
98     PVOID   Key;
99     DWORD   LineNumber;
100     PWSTR FileName;
101     DWORD64 Address;
102 }
103 
104 enum SYM_TYPE : int
105 {
106     SymNone = 0,
107     SymCoff,
108     SymCv,
109     SymPdb,
110     SymExport,
111     SymDeferred,
112     SymSym,
113     SymDia,
114     SymVirtual,
115     NumSymTypes,
116 }
117 
118 struct IMAGEHLP_MODULEA64
119 {
120     DWORD      SizeOfStruct;
121     DWORD64    BaseOfImage;
122     DWORD      ImageSize;
123     DWORD      TimeDateStamp;
124     DWORD      CheckSum;
125     DWORD      NumSyms;
126     SYM_TYPE   SymType;
127     CHAR[32]   ModuleName = 0;
128     CHAR[256]  ImageName = 0;
129     CHAR[256]  LoadedImageName = 0;
130     // new elements: 07-Jun-2002
131     version (none)
132     {
133         CHAR[256]  LoadedPdbName = 0;
134         DWORD      CVSig;
135         CHAR[MAX_PATH*3] CVData = 0;
136         DWORD      PdbSig;
137         GUID       PdbSig70;
138         DWORD      PdbAge;
139         BOOL       PdbUnmatched;
140         BOOL       DbgUnmachted;
141         BOOL       LineNumbers;
142         BOOL       GlobalSymbols;
143         BOOL       TypeInfo;
144     }
145     // new elements: 17-Dec-2003
146     version (none)
147     {
148         BOOL       SourceIndexed;
149         BOOL       Publics;
150     }
151 }
152 struct IMAGEHLP_MODULEW64
153 {
154     DWORD      SizeOfStruct;
155     DWORD64    BaseOfImage;
156     DWORD      ImageSize;
157     DWORD      TimeDateStamp;
158     DWORD      CheckSum;
159     DWORD      NumSyms;
160     SYM_TYPE   SymType;
161     WCHAR[32]  ModuleName = 0;
162     WCHAR[256] ImageName = 0;
163     WCHAR[256] LoadedImageName = 0;
164     // new elements: 07-Jun-2002
165     version (none)
166     {
167         WCHAR[256] LoadedPdbName = 0;
168         DWORD      CVSig;
169         WCHAR[MAX_PATH*3] CVData = 0;
170         DWORD      PdbSig;
171         GUID       PdbSig70;
172         DWORD      PdbAge;
173         BOOL       PdbUnmatched;
174         BOOL       DbgUnmachted;
175         BOOL       LineNumbers;
176         BOOL       GlobalSymbols;
177         BOOL       TypeInfo;
178     }
179     // new elements: 17-Dec-2003
180     version (none)
181     {
182         BOOL       SourceIndexed;
183         BOOL       Publics;
184     }
185 }
186 
187 struct IMAGEHLP_SYMBOLA64
188 {
189     DWORD    SizeOfStruct;
190     DWORD64  Address;
191     DWORD    Size;
192     DWORD    Flags;
193     DWORD    MaxNameLength;
194     CHAR[1] Name = 0;
195 }
196 struct IMAGEHLP_SYMBOLW64
197 {
198     DWORD    SizeOfStruct;
199     DWORD64  Address;
200     DWORD    Size;
201     DWORD    Flags;
202     DWORD    MaxNameLength;
203     WCHAR[1] Name = 0;
204 }
205 
206 
207 struct IMAGEHLP_CBA_READ_MEMORY
208 {
209     DWORD64 addr;
210     PVOID   buf;
211     DWORD   bytes;
212     DWORD   *bytesread;
213 }
214 
215 struct API_VERSION
216 {
217     USHORT MajorVersion;
218     USHORT MinorVersion;
219     USHORT Revision;
220     USHORT Reserved;
221 }
222 
223 version (Unicode)
224 {
225     alias IMAGEHLP_LINEW64 IMAGEHLP_LINE64;
226     alias IMAGEHLP_MODULEW64 IMAGEHLP_MODULE64;
227     alias IMAGEHLP_SYMBOLW64 IMAGEHLP_SYMBOL64;
228 }
229 else
230 {
231     alias IMAGEHLP_LINEA64 IMAGEHLP_LINE64;
232     alias IMAGEHLP_MODULEA64 IMAGEHLP_MODULE64;
233     alias IMAGEHLP_SYMBOLA64 IMAGEHLP_SYMBOL64;
234 }