source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/vdmdbg.h@ 1194

Last change on this file since 1194 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 10.9 KB
RevLine 
[1166]1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _VDMDBG_
7#define _VDMDBG_
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#include <pshpack4.h>
14
15#define STATUS_VDM_EVENT STATUS_SEGMENT_NOTIFICATION
16
17#ifndef DBG_SEGLOAD
18#define DBG_SEGLOAD 0
19#define DBG_SEGMOVE 1
20#define DBG_SEGFREE 2
21#define DBG_MODLOAD 3
22#define DBG_MODFREE 4
23#define DBG_SINGLESTEP 5
24#define DBG_BREAK 6
25#define DBG_GPFAULT 7
26#define DBG_DIVOVERFLOW 8
27#define DBG_INSTRFAULT 9
28#define DBG_TASKSTART 10
29#define DBG_TASKSTOP 11
30#define DBG_DLLSTART 12
31#define DBG_DLLSTOP 13
32#define DBG_ATTACH 14
33#define DBG_TOOLHELP 15
34#define DBG_STACKFAULT 16
35#define DBG_WOWINIT 17
36#define DBG_TEMPBP 18
37#define DBG_MODMOVE 19
38#define DBG_INIT 20
39#define DBG_GPFAULT2 21
40#endif
41
42#define VDMEVENT_NEEDS_INTERACTIVE 0x8000
43#define VDMEVENT_VERBOSE 0x4000
44#define VDMEVENT_PE 0x2000
45#define VDMEVENT_ALLFLAGS 0xe000
46
47#define VDMEVENT_V86 0x0001
48#define VDMEVENT_PM16 0x0002
49
50#define VDMCONTEXT_i386 0x00010000
51#define VDMCONTEXT_i486 0x00010000
52
53#define VDMCONTEXT_CONTROL (VDMCONTEXT_i386 | __MSABI_LONG(0x00000001))
54#define VDMCONTEXT_INTEGER (VDMCONTEXT_i386 | __MSABI_LONG(0x00000002))
55#define VDMCONTEXT_SEGMENTS (VDMCONTEXT_i386 | __MSABI_LONG(0x00000004))
56#define VDMCONTEXT_FLOATING_POINT (VDMCONTEXT_i386 | __MSABI_LONG(0x00000008))
57#define VDMCONTEXT_DEBUG_REGISTERS (VDMCONTEXT_i386 | __MSABI_LONG(0x00000010))
58#define VDMCONTEXT_EXTENDED_REGISTERS (VDMCONTEXT_i386 | __MSABI_LONG(0x00000020))
59
60#define VDMCONTEXT_FULL (VDMCONTEXT_CONTROL | VDMCONTEXT_INTEGER | VDMCONTEXT_SEGMENTS)
61
62#ifdef _X86_
63
64 typedef struct _CONTEXT VDMCONTEXT;
65 typedef struct _LDT_ENTRY VDMLDT_ENTRY;
66#else
67
68#define SIZE_OF_80387_REGISTERS 80
69
70 typedef struct _FLOATING_SAVE_AREA {
71 ULONG ControlWord;
72 ULONG StatusWord;
73 ULONG TagWord;
74 ULONG ErrorOffset;
75 ULONG ErrorSelector;
76 ULONG DataOffset;
77 ULONG DataSelector;
78 UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
79 ULONG Cr0NpxState;
80 } FLOATING_SAVE_AREA;
81
82 typedef struct _VDMCONTEXT {
83 ULONG ContextFlags;
84
85 ULONG Dr0;
86 ULONG Dr1;
87 ULONG Dr2;
88 ULONG Dr3;
89 ULONG Dr6;
90 ULONG Dr7;
91
92 FLOATING_SAVE_AREA FloatSave;
93 ULONG SegGs;
94 ULONG SegFs;
95 ULONG SegEs;
96 ULONG SegDs;
97 ULONG Edi;
98 ULONG Esi;
99 ULONG Ebx;
100 ULONG Edx;
101 ULONG Ecx;
102 ULONG Eax;
103 ULONG Ebp;
104 ULONG Eip;
105 ULONG SegCs;
106 ULONG EFlags;
107 ULONG Esp;
108 ULONG SegSs;
109 } VDMCONTEXT;
110
111 typedef struct _VDMLDT_ENTRY {
112 USHORT LimitLow;
113 USHORT BaseLow;
114 union {
115 struct {
116 UCHAR BaseMid;
117 UCHAR Flags1;
118 UCHAR Flags2;
119 UCHAR BaseHi;
120 } Bytes;
121 struct {
122 ULONG BaseMid : 8;
123 ULONG Type : 5;
124 ULONG Dpl : 2;
125 ULONG Pres : 1;
126 ULONG LimitHi : 4;
127 ULONG Sys : 1;
128 ULONG Reserved_0 : 1;
129 ULONG Default_Big : 1;
130 ULONG Granularity : 1;
131 ULONG BaseHi : 8;
132 } Bits;
133 } HighWord;
134 } VDMLDT_ENTRY;
135#endif
136
137 typedef VDMCONTEXT *LPVDMCONTEXT;
138 typedef VDMLDT_ENTRY *LPVDMLDT_ENTRY;
139
140#define VDMCONTEXT_TO_PROGRAM_COUNTER(Context) (PVOID)((Context)->Eip)
141
142#define VDMCONTEXT_LENGTH (sizeof(VDMCONTEXT))
143#define VDMCONTEXT_ALIGN (sizeof(ULONG))
144#define VDMCONTEXT_ROUND (VDMCONTEXT_ALIGN - 1)
145
146#define V86FLAGS_CARRY 0x00001
147#define V86FLAGS_PARITY 0x00004
148#define V86FLAGS_AUXCARRY 0x00010
149#define V86FLAGS_ZERO 0x00040
150#define V86FLAGS_SIGN 0x00080
151#define V86FLAGS_TRACE 0x00100
152#define V86FLAGS_INTERRUPT 0x00200
153#define V86FLAGS_DIRECTION 0x00400
154#define V86FLAGS_OVERFLOW 0x00800
155#define V86FLAGS_IOPL 0x03000
156#define V86FLAGS_IOPL_BITS 0x12
157#define V86FLAGS_RESUME 0x10000
158#define V86FLAGS_V86 0x20000
159#define V86FLAGS_ALIGNMENT 0x40000
160
161#define MAX_MODULE_NAME 8 + 1
162#define MAX_PATH16 255
163
164 typedef struct _SEGMENT_NOTE {
165 WORD Selector1;
166 WORD Selector2;
167 WORD Segment;
168 CHAR Module[MAX_MODULE_NAME+1];
169 CHAR FileName[MAX_PATH16+1];
170 WORD Type;
171 DWORD Length;
172 } SEGMENT_NOTE;
173
174 typedef struct _IMAGE_NOTE {
175 CHAR Module[MAX_MODULE_NAME+1];
176 CHAR FileName[MAX_PATH16+1];
177 WORD hModule;
178 WORD hTask;
179 } IMAGE_NOTE;
180
181 typedef struct {
182 DWORD dwSize;
183 char szModule[MAX_MODULE_NAME+1];
184 HANDLE hModule;
185 WORD wcUsage;
186 char szExePath[MAX_PATH16+1];
187 WORD wNext;
188 } MODULEENTRY,*LPMODULEENTRY;
189
190#define SN_CODE 0
191#define SN_DATA 1
192#define SN_V86 2
193
194 typedef struct _TEMP_BP_NOTE {
195 WORD Seg;
196 DWORD Offset;
197 WINBOOL bPM;
198 } TEMP_BP_NOTE;
199
200 typedef struct _VDM_SEGINFO {
201 WORD Selector;
202 WORD SegNumber;
203 DWORD Length;
204 WORD Type;
205 CHAR ModuleName[MAX_MODULE_NAME];
206 CHAR FileName[MAX_PATH16];
207 } VDM_SEGINFO;
208
209#define GLOBAL_ALL 0
210#define GLOBAL_LRU 1
211#define GLOBAL_FREE 2
212
213#define GT_UNKNOWN 0
214#define GT_DGROUP 1
215#define GT_DATA 2
216#define GT_CODE 3
217#define GT_TASK 4
218#define GT_RESOURCE 5
219#define GT_MODULE 6
220#define GT_FREE 7
221#define GT_INTERNAL 8
222#define GT_SENTINEL 9
223#define GT_BURGERMASTER 10
224
225#define GD_USERDEFINED 0
226#define GD_CURSORCOMPONENT 1
227#define GD_BITMAP 2
228#define GD_ICONCOMPONENT 3
229#define GD_MENU 4
230#define GD_DIALOG 5
231#define GD_STRING 6
232#define GD_FONTDIR 7
233#define GD_FONT 8
234#define GD_ACCELERATORS 9
235#define GD_RCDATA 10
236#define GD_ERRTABLE 11
237#define GD_CURSOR 12
238#define GD_ICON 14
239#define GD_NAMETABLE 15
240#define GD_MAX_RESOURCE 15
241
242 typedef struct {
243 DWORD dwSize;
244 DWORD dwAddress;
245 DWORD dwBlockSize;
246 HANDLE hBlock;
247 WORD wcLock;
248 WORD wcPageLock;
249 WORD wFlags;
250 WINBOOL wHeapPresent;
251 HANDLE hOwner;
252 WORD wType;
253 WORD wData;
254 DWORD dwNext;
255 DWORD dwNextAlt;
256 } GLOBALENTRY,*LPGLOBALENTRY;
257
258 typedef DWORD (CALLBACK *DEBUGEVENTPROC)(LPDEBUG_EVENT,LPVOID);
259
260#define W1(x) ((USHORT)(x.ExceptionInformation[0]))
261#define W2(x) ((USHORT)(x.ExceptionInformation[0] >> 16))
262#define W3(x) ((USHORT)(x.ExceptionInformation[1]))
263#define W4(x) ((USHORT)(x.ExceptionInformation[1] >> 16))
264#define DW3(x) (x.ExceptionInformation[2])
265#define DW4(x) (x.ExceptionInformation[3])
266
267#include <poppack.h>
268
269 WINBOOL WINAPI VDMProcessException(LPDEBUG_EVENT lpDebugEvent);
270 WINBOOL WINAPI VDMGetThreadSelectorEntry(HANDLE hProcess,HANDLE hThread,WORD wSelector,LPVDMLDT_ENTRY lpSelectorEntry);
271 ULONG WINAPI VDMGetPointer(HANDLE hProcess,HANDLE hThread,WORD wSelector,DWORD dwOffset,WINBOOL fProtMode);
272 WINBOOL WINAPI VDMGetContext(HANDLE hProcess,HANDLE hThread,LPVDMCONTEXT lpVDMContext);
273 WINBOOL WINAPI VDMSetContext(HANDLE hProcess,HANDLE hThread,LPVDMCONTEXT lpVDMContext);
274 WINBOOL WINAPI VDMGetSelectorModule(HANDLE hProcess,HANDLE hThread,WORD wSelector,PUINT lpSegmentNumber,LPSTR lpModuleName,UINT nNameSize,LPSTR lpModulePath,UINT nPathSize);
275 WINBOOL WINAPI VDMGetModuleSelector(HANDLE hProcess,HANDLE hThread,UINT wSegmentNumber,LPSTR lpModuleName,LPWORD lpSelector);
276 WINBOOL WINAPI VDMModuleFirst(HANDLE hProcess,HANDLE hThread,LPMODULEENTRY lpModuleEntry,DEBUGEVENTPROC lpEventProc,LPVOID lpData);
277 WINBOOL WINAPI VDMModuleNext(HANDLE hProcess,HANDLE hThread,LPMODULEENTRY lpModuleEntry,DEBUGEVENTPROC lpEventProc,LPVOID lpData);
278 WINBOOL WINAPI VDMGlobalFirst(HANDLE hProcess,HANDLE hThread,LPGLOBALENTRY lpGlobalEntry,WORD wFlags,DEBUGEVENTPROC lpEventProc,LPVOID lpData);
279 WINBOOL WINAPI VDMGlobalNext(HANDLE hProcess,HANDLE hThread,LPGLOBALENTRY lpGlobalEntry,WORD wFlags,DEBUGEVENTPROC lpEventProc,LPVOID lpData);
280
281 typedef WINBOOL (WINAPI *PROCESSENUMPROC)(DWORD dwProcessId,DWORD dwAttributes,LPARAM lpUserDefined);
282 typedef WINBOOL (WINAPI *TASKENUMPROC)(DWORD dwThreadId,WORD hMod16,WORD hTask16,LPARAM lpUserDefined);
283 typedef WINBOOL (WINAPI *TASKENUMPROCEX)(DWORD dwThreadId,WORD hMod16,WORD hTask16,PSZ pszModName,PSZ pszFileName,LPARAM lpUserDefined);
284
285#define WOW_SYSTEM (DWORD)0x0001
286
287 INT WINAPI VDMEnumProcessWOW(PROCESSENUMPROC fp,LPARAM lparam);
288 INT WINAPI VDMEnumTaskWOW(DWORD dwProcessId,TASKENUMPROC fp,LPARAM lparam);
289 INT WINAPI VDMEnumTaskWOWEx(DWORD dwProcessId,TASKENUMPROCEX fp,LPARAM lparam);
290 WINBOOL WINAPI VDMTerminateTaskWOW(DWORD dwProcessId,WORD htask);
291 WINBOOL WINAPI VDMStartTaskInWOW(DWORD dwProcessId,LPSTR lpCommandLine,WORD wShow);
292 WINBOOL WINAPI VDMKillWOW(VOID);
293 WINBOOL WINAPI VDMDetectWOW(VOID);
294 WINBOOL WINAPI VDMBreakThread(HANDLE hProcess,HANDLE hThread);
295 DWORD WINAPI VDMGetDbgFlags(HANDLE hProcess);
296 WINBOOL WINAPI VDMSetDbgFlags(HANDLE hProcess,DWORD dwFlags);
297
298#define VDMDBG_BREAK_DOSTASK 0x00000001
299#define VDMDBG_BREAK_WOWTASK 0x00000002
300#define VDMDBG_BREAK_LOADDLL 0x00000004
301#define VDMDBG_BREAK_EXCEPTIONS 0x00000008
302#define VDMDBG_BREAK_DEBUGGER 0x00000010
303#define VDMDBG_TRACE_HISTORY 0x00000080
304
305 WINBOOL WINAPI VDMIsModuleLoaded(LPSTR szPath);
306 WINBOOL WINAPI VDMGetSegmentInfo(WORD Selector,ULONG Offset,WINBOOL bProtectMode,VDM_SEGINFO *pSegInfo);
307 WINBOOL WINAPI VDMGetSymbol(LPSTR szModule,WORD SegNumber,DWORD Offset,WINBOOL bProtectMode,WINBOOL bNextSymbol,LPSTR szSymbolName,PDWORD pDisplacement);
308 WINBOOL WINAPI VDMGetAddrExpression(LPSTR szModule,LPSTR szSymbol,PWORD Selector,PDWORD Offset,PWORD Type);
309
310#define VDMADDR_V86 2
311#define VDMADDR_PM16 4
312#define VDMADDR_PM32 16
313
314 typedef WINBOOL (WINAPI *VDMPROCESSEXCEPTIONPROC)(LPDEBUG_EVENT);
315 typedef WINBOOL (WINAPI *VDMGETTHREADSELECTORENTRYPROC)(HANDLE,HANDLE,DWORD,LPVDMLDT_ENTRY);
316 typedef ULONG (WINAPI *VDMGETPOINTERPROC)(HANDLE,HANDLE,WORD,DWORD,WINBOOL);
317 typedef WINBOOL (WINAPI *VDMGETCONTEXTPROC)(HANDLE,HANDLE,LPVDMCONTEXT);
318 typedef WINBOOL (WINAPI *VDMSETCONTEXTPROC)(HANDLE,HANDLE,LPVDMCONTEXT);
319 typedef WINBOOL (WINAPI *VDMKILLWOWPROC)(VOID);
320 typedef WINBOOL (WINAPI *VDMDETECTWOWPROC)(VOID);
321 typedef WINBOOL (WINAPI *VDMBREAKTHREADPROC)(HANDLE);
322 typedef WINBOOL (WINAPI *VDMGETSELECTORMODULEPROC)(HANDLE,HANDLE,WORD,PUINT,LPSTR,UINT,LPSTR,UINT);
323 typedef WINBOOL (WINAPI *VDMGETMODULESELECTORPROC)(HANDLE,HANDLE,UINT,LPSTR,LPWORD);
324 typedef WINBOOL (WINAPI *VDMMODULEFIRSTPROC)(HANDLE,HANDLE,LPMODULEENTRY,DEBUGEVENTPROC,LPVOID);
325 typedef WINBOOL (WINAPI *VDMMODULENEXTPROC)(HANDLE,HANDLE,LPMODULEENTRY,DEBUGEVENTPROC,LPVOID);
326 typedef WINBOOL (WINAPI *VDMGLOBALFIRSTPROC)(HANDLE,HANDLE,LPGLOBALENTRY,WORD,DEBUGEVENTPROC,LPVOID);
327 typedef WINBOOL (WINAPI *VDMGLOBALNEXTPROC)(HANDLE,HANDLE,LPGLOBALENTRY,WORD,DEBUGEVENTPROC,LPVOID);
328 typedef INT (WINAPI *VDMENUMPROCESSWOWPROC)(PROCESSENUMPROC,LPARAM);
329 typedef INT (WINAPI *VDMENUMTASKWOWPROC)(DWORD,TASKENUMPROC,LPARAM);
330 typedef INT (WINAPI *VDMENUMTASKWOWEXPROC)(DWORD,TASKENUMPROCEX,LPARAM);
331 typedef WINBOOL (WINAPI *VDMTERMINATETASKINWOWPROC)(DWORD,WORD);
332 typedef WINBOOL (WINAPI *VDMSTARTTASKINWOWPROC)(DWORD,LPSTR,WORD);
333 typedef DWORD (WINAPI *VDMGETDBGFLAGSPROC)(HANDLE);
334 typedef WINBOOL (WINAPI *VDMSETDBGFLAGSPROC)(HANDLE,DWORD);
335 typedef WINBOOL (WINAPI *VDMISMODULELOADEDPROC)(LPSTR);
336 typedef WINBOOL (WINAPI *VDMGETSEGMENTINFOPROC)(WORD,ULONG,WINBOOL,VDM_SEGINFO);
337 typedef WINBOOL (WINAPI *VDMGETSYMBOLPROC)(LPSTR,WORD,DWORD,WINBOOL,WINBOOL,LPSTR,PDWORD);
338 typedef WINBOOL (WINAPI *VDMGETADDREXPRESSIONPROC)(LPSTR,LPSTR,PWORD,PDWORD,PWORD);
339
340#ifdef __cplusplus
341}
342#endif
343#endif
Note: See TracBrowser for help on using the repository browser.