xref: /reactos/dll/win32/dbghelp/compat.h (revision 01fbf25d)
1c2c66affSColin Finck #pragma once
2c2c66affSColin Finck 
3c2c66affSColin Finck #include <typedefs.h>
4c2c66affSColin Finck #include <guiddef.h>
5c2c66affSColin Finck #include <pecoff.h>
6c2c66affSColin Finck #include <wine/unicode.h>
7c2c66affSColin Finck 
8c2c66affSColin Finck #include <stdio.h>
9c2c66affSColin Finck #include <stdlib.h>
10c2c66affSColin Finck #include <wchar.h>
11c2c66affSColin Finck #include <ctype.h>
1263c0d5e3Swinesync #include <wctype.h>
1363c0d5e3Swinesync 
1463c0d5e3Swinesync #define wcsnicmp strncmpiW
1563c0d5e3Swinesync #define wcsicmp strcmpiW
1663c0d5e3Swinesync #define wcsrchr strrchrW
1763c0d5e3Swinesync #define wcschr strchrW
18c2c66affSColin Finck 
19c2c66affSColin Finck typedef HANDLE HWND;
20c2c66affSColin Finck 
21c2c66affSColin Finck #define min(x, y) (((x) < (y)) ? (x) : (y))
22c2c66affSColin Finck #define max(x, y) (((x) > (y)) ? (x) : (y))
23ad6eaca4Swinesync #define _strnicmp(_String1, _String2, _MaxCount) strncasecmp(_String1, _String2, _MaxCount)
2437eff17dSwinesync #define stricmp(_String1, _String2) strcasecmp(_String1, _String2)
25c2c66affSColin Finck 
26c2c66affSColin Finck #ifdef __i386__
27c2c66affSColin Finck #define CDECL __cdecl
28c2c66affSColin Finck #else
29c2c66affSColin Finck #define CDECL
30c2c66affSColin Finck #endif
31c2c66affSColin Finck typedef PVOID IUnknown, IDispatch, IRecordInfo;
32c2c66affSColin Finck 
33c2c66affSColin Finck // windef.h
34c2c66affSColin Finck #define MAX_PATH 260
35c2c66affSColin Finck #define CALLBACK
36c2c66affSColin Finck typedef int (*FARPROC)();
37c2c66affSColin Finck 
38c2c66affSColin Finck // bytesex.h
39c2c66affSColin Finck #define SWAPD(x) x
40c2c66affSColin Finck #define SWAPW(x) x
41c2c66affSColin Finck 
42c2c66affSColin Finck // Wine stuff
43c2c66affSColin Finck #define DECLSPEC_HIDDEN
44c2c66affSColin Finck #define WINE_DEFAULT_DEBUG_CHANNEL(x)
45c2c66affSColin Finck #define WINE_DECLARE_DEBUG_CHANNEL(x)
46c2c66affSColin Finck extern const char *wine_dbgstr_an( const char * s, int n );
47c2c66affSColin Finck extern const char *wine_dbgstr_wn( const WCHAR *s, int n );
48c2c66affSColin Finck extern const char *wine_dbg_sprintf( const char *format, ... );
wine_dbgstr_longlong(ULONGLONG ll)49c2c66affSColin Finck static __inline const char *wine_dbgstr_longlong( ULONGLONG ll )
50c2c66affSColin Finck {
51c2c66affSColin Finck     if (/*sizeof(ll) > sizeof(unsigned long) &&*/ ll >> 32) /* ULONGLONG is always > long in ReactOS */
52c2c66affSColin Finck         return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
53c2c66affSColin Finck     else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
54c2c66affSColin Finck }
debugstr_an(const char * s,int n)55c2c66affSColin Finck static __inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
debugstr_wn(const WCHAR * s,int n)56c2c66affSColin Finck static __inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
debugstr_a(const char * s)57c2c66affSColin Finck static __inline const char *debugstr_a( const char *s )  { return wine_dbgstr_an( s, -1 ); }
debugstr_w(const WCHAR * s)58c2c66affSColin Finck static __inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
wine_dbgstr_w(const WCHAR * s)59c2c66affSColin Finck static __inline const char *wine_dbgstr_w( const WCHAR *s ){return wine_dbgstr_wn( s, -1 );}
6070880dd1Swinesync /* This should never be called */
6170880dd1Swinesync #define wine_get_dos_file_name(__x) (assert(0), NULL)
62c2c66affSColin Finck 
63c2c66affSColin Finck #if 0
64c2c66affSColin Finck #define WARN(fmt, ...) fprintf(stderr, "WARN %s: " fmt, __FUNCTION__, ##__VA_ARGS__)
65c2c66affSColin Finck #define FIXME(fmt, ...) fprintf(stderr, "FIXME %s: " fmt, __FUNCTION__, ##__VA_ARGS__)
66c2c66affSColin Finck #define TRACE(fmt, ...) fprintf(stderr, "TRACE %s: " fmt, __FUNCTION__, ##__VA_ARGS__)
67c2c66affSColin Finck #define ERR(fmt, ...) fprintf(stderr, "ERR %s: " fmt, __FUNCTION__, ##__VA_ARGS__)
68c2c66affSColin Finck #else
69c2c66affSColin Finck #define WARN(fmt, ...)
70c2c66affSColin Finck #define FIXME(fmt, ...)
71c2c66affSColin Finck #define TRACE(fmt, ...)
72c2c66affSColin Finck #define ERR(fmt, ...)
73c2c66affSColin Finck #endif
74c2c66affSColin Finck 
75c2c66affSColin Finck #define TRACE_ON(x) FALSE
76c2c66affSColin Finck #define TRACE_(x) TRACE
77c2c66affSColin Finck #define FIXME_(x) FIXME
78c2c66affSColin Finck const char *wine_dbg_sprintf( const char *format, ... );
79c2c66affSColin Finck #define CP_UNIXCP CP_ACP
80c2c66affSColin Finck #define __TRY if(1)
81c2c66affSColin Finck #define __EXCEPT_PAGE_FAULT else
82c2c66affSColin Finck #define __ENDTRY
83c2c66affSColin Finck 
84c2c66affSColin Finck // basetsd.h
85c2c66affSColin Finck typedef ULONG_PTR KAFFINITY;
86c2c66affSColin Finck 
87c2c66affSColin Finck // excpt.h
88c2c66affSColin Finck typedef enum _EXCEPTION_DISPOSITION
89c2c66affSColin Finck {
90c2c66affSColin Finck     ExceptionContinueExecution,
91c2c66affSColin Finck     ExceptionContinueSearch,
92c2c66affSColin Finck     ExceptionNestedException,
93c2c66affSColin Finck     ExceptionCollidedUnwind,
94c2c66affSColin Finck } EXCEPTION_DISPOSITION;
95c2c66affSColin Finck 
96c2c66affSColin Finck // winerror.h
97c2c66affSColin Finck #define ERROR_ACCESS_DENIED                                5
98c2c66affSColin Finck #define ERROR_INVALID_HANDLE                               6
99c2c66affSColin Finck #define ERROR_OUTOFMEMORY                                  14
100c2c66affSColin Finck #define ERROR_NOT_SUPPORTED                                50
101c2c66affSColin Finck #define ERROR_INVALID_PARAMETER                            87
102c2c66affSColin Finck #define ERROR_CALL_NOT_IMPLEMENTED                         120
103c2c66affSColin Finck #define ERROR_INVALID_NAME                                 123
104c2c66affSColin Finck #define ERROR_MOD_NOT_FOUND                                126
105c2c66affSColin Finck #define ERROR_NO_MORE_ITEMS                                259
106c2c66affSColin Finck #define ERROR_INVALID_ADDRESS                              487
107c2c66affSColin Finck 
108c2c66affSColin Finck // winnls.h
109c2c66affSColin Finck #define CP_ACP 0
110c2c66affSColin Finck #define MultiByteToWideChar __MultiByteToWideChar
111c2c66affSColin Finck #define WideCharToMultiByte __WideCharToMultiByte
112c2c66affSColin Finck INT __MultiByteToWideChar( UINT page, DWORD flags, LPCSTR src, INT srclen, LPWSTR dst, INT dstlen );
113c2c66affSColin Finck INT __WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen, LPSTR dst, INT dstlen, LPCSTR defchar, BOOL *used );
114c2c66affSColin Finck 
115c2c66affSColin Finck // #define strlenW(s) wcslen((s))
116c2c66affSColin Finck // #define strcpyW(d,s) wcscpy((d),(s))
117c2c66affSColin Finck // #define strchrW(s,c) wcschr((s),(c))
118c2c66affSColin Finck // #define strcatW(d,s) wcscat((d),(s))
119c2c66affSColin Finck // #define strncmpiW(s1,s2,n) _wcsnicmp((s1),(s2),(n))
120c2c66affSColin Finck // #define strcmpW(s1,s2) wcscmp((s1),(s2))
121c2c66affSColin Finck // #define strcmpiW(s1,s2) _wcsicmp((s1),(s2))
122c2c66affSColin Finck // #define tolowerW(n) towlower((n))
123c2c66affSColin Finck // #define toupperW(n) towupper((n))
124c2c66affSColin Finck 
125c2c66affSColin Finck // winnt.h
1264e896039Swinesync # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
127c2c66affSColin Finck #define IMAGE_FILE_MACHINE_ARMNT      0x1c4
128c2c66affSColin Finck #define IMAGE_FILE_MACHINE_POWERPC    0x1f0
1291eea9304SStas'M #define IMAGE_FILE_MACHINE_ARM64      0xaa64
130c2c66affSColin Finck #define DLL_PROCESS_DETACH	0
131c2c66affSColin Finck #define DLL_PROCESS_ATTACH	1
132c2c66affSColin Finck #define DLL_THREAD_ATTACH	2
133c2c66affSColin Finck #define DLL_THREAD_DETACH	3
134c2c66affSColin Finck #define HEAP_ZERO_MEMORY 8
135c2c66affSColin Finck #define GENERIC_READ	0x80000000
136c2c66affSColin Finck #define FILE_SHARE_READ			0x00000001
137c2c66affSColin Finck #define FILE_ATTRIBUTE_NORMAL			0x00000080
138c2c66affSColin Finck #define PAGE_READONLY	0x0002
139c2c66affSColin Finck #define SECTION_MAP_READ 4
140c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_UNKNOWN 0
141c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_COFF 1
142c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_CODEVIEW 2
143c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_FPO 3
144c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_MISC 4
145c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_EXCEPTION 5
146c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_FIXUP 6
147c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
148c2c66affSColin Finck #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
149c2c66affSColin Finck #define IMAGE_SYM_CLASS_EXTERNAL 2
150c2c66affSColin Finck #define IMAGE_SYM_CLASS_FILE 103
151c2c66affSColin Finck #define IMAGE_DIRECTORY_ENTRY_EXPORT	0
152c2c66affSColin Finck #define IMAGE_DIRECTORY_ENTRY_DEBUG	6
1532ed06c95SMark Jansen #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG	10
154c2c66affSColin Finck #define IMAGE_DEBUG_MISC_EXENAME 1
155c2c66affSColin Finck #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
156c2c66affSColin Finck typedef struct _IMAGE_EXPORT_DIRECTORY {
157c2c66affSColin Finck   DWORD Characteristics;
158c2c66affSColin Finck   DWORD TimeDateStamp;
159c2c66affSColin Finck   WORD MajorVersion;
160c2c66affSColin Finck   WORD MinorVersion;
161c2c66affSColin Finck   DWORD Name;
162c2c66affSColin Finck   DWORD Base;
163c2c66affSColin Finck   DWORD NumberOfFunctions;
164c2c66affSColin Finck   DWORD NumberOfNames;
165c2c66affSColin Finck   DWORD AddressOfFunctions;
166c2c66affSColin Finck   DWORD AddressOfNames;
167c2c66affSColin Finck   DWORD AddressOfNameOrdinals;
168c2c66affSColin Finck } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
169c2c66affSColin Finck typedef struct _IMAGE_DEBUG_MISC {
170c2c66affSColin Finck   DWORD DataType;
171c2c66affSColin Finck   DWORD Length;
172c2c66affSColin Finck   BOOLEAN Unicode;
173c2c66affSColin Finck   BYTE Reserved[3];
174c2c66affSColin Finck   BYTE Data[1];
175c2c66affSColin Finck } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
176c2c66affSColin Finck typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
177c2c66affSColin Finck   WORD Signature;
178c2c66affSColin Finck   WORD Flags;
179c2c66affSColin Finck   WORD Machine;
180c2c66affSColin Finck   WORD Characteristics;
181c2c66affSColin Finck   DWORD TimeDateStamp;
182c2c66affSColin Finck   DWORD CheckSum;
183c2c66affSColin Finck   DWORD ImageBase;
184c2c66affSColin Finck   DWORD SizeOfImage;
185c2c66affSColin Finck   DWORD NumberOfSections;
186c2c66affSColin Finck   DWORD ExportedNamesSize;
187c2c66affSColin Finck   DWORD DebugDirectorySize;
188c2c66affSColin Finck   DWORD SectionAlignment;
189c2c66affSColin Finck   DWORD Reserved[2];
190c2c66affSColin Finck } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
191c2c66affSColin Finck typedef struct _SECURITY_ATTRIBUTES {
192c2c66affSColin Finck 	DWORD nLength;
193c2c66affSColin Finck 	LPVOID lpSecurityDescriptor;
194c2c66affSColin Finck 	BOOL bInheritHandle;
195c2c66affSColin Finck } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
196c2c66affSColin Finck typedef struct _IMAGE_DEBUG_DIRECTORY {
197c2c66affSColin Finck   DWORD Characteristics;
198c2c66affSColin Finck   DWORD TimeDateStamp;
199c2c66affSColin Finck   WORD MajorVersion;
200c2c66affSColin Finck   WORD MinorVersion;
201c2c66affSColin Finck   DWORD Type;
202c2c66affSColin Finck   DWORD SizeOfData;
203c2c66affSColin Finck   DWORD AddressOfRawData;
204c2c66affSColin Finck   DWORD PointerToRawData;
205c2c66affSColin Finck } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
206c2c66affSColin Finck #define EXCEPTION_MAXIMUM_PARAMETERS   15
207c2c66affSColin Finck typedef struct _EXCEPTION_RECORD {
208c2c66affSColin Finck   DWORD ExceptionCode;
209c2c66affSColin Finck   DWORD ExceptionFlags;
210c2c66affSColin Finck   struct _EXCEPTION_RECORD *ExceptionRecord;
211c2c66affSColin Finck   PVOID ExceptionAddress;
212c2c66affSColin Finck   DWORD NumberParameters;
213c2c66affSColin Finck   ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
214c2c66affSColin Finck } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2157470eb9cSwinesync 
2167470eb9cSwinesync #define WOW64_CONTEXT_i386 0x00010000
2177470eb9cSwinesync #define WOW64_CONTEXT_i486 0x00010000
2187470eb9cSwinesync #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
2197470eb9cSwinesync #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
2207470eb9cSwinesync #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
2217470eb9cSwinesync #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
2227470eb9cSwinesync #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
2237470eb9cSwinesync #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
2247470eb9cSwinesync #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
2257470eb9cSwinesync #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
2267470eb9cSwinesync                            WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
2277470eb9cSwinesync                            WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
2287470eb9cSwinesync 
2297470eb9cSwinesync #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2307470eb9cSwinesync 
2317470eb9cSwinesync #define WOW64_CONTEXT_EXCEPTION_ACTIVE      0x08000000
2327470eb9cSwinesync #define WOW64_CONTEXT_SERVICE_ACTIVE        0x10000000
2337470eb9cSwinesync #define WOW64_CONTEXT_EXCEPTION_REQUEST     0x40000000
2347470eb9cSwinesync #define WOW64_CONTEXT_EXCEPTION_REPORTING   0x80000000
2357470eb9cSwinesync 
2367470eb9cSwinesync #define WOW64_SIZE_OF_80387_REGISTERS 80
2377470eb9cSwinesync #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
2387470eb9cSwinesync 
2397470eb9cSwinesync typedef struct _WOW64_FLOATING_SAVE_AREA
2407470eb9cSwinesync {
2417470eb9cSwinesync     DWORD   ControlWord;
2427470eb9cSwinesync     DWORD   StatusWord;
2437470eb9cSwinesync     DWORD   TagWord;
2447470eb9cSwinesync     DWORD   ErrorOffset;
2457470eb9cSwinesync     DWORD   ErrorSelector;
2467470eb9cSwinesync     DWORD   DataOffset;
2477470eb9cSwinesync     DWORD   DataSelector;
2487470eb9cSwinesync     BYTE    RegisterArea[WOW64_SIZE_OF_80387_REGISTERS];
2497470eb9cSwinesync     DWORD   Cr0NpxState;
2507470eb9cSwinesync } WOW64_FLOATING_SAVE_AREA, *PWOW64_FLOATING_SAVE_AREA;
2517470eb9cSwinesync 
2527470eb9cSwinesync #include "pshpack4.h"
2537470eb9cSwinesync typedef struct _WOW64_CONTEXT
2547470eb9cSwinesync {
2557470eb9cSwinesync     DWORD ContextFlags;
2567470eb9cSwinesync     DWORD Dr0;
2577470eb9cSwinesync     DWORD Dr1;
2587470eb9cSwinesync     DWORD Dr2;
2597470eb9cSwinesync     DWORD Dr3;
2607470eb9cSwinesync     DWORD Dr6;
2617470eb9cSwinesync     DWORD Dr7;
2627470eb9cSwinesync     WOW64_FLOATING_SAVE_AREA FloatSave;
2637470eb9cSwinesync     DWORD SegGs;
2647470eb9cSwinesync     DWORD SegFs;
2657470eb9cSwinesync     DWORD SegEs;
2667470eb9cSwinesync     DWORD SegDs;
2677470eb9cSwinesync     DWORD Edi;
2687470eb9cSwinesync     DWORD Esi;
2697470eb9cSwinesync     DWORD Ebx;
2707470eb9cSwinesync     DWORD Edx;
2717470eb9cSwinesync     DWORD Ecx;
2727470eb9cSwinesync     DWORD Eax;
2737470eb9cSwinesync     DWORD Ebp;
2747470eb9cSwinesync     DWORD Eip;
2757470eb9cSwinesync     DWORD SegCs;
2767470eb9cSwinesync     DWORD EFlags;
2777470eb9cSwinesync     DWORD Esp;
2787470eb9cSwinesync     DWORD SegSs;
2797470eb9cSwinesync     BYTE ExtendedRegisters[WOW64_MAXIMUM_SUPPORTED_EXTENSION];
2807470eb9cSwinesync } WOW64_CONTEXT, *PWOW64_CONTEXT;
2817470eb9cSwinesync #include "poppack.h"
2827470eb9cSwinesync 
283493ceb7aSJérôme Gardou #if defined(TARGET_i386)
284c2c66affSColin Finck #define SIZE_OF_80387_REGISTERS	80
285c2c66affSColin Finck #define CONTEXT_i386	0x10000
286c2c66affSColin Finck #define CONTEXT_i486	0x10000
287c2c66affSColin Finck #define CONTEXT_CONTROL	(CONTEXT_i386|0x00000001L)
288c2c66affSColin Finck #define CONTEXT_INTEGER	(CONTEXT_i386|0x00000002L)
289c2c66affSColin Finck #define CONTEXT_SEGMENTS	(CONTEXT_i386|0x00000004L)
290c2c66affSColin Finck #define CONTEXT_FLOATING_POINT	(CONTEXT_i386|0x00000008L)
291c2c66affSColin Finck #define CONTEXT_DEBUG_REGISTERS	(CONTEXT_i386|0x00000010L)
292c2c66affSColin Finck #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
293c2c66affSColin Finck #define CONTEXT_FULL	(CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
294c2c66affSColin Finck #define MAXIMUM_SUPPORTED_EXTENSION  512
295c2c66affSColin Finck 
296c2c66affSColin Finck #define EXCEPTION_READ_FAULT    0
297c2c66affSColin Finck #define EXCEPTION_WRITE_FAULT   1
298c2c66affSColin Finck #define EXCEPTION_EXECUTE_FAULT 8
299c2c66affSColin Finck 
300c2c66affSColin Finck typedef struct _FLOATING_SAVE_AREA {
301c2c66affSColin Finck   DWORD ControlWord;
302c2c66affSColin Finck   DWORD StatusWord;
303c2c66affSColin Finck   DWORD TagWord;
304c2c66affSColin Finck   DWORD ErrorOffset;
305c2c66affSColin Finck   DWORD ErrorSelector;
306c2c66affSColin Finck   DWORD DataOffset;
307c2c66affSColin Finck   DWORD DataSelector;
308c2c66affSColin Finck   BYTE RegisterArea[80];
309c2c66affSColin Finck   DWORD Cr0NpxState;
310c2c66affSColin Finck } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
311c2c66affSColin Finck 
312c2c66affSColin Finck typedef struct _CONTEXT {
313c2c66affSColin Finck   DWORD ContextFlags;
314c2c66affSColin Finck   DWORD Dr0;
315c2c66affSColin Finck   DWORD Dr1;
316c2c66affSColin Finck   DWORD Dr2;
317c2c66affSColin Finck   DWORD Dr3;
318c2c66affSColin Finck   DWORD Dr6;
319c2c66affSColin Finck   DWORD Dr7;
320c2c66affSColin Finck   FLOATING_SAVE_AREA FloatSave;
321c2c66affSColin Finck   DWORD SegGs;
322c2c66affSColin Finck   DWORD SegFs;
323c2c66affSColin Finck   DWORD SegEs;
324c2c66affSColin Finck   DWORD SegDs;
325c2c66affSColin Finck   DWORD Edi;
326c2c66affSColin Finck   DWORD Esi;
327c2c66affSColin Finck   DWORD Ebx;
328c2c66affSColin Finck   DWORD Edx;
329c2c66affSColin Finck   DWORD Ecx;
330c2c66affSColin Finck   DWORD Eax;
331c2c66affSColin Finck   DWORD Ebp;
332c2c66affSColin Finck   DWORD Eip;
333c2c66affSColin Finck   DWORD SegCs;
334c2c66affSColin Finck   DWORD EFlags;
335c2c66affSColin Finck   DWORD Esp;
336c2c66affSColin Finck   DWORD SegSs;
337c2c66affSColin Finck   BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
3384ffd9fb3SCarlo Bramini } CONTEXT;
339c2c66affSColin Finck 
340493ceb7aSJérôme Gardou #elif defined TARGET_amd64
341493ceb7aSJérôme Gardou 
3424ffd9fb3SCarlo Bramini typedef struct _M128A {
3434ffd9fb3SCarlo Bramini     ULONGLONG Low;
3444ffd9fb3SCarlo Bramini     LONGLONG High;
3454ffd9fb3SCarlo Bramini } M128A, *PM128A;
3464ffd9fb3SCarlo Bramini 
3474ffd9fb3SCarlo Bramini typedef struct _XMM_SAVE_AREA32 {
3484ffd9fb3SCarlo Bramini     WORD ControlWord;
3494ffd9fb3SCarlo Bramini     WORD StatusWord;
3504ffd9fb3SCarlo Bramini     BYTE TagWord;
3514ffd9fb3SCarlo Bramini     BYTE Reserved1;
3524ffd9fb3SCarlo Bramini     WORD ErrorOpcode;
3534ffd9fb3SCarlo Bramini     DWORD ErrorOffset;
3544ffd9fb3SCarlo Bramini     WORD ErrorSelector;
3554ffd9fb3SCarlo Bramini     WORD Reserved2;
3564ffd9fb3SCarlo Bramini     DWORD DataOffset;
3574ffd9fb3SCarlo Bramini     WORD DataSelector;
3584ffd9fb3SCarlo Bramini     WORD Reserved3;
3594ffd9fb3SCarlo Bramini     DWORD MxCsr;
3604ffd9fb3SCarlo Bramini     DWORD MxCsr_Mask;
3614ffd9fb3SCarlo Bramini     M128A FloatRegisters[8];
3624ffd9fb3SCarlo Bramini     M128A XmmRegisters[16];
3634ffd9fb3SCarlo Bramini     BYTE Reserved4[96];
3644ffd9fb3SCarlo Bramini } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
3654ffd9fb3SCarlo Bramini 
3664ffd9fb3SCarlo Bramini typedef struct _CONTEXT {
3674ffd9fb3SCarlo Bramini     DWORD64 P1Home;
3684ffd9fb3SCarlo Bramini     DWORD64 P2Home;
3694ffd9fb3SCarlo Bramini     DWORD64 P3Home;
3704ffd9fb3SCarlo Bramini     DWORD64 P4Home;
3714ffd9fb3SCarlo Bramini     DWORD64 P5Home;
3724ffd9fb3SCarlo Bramini     DWORD64 P6Home;
3734ffd9fb3SCarlo Bramini 
3744ffd9fb3SCarlo Bramini     /* Control flags */
3754ffd9fb3SCarlo Bramini     DWORD ContextFlags;
3764ffd9fb3SCarlo Bramini     DWORD MxCsr;
3774ffd9fb3SCarlo Bramini 
3784ffd9fb3SCarlo Bramini     /* Segment */
3794ffd9fb3SCarlo Bramini     WORD SegCs;
3804ffd9fb3SCarlo Bramini     WORD SegDs;
3814ffd9fb3SCarlo Bramini     WORD SegEs;
3824ffd9fb3SCarlo Bramini     WORD SegFs;
3834ffd9fb3SCarlo Bramini     WORD SegGs;
3844ffd9fb3SCarlo Bramini     WORD SegSs;
3854ffd9fb3SCarlo Bramini     DWORD EFlags;
3864ffd9fb3SCarlo Bramini 
3874ffd9fb3SCarlo Bramini     /* Debug */
3884ffd9fb3SCarlo Bramini     DWORD64 Dr0;
3894ffd9fb3SCarlo Bramini     DWORD64 Dr1;
3904ffd9fb3SCarlo Bramini     DWORD64 Dr2;
3914ffd9fb3SCarlo Bramini     DWORD64 Dr3;
3924ffd9fb3SCarlo Bramini     DWORD64 Dr6;
3934ffd9fb3SCarlo Bramini     DWORD64 Dr7;
3944ffd9fb3SCarlo Bramini 
3954ffd9fb3SCarlo Bramini     /* Integer */
3964ffd9fb3SCarlo Bramini     DWORD64 Rax;
3974ffd9fb3SCarlo Bramini     DWORD64 Rcx;
3984ffd9fb3SCarlo Bramini     DWORD64 Rdx;
3994ffd9fb3SCarlo Bramini     DWORD64 Rbx;
4004ffd9fb3SCarlo Bramini     DWORD64 Rsp;
4014ffd9fb3SCarlo Bramini     DWORD64 Rbp;
4024ffd9fb3SCarlo Bramini     DWORD64 Rsi;
4034ffd9fb3SCarlo Bramini     DWORD64 Rdi;
4044ffd9fb3SCarlo Bramini     DWORD64 R8;
4054ffd9fb3SCarlo Bramini     DWORD64 R9;
4064ffd9fb3SCarlo Bramini     DWORD64 R10;
4074ffd9fb3SCarlo Bramini     DWORD64 R11;
4084ffd9fb3SCarlo Bramini     DWORD64 R12;
4094ffd9fb3SCarlo Bramini     DWORD64 R13;
4104ffd9fb3SCarlo Bramini     DWORD64 R14;
4114ffd9fb3SCarlo Bramini     DWORD64 R15;
4124ffd9fb3SCarlo Bramini 
4134ffd9fb3SCarlo Bramini     /* Counter */
4144ffd9fb3SCarlo Bramini     DWORD64 Rip;
4154ffd9fb3SCarlo Bramini 
4164ffd9fb3SCarlo Bramini    /* Floating point */
4174ffd9fb3SCarlo Bramini    union {
4184ffd9fb3SCarlo Bramini        XMM_SAVE_AREA32 FltSave;
4194ffd9fb3SCarlo Bramini        struct {
4204ffd9fb3SCarlo Bramini            M128A Header[2];
4214ffd9fb3SCarlo Bramini            M128A Legacy[8];
4224ffd9fb3SCarlo Bramini            M128A Xmm0;
4234ffd9fb3SCarlo Bramini            M128A Xmm1;
4244ffd9fb3SCarlo Bramini            M128A Xmm2;
4254ffd9fb3SCarlo Bramini            M128A Xmm3;
4264ffd9fb3SCarlo Bramini            M128A Xmm4;
4274ffd9fb3SCarlo Bramini            M128A Xmm5;
4284ffd9fb3SCarlo Bramini            M128A Xmm6;
4294ffd9fb3SCarlo Bramini            M128A Xmm7;
4304ffd9fb3SCarlo Bramini            M128A Xmm8;
4314ffd9fb3SCarlo Bramini            M128A Xmm9;
4324ffd9fb3SCarlo Bramini            M128A Xmm10;
4334ffd9fb3SCarlo Bramini            M128A Xmm11;
4344ffd9fb3SCarlo Bramini            M128A Xmm12;
4354ffd9fb3SCarlo Bramini            M128A Xmm13;
4364ffd9fb3SCarlo Bramini            M128A Xmm14;
4374ffd9fb3SCarlo Bramini            M128A Xmm15;
4384ffd9fb3SCarlo Bramini       } DUMMYSTRUCTNAME;
4394ffd9fb3SCarlo Bramini     } DUMMYUNIONNAME;
4404ffd9fb3SCarlo Bramini 
4414ffd9fb3SCarlo Bramini      /* Vector */
4424ffd9fb3SCarlo Bramini     M128A VectorRegister[26];
4434ffd9fb3SCarlo Bramini     DWORD64 VectorControl;
4444ffd9fb3SCarlo Bramini 
4454ffd9fb3SCarlo Bramini     /* Debug control */
4464ffd9fb3SCarlo Bramini     DWORD64 DebugControl;
4474ffd9fb3SCarlo Bramini     DWORD64 LastBranchToRip;
4484ffd9fb3SCarlo Bramini     DWORD64 LastBranchFromRip;
4494ffd9fb3SCarlo Bramini     DWORD64 LastExceptionToRip;
4504ffd9fb3SCarlo Bramini     DWORD64 LastExceptionFromRip;
4514ffd9fb3SCarlo Bramini } CONTEXT;
452493ceb7aSJérôme Gardou 
45398b90e73SJustin Miller #elif defined TARGET_arm
454c2c66affSColin Finck 
455c2c66affSColin Finck /* The following flags control the contents of the CONTEXT structure. */
456c2c66affSColin Finck 
457c2c66affSColin Finck #define CONTEXT_ARM    0x0200000
458c2c66affSColin Finck #define CONTEXT_CONTROL         (CONTEXT_ARM | 0x00000001)
459c2c66affSColin Finck #define CONTEXT_INTEGER         (CONTEXT_ARM | 0x00000002)
460c2c66affSColin Finck #define CONTEXT_FLOATING_POINT  (CONTEXT_ARM | 0x00000004)
461c2c66affSColin Finck #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
462c2c66affSColin Finck 
463c2c66affSColin Finck #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
464c2c66affSColin Finck 
465c2c66affSColin Finck #define EXCEPTION_READ_FAULT    0
466c2c66affSColin Finck #define EXCEPTION_WRITE_FAULT   1
467c2c66affSColin Finck #define EXCEPTION_EXECUTE_FAULT 8
468c2c66affSColin Finck 
469c2c66affSColin Finck typedef struct _RUNTIME_FUNCTION
470c2c66affSColin Finck {
471c2c66affSColin Finck     DWORD BeginAddress;
472c2c66affSColin Finck     union {
473c2c66affSColin Finck         DWORD UnwindData;
474c2c66affSColin Finck         struct {
475c2c66affSColin Finck             DWORD Flag : 2;
476c2c66affSColin Finck             DWORD FunctionLength : 11;
477c2c66affSColin Finck             DWORD Ret : 2;
478c2c66affSColin Finck             DWORD H : 1;
479c2c66affSColin Finck             DWORD Reg : 3;
480c2c66affSColin Finck             DWORD R : 1;
481c2c66affSColin Finck             DWORD L : 1;
482c2c66affSColin Finck             DWORD C : 1;
483c2c66affSColin Finck             DWORD StackAdjust : 10;
484c2c66affSColin Finck         } DUMMYSTRUCTNAME;
485c2c66affSColin Finck     } DUMMYUNIONNAME;
486c2c66affSColin Finck } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
487c2c66affSColin Finck 
488c2c66affSColin Finck #define UNWIND_HISTORY_TABLE_SIZE 12
489c2c66affSColin Finck typedef struct _UNWIND_HISTORY_TABLE_ENTRY
490c2c66affSColin Finck {
491c2c66affSColin Finck     DWORD ImageBase;
492c2c66affSColin Finck     PRUNTIME_FUNCTION FunctionEntry;
493c2c66affSColin Finck } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
494c2c66affSColin Finck 
495c2c66affSColin Finck typedef struct _UNWIND_HISTORY_TABLE
496c2c66affSColin Finck {
497c2c66affSColin Finck     DWORD Count;
498c2c66affSColin Finck     BYTE  LocalHint;
499c2c66affSColin Finck     BYTE  GlobalHint;
500c2c66affSColin Finck     BYTE  Search;
501c2c66affSColin Finck     BYTE  Once;
502c2c66affSColin Finck     DWORD LowAddress;
503c2c66affSColin Finck     DWORD HighAddress;
504c2c66affSColin Finck     UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
505c2c66affSColin Finck } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
506c2c66affSColin Finck 
507c2c66affSColin Finck typedef struct _CONTEXT {
508c2c66affSColin Finck         /* The flags values within this flag control the contents of
509c2c66affSColin Finck            a CONTEXT record.
510c2c66affSColin Finck 
511c2c66affSColin Finck            If the context record is used as an input parameter, then
512c2c66affSColin Finck            for each portion of the context record controlled by a flag
513c2c66affSColin Finck            whose value is set, it is assumed that that portion of the
514c2c66affSColin Finck            context record contains valid context. If the context record
515c2c66affSColin Finck            is being used to modify a thread's context, then only that
516c2c66affSColin Finck            portion of the threads context will be modified.
517c2c66affSColin Finck 
518c2c66affSColin Finck            If the context record is used as an IN OUT parameter to capture
519c2c66affSColin Finck            the context of a thread, then only those portions of the thread's
520c2c66affSColin Finck            context corresponding to set flags will be returned.
521c2c66affSColin Finck 
522c2c66affSColin Finck            The context record is never used as an OUT only parameter. */
523c2c66affSColin Finck 
524c2c66affSColin Finck         ULONG ContextFlags;
525c2c66affSColin Finck 
526c2c66affSColin Finck         /* This section is specified/returned if the ContextFlags word contains
527c2c66affSColin Finck            the flag CONTEXT_INTEGER. */
528c2c66affSColin Finck         ULONG R0;
529c2c66affSColin Finck         ULONG R1;
530c2c66affSColin Finck         ULONG R2;
531c2c66affSColin Finck         ULONG R3;
532c2c66affSColin Finck         ULONG R4;
533c2c66affSColin Finck         ULONG R5;
534c2c66affSColin Finck         ULONG R6;
535c2c66affSColin Finck         ULONG R7;
536c2c66affSColin Finck         ULONG R8;
537c2c66affSColin Finck         ULONG R9;
538c2c66affSColin Finck         ULONG R10;
539c2c66affSColin Finck         ULONG Fp;
540c2c66affSColin Finck         ULONG Ip;
541c2c66affSColin Finck 
542c2c66affSColin Finck         /* These are selected by CONTEXT_CONTROL */
543c2c66affSColin Finck         ULONG Sp;
544c2c66affSColin Finck         ULONG Lr;
545c2c66affSColin Finck         ULONG Pc;
546c2c66affSColin Finck         ULONG Cpsr;
547c2c66affSColin Finck } CONTEXT;
548c2c66affSColin Finck 
549c2c66affSColin Finck BOOLEAN CDECL            RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD);
550c2c66affSColin Finck BOOLEAN CDECL            RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
551c2c66affSColin Finck PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(ULONG_PTR,DWORD*,UNWIND_HISTORY_TABLE*);
55298b90e73SJustin Miller 
55398b90e73SJustin Miller #elif defined TARGET_arm64
55498b90e73SJustin Miller 
55598b90e73SJustin Miller #define CONTEXT_ARM64   0x00400000L
55698b90e73SJustin Miller #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x1L)
55798b90e73SJustin Miller #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x2L)
55898b90e73SJustin Miller #define CONTEXT_FLOATING_POINT  (CONTEXT_ARM64 | 0x4L)
55998b90e73SJustin Miller #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x8L)
56098b90e73SJustin Miller #define CONTEXT_X18 (CONTEXT_ARM64 | 0x10L)
56198b90e73SJustin Miller #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
56298b90e73SJustin Miller 
56398b90e73SJustin Miller #define EXCEPTION_READ_FAULT    0
56498b90e73SJustin Miller #define EXCEPTION_WRITE_FAULT   1
56598b90e73SJustin Miller #define EXCEPTION_EXECUTE_FAULT 8
56698b90e73SJustin Miller 
56798b90e73SJustin Miller typedef union NEON128 {
56898b90e73SJustin Miller     struct {
56998b90e73SJustin Miller         ULONGLONG Low;
57098b90e73SJustin Miller         LONGLONG High;
57198b90e73SJustin Miller     } DUMMYSTRUCTNAME;
57298b90e73SJustin Miller     double D[2];
57398b90e73SJustin Miller     float S[4];
57498b90e73SJustin Miller     WORD   H[8];
57598b90e73SJustin Miller     BYTE  B[16];
57698b90e73SJustin Miller } NEON128, *PNEON128;
57798b90e73SJustin Miller 
57898b90e73SJustin Miller #define ARM64_MAX_BREAKPOINTS 8
57998b90e73SJustin Miller #define ARM64_MAX_WATCHPOINTS 2
58098b90e73SJustin Miller 
58198b90e73SJustin Miller typedef struct _CONTEXT {
58298b90e73SJustin Miller 
58398b90e73SJustin Miller     //
58498b90e73SJustin Miller     // Control flags.
58598b90e73SJustin Miller     //
58698b90e73SJustin Miller 
58798b90e73SJustin Miller     DWORD ContextFlags;
58898b90e73SJustin Miller 
58998b90e73SJustin Miller     //
59098b90e73SJustin Miller     // Integer registers
59198b90e73SJustin Miller     //
59298b90e73SJustin Miller 
59398b90e73SJustin Miller     DWORD Cpsr;
59498b90e73SJustin Miller     union {
59598b90e73SJustin Miller         struct {
59698b90e73SJustin Miller             DWORD64 X0;
59798b90e73SJustin Miller             DWORD64 X1;
59898b90e73SJustin Miller             DWORD64 X2;
59998b90e73SJustin Miller             DWORD64 X3;
60098b90e73SJustin Miller             DWORD64 X4;
60198b90e73SJustin Miller             DWORD64 X5;
60298b90e73SJustin Miller             DWORD64 X6;
60398b90e73SJustin Miller             DWORD64 X7;
60498b90e73SJustin Miller             DWORD64 X8;
60598b90e73SJustin Miller             DWORD64 X9;
60698b90e73SJustin Miller             DWORD64 X10;
60798b90e73SJustin Miller             DWORD64 X11;
60898b90e73SJustin Miller             DWORD64 X12;
60998b90e73SJustin Miller             DWORD64 X13;
61098b90e73SJustin Miller             DWORD64 X14;
61198b90e73SJustin Miller             DWORD64 X15;
61298b90e73SJustin Miller             DWORD64 X16;
61398b90e73SJustin Miller             DWORD64 X17;
61498b90e73SJustin Miller             DWORD64 X18;
61598b90e73SJustin Miller             DWORD64 X19;
61698b90e73SJustin Miller             DWORD64 X20;
61798b90e73SJustin Miller             DWORD64 X21;
61898b90e73SJustin Miller             DWORD64 X22;
61998b90e73SJustin Miller             DWORD64 X23;
62098b90e73SJustin Miller             DWORD64 X24;
62198b90e73SJustin Miller             DWORD64 X25;
62298b90e73SJustin Miller             DWORD64 X26;
62398b90e73SJustin Miller             DWORD64 X27;
62498b90e73SJustin Miller             DWORD64 X28;
62598b90e73SJustin Miller             DWORD64 Fp;
62698b90e73SJustin Miller             DWORD64 Lr;
62798b90e73SJustin Miller         } DUMMYSTRUCTNAME;
62898b90e73SJustin Miller         DWORD64 X[31];
62998b90e73SJustin Miller     } DUMMYUNIONNAME;
63098b90e73SJustin Miller 
63198b90e73SJustin Miller     DWORD64 Sp;
63298b90e73SJustin Miller     DWORD64 Pc;
63398b90e73SJustin Miller 
63498b90e73SJustin Miller     //
63598b90e73SJustin Miller     // Floating Point/NEON Registers
63698b90e73SJustin Miller     //
63798b90e73SJustin Miller 
63898b90e73SJustin Miller     NEON128 V[32];
63998b90e73SJustin Miller     DWORD Fpcr;
64098b90e73SJustin Miller     DWORD Fpsr;
64198b90e73SJustin Miller 
64298b90e73SJustin Miller     //
64398b90e73SJustin Miller     // Debug registers
64498b90e73SJustin Miller     //
64598b90e73SJustin Miller 
64698b90e73SJustin Miller     DWORD Bcr[ARM64_MAX_BREAKPOINTS];
64798b90e73SJustin Miller     DWORD64 Bvr[ARM64_MAX_BREAKPOINTS];
64898b90e73SJustin Miller     DWORD Wcr[ARM64_MAX_WATCHPOINTS];
64998b90e73SJustin Miller     DWORD64 Wvr[ARM64_MAX_WATCHPOINTS];
65098b90e73SJustin Miller 
65198b90e73SJustin Miller } _CONTEXT, *P_CONTEXT;
65298b90e73SJustin Miller typedef _CONTEXT CONTEXT, *PCONTEXT;
65398b90e73SJustin Miller 
65498b90e73SJustin Miller typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY {
65598b90e73SJustin Miller     DWORD BeginAddress;
65698b90e73SJustin Miller     union {
65798b90e73SJustin Miller         DWORD UnwindData;
65898b90e73SJustin Miller         struct {
65998b90e73SJustin Miller             DWORD Flag : 2;
66098b90e73SJustin Miller             DWORD FunctionLength : 11;
66198b90e73SJustin Miller             DWORD RegF : 3;
66298b90e73SJustin Miller             DWORD RegI : 4;
66398b90e73SJustin Miller             DWORD H : 1;
66498b90e73SJustin Miller             DWORD CR : 2;
66598b90e73SJustin Miller             DWORD FrameSize : 9;
66698b90e73SJustin Miller         } DUMMYSTRUCTNAME;
66798b90e73SJustin Miller     } DUMMYUNIONNAME;
66898b90e73SJustin Miller } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
66998b90e73SJustin Miller typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
67098b90e73SJustin Miller 
67198b90e73SJustin Miller #define UNWIND_HISTORY_TABLE_SIZE 12
67298b90e73SJustin Miller 
67398b90e73SJustin Miller typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
67498b90e73SJustin Miller     ULONG_PTR ImageBase;
67598b90e73SJustin Miller     PRUNTIME_FUNCTION FunctionEntry;
67698b90e73SJustin Miller } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
67798b90e73SJustin Miller 
67898b90e73SJustin Miller typedef struct _UNWIND_HISTORY_TABLE {
67998b90e73SJustin Miller     DWORD Count;
68098b90e73SJustin Miller     BYTE  LocalHint;
68198b90e73SJustin Miller     BYTE  GlobalHint;
68298b90e73SJustin Miller     BYTE  Search;
68398b90e73SJustin Miller     BYTE  Once;
68498b90e73SJustin Miller     ULONG_PTR LowAddress;
68598b90e73SJustin Miller     ULONG_PTR HighAddress;
68698b90e73SJustin Miller     UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
68798b90e73SJustin Miller } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
68898b90e73SJustin Miller 
68998b90e73SJustin Miller BOOLEAN CDECL            RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD);
69098b90e73SJustin Miller BOOLEAN CDECL            RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
69198b90e73SJustin Miller PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(ULONG_PTR,DWORD*,UNWIND_HISTORY_TABLE*);
69298b90e73SJustin Miller 
693493ceb7aSJérôme Gardou #else
694493ceb7aSJérôme Gardou 
695493ceb7aSJérôme Gardou #error "Unknown target platform"
696493ceb7aSJérôme Gardou 
697c2c66affSColin Finck #endif
698c2c66affSColin Finck 
6994ffd9fb3SCarlo Bramini typedef CONTEXT *PCONTEXT;
7004ffd9fb3SCarlo Bramini 
701c2c66affSColin Finck typedef
702c2c66affSColin Finck EXCEPTION_DISPOSITION
703c2c66affSColin Finck NTAPI
704c2c66affSColin Finck EXCEPTION_ROUTINE(
705c2c66affSColin Finck   struct _EXCEPTION_RECORD *ExceptionRecord,
706c2c66affSColin Finck   PVOID EstablisherFrame,
707c2c66affSColin Finck   struct _CONTEXT *ContextRecord,
708c2c66affSColin Finck   PVOID DispatcherContext);
709c2c66affSColin Finck typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
710c2c66affSColin Finck typedef struct _NT_TIB {
711c2c66affSColin Finck   struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
712c2c66affSColin Finck   PVOID StackBase;
713c2c66affSColin Finck   PVOID StackLimit;
714c2c66affSColin Finck   PVOID SubSystemTib;
715c2c66affSColin Finck   union {
716c2c66affSColin Finck     PVOID FiberData;
717c2c66affSColin Finck     DWORD Version;
718c2c66affSColin Finck   } DUMMYUNIONNAME;
719c2c66affSColin Finck   PVOID ArbitraryUserPointer;
720c2c66affSColin Finck   struct _NT_TIB *Self;
721c2c66affSColin Finck } NT_TIB,*PNT_TIB;
722c2c66affSColin Finck 
723c2c66affSColin Finck // rtltypes.h
724c2c66affSColin Finck typedef struct _EXCEPTION_REGISTRATION_RECORD
725c2c66affSColin Finck {
726c2c66affSColin Finck     struct _EXCEPTION_REGISTRATION_RECORD *Next;
727c2c66affSColin Finck     PEXCEPTION_ROUTINE Handler;
728c2c66affSColin Finck } EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
729c2c66affSColin Finck 
730c2c66affSColin Finck // winbase.h
731c2c66affSColin Finck #define INVALID_HANDLE_VALUE (HANDLE)(-1)
732ebdb2b35Swinesync #define INVALID_SET_FILE_POINTER	((DWORD)-1)
733c2c66affSColin Finck #define HeapAlloc __HeapAlloc
734c2c66affSColin Finck #define HeapReAlloc __HeapReAlloc
735c2c66affSColin Finck #define HeapFree(x,y,z) free(z)
736c2c66affSColin Finck #define GetProcessHeap() 1
737c2c66affSColin Finck #define GetProcessId(x) 8
738c2c66affSColin Finck #define lstrcpynW __lstrcpynW
739c2c66affSColin Finck #define CloseHandle __CloseHandle
740c2c66affSColin Finck #define CreateFileA(a,b,c,d,e,f,g) fopen(a, "rb")
741c2c66affSColin Finck #define CreateFileW __CreateFileW
742ebdb2b35Swinesync #define ReadFile(a,b,c,d,e) __ReadFile
743ebdb2b35Swinesync #define SetFilePointer __SetFilePointer
744c2c66affSColin Finck #define CreateFileMappingW(a,b,c,d,e,f) a
745c2c66affSColin Finck #define MapViewOfFile __MapViewOfFile
746c2c66affSColin Finck #define UnmapViewOfFile __UnmapViewOfFile
747c2c66affSColin Finck #define LoadLibraryW(x) 0
748c2c66affSColin Finck #define FreeLibrary(x) 0
749c2c66affSColin Finck #define lstrcpyW strcpyW // Forward this to wine unicode inline function
750c2c66affSColin Finck #define lstrlenW strlenW // ditto
751c2c66affSColin Finck #define lstrcpynA __lstrcpynA
752c2c66affSColin Finck #define SetLastError(x)
753c2c66affSColin Finck #define GetProcAddress(x,y) 0
754c2c66affSColin Finck #define GetEnvironmentVariableA(x, y, z) 0
755c2c66affSColin Finck #define GetEnvironmentVariableW(x, y, z) 0
756c2c66affSColin Finck #define GetCurrentDirectoryW(x, y) 0
757c2c66affSColin Finck #define GetFileSizeEx __GetFileSizeEx
758c2c66affSColin Finck #define ReadProcessMemory(a,b,c,d,e) 0
759f69be6c5Swinesync #define GetCurrentProcess() (HANDLE)1
760f69be6c5Swinesync #define IsWow64Process __IsWow64Process
761ebdb2b35Swinesync #define FILE_BEGIN	0
762c2c66affSColin Finck 
763c2c66affSColin Finck void* __HeapAlloc(int heap, int flags, size_t size);
764c2c66affSColin Finck void* __HeapReAlloc(int heap, DWORD d2, void *slab, SIZE_T newsize);
765c2c66affSColin Finck WCHAR* __lstrcpynW(WCHAR* lpString1, const WCHAR* lpString2, int iMaxLength);
766c2c66affSColin Finck BOOL __CloseHandle(HANDLE handle);
767c2c66affSColin Finck HANDLE __CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
768ebdb2b35Swinesync BOOL __ReadFile(HANDLE,PVOID,DWORD,PDWORD,/*LPOVERLAPPED*/ PVOID);
769ebdb2b35Swinesync DWORD __SetFilePointer(HANDLE,LONG,PLONG,DWORD);
770c2c66affSColin Finck void* __MapViewOfFile(HANDLE file,DWORD d1,DWORD d2,DWORD d3,SIZE_T s);
771c2c66affSColin Finck BOOL __UnmapViewOfFile(const void*);
772c2c66affSColin Finck LPSTR __lstrcpynA(LPSTR,LPCSTR,int);
773c2c66affSColin Finck BOOL __GetFileSizeEx(HANDLE,PLARGE_INTEGER);
774f69be6c5Swinesync BOOL WINAPI __IsWow64Process(HANDLE,BOOL*);
775c2c66affSColin Finck #define OPEN_EXISTING	3
776c2c66affSColin Finck #define FILE_MAP_READ SECTION_MAP_READ
777c2c66affSColin Finck typedef struct _LDT_ENTRY {
778c2c66affSColin Finck 	WORD LimitLow;
779c2c66affSColin Finck 	WORD BaseLow;
780c2c66affSColin Finck 	union {
781c2c66affSColin Finck 		struct {
782c2c66affSColin Finck 			BYTE BaseMid;
783c2c66affSColin Finck 			BYTE Flags1;
784c2c66affSColin Finck 			BYTE Flags2;
785c2c66affSColin Finck 			BYTE BaseHi;
786c2c66affSColin Finck 		} Bytes;
787c2c66affSColin Finck 		struct {
788c2c66affSColin Finck 			DWORD BaseMid:8;
789c2c66affSColin Finck 			DWORD Type:5;
790c2c66affSColin Finck 			DWORD Dpl:2;
791c2c66affSColin Finck 			DWORD Pres:1;
792c2c66affSColin Finck 			DWORD LimitHi:4;
793c2c66affSColin Finck 			DWORD Sys:1;
794c2c66affSColin Finck 			DWORD Reserved_0:1;
795c2c66affSColin Finck 			DWORD Default_Big:1;
796c2c66affSColin Finck 			DWORD Granularity:1;
797c2c66affSColin Finck 			DWORD BaseHi:8;
798c2c66affSColin Finck 		} Bits;
799c2c66affSColin Finck 	} HighWord;
800c2c66affSColin Finck } LDT_ENTRY,*PLDT_ENTRY,*LPLDT_ENTRY;
801c2c66affSColin Finck 
802c2c66affSColin Finck // umtypes.h
803c2c66affSColin Finck typedef LONG KPRIORITY;
804c2c66affSColin Finck 
805c2c66affSColin Finck // winternl.h
806c2c66affSColin Finck #define RtlImageNtHeader __RtlImageNtHeader
807c2c66affSColin Finck #define RtlImageRvaToVa __RtlImageRvaToVa
808c2c66affSColin Finck #define RtlImageRvaToSection __RtlImageRvaToSection
809c2c66affSColin Finck #define RtlImageDirectoryEntryToData __RtlImageDirectoryEntryToData
810ebdb2b35Swinesync #define RtlComputeCrc32 __RtlComputeCrc32
811c2c66affSColin Finck 
812c2c66affSColin Finck #ifdef _MSC_VER
813c2c66affSColin Finck #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
814c2c66affSColin Finck #else
815c2c66affSColin Finck #define RtlUlongByteSwap(_x) __builtin_bswap32((_x))
816c2c66affSColin Finck #endif
817c2c66affSColin Finck 
818c2c66affSColin Finck PIMAGE_NT_HEADERS __RtlImageNtHeader(void *data);
819c2c66affSColin Finck PVOID __RtlImageRvaToVa (const IMAGE_NT_HEADERS* NtHeader, PVOID BaseAddress, ULONG Rva, PIMAGE_SECTION_HEADER *SectionHeader);
820c2c66affSColin Finck PVOID __RtlImageDirectoryEntryToData(PVOID BaseAddress, BOOLEAN MappedAsImage, USHORT Directory, PULONG Size);
821*01fbf25dSSerge Gautherie ULONG __RtlComputeCrc32(ULONG Initial, const UCHAR *Data, ULONG Length);
822c2c66affSColin Finck 
823c2c66affSColin Finck typedef struct _CLIENT_ID
824c2c66affSColin Finck {
825c2c66affSColin Finck    HANDLE UniqueProcess;
826c2c66affSColin Finck    HANDLE UniqueThread;
827c2c66affSColin Finck } CLIENT_ID, *PCLIENT_ID;
828c2c66affSColin Finck #define GDI_BATCH_BUFFER_SIZE 0x136
829c2c66affSColin Finck typedef struct _GDI_TEB_BATCH
830c2c66affSColin Finck {
831c2c66affSColin Finck     ULONG Offset;
832c2c66affSColin Finck     HANDLE HDC;
833c2c66affSColin Finck     ULONG Buffer[GDI_BATCH_BUFFER_SIZE];
834c2c66affSColin Finck } GDI_TEB_BATCH, *PGDI_TEB_BATCH;
835c2c66affSColin Finck typedef struct _TEB
836c2c66affSColin Finck {
837c2c66affSColin Finck     NT_TIB          Tib;                        /* 000 */
838c2c66affSColin Finck     PVOID           EnvironmentPointer;         /* 01c */
839c2c66affSColin Finck     CLIENT_ID       ClientId;                   /* 020 */
840c2c66affSColin Finck     PVOID           ActiveRpcHandle;            /* 028 */
841c2c66affSColin Finck     PVOID           ThreadLocalStoragePointer;  /* 02c */
842c2c66affSColin Finck     PVOID           Peb;                        /* 030 */
843c2c66affSColin Finck     ULONG           LastErrorValue;             /* 034 */
844c2c66affSColin Finck     ULONG           CountOfOwnedCriticalSections;/* 038 */
845c2c66affSColin Finck     PVOID           CsrClientThread;            /* 03c */
846c2c66affSColin Finck     PVOID           Win32ThreadInfo;            /* 040 */
847c2c66affSColin Finck     ULONG           Win32ClientInfo[31];        /* 044 used for user32 private data in Wine */
848c2c66affSColin Finck     PVOID           WOW32Reserved;              /* 0c0 */
849c2c66affSColin Finck     ULONG           CurrentLocale;              /* 0c4 */
850c2c66affSColin Finck     ULONG           FpSoftwareStatusRegister;   /* 0c8 */
851c2c66affSColin Finck     PVOID           SystemReserved1[54];        /* 0cc used for kernel32 private data in Wine */
852c2c66affSColin Finck     PVOID           Spare1;                     /* 1a4 */
853c2c66affSColin Finck     LONG            ExceptionCode;              /* 1a8 */
854c2c66affSColin Finck     PVOID     ActivationContextStackPointer;            /* 1a8/02c8 */
855c2c66affSColin Finck     BYTE            SpareBytes1[36];            /* 1ac */
856c2c66affSColin Finck     PVOID           SystemReserved2[10];        /* 1d4 used for ntdll private data in Wine */
857c2c66affSColin Finck     GDI_TEB_BATCH   GdiTebBatch;                /* 1fc */
858c2c66affSColin Finck     ULONG           gdiRgn;                     /* 6dc */
859c2c66affSColin Finck     ULONG           gdiPen;                     /* 6e0 */
860c2c66affSColin Finck     ULONG           gdiBrush;                   /* 6e4 */
861c2c66affSColin Finck     CLIENT_ID       RealClientId;               /* 6e8 */
862c2c66affSColin Finck     HANDLE          GdiCachedProcessHandle;     /* 6f0 */
863c2c66affSColin Finck     ULONG           GdiClientPID;               /* 6f4 */
864c2c66affSColin Finck     ULONG           GdiClientTID;               /* 6f8 */
865c2c66affSColin Finck     PVOID           GdiThreadLocaleInfo;        /* 6fc */
866c2c66affSColin Finck     PVOID           UserReserved[5];            /* 700 */
867c2c66affSColin Finck     PVOID           glDispatchTable[280];        /* 714 */
868c2c66affSColin Finck     ULONG           glReserved1[26];            /* b74 */
869c2c66affSColin Finck     PVOID           glReserved2;                /* bdc */
870c2c66affSColin Finck     PVOID           glSectionInfo;              /* be0 */
871c2c66affSColin Finck     PVOID           glSection;                  /* be4 */
872c2c66affSColin Finck     PVOID           glTable;                    /* be8 */
873c2c66affSColin Finck     PVOID           glCurrentRC;                /* bec */
874c2c66affSColin Finck     PVOID           glContext;                  /* bf0 */
875c2c66affSColin Finck     ULONG           LastStatusValue;            /* bf4 */
876c2c66affSColin Finck     UNICODE_STRING  StaticUnicodeString;        /* bf8 used by advapi32 */
877c2c66affSColin Finck     WCHAR           StaticUnicodeBuffer[261];   /* c00 used by advapi32 */
878c2c66affSColin Finck     PVOID           DeallocationStack;          /* e0c */
879c2c66affSColin Finck     PVOID           TlsSlots[64];               /* e10 */
880c2c66affSColin Finck     LIST_ENTRY      TlsLinks;                   /* f10 */
881c2c66affSColin Finck     PVOID           Vdm;                        /* f18 */
882c2c66affSColin Finck     PVOID           ReservedForNtRpc;           /* f1c */
883c2c66affSColin Finck     PVOID           DbgSsReserved[2];           /* f20 */
884c2c66affSColin Finck     ULONG           HardErrorDisabled;          /* f28 */
885c2c66affSColin Finck     PVOID           Instrumentation[16];        /* f2c */
886c2c66affSColin Finck     PVOID           WinSockData;                /* f6c */
887c2c66affSColin Finck     ULONG           GdiBatchCount;              /* f70 */
888c2c66affSColin Finck     ULONG           Spare2;                     /* f74 */
889c2c66affSColin Finck     ULONG           Spare3;                     /* f78 */
890c2c66affSColin Finck     ULONG           Spare4;                     /* f7c */
891c2c66affSColin Finck     PVOID           ReservedForOle;             /* f80 */
892c2c66affSColin Finck     ULONG           WaitingOnLoaderLock;        /* f84 */
893c2c66affSColin Finck     PVOID           Reserved5[3];               /* f88 */
894c2c66affSColin Finck     PVOID          *TlsExpansionSlots;          /* f94 */
895c2c66affSColin Finck } TEB, *PTEB;
896c2c66affSColin Finck 
897c2c66affSColin Finck 
898c2c66affSColin Finck // winver.h
899c2c66affSColin Finck typedef struct tagVS_FIXEDFILEINFO {
900c2c66affSColin Finck 	DWORD dwSignature;
901c2c66affSColin Finck 	DWORD dwStrucVersion;
902c2c66affSColin Finck 	DWORD dwFileVersionMS;
903c2c66affSColin Finck 	DWORD dwFileVersionLS;
904c2c66affSColin Finck 	DWORD dwProductVersionMS;
905c2c66affSColin Finck 	DWORD dwProductVersionLS;
906c2c66affSColin Finck 	DWORD dwFileFlagsMask;
907c2c66affSColin Finck 	DWORD dwFileFlags;
908c2c66affSColin Finck 	DWORD dwFileOS;
909c2c66affSColin Finck 	DWORD dwFileType;
910c2c66affSColin Finck 	DWORD dwFileSubtype;
911c2c66affSColin Finck 	DWORD dwFileDateMS;
912c2c66affSColin Finck 	DWORD dwFileDateLS;
913c2c66affSColin Finck } VS_FIXEDFILEINFO;
914c2c66affSColin Finck 
915c2c66affSColin Finck 
916c2c66affSColin Finck // psapi.h
917c2c66affSColin Finck typedef struct _MODULEINFO {
918c2c66affSColin Finck 	LPVOID lpBaseOfDll;
919c2c66affSColin Finck 	DWORD SizeOfImage;
920c2c66affSColin Finck 	LPVOID EntryPoint;
921c2c66affSColin Finck } MODULEINFO,*LPMODULEINFO;
922c2c66affSColin Finck #define GetModuleFileNameExW(w, x, y, z) 0
923c2c66affSColin Finck 
924c2c66affSColin Finck // pstypes.h
925c2c66affSColin Finck typedef struct _THREAD_BASIC_INFORMATION
926c2c66affSColin Finck {
927c2c66affSColin Finck     NTSTATUS ExitStatus;
928c2c66affSColin Finck     PVOID TebBaseAddress;
929c2c66affSColin Finck     CLIENT_ID ClientId;
930c2c66affSColin Finck     KAFFINITY AffinityMask;
931c2c66affSColin Finck     KPRIORITY Priority;
932c2c66affSColin Finck     KPRIORITY BasePriority;
933c2c66affSColin Finck } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
934c2c66affSColin Finck typedef enum _THREADINFOCLASS {
935c2c66affSColin Finck   ThreadBasicInformation,
936c2c66affSColin Finck   ThreadTimes,
937c2c66affSColin Finck   ThreadPriority,
938c2c66affSColin Finck   ThreadBasePriority,
939c2c66affSColin Finck   ThreadAffinityMask,
940c2c66affSColin Finck   ThreadImpersonationToken,
941c2c66affSColin Finck   ThreadDescriptorTableEntry,
942c2c66affSColin Finck   ThreadEnableAlignmentFaultFixup,
943c2c66affSColin Finck   ThreadEventPair_Reusable,
944c2c66affSColin Finck   ThreadQuerySetWin32StartAddress,
945c2c66affSColin Finck   ThreadZeroTlsCell,
946c2c66affSColin Finck   ThreadPerformanceCount,
947c2c66affSColin Finck   ThreadAmILastThread,
948c2c66affSColin Finck   ThreadIdealProcessor,
949c2c66affSColin Finck   ThreadPriorityBoost,
950c2c66affSColin Finck   ThreadSetTlsArrayAddress,
951c2c66affSColin Finck   ThreadIsIoPending,
952c2c66affSColin Finck   ThreadHideFromDebugger,
953c2c66affSColin Finck   ThreadBreakOnTermination,
954c2c66affSColin Finck   ThreadSwitchLegacyState,
955c2c66affSColin Finck   ThreadIsTerminated,
956c2c66affSColin Finck   ThreadLastSystemCall,
957c2c66affSColin Finck   ThreadIoPriority,
958c2c66affSColin Finck   ThreadCycleTime,
959c2c66affSColin Finck   ThreadPagePriority,
960c2c66affSColin Finck   ThreadActualBasePriority,
961c2c66affSColin Finck   ThreadTebInformation,
962c2c66affSColin Finck   ThreadCSwitchMon,
963c2c66affSColin Finck   ThreadCSwitchPmu,
964c2c66affSColin Finck   ThreadWow64Context,
965c2c66affSColin Finck   ThreadGroupInformation,
966c2c66affSColin Finck   ThreadUmsInformation,
967c2c66affSColin Finck   ThreadCounterProfiling,
968c2c66affSColin Finck   ThreadIdealProcessorEx,
969c2c66affSColin Finck   MaxThreadInfoClass
970c2c66affSColin Finck } THREADINFOCLASS;
971c2c66affSColin Finck 
972c2c66affSColin Finck 
973c2c66affSColin Finck // dbghelp.h
974c2c66affSColin Finck typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
975c2c66affSColin Finck #define MAX_SYM_NAME    2000
976c2c66affSColin Finck #define CBA_DEFERRED_SYMBOL_LOAD_START          0x00000001
977c2c66affSColin Finck #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE       0x00000002
978c2c66affSColin Finck #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE        0x00000003
979c2c66affSColin Finck #define CBA_SYMBOLS_UNLOADED                    0x00000004
980c2c66affSColin Finck #define CBA_DUPLICATE_SYMBOL                    0x00000005
981c2c66affSColin Finck #define CBA_READ_MEMORY                         0x00000006
982c2c66affSColin Finck #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL         0x00000007
983c2c66affSColin Finck #define CBA_SET_OPTIONS                         0x00000008
984c2c66affSColin Finck #define CBA_EVENT                               0x00000010
985c2c66affSColin Finck #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL        0x00000020
986c2c66affSColin Finck #define CBA_DEBUG_INFO                          0x10000000
987c2c66affSColin Finck #define SYMOPT_CASE_INSENSITIVE         0x00000001
988c2c66affSColin Finck #define SYMOPT_UNDNAME                  0x00000002
989c2c66affSColin Finck #define SYMOPT_DEFERRED_LOADS           0x00000004
990c2c66affSColin Finck #define SYMOPT_LOAD_LINES               0x00000010
991c2c66affSColin Finck #define SYMOPT_LOAD_ANYTHING            0x00000040
992c2c66affSColin Finck #define SYMOPT_PUBLICS_ONLY             0x00004000
993c2c66affSColin Finck #define SYMOPT_NO_PUBLICS               0x00008000
994c2c66affSColin Finck #define SYMOPT_AUTO_PUBLICS             0x00010000
995c2c66affSColin Finck #define SYMFLAG_VALUEPRESENT     0x00000001
996c2c66affSColin Finck #define SYMFLAG_REGISTER         0x00000008
997c2c66affSColin Finck #define SYMFLAG_REGREL           0x00000010
998c2c66affSColin Finck #define SYMFLAG_FRAMEREL         0x00000020
999c2c66affSColin Finck #define SYMFLAG_PARAMETER        0x00000040
1000c2c66affSColin Finck #define SYMFLAG_LOCAL            0x00000080
1001c2c66affSColin Finck #define SYMFLAG_CONSTANT         0x00000100
1002c2c66affSColin Finck #define SYMFLAG_EXPORT           0x00000200
1003c2c66affSColin Finck #define SYMFLAG_FORWARDER        0x00000400
1004c2c66affSColin Finck #define SYMFLAG_FUNCTION         0x00000800
1005c2c66affSColin Finck #define SYMFLAG_VIRTUAL          0x00001000
1006c2c66affSColin Finck #define SYMFLAG_THUNK            0x00002000
1007c2c66affSColin Finck #define SYMFLAG_TLSREL           0x00004000
1008c2c66affSColin Finck #define SYMFLAG_SLOT             0x00008000
100957519609Swinesync #define SYMFLAG_ILREL            0x00010000
101057519609Swinesync #define SYMFLAG_METADATA         0x00020000
101157519609Swinesync #define SYMFLAG_CLR_TOKEN        0x00040000
101257519609Swinesync #define SYMFLAG_NULL             0x00080000
101357519609Swinesync #define SYMFLAG_FUNC_NO_RETURN   0x00100000
101457519609Swinesync #define SYMFLAG_SYNTHETIC_ZEROBASE 0x00200000
101557519609Swinesync #define SYMFLAG_PUBLIC_CODE      0x00400000
1016c2c66affSColin Finck #define UNDNAME_COMPLETE                 (0x0000)
1017c2c66affSColin Finck #define UNDNAME_NAME_ONLY                (0x1000)
1018c2c66affSColin Finck typedef struct _TI_FINDCHILDREN_PARAMS
1019c2c66affSColin Finck {
1020c2c66affSColin Finck     ULONG Count;
1021c2c66affSColin Finck     ULONG Start;
1022c2c66affSColin Finck     ULONG ChildId[1];
1023c2c66affSColin Finck } TI_FINDCHILDREN_PARAMS;
1024c2c66affSColin Finck #define SYMSEARCH_GLOBALSONLY           0x04
1025c2c66affSColin Finck /* flags for SymLoadModuleEx */
1026c2c66affSColin Finck #define SLMFLAG_VIRTUAL         0x1
1027c2c66affSColin Finck #define SLMFLAG_NO_SYMBOLS      0x4
1028c2c66affSColin Finck typedef struct _DBGHELP_MODLOAD_DATA
1029c2c66affSColin Finck {
1030c2c66affSColin Finck     DWORD               ssize;
1031c2c66affSColin Finck     DWORD               ssig;
1032c2c66affSColin Finck     PVOID               data;
1033c2c66affSColin Finck     DWORD               size;
1034c2c66affSColin Finck     DWORD               flags;
1035c2c66affSColin Finck } MODLOAD_DATA, *PMODLOAD_DATA;
1036c2c66affSColin Finck typedef struct _SYMBOL_INFO
1037c2c66affSColin Finck {
1038c2c66affSColin Finck     ULONG       SizeOfStruct;
1039c2c66affSColin Finck     ULONG       TypeIndex;
1040c2c66affSColin Finck     ULONG64     Reserved[2];
1041c2c66affSColin Finck     ULONG       Index;
1042c2c66affSColin Finck     ULONG       Size;
1043c2c66affSColin Finck     ULONG64     ModBase;
1044c2c66affSColin Finck     ULONG       Flags;
1045c2c66affSColin Finck     ULONG64     Value;
1046c2c66affSColin Finck     ULONG64     Address;
1047c2c66affSColin Finck     ULONG       Register;
1048c2c66affSColin Finck     ULONG       Scope;
1049c2c66affSColin Finck     ULONG       Tag;
1050c2c66affSColin Finck     ULONG       NameLen;
1051c2c66affSColin Finck     ULONG       MaxNameLen;
1052c2c66affSColin Finck     CHAR        Name[1];
1053c2c66affSColin Finck } SYMBOL_INFO, *PSYMBOL_INFO;
1054c2c66affSColin Finck typedef enum
1055c2c66affSColin Finck {
1056c2c66affSColin Finck     SymNone = 0,
1057c2c66affSColin Finck     SymCoff,
1058c2c66affSColin Finck     SymCv,
1059c2c66affSColin Finck     SymPdb,
1060c2c66affSColin Finck     SymExport,
1061c2c66affSColin Finck     SymDeferred,
1062c2c66affSColin Finck     SymSym,
1063c2c66affSColin Finck     SymDia,
1064c2c66affSColin Finck     SymVirtual,
1065c2c66affSColin Finck     NumSymTypes
1066c2c66affSColin Finck } SYM_TYPE;
1067c2c66affSColin Finck typedef struct _IMAGEHLP_MODULEW64
1068c2c66affSColin Finck {
1069c2c66affSColin Finck     DWORD                       SizeOfStruct;
1070c2c66affSColin Finck     DWORD64                     BaseOfImage;
1071c2c66affSColin Finck     DWORD                       ImageSize;
1072c2c66affSColin Finck     DWORD                       TimeDateStamp;
1073c2c66affSColin Finck     DWORD                       CheckSum;
1074c2c66affSColin Finck     DWORD                       NumSyms;
1075c2c66affSColin Finck     SYM_TYPE                    SymType;
1076c2c66affSColin Finck     WCHAR                       ModuleName[32];
1077c2c66affSColin Finck     WCHAR                       ImageName[256];
1078c2c66affSColin Finck     WCHAR                       LoadedImageName[256];
1079c2c66affSColin Finck     WCHAR                       LoadedPdbName[256];
1080c2c66affSColin Finck     DWORD                       CVSig;
1081c2c66affSColin Finck     WCHAR                       CVData[MAX_PATH*3];
1082c2c66affSColin Finck     DWORD                       PdbSig;
1083c2c66affSColin Finck     GUID                        PdbSig70;
1084c2c66affSColin Finck     DWORD                       PdbAge;
1085c2c66affSColin Finck     BOOL                        PdbUnmatched;
1086c2c66affSColin Finck     BOOL                        DbgUnmatched;
1087c2c66affSColin Finck     BOOL                        LineNumbers;
1088c2c66affSColin Finck     BOOL                        GlobalSymbols;
1089c2c66affSColin Finck     BOOL                        TypeInfo;
1090c2c66affSColin Finck     BOOL                        SourceIndexed;
1091c2c66affSColin Finck     BOOL                        Publics;
1092c2c66affSColin Finck } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
1093c2c66affSColin Finck typedef struct _IMAGEHLP_LINE64
1094c2c66affSColin Finck {
1095c2c66affSColin Finck     DWORD                       SizeOfStruct;
1096c2c66affSColin Finck     PVOID                       Key;
1097c2c66affSColin Finck     DWORD                       LineNumber;
1098c2c66affSColin Finck     PCHAR                       FileName;
1099c2c66affSColin Finck     DWORD64                     Address;
1100c2c66affSColin Finck } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
110170880dd1Swinesync typedef enum
110270880dd1Swinesync {
110370880dd1Swinesync     SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
110470880dd1Swinesync     SYMOPT_EX_MAX,
110570880dd1Swinesync /* __WINESRC__ */
110670880dd1Swinesync     SYMOPT_EX_WINE_NATIVE_MODULES = 1000
110770880dd1Swinesync } IMAGEHLP_EXTENDED_OPTIONS;
1108c2c66affSColin Finck typedef struct _SRCCODEINFO
1109c2c66affSColin Finck {
1110c2c66affSColin Finck     DWORD       SizeOfStruct;
1111c2c66affSColin Finck     PVOID       Key;
1112c2c66affSColin Finck     DWORD64     ModBase;
1113c2c66affSColin Finck     CHAR        Obj[MAX_PATH+1];
1114c2c66affSColin Finck     CHAR        FileName[MAX_PATH+1];
1115c2c66affSColin Finck     DWORD       LineNumber;
1116c2c66affSColin Finck     DWORD64     Address;
1117c2c66affSColin Finck } SRCCODEINFO, *PSRCCODEINFO;
1118c2c66affSColin Finck typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
1119c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
1120c2c66affSColin Finck BOOL WINAPI SymInitialize(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess);
1121c2c66affSColin Finck BOOL WINAPI SymCleanup(HANDLE hProcess);
1122c2c66affSColin Finck BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name, DWORD64 addr, DWORD size, DWORD flags);
1123c2c66affSColin Finck BOOL  WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr, PIMAGEHLP_MODULEW64 ModuleInfo);
1124c2c66affSColin Finck BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case);
1125c2c66affSColin Finck DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, PCSTR ImageName,
1126c2c66affSColin Finck                            PCSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll);
1127c2c66affSColin Finck DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
1128c2c66affSColin Finck                                PMODLOAD_DATA, DWORD);
1129c2c66affSColin Finck DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD,
1130c2c66affSColin Finck                                 PMODLOAD_DATA, DWORD);
1131c2c66affSColin Finck DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64);
1132c2c66affSColin Finck BOOL WINAPI SymUnloadModule(HANDLE hProcess, DWORD BaseOfDll);
1133c2c66affSColin Finck PVOID   WINAPI SymFunctionTableAccess(HANDLE, DWORD);
1134c2c66affSColin Finck PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
1135c2c66affSColin Finck BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64* Displacement, PSYMBOL_INFO Symbol);
1136c2c66affSColin Finck BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland, PCSTR srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user);
1137c2c66affSColin Finck DWORD WINAPI SymSetOptions(DWORD opts);
113870880dd1Swinesync BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value);
1139c2c66affSColin Finck BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
1140c2c66affSColin Finck typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
1141c2c66affSColin Finck #define FindExecutableImageExW __FindExecutableImageExW
1142c2c66affSColin Finck HANDLE __FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
1143c2c66affSColin Finck DWORD WINAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
1144c2c66affSColin Finck typedef enum _THREAD_WRITE_FLAGS
1145c2c66affSColin Finck {
1146c2c66affSColin Finck     ThreadWriteThread            = 0x0001,
1147c2c66affSColin Finck     ThreadWriteStack             = 0x0002,
1148c2c66affSColin Finck     ThreadWriteContext           = 0x0004,
1149c2c66affSColin Finck     ThreadWriteBackingStore      = 0x0008,
1150c2c66affSColin Finck     ThreadWriteInstructionWindow = 0x0010,
1151c2c66affSColin Finck     ThreadWriteThreadData        = 0x0020,
1152c2c66affSColin Finck     ThreadWriteThreadInfo        = 0x0040
1153c2c66affSColin Finck } THREAD_WRITE_FLAGS;
1154c2c66affSColin Finck typedef enum
1155c2c66affSColin Finck {
1156c2c66affSColin Finck     AddrMode1616,
1157c2c66affSColin Finck     AddrMode1632,
1158c2c66affSColin Finck     AddrModeReal,
1159c2c66affSColin Finck     AddrModeFlat
1160c2c66affSColin Finck } ADDRESS_MODE;
1161c2c66affSColin Finck typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
1162c2c66affSColin Finck {
1163c2c66affSColin Finck     DWORD                       SizeOfStruct;
1164c2c66affSColin Finck     DWORD64                     BaseOfImage;
1165c2c66affSColin Finck     DWORD                       CheckSum;
1166c2c66affSColin Finck     DWORD                       TimeDateStamp;
1167c2c66affSColin Finck     WCHAR                       FileName[MAX_PATH + 1];
1168c2c66affSColin Finck     BOOLEAN                     Reparse;
1169c2c66affSColin Finck     HANDLE                      hFile;
1170c2c66affSColin Finck     DWORD                       Flags;
1171c2c66affSColin Finck } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
1172c2c66affSColin Finck typedef struct _tagADDRESS64
1173c2c66affSColin Finck {
1174c2c66affSColin Finck     DWORD64                     Offset;
1175c2c66affSColin Finck     WORD                        Segment;
1176c2c66affSColin Finck     ADDRESS_MODE                Mode;
1177c2c66affSColin Finck } ADDRESS64, *LPADDRESS64;
1178c2c66affSColin Finck typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(PCWSTR, PVOID);
1179c2c66affSColin Finck typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE, DWORD64);
1180c2c66affSColin Finck typedef DWORD64 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(HANDLE, DWORD64);
1181c2c66affSColin Finck typedef DWORD64 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE, HANDLE, LPADDRESS64);
1182c2c66affSColin Finck typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
1183c2c66affSColin Finck typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE, DWORD64, PVOID, DWORD, PDWORD);
1184c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PCSTR, DWORD64, PVOID);
1185c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PCWSTR, DWORD64, PVOID);
1186c2c66affSColin Finck typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
1187c2c66affSColin Finck typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PCWSTR, DWORD64, ULONG, PVOID);
1188c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
1189c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PCWSTR, DWORD64, ULONG, PVOID);
1190c2c66affSColin Finck 
1191c2c66affSColin Finck BOOL WINAPI SymEnumerateModulesW64(HANDLE hProcess, PSYM_ENUMMODULES_CALLBACKW64 EnumModulesCallback, PVOID UserContext);
1192c2c66affSColin Finck 
1193c2c66affSColin Finck typedef struct _tagADDRESS
1194c2c66affSColin Finck {
1195c2c66affSColin Finck     DWORD                       Offset;
1196c2c66affSColin Finck     WORD                        Segment;
1197c2c66affSColin Finck     ADDRESS_MODE                Mode;
1198c2c66affSColin Finck } ADDRESS, *LPADDRESS;
1199c2c66affSColin Finck 
1200c2c66affSColin Finck typedef struct _IMAGEHLP_MODULE
1201c2c66affSColin Finck {
1202c2c66affSColin Finck     DWORD                       SizeOfStruct;
1203c2c66affSColin Finck     DWORD                       BaseOfImage;
1204c2c66affSColin Finck     DWORD                       ImageSize;
1205c2c66affSColin Finck     DWORD                       TimeDateStamp;
1206c2c66affSColin Finck     DWORD                       CheckSum;
1207c2c66affSColin Finck     DWORD                       NumSyms;
1208c2c66affSColin Finck     SYM_TYPE                    SymType;
1209c2c66affSColin Finck     CHAR                        ModuleName[32];
1210c2c66affSColin Finck     CHAR                        ImageName[256];
1211c2c66affSColin Finck     CHAR                        LoadedImageName[256];
1212c2c66affSColin Finck } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
1213c2c66affSColin Finck typedef struct _IMAGEHLP_MODULEW
1214c2c66affSColin Finck {
1215c2c66affSColin Finck     DWORD                       SizeOfStruct;
1216c2c66affSColin Finck     DWORD                       BaseOfImage;
1217c2c66affSColin Finck     DWORD                       ImageSize;
1218c2c66affSColin Finck     DWORD                       TimeDateStamp;
1219c2c66affSColin Finck     DWORD                       CheckSum;
1220c2c66affSColin Finck     DWORD                       NumSyms;
1221c2c66affSColin Finck     SYM_TYPE                    SymType;
1222c2c66affSColin Finck     WCHAR                       ModuleName[32];
1223c2c66affSColin Finck     WCHAR                       ImageName[256];
1224c2c66affSColin Finck     WCHAR                       LoadedImageName[256];
1225c2c66affSColin Finck } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
1226c2c66affSColin Finck typedef BOOL  (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1227c2c66affSColin Finck typedef BOOL  (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
1228c2c66affSColin Finck typedef BOOL  (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE, DWORD, PVOID, DWORD, PDWORD);
1229c2c66affSColin Finck typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
1230c2c66affSColin Finck typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
1231c2c66affSColin Finck typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
1232c2c66affSColin Finck typedef BOOL  (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PCSTR, ULONG, PVOID);
1233c2c66affSColin Finck typedef BOOL  (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1234c2c66affSColin Finck typedef BOOL  (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PCWSTR, ULONG, ULONG, PVOID);
1235c2c66affSColin Finck 
1236c2c66affSColin Finck typedef struct _IMAGEHLP_MODULE64
1237c2c66affSColin Finck {
1238c2c66affSColin Finck     DWORD                       SizeOfStruct;
1239c2c66affSColin Finck     DWORD64                     BaseOfImage;
1240c2c66affSColin Finck     DWORD                       ImageSize;
1241c2c66affSColin Finck     DWORD                       TimeDateStamp;
1242c2c66affSColin Finck     DWORD                       CheckSum;
1243c2c66affSColin Finck     DWORD                       NumSyms;
1244c2c66affSColin Finck     SYM_TYPE                    SymType;
1245c2c66affSColin Finck     CHAR                        ModuleName[32];
1246c2c66affSColin Finck     CHAR                        ImageName[256];
1247c2c66affSColin Finck     CHAR                        LoadedImageName[256];
1248c2c66affSColin Finck     CHAR                        LoadedPdbName[256];
1249c2c66affSColin Finck     DWORD                       CVSig;
1250c2c66affSColin Finck     CHAR                        CVData[MAX_PATH*3];
1251c2c66affSColin Finck     DWORD                       PdbSig;
1252c2c66affSColin Finck     GUID                        PdbSig70;
1253c2c66affSColin Finck     DWORD                       PdbAge;
1254c2c66affSColin Finck     BOOL                        PdbUnmatched;
1255c2c66affSColin Finck     BOOL                        DbgUnmatched;
1256c2c66affSColin Finck     BOOL                        LineNumbers;
1257c2c66affSColin Finck     BOOL                        GlobalSymbols;
1258c2c66affSColin Finck     BOOL                        TypeInfo;
1259c2c66affSColin Finck     BOOL                        SourceIndexed;
1260c2c66affSColin Finck     BOOL                        Publics;
1261c2c66affSColin Finck } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
1262c2c66affSColin Finck typedef DWORD   RVA;
1263c2c66affSColin Finck typedef ULONG64 RVA64;
1264c2c66affSColin Finck typedef enum _MINIDUMP_TYPE
1265c2c66affSColin Finck {
1266c2c66affSColin Finck     MiniDumpNormal                              = 0x0000,
1267c2c66affSColin Finck     MiniDumpWithDataSegs                        = 0x0001,
1268c2c66affSColin Finck     MiniDumpWithFullMemory                      = 0x0002,
1269c2c66affSColin Finck     MiniDumpWithHandleData                      = 0x0004,
1270c2c66affSColin Finck     MiniDumpFilterMemory                        = 0x0008,
1271c2c66affSColin Finck     MiniDumpScanMemory                          = 0x0010,
1272c2c66affSColin Finck     MiniDumpWithUnloadedModules                 = 0x0020,
1273c2c66affSColin Finck     MiniDumpWithIndirectlyReferencedMemory      = 0x0040,
1274c2c66affSColin Finck     MiniDumpFilterModulePaths                   = 0x0080,
1275c2c66affSColin Finck     MiniDumpWithProcessThreadData               = 0x0100,
1276c2c66affSColin Finck     MiniDumpWithPrivateReadWriteMemory          = 0x0200,
1277c2c66affSColin Finck     MiniDumpWithoutOptionalData                 = 0x0400,
1278c2c66affSColin Finck     MiniDumpWithFullMemoryInfo                  = 0x0800,
1279c2c66affSColin Finck     MiniDumpWithThreadInfo                      = 0x1000,
1280c2c66affSColin Finck     MiniDumpWithCodeSegs                        = 0x2000
1281c2c66affSColin Finck } MINIDUMP_TYPE;
1282c2c66affSColin Finck typedef struct _MINIDUMP_THREAD_CALLBACK
1283c2c66affSColin Finck {
1284c2c66affSColin Finck     ULONG                       ThreadId;
1285c2c66affSColin Finck     HANDLE                      ThreadHandle;
1286c2c66affSColin Finck     CONTEXT                     Context;
1287c2c66affSColin Finck     ULONG                       SizeOfContext;
1288c2c66affSColin Finck     ULONG64                     StackBase;
1289c2c66affSColin Finck     ULONG64                     StackEnd;
1290c2c66affSColin Finck } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
1291c2c66affSColin Finck typedef struct _MINIDUMP_THREAD_EX_CALLBACK
1292c2c66affSColin Finck {
1293c2c66affSColin Finck     ULONG                       ThreadId;
1294c2c66affSColin Finck     HANDLE                      ThreadHandle;
1295c2c66affSColin Finck     CONTEXT                     Context;
1296c2c66affSColin Finck     ULONG                       SizeOfContext;
1297c2c66affSColin Finck     ULONG64                     StackBase;
1298c2c66affSColin Finck     ULONG64                     StackEnd;
1299c2c66affSColin Finck     ULONG64                     BackingStoreBase;
1300c2c66affSColin Finck     ULONG64                     BackingStoreEnd;
1301c2c66affSColin Finck } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
1302c2c66affSColin Finck typedef struct _MINIDUMP_MODULE_CALLBACK
1303c2c66affSColin Finck {
1304c2c66affSColin Finck     PWCHAR                      FullPath;
1305c2c66affSColin Finck     ULONG64                     BaseOfImage;
1306c2c66affSColin Finck     ULONG                       SizeOfImage;
1307c2c66affSColin Finck     ULONG                       CheckSum;
1308c2c66affSColin Finck     ULONG                       TimeDateStamp;
1309c2c66affSColin Finck     VS_FIXEDFILEINFO            VersionInfo;
1310c2c66affSColin Finck     PVOID                       CvRecord;
1311c2c66affSColin Finck     ULONG                       SizeOfCvRecord;
1312c2c66affSColin Finck     PVOID                       MiscRecord;
1313c2c66affSColin Finck     ULONG                       SizeOfMiscRecord;
1314c2c66affSColin Finck } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
1315c2c66affSColin Finck typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
1316c2c66affSColin Finck {
1317c2c66affSColin Finck     ULONG ThreadId;
1318c2c66affSColin Finck } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
1319c2c66affSColin Finck typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
1320c2c66affSColin Finck {
1321c2c66affSColin Finck     ULONG64 BaseOfImage;
1322c2c66affSColin Finck } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
1323c2c66affSColin Finck typedef struct _MINIDUMP_CALLBACK_INPUT
1324c2c66affSColin Finck {
1325c2c66affSColin Finck     ULONG                       ProcessId;
1326c2c66affSColin Finck     HANDLE                      ProcessHandle;
1327c2c66affSColin Finck     ULONG                       CallbackType;
1328c2c66affSColin Finck     union
1329c2c66affSColin Finck     {
1330c2c66affSColin Finck         MINIDUMP_THREAD_CALLBACK        Thread;
1331c2c66affSColin Finck         MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
1332c2c66affSColin Finck         MINIDUMP_MODULE_CALLBACK        Module;
1333c2c66affSColin Finck         MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
1334c2c66affSColin Finck         MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
1335c2c66affSColin Finck     } DUMMYUNIONNAME;
1336c2c66affSColin Finck } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
1337c2c66affSColin Finck typedef struct _MINIDUMP_CALLBACK_OUTPUT
1338c2c66affSColin Finck {
1339c2c66affSColin Finck     union
1340c2c66affSColin Finck     {
1341c2c66affSColin Finck         ULONG                           ModuleWriteFlags;
1342c2c66affSColin Finck         ULONG                           ThreadWriteFlags;
1343c2c66affSColin Finck         struct
1344c2c66affSColin Finck         {
1345c2c66affSColin Finck             ULONG64                     MemoryBase;
1346c2c66affSColin Finck             ULONG                       MemorySize;
1347c2c66affSColin Finck         } DUMMYSTRUCTNAME;
1348c2c66affSColin Finck     } DUMMYUNIONNAME;
1349c2c66affSColin Finck } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
1350c2c66affSColin Finck typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID, const PMINIDUMP_CALLBACK_INPUT, PMINIDUMP_CALLBACK_OUTPUT);
1351c2c66affSColin Finck typedef struct _MINIDUMP_CALLBACK_INFORMATION
1352c2c66affSColin Finck {
1353c2c66affSColin Finck     MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
1354c2c66affSColin Finck     void*                       CallbackParam;
1355c2c66affSColin Finck } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
1356c2c66affSColin Finck typedef struct _SYMBOL_INFOW
1357c2c66affSColin Finck {
1358c2c66affSColin Finck     ULONG       SizeOfStruct;
1359c2c66affSColin Finck     ULONG       TypeIndex;
1360c2c66affSColin Finck     ULONG64     Reserved[2];
1361c2c66affSColin Finck     ULONG       Index;
1362c2c66affSColin Finck     ULONG       Size;
1363c2c66affSColin Finck     ULONG64     ModBase;
1364c2c66affSColin Finck     ULONG       Flags;
1365c2c66affSColin Finck     ULONG64     Value;
1366c2c66affSColin Finck     ULONG64     Address;
1367c2c66affSColin Finck     ULONG       Register;
1368c2c66affSColin Finck     ULONG       Scope;
1369c2c66affSColin Finck     ULONG       Tag;
1370c2c66affSColin Finck     ULONG       NameLen;
1371c2c66affSColin Finck     ULONG       MaxNameLen;
1372c2c66affSColin Finck     WCHAR       Name[1];
1373c2c66affSColin Finck } SYMBOL_INFOW, *PSYMBOL_INFOW;
1374c2c66affSColin Finck typedef struct _IMAGEHLP_STACK_FRAME
1375c2c66affSColin Finck {
1376c2c66affSColin Finck     ULONG64     InstructionOffset;
1377c2c66affSColin Finck     ULONG64     ReturnOffset;
1378c2c66affSColin Finck     ULONG64     FrameOffset;
1379c2c66affSColin Finck     ULONG64     StackOffset;
1380c2c66affSColin Finck     ULONG64     BackingStoreOffset;
1381c2c66affSColin Finck     ULONG64     FuncTableEntry;
1382c2c66affSColin Finck     ULONG64     Params[4];
1383c2c66affSColin Finck     ULONG64     Reserved[5];
1384c2c66affSColin Finck     BOOL        Virtual;
1385c2c66affSColin Finck     ULONG       Reserved2;
1386c2c66affSColin Finck } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
1387c2c66affSColin Finck typedef struct _KDHELP64
1388c2c66affSColin Finck {
1389c2c66affSColin Finck     DWORD64     Thread;
1390c2c66affSColin Finck     DWORD       ThCallbackStack;
1391c2c66affSColin Finck     DWORD       ThCallbackBStore;
1392c2c66affSColin Finck     DWORD       NextCallback;
1393c2c66affSColin Finck     DWORD       FramePointer;
1394c2c66affSColin Finck     DWORD64     KiCallUserMode;
1395c2c66affSColin Finck     DWORD64     KeUserCallbackDispatcher;
1396c2c66affSColin Finck     DWORD64     SystemRangeStart;
1397c2c66affSColin Finck     DWORD64     Reserved[8];
1398c2c66affSColin Finck } KDHELP64, *PKDHELP64;
1399c2c66affSColin Finck typedef struct _STACKFRAME64
1400c2c66affSColin Finck {
1401c2c66affSColin Finck     ADDRESS64   AddrPC;
1402c2c66affSColin Finck     ADDRESS64   AddrReturn;
1403c2c66affSColin Finck     ADDRESS64   AddrFrame;
1404c2c66affSColin Finck     ADDRESS64   AddrStack;
1405c2c66affSColin Finck     ADDRESS64   AddrBStore;
1406c2c66affSColin Finck     PVOID       FuncTableEntry;
1407c2c66affSColin Finck     DWORD64     Params[4];
1408c2c66affSColin Finck     BOOL        Far;
1409c2c66affSColin Finck     BOOL        Virtual;
1410c2c66affSColin Finck     DWORD64     Reserved[3];
1411c2c66affSColin Finck     KDHELP64    KdHelp;
1412c2c66affSColin Finck } STACKFRAME64, *LPSTACKFRAME64;
1413c2c66affSColin Finck typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
1414c2c66affSColin Finck {
1415c2c66affSColin Finck     TI_GET_SYMTAG,
1416c2c66affSColin Finck     TI_GET_SYMNAME,
1417c2c66affSColin Finck     TI_GET_LENGTH,
1418c2c66affSColin Finck     TI_GET_TYPE,
1419c2c66affSColin Finck     TI_GET_TYPEID,
1420c2c66affSColin Finck     TI_GET_BASETYPE,
1421c2c66affSColin Finck     TI_GET_ARRAYINDEXTYPEID,
1422c2c66affSColin Finck     TI_FINDCHILDREN,
1423c2c66affSColin Finck     TI_GET_DATAKIND,
1424c2c66affSColin Finck     TI_GET_ADDRESSOFFSET,
1425c2c66affSColin Finck     TI_GET_OFFSET,
1426c2c66affSColin Finck     TI_GET_VALUE,
1427c2c66affSColin Finck     TI_GET_COUNT,
1428c2c66affSColin Finck     TI_GET_CHILDRENCOUNT,
1429c2c66affSColin Finck     TI_GET_BITPOSITION,
1430c2c66affSColin Finck     TI_GET_VIRTUALBASECLASS,
1431c2c66affSColin Finck     TI_GET_VIRTUALTABLESHAPEID,
1432c2c66affSColin Finck     TI_GET_VIRTUALBASEPOINTEROFFSET,
1433c2c66affSColin Finck     TI_GET_CLASSPARENTID,
1434c2c66affSColin Finck     TI_GET_NESTED,
1435c2c66affSColin Finck     TI_GET_SYMINDEX,
1436c2c66affSColin Finck     TI_GET_LEXICALPARENT,
1437c2c66affSColin Finck     TI_GET_ADDRESS,
1438c2c66affSColin Finck     TI_GET_THISADJUST,
1439c2c66affSColin Finck     TI_GET_UDTKIND,
1440c2c66affSColin Finck     TI_IS_EQUIV_TO,
1441c2c66affSColin Finck     TI_GET_CALLING_CONVENTION,
1442c2c66affSColin Finck } IMAGEHLP_SYMBOL_TYPE_INFO;
1443c2c66affSColin Finck typedef struct _SOURCEFILE
1444c2c66affSColin Finck {
1445c2c66affSColin Finck     DWORD64                     ModBase;
1446c2c66affSColin Finck     PCHAR                       FileName;
1447c2c66affSColin Finck } SOURCEFILE, *PSOURCEFILE;
1448c2c66affSColin Finck typedef struct _SOURCEFILEW
1449c2c66affSColin Finck {
1450c2c66affSColin Finck     DWORD64                     ModBase;
1451c2c66affSColin Finck     PWSTR                       FileName;
1452c2c66affSColin Finck } SOURCEFILEW, *PSOURCEFILEW;
1453c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
1454c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACKW)(PSOURCEFILEW, PVOID);
1455c2c66affSColin Finck typedef struct _SRCCODEINFOW
1456c2c66affSColin Finck {
1457c2c66affSColin Finck     DWORD       SizeOfStruct;
1458c2c66affSColin Finck     PVOID       Key;
1459c2c66affSColin Finck     DWORD64     ModBase;
1460c2c66affSColin Finck     WCHAR       Obj[MAX_PATH+1];
1461c2c66affSColin Finck     WCHAR       FileName[MAX_PATH+1];
1462c2c66affSColin Finck     DWORD       LineNumber;
1463c2c66affSColin Finck     DWORD64     Address;
1464c2c66affSColin Finck } SRCCODEINFOW, *PSRCCODEINFOW;
1465c2c66affSColin Finck typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACKW)(PSRCCODEINFOW, PVOID);
1466c2c66affSColin Finck typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW, ULONG, PVOID);
1467c2c66affSColin Finck #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
1468c2c66affSColin Finck #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
1469c2c66affSColin Finck #define IMAGEHLP_SYMBOLW IMAGEHLP_SYMBOLW64
1470c2c66affSColin Finck #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
1471c2c66affSColin Finck #define PIMAGEHLP_SYMBOLW PIMAGEHLP_SYMBOLW64
1472c2c66affSColin Finck #else
1473c2c66affSColin Finck typedef struct _IMAGEHLP_SYMBOL
1474c2c66affSColin Finck {
1475c2c66affSColin Finck     DWORD                       SizeOfStruct;
1476c2c66affSColin Finck     DWORD                       Address;
1477c2c66affSColin Finck     DWORD                       Size;
1478c2c66affSColin Finck     DWORD                       Flags;
1479c2c66affSColin Finck     DWORD                       MaxNameLength;
1480c2c66affSColin Finck     CHAR                        Name[1];
1481c2c66affSColin Finck } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
1482c2c66affSColin Finck 
1483c2c66affSColin Finck typedef struct _IMAGEHLP_SYMBOLW
1484c2c66affSColin Finck {
1485c2c66affSColin Finck     DWORD                       SizeOfStruct;
1486c2c66affSColin Finck     DWORD                       Address;
1487c2c66affSColin Finck     DWORD                       Size;
1488c2c66affSColin Finck     DWORD                       Flags;
1489c2c66affSColin Finck     DWORD                       MaxNameLength;
1490c2c66affSColin Finck     WCHAR                       Name[1];
1491c2c66affSColin Finck } IMAGEHLP_SYMBOLW, *PIMAGEHLP_SYMBOLW;
1492c2c66affSColin Finck #endif
1493c2c66affSColin Finck typedef struct _IMAGEHLP_SYMBOL64
1494c2c66affSColin Finck {
1495c2c66affSColin Finck     DWORD                       SizeOfStruct;
1496c2c66affSColin Finck     DWORD64                     Address;
1497c2c66affSColin Finck     DWORD                       Size;
1498c2c66affSColin Finck     DWORD                       Flags;
1499c2c66affSColin Finck     DWORD                       MaxNameLength;
1500c2c66affSColin Finck     CHAR                        Name[1];
1501c2c66affSColin Finck } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
1502c2c66affSColin Finck typedef struct _IMAGEHLP_SYMBOLW64
1503c2c66affSColin Finck {
1504c2c66affSColin Finck     DWORD                       SizeOfStruct;
1505c2c66affSColin Finck     DWORD64                     Address;
1506c2c66affSColin Finck     DWORD                       Size;
1507c2c66affSColin Finck     DWORD                       Flags;
1508c2c66affSColin Finck     DWORD                       MaxNameLength;
1509c2c66affSColin Finck     WCHAR                       Name[1];
1510c2c66affSColin Finck } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
1511c2c66affSColin Finck #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
1512c2c66affSColin Finck #define IMAGEHLP_LINE IMAGEHLP_LINE64
1513c2c66affSColin Finck #define PIMAGEHLP_LINE PIMAGEHLP_LINE64
1514c2c66affSColin Finck #define IMAGEHLP_LINEW IMAGEHLP_LINEW64
1515c2c66affSColin Finck #define PIMAGEHLP_LINEW PIMAGEHLP_LINEW64
1516c2c66affSColin Finck #else
1517c2c66affSColin Finck typedef struct _IMAGEHLP_LINE
1518c2c66affSColin Finck {
1519c2c66affSColin Finck     DWORD                       SizeOfStruct;
1520c2c66affSColin Finck     PVOID                       Key;
1521c2c66affSColin Finck     DWORD                       LineNumber;
1522c2c66affSColin Finck     PCHAR                       FileName;
1523c2c66affSColin Finck     DWORD                       Address;
1524c2c66affSColin Finck } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
1525c2c66affSColin Finck 
1526c2c66affSColin Finck typedef struct _IMAGEHLP_LINEW
1527c2c66affSColin Finck {
1528c2c66affSColin Finck     DWORD                       SizeOfStruct;
1529c2c66affSColin Finck     PVOID                       Key;
1530c2c66affSColin Finck     DWORD                       LineNumber;
1531c2c66affSColin Finck     PWSTR                       FileName;
1532c2c66affSColin Finck     DWORD                       Address;
1533c2c66affSColin Finck } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
1534c2c66affSColin Finck #endif
1535c2c66affSColin Finck typedef struct _IMAGEHLP_LINEW64
1536c2c66affSColin Finck {
1537c2c66affSColin Finck     DWORD                       SizeOfStruct;
1538c2c66affSColin Finck     PVOID                       Key;
1539c2c66affSColin Finck     DWORD                       LineNumber;
1540c2c66affSColin Finck     PWSTR                       FileName;
1541c2c66affSColin Finck     DWORD64                     Address;
1542c2c66affSColin Finck } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
1543c2c66affSColin Finck #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
1544c2c66affSColin Finck #define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64
1545c2c66affSColin Finck #define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
1546c2c66affSColin Finck #else
1547c2c66affSColin Finck typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
1548c2c66affSColin Finck {
1549c2c66affSColin Finck     DWORD                       SizeOfStruct;
1550c2c66affSColin Finck     DWORD                       BaseOfImage;
1551c2c66affSColin Finck     DWORD                       CheckSum;
1552c2c66affSColin Finck     DWORD                       TimeDateStamp;
1553c2c66affSColin Finck     CHAR                        FileName[MAX_PATH];
1554c2c66affSColin Finck     BOOLEAN                     Reparse;
1555c2c66affSColin Finck     HANDLE                      hFile;
1556c2c66affSColin Finck } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
1557c2c66affSColin Finck #endif
1558c2c66affSColin Finck typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
1559c2c66affSColin Finck {
1560c2c66affSColin Finck     DWORD                       SizeOfStruct;
1561c2c66affSColin Finck     DWORD64                     BaseOfImage;
1562c2c66affSColin Finck     DWORD                       CheckSum;
1563c2c66affSColin Finck     DWORD                       TimeDateStamp;
1564c2c66affSColin Finck     CHAR                        FileName[MAX_PATH];
1565c2c66affSColin Finck     BOOLEAN                     Reparse;
1566c2c66affSColin Finck     HANDLE                      hFile;
1567c2c66affSColin Finck     DWORD                       Flags;
1568c2c66affSColin Finck } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
1569c2c66affSColin Finck typedef struct API_VERSION
1570c2c66affSColin Finck {
1571c2c66affSColin Finck     USHORT  MajorVersion;
1572c2c66affSColin Finck     USHORT  MinorVersion;
1573c2c66affSColin Finck     USHORT  Revision;
1574c2c66affSColin Finck     USHORT  Reserved;
1575c2c66affSColin Finck } API_VERSION, *LPAPI_VERSION;
1576c2c66affSColin Finck 
1577c2c66affSColin Finck // cvconst.h
1578c2c66affSColin Finck /* symbols & types enumeration */
1579c2c66affSColin Finck enum SymTagEnum
1580c2c66affSColin Finck {
1581c2c66affSColin Finck    SymTagNull,
1582c2c66affSColin Finck    SymTagExe,
1583c2c66affSColin Finck    SymTagCompiland,
1584c2c66affSColin Finck    SymTagCompilandDetails,
1585c2c66affSColin Finck    SymTagCompilandEnv,
1586c2c66affSColin Finck    SymTagFunction,
1587c2c66affSColin Finck    SymTagBlock,
1588c2c66affSColin Finck    SymTagData,
1589c2c66affSColin Finck    SymTagAnnotation,
1590c2c66affSColin Finck    SymTagLabel,
1591c2c66affSColin Finck    SymTagPublicSymbol,
1592c2c66affSColin Finck    SymTagUDT,
1593c2c66affSColin Finck    SymTagEnum,
1594c2c66affSColin Finck    SymTagFunctionType,
1595c2c66affSColin Finck    SymTagPointerType,
1596c2c66affSColin Finck    SymTagArrayType,
1597c2c66affSColin Finck    SymTagBaseType,
1598c2c66affSColin Finck    SymTagTypedef,
1599c2c66affSColin Finck    SymTagBaseClass,
1600c2c66affSColin Finck    SymTagFriend,
1601c2c66affSColin Finck    SymTagFunctionArgType,
1602c2c66affSColin Finck    SymTagFuncDebugStart,
1603c2c66affSColin Finck    SymTagFuncDebugEnd,
1604c2c66affSColin Finck    SymTagUsingNamespace,
1605c2c66affSColin Finck    SymTagVTableShape,
1606c2c66affSColin Finck    SymTagVTable,
1607c2c66affSColin Finck    SymTagCustom,
1608c2c66affSColin Finck    SymTagThunk,
1609c2c66affSColin Finck    SymTagCustomType,
1610c2c66affSColin Finck    SymTagManagedType,
1611c2c66affSColin Finck    SymTagDimension,
1612c2c66affSColin Finck    SymTagMax
1613c2c66affSColin Finck };
1614c2c66affSColin Finck 
1615c2c66affSColin Finck enum BasicType
1616c2c66affSColin Finck {
1617c2c66affSColin Finck     btNoType = 0,
1618c2c66affSColin Finck     btVoid = 1,
1619c2c66affSColin Finck     btChar = 2,
1620c2c66affSColin Finck     btWChar = 3,
1621c2c66affSColin Finck     btInt = 6,
1622c2c66affSColin Finck     btUInt = 7,
1623c2c66affSColin Finck     btFloat = 8,
1624c2c66affSColin Finck     btBCD = 9,
1625c2c66affSColin Finck     btBool = 10,
1626c2c66affSColin Finck     btLong = 13,
1627c2c66affSColin Finck     btULong = 14,
1628c2c66affSColin Finck     btCurrency = 25,
1629c2c66affSColin Finck     btDate = 26,
1630c2c66affSColin Finck     btVariant = 27,
1631c2c66affSColin Finck     btComplex = 28,
1632c2c66affSColin Finck     btBit = 29,
1633c2c66affSColin Finck     btBSTR = 30,
1634c2c66affSColin Finck     btHresult = 31,
1635c2c66affSColin Finck };
1636c2c66affSColin Finck 
1637c2c66affSColin Finck /* kind of UDT */
1638c2c66affSColin Finck enum UdtKind
1639c2c66affSColin Finck {
1640c2c66affSColin Finck     UdtStruct,
1641c2c66affSColin Finck     UdtClass,
1642c2c66affSColin Finck     UdtUnion
1643c2c66affSColin Finck };
1644c2c66affSColin Finck 
1645c2c66affSColin Finck /* kind of SymTagData */
1646c2c66affSColin Finck enum DataKind
1647c2c66affSColin Finck {
1648c2c66affSColin Finck     DataIsUnknown,
1649c2c66affSColin Finck     DataIsLocal,
1650c2c66affSColin Finck     DataIsStaticLocal,
1651c2c66affSColin Finck     DataIsParam,
1652c2c66affSColin Finck     DataIsObjectPtr,
1653c2c66affSColin Finck     DataIsFileStatic,
1654c2c66affSColin Finck     DataIsGlobal,
1655c2c66affSColin Finck     DataIsMember,
1656c2c66affSColin Finck     DataIsStaticMember,
1657c2c66affSColin Finck     DataIsConstant
1658c2c66affSColin Finck };
1659c2c66affSColin Finck 
1660c2c66affSColin Finck /* values for registers (on different CPUs) */
1661c2c66affSColin Finck enum CV_HREG_e
1662c2c66affSColin Finck {
1663c2c66affSColin Finck     /* those values are common to all supported CPUs (and CPU independent) */
1664c2c66affSColin Finck     CV_ALLREG_ERR       = 30000,
1665c2c66affSColin Finck     CV_ALLREG_TEB       = 30001,
1666c2c66affSColin Finck     CV_ALLREG_TIMER     = 30002,
1667c2c66affSColin Finck     CV_ALLREG_EFAD1     = 30003,
1668c2c66affSColin Finck     CV_ALLREG_EFAD2     = 30004,
1669c2c66affSColin Finck     CV_ALLREG_EFAD3     = 30005,
1670c2c66affSColin Finck     CV_ALLREG_VFRAME    = 30006,
1671c2c66affSColin Finck     CV_ALLREG_HANDLE    = 30007,
1672c2c66affSColin Finck     CV_ALLREG_PARAMS    = 30008,
1673c2c66affSColin Finck     CV_ALLREG_LOCALS    = 30009,
1674c2c66affSColin Finck     CV_ALLREG_TID       = 30010,
1675c2c66affSColin Finck     CV_ALLREG_ENV       = 30011,
1676c2c66affSColin Finck     CV_ALLREG_CMDLN     = 30012,
1677c2c66affSColin Finck 
1678c2c66affSColin Finck     /* Intel x86 CPU */
1679c2c66affSColin Finck     CV_REG_NONE         = 0,
1680c2c66affSColin Finck     CV_REG_AL           = 1,
1681c2c66affSColin Finck     CV_REG_CL           = 2,
1682c2c66affSColin Finck     CV_REG_DL           = 3,
1683c2c66affSColin Finck     CV_REG_BL           = 4,
1684c2c66affSColin Finck     CV_REG_AH           = 5,
1685c2c66affSColin Finck     CV_REG_CH           = 6,
1686c2c66affSColin Finck     CV_REG_DH           = 7,
1687c2c66affSColin Finck     CV_REG_BH           = 8,
1688c2c66affSColin Finck     CV_REG_AX           = 9,
1689c2c66affSColin Finck     CV_REG_CX           = 10,
1690c2c66affSColin Finck     CV_REG_DX           = 11,
1691c2c66affSColin Finck     CV_REG_BX           = 12,
1692c2c66affSColin Finck     CV_REG_SP           = 13,
1693c2c66affSColin Finck     CV_REG_BP           = 14,
1694c2c66affSColin Finck     CV_REG_SI           = 15,
1695c2c66affSColin Finck     CV_REG_DI           = 16,
1696c2c66affSColin Finck     CV_REG_EAX          = 17,
1697c2c66affSColin Finck     CV_REG_ECX          = 18,
1698c2c66affSColin Finck     CV_REG_EDX          = 19,
1699c2c66affSColin Finck     CV_REG_EBX          = 20,
1700c2c66affSColin Finck     CV_REG_ESP          = 21,
1701c2c66affSColin Finck     CV_REG_EBP          = 22,
1702c2c66affSColin Finck     CV_REG_ESI          = 23,
1703c2c66affSColin Finck     CV_REG_EDI          = 24,
1704c2c66affSColin Finck     CV_REG_ES           = 25,
1705c2c66affSColin Finck     CV_REG_CS           = 26,
1706c2c66affSColin Finck     CV_REG_SS           = 27,
1707c2c66affSColin Finck     CV_REG_DS           = 28,
1708c2c66affSColin Finck     CV_REG_FS           = 29,
1709c2c66affSColin Finck     CV_REG_GS           = 30,
1710c2c66affSColin Finck     CV_REG_IP           = 31,
1711c2c66affSColin Finck     CV_REG_FLAGS        = 32,
1712c2c66affSColin Finck     CV_REG_EIP          = 33,
1713c2c66affSColin Finck     CV_REG_EFLAGS       = 34,
1714c2c66affSColin Finck 
1715c2c66affSColin Finck     /* <pcode> */
1716c2c66affSColin Finck     CV_REG_TEMP         = 40,
1717c2c66affSColin Finck     CV_REG_TEMPH        = 41,
1718c2c66affSColin Finck     CV_REG_QUOTE        = 42,
1719c2c66affSColin Finck     CV_REG_PCDR3        = 43,   /* this includes PCDR4 to PCDR7 */
1720c2c66affSColin Finck     CV_REG_CR0          = 80,   /* this includes CR1 to CR4 */
1721c2c66affSColin Finck     CV_REG_DR0          = 90,   /* this includes DR1 to DR7 */
1722c2c66affSColin Finck     /* </pcode> */
1723c2c66affSColin Finck 
1724c2c66affSColin Finck     CV_REG_GDTR         = 110,
1725c2c66affSColin Finck     CV_REG_GDTL         = 111,
1726c2c66affSColin Finck     CV_REG_IDTR         = 112,
1727c2c66affSColin Finck     CV_REG_IDTL         = 113,
1728c2c66affSColin Finck     CV_REG_LDTR         = 114,
1729c2c66affSColin Finck     CV_REG_TR           = 115,
1730c2c66affSColin Finck 
1731c2c66affSColin Finck     CV_REG_PSEUDO1      = 116, /* this includes Pseudo02 to Pseudo09 */
1732c2c66affSColin Finck     CV_REG_ST0          = 128, /* this includes ST1 to ST7 */
1733c2c66affSColin Finck     CV_REG_CTRL         = 136,
1734c2c66affSColin Finck     CV_REG_STAT         = 137,
1735c2c66affSColin Finck     CV_REG_TAG          = 138,
1736c2c66affSColin Finck     CV_REG_FPIP         = 139,
1737c2c66affSColin Finck     CV_REG_FPCS         = 140,
1738c2c66affSColin Finck     CV_REG_FPDO         = 141,
1739c2c66affSColin Finck     CV_REG_FPDS         = 142,
1740c2c66affSColin Finck     CV_REG_ISEM         = 143,
1741c2c66affSColin Finck     CV_REG_FPEIP        = 144,
1742c2c66affSColin Finck     CV_REG_FPEDO        = 145,
1743c2c66affSColin Finck     CV_REG_MM0          = 146, /* this includes MM1 to MM7 */
1744c2c66affSColin Finck     CV_REG_XMM0         = 154, /* this includes XMM1 to XMM7 */
1745c2c66affSColin Finck     CV_REG_XMM00        = 162,
1746c2c66affSColin Finck     CV_REG_XMM0L        = 194, /* this includes XMM1L to XMM7L */
1747c2c66affSColin Finck     CV_REG_XMM0H        = 202, /* this includes XMM1H to XMM7H */
1748c2c66affSColin Finck     CV_REG_MXCSR        = 211,
1749c2c66affSColin Finck     CV_REG_EDXEAX       = 212,
1750c2c66affSColin Finck     CV_REG_EMM0L        = 220,
1751c2c66affSColin Finck     CV_REG_EMM0H        = 228,
1752c2c66affSColin Finck     CV_REG_MM00         = 236,
1753c2c66affSColin Finck     CV_REG_MM01         = 237,
1754c2c66affSColin Finck     CV_REG_MM10         = 238,
1755c2c66affSColin Finck     CV_REG_MM11         = 239,
1756c2c66affSColin Finck     CV_REG_MM20         = 240,
1757c2c66affSColin Finck     CV_REG_MM21         = 241,
1758c2c66affSColin Finck     CV_REG_MM30         = 242,
1759c2c66affSColin Finck     CV_REG_MM31         = 243,
1760c2c66affSColin Finck     CV_REG_MM40         = 244,
1761c2c66affSColin Finck     CV_REG_MM41         = 245,
1762c2c66affSColin Finck     CV_REG_MM50         = 246,
1763c2c66affSColin Finck     CV_REG_MM51         = 247,
1764c2c66affSColin Finck     CV_REG_MM60         = 248,
1765c2c66affSColin Finck     CV_REG_MM61         = 249,
1766c2c66affSColin Finck     CV_REG_MM70         = 250,
1767c2c66affSColin Finck     CV_REG_MM71         = 251,
1768c2c66affSColin Finck 
1769c2c66affSColin Finck     CV_REG_YMM0         = 252, /* this includes YMM1 to YMM7 */
1770c2c66affSColin Finck     CV_REG_YMM0H        = 260, /* this includes YMM1H to YMM7H */
1771c2c66affSColin Finck     CV_REG_YMM0I0       = 268, /* this includes YMM0I1 to YMM0I3 */
1772c2c66affSColin Finck     CV_REG_YMM1I0       = 272, /* this includes YMM1I1 to YMM1I3 */
1773c2c66affSColin Finck     CV_REG_YMM2I0       = 276, /* this includes YMM2I1 to YMM2I3 */
1774c2c66affSColin Finck     CV_REG_YMM3I0       = 280, /* this includes YMM3I1 to YMM3I3 */
1775c2c66affSColin Finck     CV_REG_YMM4I0       = 284, /* this includes YMM4I1 to YMM4I3 */
1776c2c66affSColin Finck     CV_REG_YMM5I0       = 288, /* this includes YMM5I1 to YMM5I3 */
1777c2c66affSColin Finck     CV_REG_YMM6I0       = 292, /* this includes YMM6I1 to YMM6I3 */
1778c2c66affSColin Finck     CV_REG_YMM7I0       = 296, /* this includes YMM7I1 to YMM7I3 */
1779c2c66affSColin Finck     CV_REG_YMM0F0       = 300, /* this includes YMM0F1 to YMM0F7 */
1780c2c66affSColin Finck     CV_REG_YMM1F0       = 308, /* this includes YMM1F1 to YMM1F7 */
1781c2c66affSColin Finck     CV_REG_YMM2F0       = 316, /* this includes YMM2F1 to YMM2F7 */
1782c2c66affSColin Finck     CV_REG_YMM3F0       = 324, /* this includes YMM3F1 to YMM3F7 */
1783c2c66affSColin Finck     CV_REG_YMM4F0       = 332, /* this includes YMM4F1 to YMM4F7 */
1784c2c66affSColin Finck     CV_REG_YMM5F0       = 340, /* this includes YMM5F1 to YMM5F7 */
1785c2c66affSColin Finck     CV_REG_YMM6F0       = 348, /* this includes YMM6F1 to YMM6F7 */
1786c2c66affSColin Finck     CV_REG_YMM7F0       = 356, /* this includes YMM7F1 to YMM7F7 */
1787c2c66affSColin Finck     CV_REG_YMM0D0       = 364, /* this includes YMM0D1 to YMM0D3 */
1788c2c66affSColin Finck     CV_REG_YMM1D0       = 368, /* this includes YMM1D1 to YMM1D3 */
1789c2c66affSColin Finck     CV_REG_YMM2D0       = 372, /* this includes YMM2D1 to YMM2D3 */
1790c2c66affSColin Finck     CV_REG_YMM3D0       = 376, /* this includes YMM3D1 to YMM3D3 */
1791c2c66affSColin Finck     CV_REG_YMM4D0       = 380, /* this includes YMM4D1 to YMM4D3 */
1792c2c66affSColin Finck     CV_REG_YMM5D0       = 384, /* this includes YMM5D1 to YMM5D3 */
1793c2c66affSColin Finck     CV_REG_YMM6D0       = 388, /* this includes YMM6D1 to YMM6D3 */
1794c2c66affSColin Finck     CV_REG_YMM7D0       = 392, /* this includes YMM7D1 to YMM7D3 */
1795c2c66affSColin Finck 
1796c2c66affSColin Finck     /* Motorola 68K CPU */
1797c2c66affSColin Finck     CV_R68_D0           = 0, /* this includes D1 to D7 too */
1798c2c66affSColin Finck     CV_R68_A0           = 8, /* this includes A1 to A7 too */
1799c2c66affSColin Finck     CV_R68_CCR          = 16,
1800c2c66affSColin Finck     CV_R68_SR           = 17,
1801c2c66affSColin Finck     CV_R68_USP          = 18,
1802c2c66affSColin Finck     CV_R68_MSP          = 19,
1803c2c66affSColin Finck     CV_R68_SFC          = 20,
1804c2c66affSColin Finck     CV_R68_DFC          = 21,
1805c2c66affSColin Finck     CV_R68_CACR         = 22,
1806c2c66affSColin Finck     CV_R68_VBR          = 23,
1807c2c66affSColin Finck     CV_R68_CAAR         = 24,
1808c2c66affSColin Finck     CV_R68_ISP          = 25,
1809c2c66affSColin Finck     CV_R68_PC           = 26,
1810c2c66affSColin Finck     CV_R68_FPCR         = 28,
1811c2c66affSColin Finck     CV_R68_FPSR         = 29,
1812c2c66affSColin Finck     CV_R68_FPIAR        = 30,
1813c2c66affSColin Finck     CV_R68_FP0          = 32, /* this includes FP1 to FP7 */
1814c2c66affSColin Finck     CV_R68_MMUSR030     = 41,
1815c2c66affSColin Finck     CV_R68_MMUSR        = 42,
1816c2c66affSColin Finck     CV_R68_URP          = 43,
1817c2c66affSColin Finck     CV_R68_DTT0         = 44,
1818c2c66affSColin Finck     CV_R68_DTT1         = 45,
1819c2c66affSColin Finck     CV_R68_ITT0         = 46,
1820c2c66affSColin Finck     CV_R68_ITT1         = 47,
1821c2c66affSColin Finck     CV_R68_PSR          = 51,
1822c2c66affSColin Finck     CV_R68_PCSR         = 52,
1823c2c66affSColin Finck     CV_R68_VAL          = 53,
1824c2c66affSColin Finck     CV_R68_CRP          = 54,
1825c2c66affSColin Finck     CV_R68_SRP          = 55,
1826c2c66affSColin Finck     CV_R68_DRP          = 56,
1827c2c66affSColin Finck     CV_R68_TC           = 57,
1828c2c66affSColin Finck     CV_R68_AC           = 58,
1829c2c66affSColin Finck     CV_R68_SCC          = 59,
1830c2c66affSColin Finck     CV_R68_CAL          = 60,
1831c2c66affSColin Finck     CV_R68_TT0          = 61,
1832c2c66affSColin Finck     CV_R68_TT1          = 62,
1833c2c66affSColin Finck     CV_R68_BAD0         = 64, /* this includes BAD1 to BAD7 */
1834c2c66affSColin Finck     CV_R68_BAC0         = 72, /* this includes BAC1 to BAC7 */
1835c2c66affSColin Finck 
1836c2c66affSColin Finck     /* MIPS 4000 CPU */
1837c2c66affSColin Finck     CV_M4_NOREG         = CV_REG_NONE,
1838c2c66affSColin Finck     CV_M4_IntZERO       = 10,
1839c2c66affSColin Finck     CV_M4_IntAT         = 11,
1840c2c66affSColin Finck     CV_M4_IntV0         = 12,
1841c2c66affSColin Finck     CV_M4_IntV1         = 13,
1842c2c66affSColin Finck     CV_M4_IntA0         = 14, /* this includes IntA1 to IntA3 */
1843c2c66affSColin Finck     CV_M4_IntT0         = 18, /* this includes IntT1 to IntT7 */
1844c2c66affSColin Finck     CV_M4_IntS0         = 26, /* this includes IntS1 to IntS7 */
1845c2c66affSColin Finck     CV_M4_IntT8         = 34,
1846c2c66affSColin Finck     CV_M4_IntT9         = 35,
1847c2c66affSColin Finck     CV_M4_IntKT0        = 36,
1848c2c66affSColin Finck     CV_M4_IntKT1        = 37,
1849c2c66affSColin Finck     CV_M4_IntGP         = 38,
1850c2c66affSColin Finck     CV_M4_IntSP         = 39,
1851c2c66affSColin Finck     CV_M4_IntS8         = 40,
1852c2c66affSColin Finck     CV_M4_IntRA         = 41,
1853c2c66affSColin Finck     CV_M4_IntLO         = 42,
1854c2c66affSColin Finck     CV_M4_IntHI         = 43,
1855c2c66affSColin Finck     CV_M4_Fir           = 50,
1856c2c66affSColin Finck     CV_M4_Psr           = 51,
1857c2c66affSColin Finck     CV_M4_FltF0         = 60, /* this includes FltF1 to Flt31 */
1858c2c66affSColin Finck     CV_M4_FltFsr        = 92,
1859c2c66affSColin Finck 
1860c2c66affSColin Finck     /* Alpha AXP CPU */
1861c2c66affSColin Finck     CV_ALPHA_NOREG      = CV_REG_NONE,
1862c2c66affSColin Finck     CV_ALPHA_FltF0      = 10, /* this includes FltF1 to FltF31 */
1863c2c66affSColin Finck     CV_ALPHA_IntV0      = 42,
1864c2c66affSColin Finck     CV_ALPHA_IntT0      = 43, /* this includes T1 to T7 */
1865c2c66affSColin Finck     CV_ALPHA_IntS0      = 51, /* this includes S1 to S5 */
1866c2c66affSColin Finck     CV_ALPHA_IntFP      = 57,
1867c2c66affSColin Finck     CV_ALPHA_IntA0      = 58, /* this includes A1 to A5 */
1868c2c66affSColin Finck     CV_ALPHA_IntT8      = 64,
1869c2c66affSColin Finck     CV_ALPHA_IntT9      = 65,
1870c2c66affSColin Finck     CV_ALPHA_IntT10     = 66,
1871c2c66affSColin Finck     CV_ALPHA_IntT11     = 67,
1872c2c66affSColin Finck     CV_ALPHA_IntRA      = 68,
1873c2c66affSColin Finck     CV_ALPHA_IntT12     = 69,
1874c2c66affSColin Finck     CV_ALPHA_IntAT      = 70,
1875c2c66affSColin Finck     CV_ALPHA_IntGP      = 71,
1876c2c66affSColin Finck     CV_ALPHA_IntSP      = 72,
1877c2c66affSColin Finck     CV_ALPHA_IntZERO    = 73,
1878c2c66affSColin Finck     CV_ALPHA_Fpcr       = 74,
1879c2c66affSColin Finck     CV_ALPHA_Fir        = 75,
1880c2c66affSColin Finck     CV_ALPHA_Psr        = 76,
1881c2c66affSColin Finck     CV_ALPHA_FltFsr     = 77,
1882c2c66affSColin Finck     CV_ALPHA_SoftFpcr   = 78,
1883c2c66affSColin Finck 
1884c2c66affSColin Finck     /* Motorola & IBM PowerPC CPU */
1885c2c66affSColin Finck     CV_PPC_GPR0         = 1, /* this includes GPR1 to GPR31 */
1886c2c66affSColin Finck     CV_PPC_CR           = 33,
1887c2c66affSColin Finck     CV_PPC_CR0          = 34, /* this includes CR1 to CR7 */
1888c2c66affSColin Finck     CV_PPC_FPR0         = 42, /* this includes FPR1 to FPR31 */
1889c2c66affSColin Finck 
1890c2c66affSColin Finck     CV_PPC_FPSCR        = 74,
1891c2c66affSColin Finck     CV_PPC_MSR          = 75,
1892c2c66affSColin Finck     CV_PPC_SR0          = 76, /* this includes SR1 to SR15 */
1893c2c66affSColin Finck     CV_PPC_PC           = 99,
1894c2c66affSColin Finck     CV_PPC_MQ           = 100,
1895c2c66affSColin Finck     CV_PPC_XER          = 101,
1896c2c66affSColin Finck     CV_PPC_RTCU         = 104,
1897c2c66affSColin Finck     CV_PPC_RTCL         = 105,
1898c2c66affSColin Finck     CV_PPC_LR           = 108,
1899c2c66affSColin Finck     CV_PPC_CTR          = 109,
1900c2c66affSColin Finck     CV_PPC_COMPARE      = 110,
1901c2c66affSColin Finck     CV_PPC_COUNT        = 111,
1902c2c66affSColin Finck     CV_PPC_DSISR        = 118,
1903c2c66affSColin Finck     CV_PPC_DAR          = 119,
1904c2c66affSColin Finck     CV_PPC_DEC          = 122,
1905c2c66affSColin Finck     CV_PPC_SDR1         = 125,
1906c2c66affSColin Finck     CV_PPC_SRR0         = 126,
1907c2c66affSColin Finck     CV_PPC_SRR1         = 127,
1908c2c66affSColin Finck     CV_PPC_SPRG0        = 372, /* this includes SPRG1 to SPRG3 */
1909c2c66affSColin Finck     CV_PPC_ASR          = 280,
1910c2c66affSColin Finck     CV_PPC_EAR          = 382,
1911c2c66affSColin Finck     CV_PPC_PVR          = 287,
1912c2c66affSColin Finck     CV_PPC_BAT0U        = 628,
1913c2c66affSColin Finck     CV_PPC_BAT0L        = 629,
1914c2c66affSColin Finck     CV_PPC_BAT1U        = 630,
1915c2c66affSColin Finck     CV_PPC_BAT1L        = 631,
1916c2c66affSColin Finck     CV_PPC_BAT2U        = 632,
1917c2c66affSColin Finck     CV_PPC_BAT2L        = 633,
1918c2c66affSColin Finck     CV_PPC_BAT3U        = 634,
1919c2c66affSColin Finck     CV_PPC_BAT3L        = 635,
1920c2c66affSColin Finck     CV_PPC_DBAT0U       = 636,
1921c2c66affSColin Finck     CV_PPC_DBAT0L       = 637,
1922c2c66affSColin Finck     CV_PPC_DBAT1U       = 638,
1923c2c66affSColin Finck     CV_PPC_DBAT1L       = 639,
1924c2c66affSColin Finck     CV_PPC_DBAT2U       = 640,
1925c2c66affSColin Finck     CV_PPC_DBAT2L       = 641,
1926c2c66affSColin Finck     CV_PPC_DBAT3U       = 642,
1927c2c66affSColin Finck     CV_PPC_DBAT3L       = 643,
1928c2c66affSColin Finck     CV_PPC_PMR0         = 1044, /* this includes PMR1 to PMR15 */
1929c2c66affSColin Finck     CV_PPC_DMISS        = 1076,
1930c2c66affSColin Finck     CV_PPC_DCMP         = 1077,
1931c2c66affSColin Finck     CV_PPC_HASH1        = 1078,
1932c2c66affSColin Finck     CV_PPC_HASH2        = 1079,
1933c2c66affSColin Finck     CV_PPC_IMISS        = 1080,
1934c2c66affSColin Finck     CV_PPC_ICMP         = 1081,
1935c2c66affSColin Finck     CV_PPC_RPA          = 1082,
1936c2c66affSColin Finck     CV_PPC_HID0         = 1108, /* this includes HID1 to HID15 */
1937c2c66affSColin Finck 
1938c2c66affSColin Finck     /* Java */
1939c2c66affSColin Finck     CV_JAVA_PC          = 1,
1940c2c66affSColin Finck 
1941c2c66affSColin Finck     /* Hitachi SH3 CPU */
1942c2c66affSColin Finck     CV_SH3_NOREG        = CV_REG_NONE,
1943c2c66affSColin Finck     CV_SH3_IntR0        = 10, /* this include R1 to R13 */
1944c2c66affSColin Finck     CV_SH3_IntFp        = 24,
1945c2c66affSColin Finck     CV_SH3_IntSp        = 25,
1946c2c66affSColin Finck     CV_SH3_Gbr          = 38,
1947c2c66affSColin Finck     CV_SH3_Pr           = 39,
1948c2c66affSColin Finck     CV_SH3_Mach         = 40,
1949c2c66affSColin Finck     CV_SH3_Macl         = 41,
1950c2c66affSColin Finck     CV_SH3_Pc           = 50,
1951c2c66affSColin Finck     CV_SH3_Sr           = 51,
1952c2c66affSColin Finck     CV_SH3_BarA         = 60,
1953c2c66affSColin Finck     CV_SH3_BasrA        = 61,
1954c2c66affSColin Finck     CV_SH3_BamrA        = 62,
1955c2c66affSColin Finck     CV_SH3_BbrA         = 63,
1956c2c66affSColin Finck     CV_SH3_BarB         = 64,
1957c2c66affSColin Finck     CV_SH3_BasrB        = 65,
1958c2c66affSColin Finck     CV_SH3_BamrB        = 66,
1959c2c66affSColin Finck     CV_SH3_BbrB         = 67,
1960c2c66affSColin Finck     CV_SH3_BdrB         = 68,
1961c2c66affSColin Finck     CV_SH3_BdmrB        = 69,
1962c2c66affSColin Finck     CV_SH3_Brcr         = 70,
1963c2c66affSColin Finck     CV_SH_Fpscr         = 75,
1964c2c66affSColin Finck     CV_SH_Fpul          = 76,
1965c2c66affSColin Finck     CV_SH_FpR0          = 80, /* this includes FpR1 to FpR15 */
1966c2c66affSColin Finck     CV_SH_XFpR0         = 96, /* this includes XFpR1 to XXFpR15 */
1967c2c66affSColin Finck 
1968c2c66affSColin Finck     /* ARM CPU */
1969c2c66affSColin Finck     CV_ARM_NOREG        = CV_REG_NONE,
1970c2c66affSColin Finck     CV_ARM_R0           = 10, /* this includes R1 to R12 */
1971c2c66affSColin Finck     CV_ARM_SP           = 23,
1972c2c66affSColin Finck     CV_ARM_LR           = 24,
1973c2c66affSColin Finck     CV_ARM_PC           = 25,
1974c2c66affSColin Finck     CV_ARM_CPSR         = 26,
1975c2c66affSColin Finck     CV_ARM_ACC0         = 27,
1976c2c66affSColin Finck     CV_ARM_FPSCR        = 40,
1977c2c66affSColin Finck     CV_ARM_FPEXC        = 41,
1978c2c66affSColin Finck     CV_ARM_FS0          = 50, /* this includes FS1 to FS31 */
1979c2c66affSColin Finck     CV_ARM_FPEXTRA0     = 90, /* this includes FPEXTRA1 to FPEXTRA7 */
1980c2c66affSColin Finck     CV_ARM_WR0          = 128, /* this includes WR1 to WR15 */
1981c2c66affSColin Finck     CV_ARM_WCID         = 144,
1982c2c66affSColin Finck     CV_ARM_WCON         = 145,
1983c2c66affSColin Finck     CV_ARM_WCSSF        = 146,
1984c2c66affSColin Finck     CV_ARM_WCASF        = 147,
1985c2c66affSColin Finck     CV_ARM_WC4          = 148,
1986c2c66affSColin Finck     CV_ARM_WC5          = 149,
1987c2c66affSColin Finck     CV_ARM_WC6          = 150,
1988c2c66affSColin Finck     CV_ARM_WC7          = 151,
1989c2c66affSColin Finck     CV_ARM_WCGR0        = 152, /* this includes WCGR1 to WCGR3 */
1990c2c66affSColin Finck     CV_ARM_WC12         = 156,
1991c2c66affSColin Finck     CV_ARM_WC13         = 157,
1992c2c66affSColin Finck     CV_ARM_WC14         = 158,
1993c2c66affSColin Finck     CV_ARM_WC15         = 159,
1994c2c66affSColin Finck     CV_ARM_FS32         = 200, /* this includes FS33 to FS63 */
1995c2c66affSColin Finck     CV_ARM_ND0          = 300, /* this includes ND1 to ND31 */
1996c2c66affSColin Finck     CV_ARM_NQ0          = 400, /* this includes NQ1 to NQ15 */
1997c2c66affSColin Finck 
1998c2c66affSColin Finck     /* Intel IA64 CPU */
1999c2c66affSColin Finck     CV_IA64_NOREG       = CV_REG_NONE,
2000c2c66affSColin Finck     CV_IA64_Br0         = 512, /* this includes Br1 to Br7 */
2001c2c66affSColin Finck     CV_IA64_P0          = 704, /* this includes P1 to P63 */
2002c2c66affSColin Finck     CV_IA64_Preds       = 768,
2003c2c66affSColin Finck     CV_IA64_IntH0       = 832, /* this includes H1 to H15 */
2004c2c66affSColin Finck     CV_IA64_Ip          = 1016,
2005c2c66affSColin Finck     CV_IA64_Umask       = 1017,
2006c2c66affSColin Finck     CV_IA64_Cfm         = 1018,
2007c2c66affSColin Finck     CV_IA64_Psr         = 1019,
2008c2c66affSColin Finck     CV_IA64_Nats        = 1020,
2009c2c66affSColin Finck     CV_IA64_Nats2       = 1021,
2010c2c66affSColin Finck     CV_IA64_Nats3       = 1022,
2011c2c66affSColin Finck     CV_IA64_IntR0       = 1024, /* this includes R1 to R127 */
2012c2c66affSColin Finck     CV_IA64_FltF0       = 2048, /* this includes FltF1 to FltF127 */
2013c2c66affSColin Finck     /* some IA64 registers missing */
2014c2c66affSColin Finck 
2015c2c66affSColin Finck     /* TriCore CPU */
2016c2c66affSColin Finck     CV_TRI_NOREG        = CV_REG_NONE,
2017c2c66affSColin Finck     CV_TRI_D0           = 10, /* includes D1 to D15 */
2018c2c66affSColin Finck     CV_TRI_A0           = 26, /* includes A1 to A15 */
2019c2c66affSColin Finck     CV_TRI_E0           = 42,
2020c2c66affSColin Finck     CV_TRI_E2           = 43,
2021c2c66affSColin Finck     CV_TRI_E4           = 44,
2022c2c66affSColin Finck     CV_TRI_E6           = 45,
2023c2c66affSColin Finck     CV_TRI_E8           = 46,
2024c2c66affSColin Finck     CV_TRI_E10          = 47,
2025c2c66affSColin Finck     CV_TRI_E12          = 48,
2026c2c66affSColin Finck     CV_TRI_E14          = 49,
2027c2c66affSColin Finck     CV_TRI_EA0          = 50,
2028c2c66affSColin Finck     CV_TRI_EA2          = 51,
2029c2c66affSColin Finck     CV_TRI_EA4          = 52,
2030c2c66affSColin Finck     CV_TRI_EA6          = 53,
2031c2c66affSColin Finck     CV_TRI_EA8          = 54,
2032c2c66affSColin Finck     CV_TRI_EA10         = 55,
2033c2c66affSColin Finck     CV_TRI_EA12         = 56,
2034c2c66affSColin Finck     CV_TRI_EA14         = 57,
2035c2c66affSColin Finck     CV_TRI_PSW          = 58,
2036c2c66affSColin Finck     CV_TRI_PCXI         = 59,
2037c2c66affSColin Finck     CV_TRI_PC           = 60,
2038c2c66affSColin Finck     CV_TRI_FCX          = 61,
2039c2c66affSColin Finck     CV_TRI_LCX          = 62,
2040c2c66affSColin Finck     CV_TRI_ISP          = 63,
2041c2c66affSColin Finck     CV_TRI_ICR          = 64,
2042c2c66affSColin Finck     CV_TRI_BIV          = 65,
2043c2c66affSColin Finck     CV_TRI_BTV          = 66,
2044c2c66affSColin Finck     CV_TRI_SYSCON       = 67,
2045c2c66affSColin Finck     CV_TRI_DPRx_0       = 68, /* includes DPRx_1 to DPRx_3 */
2046c2c66affSColin Finck     CV_TRI_CPRx_0       = 68, /* includes CPRx_1 to CPRx_3 */
2047c2c66affSColin Finck     CV_TRI_DPMx_0       = 68, /* includes DPMx_1 to DPMx_3 */
2048c2c66affSColin Finck     CV_TRI_CPMx_0       = 68, /* includes CPMx_1 to CPMx_3 */
2049c2c66affSColin Finck     CV_TRI_DBGSSR       = 72,
2050c2c66affSColin Finck     CV_TRI_EXEVT        = 73,
2051c2c66affSColin Finck     CV_TRI_SWEVT        = 74,
2052c2c66affSColin Finck     CV_TRI_CREVT        = 75,
2053c2c66affSColin Finck     CV_TRI_TRnEVT       = 76,
2054c2c66affSColin Finck     CV_TRI_MMUCON       = 77,
2055c2c66affSColin Finck     CV_TRI_ASI          = 78,
2056c2c66affSColin Finck     CV_TRI_TVA          = 79,
2057c2c66affSColin Finck     CV_TRI_TPA          = 80,
2058c2c66affSColin Finck     CV_TRI_TPX          = 81,
2059c2c66affSColin Finck     CV_TRI_TFA          = 82,
2060c2c66affSColin Finck 
2061c2c66affSColin Finck     /* AM33 (and the likes) CPU */
2062c2c66affSColin Finck     CV_AM33_NOREG       = CV_REG_NONE,
2063c2c66affSColin Finck     CV_AM33_E0          = 10, /* this includes E1 to E7 */
2064c2c66affSColin Finck     CV_AM33_A0          = 20, /* this includes A1 to A3 */
2065c2c66affSColin Finck     CV_AM33_D0          = 30, /* this includes D1 to D3 */
2066c2c66affSColin Finck     CV_AM33_FS0         = 40, /* this includes FS1 to FS31 */
2067c2c66affSColin Finck     CV_AM33_SP          = 80,
2068c2c66affSColin Finck     CV_AM33_PC          = 81,
2069c2c66affSColin Finck     CV_AM33_MDR         = 82,
2070c2c66affSColin Finck     CV_AM33_MDRQ        = 83,
2071c2c66affSColin Finck     CV_AM33_MCRH        = 84,
2072c2c66affSColin Finck     CV_AM33_MCRL        = 85,
2073c2c66affSColin Finck     CV_AM33_MCVF        = 86,
2074c2c66affSColin Finck     CV_AM33_EPSW        = 87,
2075c2c66affSColin Finck     CV_AM33_FPCR        = 88,
2076c2c66affSColin Finck     CV_AM33_LIR         = 89,
2077c2c66affSColin Finck     CV_AM33_LAR         = 90,
2078c2c66affSColin Finck 
2079c2c66affSColin Finck     /* Mitsubishi M32R CPU */
2080c2c66affSColin Finck     CV_M32R_NOREG       = CV_REG_NONE,
2081c2c66affSColin Finck     CV_M32R_R0          = 10, /* this includes R1 to R11 */
2082c2c66affSColin Finck     CV_M32R_R12         = 22,
2083c2c66affSColin Finck     CV_M32R_R13         = 23,
2084c2c66affSColin Finck     CV_M32R_R14         = 24,
2085c2c66affSColin Finck     CV_M32R_R15         = 25,
2086c2c66affSColin Finck     CV_M32R_PSW         = 26,
2087c2c66affSColin Finck     CV_M32R_CBR         = 27,
2088c2c66affSColin Finck     CV_M32R_SPI         = 28,
2089c2c66affSColin Finck     CV_M32R_SPU         = 29,
2090c2c66affSColin Finck     CV_M32R_SPO         = 30,
2091c2c66affSColin Finck     CV_M32R_BPC         = 31,
2092c2c66affSColin Finck     CV_M32R_ACHI        = 32,
2093c2c66affSColin Finck     CV_M32R_ACLO        = 33,
2094c2c66affSColin Finck     CV_M32R_PC          = 34,
2095c2c66affSColin Finck 
2096c2c66affSColin Finck     /* AMD/Intel x86_64 CPU */
2097c2c66affSColin Finck     CV_AMD64_NONE       = CV_REG_NONE,
2098c2c66affSColin Finck     CV_AMD64_AL         = CV_REG_AL,
2099c2c66affSColin Finck     CV_AMD64_CL         = CV_REG_CL,
2100c2c66affSColin Finck     CV_AMD64_DL         = CV_REG_DL,
2101c2c66affSColin Finck     CV_AMD64_BL         = CV_REG_BL,
2102c2c66affSColin Finck     CV_AMD64_AH         = CV_REG_AH,
2103c2c66affSColin Finck     CV_AMD64_CH         = CV_REG_CH,
2104c2c66affSColin Finck     CV_AMD64_DH         = CV_REG_DH,
2105c2c66affSColin Finck     CV_AMD64_BH         = CV_REG_BH,
2106c2c66affSColin Finck     CV_AMD64_AX         = CV_REG_AX,
2107c2c66affSColin Finck     CV_AMD64_CX         = CV_REG_CX,
2108c2c66affSColin Finck     CV_AMD64_DX         = CV_REG_DX,
2109c2c66affSColin Finck     CV_AMD64_BX         = CV_REG_BX,
2110c2c66affSColin Finck     CV_AMD64_SP         = CV_REG_SP,
2111c2c66affSColin Finck     CV_AMD64_BP         = CV_REG_BP,
2112c2c66affSColin Finck     CV_AMD64_SI         = CV_REG_SI,
2113c2c66affSColin Finck     CV_AMD64_DI         = CV_REG_DI,
2114c2c66affSColin Finck     CV_AMD64_EAX        = CV_REG_EAX,
2115c2c66affSColin Finck     CV_AMD64_ECX        = CV_REG_ECX,
2116c2c66affSColin Finck     CV_AMD64_EDX        = CV_REG_EDX,
2117c2c66affSColin Finck     CV_AMD64_EBX        = CV_REG_EBX,
2118c2c66affSColin Finck     CV_AMD64_ESP        = CV_REG_ESP,
2119c2c66affSColin Finck     CV_AMD64_EBP        = CV_REG_EBP,
2120c2c66affSColin Finck     CV_AMD64_ESI        = CV_REG_ESI,
2121c2c66affSColin Finck     CV_AMD64_EDI        = CV_REG_EDI,
2122c2c66affSColin Finck     CV_AMD64_ES         = CV_REG_ES,
2123c2c66affSColin Finck     CV_AMD64_CS         = CV_REG_CS,
2124c2c66affSColin Finck     CV_AMD64_SS         = CV_REG_SS,
2125c2c66affSColin Finck     CV_AMD64_DS         = CV_REG_DS,
2126c2c66affSColin Finck     CV_AMD64_FS         = CV_REG_FS,
2127c2c66affSColin Finck     CV_AMD64_GS         = CV_REG_GS,
2128c2c66affSColin Finck     CV_AMD64_FLAGS      = CV_REG_FLAGS,
2129c2c66affSColin Finck     CV_AMD64_RIP        = CV_REG_EIP,
2130c2c66affSColin Finck     CV_AMD64_EFLAGS     = CV_REG_EFLAGS,
2131c2c66affSColin Finck 
2132c2c66affSColin Finck     /* <pcode> */
2133c2c66affSColin Finck     CV_AMD64_TEMP       = CV_REG_TEMP,
2134c2c66affSColin Finck     CV_AMD64_TEMPH      = CV_REG_TEMPH,
2135c2c66affSColin Finck     CV_AMD64_QUOTE      = CV_REG_QUOTE,
2136c2c66affSColin Finck     CV_AMD64_PCDR3      = CV_REG_PCDR3, /* this includes PCDR4 to PCDR7 */
2137c2c66affSColin Finck     CV_AMD64_CR0        = CV_REG_CR0,   /* this includes CR1 to CR4 */
2138c2c66affSColin Finck     CV_AMD64_DR0        = CV_REG_DR0,   /* this includes DR1 to DR7 */
2139c2c66affSColin Finck     /* </pcode> */
2140c2c66affSColin Finck 
2141c2c66affSColin Finck     CV_AMD64_GDTR       = CV_REG_GDTR,
2142c2c66affSColin Finck     CV_AMD64_GDTL       = CV_REG_GDTL,
2143c2c66affSColin Finck     CV_AMD64_IDTR       = CV_REG_IDTR,
2144c2c66affSColin Finck     CV_AMD64_IDTL       = CV_REG_IDTL,
2145c2c66affSColin Finck     CV_AMD64_LDTR       = CV_REG_LDTR,
2146c2c66affSColin Finck     CV_AMD64_TR         = CV_REG_TR,
2147c2c66affSColin Finck 
2148c2c66affSColin Finck     CV_AMD64_PSEUDO1    = CV_REG_PSEUDO1, /* this includes Pseudo02 to Pseudo09 */
2149c2c66affSColin Finck     CV_AMD64_ST0        = CV_REG_ST0,     /* this includes ST1 to ST7 */
2150c2c66affSColin Finck     CV_AMD64_CTRL       = CV_REG_CTRL,
2151c2c66affSColin Finck     CV_AMD64_STAT       = CV_REG_STAT,
2152c2c66affSColin Finck     CV_AMD64_TAG        = CV_REG_TAG,
2153c2c66affSColin Finck     CV_AMD64_FPIP       = CV_REG_FPIP,
2154c2c66affSColin Finck     CV_AMD64_FPCS       = CV_REG_FPCS,
2155c2c66affSColin Finck     CV_AMD64_FPDO       = CV_REG_FPDO,
2156c2c66affSColin Finck     CV_AMD64_FPDS       = CV_REG_FPDS,
2157c2c66affSColin Finck     CV_AMD64_ISEM       = CV_REG_ISEM,
2158c2c66affSColin Finck     CV_AMD64_FPEIP      = CV_REG_FPEIP,
2159c2c66affSColin Finck     CV_AMD64_FPEDO      = CV_REG_FPEDO,
2160c2c66affSColin Finck     CV_AMD64_MM0        = CV_REG_MM0,     /* this includes MM1 to MM7 */
2161c2c66affSColin Finck     CV_AMD64_XMM0       = CV_REG_XMM0,    /* this includes XMM1 to XMM7 */
2162c2c66affSColin Finck     CV_AMD64_XMM00      = CV_REG_XMM00,
2163c2c66affSColin Finck     CV_AMD64_XMM0L      = CV_REG_XMM0L,   /* this includes XMM1L to XMM7L */
2164c2c66affSColin Finck     CV_AMD64_XMM0H      = CV_REG_XMM0H,   /* this includes XMM1H to XMM7H */
2165c2c66affSColin Finck     CV_AMD64_MXCSR      = CV_REG_MXCSR,
2166c2c66affSColin Finck     CV_AMD64_EDXEAX     = CV_REG_EDXEAX,
2167c2c66affSColin Finck     CV_AMD64_EMM0L      = CV_REG_EMM0L,
2168c2c66affSColin Finck     CV_AMD64_EMM0H      = CV_REG_EMM0H,
2169c2c66affSColin Finck     CV_AMD64_MM00       = CV_REG_MM00,
2170c2c66affSColin Finck     CV_AMD64_MM01       = CV_REG_MM01,
2171c2c66affSColin Finck     CV_AMD64_MM10       = CV_REG_MM10,
2172c2c66affSColin Finck     CV_AMD64_MM11       = CV_REG_MM11,
2173c2c66affSColin Finck     CV_AMD64_MM20       = CV_REG_MM20,
2174c2c66affSColin Finck     CV_AMD64_MM21       = CV_REG_MM21,
2175c2c66affSColin Finck     CV_AMD64_MM30       = CV_REG_MM30,
2176c2c66affSColin Finck     CV_AMD64_MM31       = CV_REG_MM31,
2177c2c66affSColin Finck     CV_AMD64_MM40       = CV_REG_MM40,
2178c2c66affSColin Finck     CV_AMD64_MM41       = CV_REG_MM41,
2179c2c66affSColin Finck     CV_AMD64_MM50       = CV_REG_MM50,
2180c2c66affSColin Finck     CV_AMD64_MM51       = CV_REG_MM51,
2181c2c66affSColin Finck     CV_AMD64_MM60       = CV_REG_MM60,
2182c2c66affSColin Finck     CV_AMD64_MM61       = CV_REG_MM61,
2183c2c66affSColin Finck     CV_AMD64_MM70       = CV_REG_MM70,
2184c2c66affSColin Finck     CV_AMD64_MM71       = CV_REG_MM71,
2185c2c66affSColin Finck 
2186c2c66affSColin Finck     CV_AMD64_XMM8       = 252,           /* this includes XMM9 to XMM15 */
2187c2c66affSColin Finck 
2188c2c66affSColin Finck     CV_AMD64_RAX        = 328,
2189c2c66affSColin Finck     CV_AMD64_RBX        = 329,
2190c2c66affSColin Finck     CV_AMD64_RCX        = 330,
2191c2c66affSColin Finck     CV_AMD64_RDX        = 331,
2192c2c66affSColin Finck     CV_AMD64_RSI        = 332,
2193c2c66affSColin Finck     CV_AMD64_RDI        = 333,
2194c2c66affSColin Finck     CV_AMD64_RBP        = 334,
2195c2c66affSColin Finck     CV_AMD64_RSP        = 335,
2196c2c66affSColin Finck 
2197c2c66affSColin Finck     CV_AMD64_R8         = 336,
2198c2c66affSColin Finck     CV_AMD64_R9         = 337,
2199c2c66affSColin Finck     CV_AMD64_R10        = 338,
2200c2c66affSColin Finck     CV_AMD64_R11        = 339,
2201c2c66affSColin Finck     CV_AMD64_R12        = 340,
2202c2c66affSColin Finck     CV_AMD64_R13        = 341,
2203c2c66affSColin Finck     CV_AMD64_R14        = 342,
2204c2c66affSColin Finck     CV_AMD64_R15        = 343,
2205c2c66affSColin Finck 
2206c2c66affSColin Finck     /* Wine extension */
2207c2c66affSColin Finck     CV_ARM64_NOREG        = CV_REG_NONE,
2208c2c66affSColin Finck     CV_ARM64_X0           = 10, /* this includes X0 to X30 */
2209c2c66affSColin Finck     CV_ARM64_SP           = 41,
2210c2c66affSColin Finck     CV_ARM64_PC           = 42,
2211c2c66affSColin Finck     CV_ARM64_PSTATE       = 43,
2212c2c66affSColin Finck };
2213c2c66affSColin Finck 
2214c2c66affSColin Finck typedef enum
2215c2c66affSColin Finck {
2216c2c66affSColin Finck    THUNK_ORDINAL_NOTYPE,
2217c2c66affSColin Finck    THUNK_ORDINAL_ADJUSTOR,
2218c2c66affSColin Finck    THUNK_ORDINAL_VCALL,
2219c2c66affSColin Finck    THUNK_ORDINAL_PCODE,
2220c2c66affSColin Finck    THUNK_ORDINAL_LOAD
2221c2c66affSColin Finck } THUNK_ORDINAL;
2222c2c66affSColin Finck 
2223c2c66affSColin Finck typedef enum CV_call_e
2224c2c66affSColin Finck {
2225c2c66affSColin Finck     CV_CALL_NEAR_C,
2226c2c66affSColin Finck     CV_CALL_FAR_C,
2227c2c66affSColin Finck     CV_CALL_NEAR_PASCAL,
2228c2c66affSColin Finck     CV_CALL_FAR_PASCAL,
2229c2c66affSColin Finck     CV_CALL_NEAR_FAST,
2230c2c66affSColin Finck     CV_CALL_FAR_FAST,
2231c2c66affSColin Finck     CV_CALL_SKIPPED,
2232c2c66affSColin Finck     CV_CALL_NEAR_STD,
2233c2c66affSColin Finck     CV_CALL_FAR_STD,
2234c2c66affSColin Finck     CV_CALL_NEAR_SYS,
2235c2c66affSColin Finck     CV_CALL_FAR_SYS,
2236c2c66affSColin Finck     CV_CALL_THISCALL,
2237c2c66affSColin Finck     CV_CALL_MIPSCALL,
2238c2c66affSColin Finck     CV_CALL_GENERIC,
2239c2c66affSColin Finck     CV_CALL_ALPHACALL,
2240c2c66affSColin Finck     CV_CALL_PPCCALL,
2241c2c66affSColin Finck     CV_CALL_SHCALL,
2242c2c66affSColin Finck     CV_CALL_ARMCALL,
2243c2c66affSColin Finck     CV_CALL_AM33CALL,
2244c2c66affSColin Finck     CV_CALL_TRICALL,
2245c2c66affSColin Finck     CV_CALL_SH5CALL,
2246c2c66affSColin Finck     CV_CALL_M32RCALL,
2247c2c66affSColin Finck     CV_CALL_RESERVED,
2248c2c66affSColin Finck } CV_call_e;
2249c2c66affSColin Finck 
2250c2c66affSColin Finck 
2251c2c66affSColin Finck // wtypes.h
2252c2c66affSColin Finck typedef LONG SCODE;
2253c2c66affSColin Finck typedef double DATE;
2254c2c66affSColin Finck typedef unsigned short VARTYPE;
2255c2c66affSColin Finck typedef union tagCY {
2256c2c66affSColin Finck     struct {
2257c2c66affSColin Finck #ifdef WORDS_BIGENDIAN
2258c2c66affSColin Finck         LONG  Hi;
2259c2c66affSColin Finck         ULONG Lo;
2260c2c66affSColin Finck #else
2261c2c66affSColin Finck         ULONG Lo;
2262c2c66affSColin Finck         LONG  Hi;
2263c2c66affSColin Finck #endif
2264c2c66affSColin Finck     } DUMMYSTRUCTNAME;
2265c2c66affSColin Finck     LONGLONG int64;
2266c2c66affSColin Finck } CY;
2267c2c66affSColin Finck typedef struct tagDEC {
2268c2c66affSColin Finck   USHORT wReserved;
2269c2c66affSColin Finck   union {
2270c2c66affSColin Finck     struct {
2271c2c66affSColin Finck       BYTE scale;
2272c2c66affSColin Finck       BYTE sign;
2273c2c66affSColin Finck     } DUMMYSTRUCTNAME;
2274c2c66affSColin Finck     USHORT signscale;
2275c2c66affSColin Finck   } DUMMYUNIONNAME;
2276c2c66affSColin Finck   ULONG Hi32;
2277c2c66affSColin Finck   union {
2278c2c66affSColin Finck     struct {
2279c2c66affSColin Finck #ifdef WORDS_BIGENDIAN
2280c2c66affSColin Finck       ULONG Mid32;
2281c2c66affSColin Finck       ULONG Lo32;
2282c2c66affSColin Finck #else
2283c2c66affSColin Finck       ULONG Lo32;
2284c2c66affSColin Finck       ULONG Mid32;
2285c2c66affSColin Finck #endif
2286c2c66affSColin Finck     } DUMMYSTRUCTNAME1;
2287c2c66affSColin Finck     ULONGLONG Lo64;
2288c2c66affSColin Finck   } DUMMYUNIONNAME1;
2289c2c66affSColin Finck } DECIMAL;
2290c2c66affSColin Finck typedef short VARIANT_BOOL;
2291c2c66affSColin Finck typedef VARIANT_BOOL _VARIANT_BOOL;
2292c2c66affSColin Finck typedef WCHAR OLECHAR;
2293c2c66affSColin Finck typedef OLECHAR *BSTR;
2294c2c66affSColin Finck enum VARENUM {
2295c2c66affSColin Finck     VT_EMPTY = 0,
2296c2c66affSColin Finck     VT_NULL = 1,
2297c2c66affSColin Finck     VT_I2 = 2,
2298c2c66affSColin Finck     VT_I4 = 3,
2299c2c66affSColin Finck     VT_R4 = 4,
2300c2c66affSColin Finck     VT_R8 = 5,
2301c2c66affSColin Finck     VT_CY = 6,
2302c2c66affSColin Finck     VT_DATE = 7,
2303c2c66affSColin Finck     VT_BSTR = 8,
2304c2c66affSColin Finck     VT_DISPATCH = 9,
2305c2c66affSColin Finck     VT_ERROR = 10,
2306c2c66affSColin Finck     VT_BOOL = 11,
2307c2c66affSColin Finck     VT_VARIANT = 12,
2308c2c66affSColin Finck     VT_UNKNOWN = 13,
2309c2c66affSColin Finck     VT_DECIMAL = 14,
2310c2c66affSColin Finck     VT_I1 = 16,
2311c2c66affSColin Finck     VT_UI1 = 17,
2312c2c66affSColin Finck     VT_UI2 = 18,
2313c2c66affSColin Finck     VT_UI4 = 19,
2314c2c66affSColin Finck     VT_I8 = 20,
2315c2c66affSColin Finck     VT_UI8 = 21,
2316c2c66affSColin Finck     VT_INT = 22,
2317c2c66affSColin Finck     VT_UINT = 23,
2318c2c66affSColin Finck     VT_VOID = 24,
2319c2c66affSColin Finck     VT_HRESULT = 25,
2320c2c66affSColin Finck     VT_PTR = 26,
2321c2c66affSColin Finck     VT_SAFEARRAY = 27,
2322c2c66affSColin Finck     VT_CARRAY = 28,
2323c2c66affSColin Finck     VT_USERDEFINED = 29,
2324c2c66affSColin Finck     VT_LPSTR = 30,
2325c2c66affSColin Finck     VT_LPWSTR = 31,
2326c2c66affSColin Finck     VT_RECORD = 36,
2327c2c66affSColin Finck     VT_INT_PTR = 37,
2328c2c66affSColin Finck     VT_UINT_PTR = 38,
2329c2c66affSColin Finck     VT_FILETIME = 64,
2330c2c66affSColin Finck     VT_BLOB = 65,
2331c2c66affSColin Finck     VT_STREAM = 66,
2332c2c66affSColin Finck     VT_STORAGE = 67,
2333c2c66affSColin Finck     VT_STREAMED_OBJECT = 68,
2334c2c66affSColin Finck     VT_STORED_OBJECT = 69,
2335c2c66affSColin Finck     VT_BLOB_OBJECT = 70,
2336c2c66affSColin Finck     VT_CF = 71,
2337c2c66affSColin Finck     VT_CLSID = 72,
2338c2c66affSColin Finck     VT_VERSIONED_STREAM = 73,
2339c2c66affSColin Finck     VT_BSTR_BLOB = 0xfff,
2340c2c66affSColin Finck     VT_VECTOR = 0x1000,
2341c2c66affSColin Finck     VT_ARRAY = 0x2000,
2342c2c66affSColin Finck     VT_BYREF = 0x4000,
2343c2c66affSColin Finck     VT_RESERVED = 0x8000,
2344c2c66affSColin Finck     VT_ILLEGAL = 0xffff,
2345c2c66affSColin Finck     VT_ILLEGALMASKED = 0xfff,
2346c2c66affSColin Finck     VT_TYPEMASK = 0xfff
2347c2c66affSColin Finck };
2348c2c66affSColin Finck 
2349c2c66affSColin Finck // oaidl.h
2350c2c66affSColin Finck typedef struct tagSAFEARRAYBOUND {
2351c2c66affSColin Finck     ULONG cElements;
2352c2c66affSColin Finck     LONG lLbound;
2353c2c66affSColin Finck } SAFEARRAYBOUND;
2354c2c66affSColin Finck typedef struct tagSAFEARRAY {
2355c2c66affSColin Finck     USHORT cDims;
2356c2c66affSColin Finck     USHORT fFeatures;
2357c2c66affSColin Finck     ULONG cbElements;
2358c2c66affSColin Finck     ULONG cLocks;
2359c2c66affSColin Finck     PVOID pvData;
2360c2c66affSColin Finck     SAFEARRAYBOUND rgsabound[1];
2361c2c66affSColin Finck } SAFEARRAY;
2362c2c66affSColin Finck typedef SAFEARRAY *LPSAFEARRAY;
2363c2c66affSColin Finck 
2364c2c66affSColin Finck #if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
2365c2c66affSColin Finck #define __VARIANT_NAME_1 n1
2366c2c66affSColin Finck #define __VARIANT_NAME_2 n2
2367c2c66affSColin Finck #define __VARIANT_NAME_3 n3
2368c2c66affSColin Finck #define __VARIANT_NAME_4 brecVal
2369c2c66affSColin Finck #else
2370c2c66affSColin Finck #define __tagVARIANT
2371c2c66affSColin Finck #define __VARIANT_NAME_1
2372c2c66affSColin Finck #define __VARIANT_NAME_2
2373c2c66affSColin Finck #define __VARIANT_NAME_3
2374c2c66affSColin Finck #define __tagBRECORD
2375c2c66affSColin Finck #define __VARIANT_NAME_4
2376c2c66affSColin Finck #endif
2377c2c66affSColin Finck typedef struct tagVARIANT VARIANT;
2378c2c66affSColin Finck struct tagVARIANT {
2379c2c66affSColin Finck     union {
2380c2c66affSColin Finck         struct __tagVARIANT {
2381c2c66affSColin Finck             VARTYPE vt;
2382c2c66affSColin Finck             WORD wReserved1;
2383c2c66affSColin Finck             WORD wReserved2;
2384c2c66affSColin Finck             WORD wReserved3;
2385c2c66affSColin Finck             union {
2386c2c66affSColin Finck                 signed char cVal;
2387c2c66affSColin Finck                 USHORT uiVal;
2388c2c66affSColin Finck                 ULONG ulVal;
2389c2c66affSColin Finck                 INT intVal;
2390c2c66affSColin Finck                 UINT uintVal;
2391c2c66affSColin Finck                 BYTE bVal;
2392c2c66affSColin Finck                 SHORT iVal;
2393c2c66affSColin Finck                 LONG lVal;
2394c2c66affSColin Finck                 FLOAT fltVal;
2395c2c66affSColin Finck                 DOUBLE dblVal;
2396c2c66affSColin Finck                 VARIANT_BOOL boolVal;
2397c2c66affSColin Finck                 SCODE scode;
2398c2c66affSColin Finck                 DATE date;
2399c2c66affSColin Finck                 BSTR bstrVal;
2400c2c66affSColin Finck                 CY cyVal;
2401c2c66affSColin Finck                 IUnknown *punkVal;
2402c2c66affSColin Finck                 IDispatch *pdispVal;
2403c2c66affSColin Finck                 SAFEARRAY *parray;
2404c2c66affSColin Finck                 LONGLONG llVal;
2405c2c66affSColin Finck                 ULONGLONG ullVal;
2406c2c66affSColin Finck                 signed char *pcVal;
2407c2c66affSColin Finck                 USHORT *puiVal;
2408c2c66affSColin Finck                 ULONG *pulVal;
2409c2c66affSColin Finck                 INT *pintVal;
2410c2c66affSColin Finck                 UINT *puintVal;
2411c2c66affSColin Finck                 BYTE *pbVal;
2412c2c66affSColin Finck                 SHORT *piVal;
2413c2c66affSColin Finck                 LONG *plVal;
2414c2c66affSColin Finck                 FLOAT *pfltVal;
2415c2c66affSColin Finck                 DOUBLE *pdblVal;
2416c2c66affSColin Finck                 VARIANT_BOOL *pboolVal;
2417c2c66affSColin Finck                 SCODE *pscode;
2418c2c66affSColin Finck                 DATE *pdate;
2419c2c66affSColin Finck                 BSTR *pbstrVal;
2420c2c66affSColin Finck                 VARIANT *pvarVal;
2421c2c66affSColin Finck                 PVOID byref;
2422c2c66affSColin Finck                 CY *pcyVal;
2423c2c66affSColin Finck                 DECIMAL *pdecVal;
2424c2c66affSColin Finck                 IUnknown **ppunkVal;
2425c2c66affSColin Finck                 IDispatch **ppdispVal;
2426c2c66affSColin Finck                 SAFEARRAY **pparray;
2427c2c66affSColin Finck                 LONGLONG *pllVal;
2428c2c66affSColin Finck                 ULONGLONG *pullVal;
2429c2c66affSColin Finck                 struct __tagBRECORD {
2430c2c66affSColin Finck                     PVOID pvRecord;
2431c2c66affSColin Finck                     IRecordInfo *pRecInfo;
2432c2c66affSColin Finck                 } __VARIANT_NAME_4;
2433c2c66affSColin Finck             } __VARIANT_NAME_3;
2434c2c66affSColin Finck         } __VARIANT_NAME_2;
2435c2c66affSColin Finck         DECIMAL decVal;
2436c2c66affSColin Finck     } __VARIANT_NAME_1;
2437c2c66affSColin Finck };
2438c2c66affSColin Finck 
2439c2c66affSColin Finck typedef VARIANT *LPVARIANT;
2440c2c66affSColin Finck typedef VARIANT VARIANTARG;
2441c2c66affSColin Finck typedef VARIANTARG *LPVARIANTARG;
2442c2c66affSColin Finck 
2443c2c66affSColin Finck // wine/windef16.h
2444c2c66affSColin Finck typedef DWORD SEGPTR;
2445c2c66affSColin Finck 
2446c2c66affSColin Finck // wine/winbase16.h
2447c2c66affSColin Finck typedef struct _STACK32FRAME
2448c2c66affSColin Finck {
2449c2c66affSColin Finck     DWORD   restore_addr;   /* 00 return address for restoring code selector */
2450c2c66affSColin Finck     DWORD   codeselector;   /* 04 code selector to restore */
2451c2c66affSColin Finck     EXCEPTION_REGISTRATION_RECORD frame;  /* 08 Exception frame */
2452c2c66affSColin Finck     SEGPTR  frame16;        /* 10 16-bit frame from last CallFrom16() */
2453c2c66affSColin Finck     DWORD   edi;            /* 14 saved registers */
2454c2c66affSColin Finck     DWORD   esi;            /* 18 */
2455c2c66affSColin Finck     DWORD   ebx;            /* 1c */
2456c2c66affSColin Finck     DWORD   ebp;            /* 20 saved 32-bit frame pointer */
2457c2c66affSColin Finck     DWORD   retaddr;        /* 24 return address */
2458c2c66affSColin Finck     DWORD   target;         /* 28 target address / CONTEXT86 pointer */
2459c2c66affSColin Finck     DWORD   nb_args;        /* 2c number of 16-bit argument bytes */
2460c2c66affSColin Finck } STACK32FRAME;
2461c2c66affSColin Finck 
2462c2c66affSColin Finck /* 16-bit stack layout after __wine_call_from_16() */
2463c2c66affSColin Finck typedef struct _STACK16FRAME
2464c2c66affSColin Finck {
2465c2c66affSColin Finck     STACK32FRAME *frame32;        /* 00 32-bit frame from last CallTo16() */
2466c2c66affSColin Finck     DWORD         edx;            /* 04 saved registers */
2467c2c66affSColin Finck     DWORD         ecx;            /* 08 */
2468c2c66affSColin Finck     DWORD         ebp;            /* 0c */
2469c2c66affSColin Finck     WORD          ds;             /* 10 */
2470c2c66affSColin Finck     WORD          es;             /* 12 */
2471c2c66affSColin Finck     WORD          fs;             /* 14 */
2472c2c66affSColin Finck     WORD          gs;             /* 16 */
2473c2c66affSColin Finck     DWORD         callfrom_ip;    /* 18 callfrom tail IP */
2474c2c66affSColin Finck     DWORD         module_cs;      /* 1c module code segment */
2475c2c66affSColin Finck     DWORD         relay;          /* 20 relay function address */
2476c2c66affSColin Finck     WORD          entry_ip;       /* 22 entry point IP */
2477c2c66affSColin Finck     DWORD         entry_point;    /* 26 API entry point to call, reused as mutex count */
2478c2c66affSColin Finck     WORD          bp;             /* 2a 16-bit stack frame chain */
2479c2c66affSColin Finck     WORD          ip;             /* 2c return address */
2480c2c66affSColin Finck     WORD          cs;             /* 2e */
2481c2c66affSColin Finck } STACK16FRAME;
2482