wine  6.0.1
About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs.
  Fossies Dox: wine-6.0.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

winnt.h
Go to the documentation of this file.
1 /*
2  * Win32 definitions for Windows NT
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef _WINNT_
22 #define _WINNT_
23 
24 #include <basetsd.h>
25 #include <guiddef.h>
26 #include <winapifamily.h>
27 
28 #ifndef RC_INVOKED
29 #include <ctype.h>
30 #include <stddef.h>
31 #include <string.h>
32 #endif
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef _NTSYSTEM_
40 #define NTSYSAPI
41 #else
42 #define NTSYSAPI DECLSPEC_IMPORT
43 #endif
44 
45 #define NTAPI __stdcall
46 #define FASTCALL __fastcall
47 
48 #ifndef MIDL_PASS
49 # if defined(_MSC_VER)
50 # define DECLSPEC_IMPORT __declspec(dllimport)
51 # elif defined(__MINGW32__) || defined(__CYGWIN__)
52 # define DECLSPEC_IMPORT __attribute__((dllimport))
53 # else
54 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
55 # endif
56 #else
57 # define DECLSPEC_IMPORT
58 #endif
59 
60 #ifndef DECLSPEC_NORETURN
61 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
62 # define DECLSPEC_NORETURN __declspec(noreturn)
63 # elif defined(__GNUC__)
64 # define DECLSPEC_NORETURN __attribute__((noreturn))
65 # else
66 # define DECLSPEC_NORETURN
67 # endif
68 #endif
69 
70 #ifndef DECLSPEC_ALIGN
71 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
72 # define DECLSPEC_ALIGN(x) __declspec(align(x))
73 # elif defined(__GNUC__)
74 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
75 # else
76 # define DECLSPEC_ALIGN(x)
77 # endif
78 #endif
79 
80 #ifndef DECLSPEC_NOTHROW
81 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
82 # define DECLSPEC_NOTHROW __declspec(nothrow)
83 # elif defined(__GNUC__)
84 # define DECLSPEC_NOTHROW __attribute__((nothrow))
85 # else
86 # define DECLSPEC_NOTHROW
87 # endif
88 #endif
89 
90 #ifndef DECLSPEC_CACHEALIGN
91 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
92 #endif
93 
94 #ifndef DECLSPEC_UUID
95 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
96 # define DECLSPEC_UUID(x) __declspec(uuid(x))
97 # else
98 # define DECLSPEC_UUID(x)
99 # endif
100 #endif
101 
102 #ifndef DECLSPEC_NOVTABLE
103 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
104 # define DECLSPEC_NOVTABLE __declspec(novtable)
105 # else
106 # define DECLSPEC_NOVTABLE
107 # endif
108 #endif
109 
110 #ifndef DECLSPEC_SELECTANY
111 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
112 #define DECLSPEC_SELECTANY __declspec(selectany)
113 #else
114 #define DECLSPEC_SELECTANY
115 #endif
116 #endif
117 
118 #ifndef NOP_FUNCTION
119 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
120 # define NOP_FUNCTION __noop
121 # else
122 # define NOP_FUNCTION (void)0
123 # endif
124 #endif
125 
126 #ifndef DECLSPEC_ADDRSAFE
127 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
128 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
129 # else
130 # define DECLSPEC_ADDRSAFE
131 # endif
132 #endif
133 
134 #ifndef FORCEINLINE
135 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
136 # define FORCEINLINE __forceinline
137 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
138 # define FORCEINLINE inline __attribute__((always_inline))
139 # else
140 # define FORCEINLINE inline
141 # endif
142 #endif
143 
144 #ifndef DECLSPEC_DEPRECATED
145 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
146 # define DECLSPEC_DEPRECATED __declspec(deprecated)
147 # define DEPRECATE_SUPPORTED
148 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
149 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
150 # define DEPRECATE_SUPPORTED
151 # else
152 # define DECLSPEC_DEPRECATED
153 # undef DEPRECATE_SUPPORTED
154 # endif
155 #endif
156 
157 /* a couple of useful Wine extensions */
158 
159 #ifdef _MSC_VER
160 # define DECLSPEC_EXPORT __declspec(dllexport)
161 #elif defined(__MINGW32__)
162 # define DECLSPEC_EXPORT __attribute__((dllexport))
163 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) && !defined(__sun)
164 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
165 #else
166 # define DECLSPEC_EXPORT
167 #endif
168 
169 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || defined(__sun)
170 # define DECLSPEC_HIDDEN
171 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
172 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
173 #else
174 # define DECLSPEC_HIDDEN
175 #endif
176 
177 #ifndef __has_attribute
178 # define __has_attribute(x) 0
179 #endif
180 
181 #if ((defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) || __has_attribute(ms_hook_prologue)) && (defined(__i386__) || defined(__x86_64__))
182 #define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__))
183 #else
184 #define DECLSPEC_HOTPATCH
185 #endif
186 
187 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
188 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
189 #else
190 #define __WINE_ALLOC_SIZE(x)
191 #endif
192 
193 /* Anonymous union/struct handling */
194 
195 #ifndef NONAMELESSSTRUCT
196 # ifdef __GNUC__
197  /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
198 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
199 # define NONAMELESSSTRUCT
200 # endif
201 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
202 # define NONAMELESSSTRUCT
203 # endif
204 #endif /* NONAMELESSSTRUCT */
205 
206 #ifndef NONAMELESSUNION
207 # ifdef __GNUC__
208  /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
209 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
210 # define NONAMELESSUNION
211 # endif
212 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
213 # define NONAMELESSUNION
214 # endif
215 #endif /* NONAMELESSUNION */
216 
217 #undef DUMMYSTRUCTNAME
218 #undef DUMMYSTRUCTNAME1
219 #undef DUMMYSTRUCTNAME2
220 #undef DUMMYSTRUCTNAME3
221 #undef DUMMYSTRUCTNAME4
222 #undef DUMMYSTRUCTNAME5
223 #ifndef NONAMELESSSTRUCT
224 #define DUMMYSTRUCTNAME
225 #define DUMMYSTRUCTNAME1
226 #define DUMMYSTRUCTNAME2
227 #define DUMMYSTRUCTNAME3
228 #define DUMMYSTRUCTNAME4
229 #define DUMMYSTRUCTNAME5
230 #else /* !defined(NONAMELESSSTRUCT) */
231 #define DUMMYSTRUCTNAME s
232 #define DUMMYSTRUCTNAME1 s1
233 #define DUMMYSTRUCTNAME2 s2
234 #define DUMMYSTRUCTNAME3 s3
235 #define DUMMYSTRUCTNAME4 s4
236 #define DUMMYSTRUCTNAME5 s5
237 #endif /* !defined(NONAMELESSSTRUCT) */
238 
239 #undef DUMMYUNIONNAME
240 #undef DUMMYUNIONNAME1
241 #undef DUMMYUNIONNAME2
242 #undef DUMMYUNIONNAME3
243 #undef DUMMYUNIONNAME4
244 #undef DUMMYUNIONNAME5
245 #undef DUMMYUNIONNAME6
246 #undef DUMMYUNIONNAME7
247 #undef DUMMYUNIONNAME8
248 #ifndef NONAMELESSUNION
249 #define DUMMYUNIONNAME
250 #define DUMMYUNIONNAME1
251 #define DUMMYUNIONNAME2
252 #define DUMMYUNIONNAME3
253 #define DUMMYUNIONNAME4
254 #define DUMMYUNIONNAME5
255 #define DUMMYUNIONNAME6
256 #define DUMMYUNIONNAME7
257 #define DUMMYUNIONNAME8
258 #else /* !defined(NONAMELESSUNION) */
259 #define DUMMYUNIONNAME u
260 #define DUMMYUNIONNAME1 u1
261 #define DUMMYUNIONNAME2 u2
262 #define DUMMYUNIONNAME3 u3
263 #define DUMMYUNIONNAME4 u4
264 #define DUMMYUNIONNAME5 u5
265 #define DUMMYUNIONNAME6 u6
266 #define DUMMYUNIONNAME7 u7
267 #define DUMMYUNIONNAME8 u8
268 #endif /* !defined(NONAMELESSUNION) */
269 
270 #undef __C89_NAMELESS
271 #undef __C89_NAMELESSSTRUCTNAME
272 #undef __C89_NAMELESSSTRUCTNAME1
273 #undef __C89_NAMELESSSTRUCTNAME2
274 #undef __C89_NAMELESSSTRUCTNAME3
275 #undef __C89_NAMELESSSTRUCTNAME4
276 #undef __C89_NAMELESSSTRUCTNAME5
277 #undef __C89_NAMELESSUNIONNAME
278 #undef __C89_NAMELESSUNIONNAME1
279 #undef __C89_NAMELESSUNIONNAME2
280 #undef __C89_NAMELESSUNIONNAME3
281 #undef __C89_NAMELESSUNIONNAME4
282 #undef __C89_NAMELESSUNIONNAME5
283 #undef __C89_NAMELESSUNIONNAME6
284 #undef __C89_NAMELESSUNIONNAME7
285 #undef __C89_NAMELESSUNIONNAME8
286 
287 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
288 # ifdef __GNUC__
289  /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
290 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
291 # define __C89_NAMELESS __extension__
292 # endif
293 # elif defined(_MSC_VER)
294 # define __C89_NAMELESS
295 # endif
296 #endif
297 
298 #ifdef __C89_NAMELESS
299 # define __C89_NAMELESSSTRUCTNAME
300 # define __C89_NAMELESSSTRUCTNAME1
301 # define __C89_NAMELESSSTRUCTNAME2
302 # define __C89_NAMELESSSTRUCTNAME3
303 # define __C89_NAMELESSSTRUCTNAME4
304 # define __C89_NAMELESSSTRUCTNAME5
305 # define __C89_NAMELESSUNIONNAME
306 # define __C89_NAMELESSUNIONNAME1
307 # define __C89_NAMELESSUNIONNAME2
308 # define __C89_NAMELESSUNIONNAME3
309 # define __C89_NAMELESSUNIONNAME4
310 # define __C89_NAMELESSUNIONNAME5
311 # define __C89_NAMELESSUNIONNAME6
312 # define __C89_NAMELESSUNIONNAME7
313 # define __C89_NAMELESSUNIONNAME8
314 #else
315 # define __C89_NAMELESS
316 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
317 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
318 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
319 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
320 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
321 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
322 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
323 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
324 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
325 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
326 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
327 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
328 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
329 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
330 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
331 #endif
332 
333 /* C99 restrict support */
334 
335 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
336 # if defined(_MSC_VER) && defined(_M_MRX000)
337 # define RESTRICTED_POINTER __restrict
338 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
339 # define RESTRICTED_POINTER __restrict
340 # else
341 # define RESTRICTED_POINTER
342 # endif
343 #else
344 # define RESTRICTED_POINTER
345 #endif
346 
347 /* C99 unaligned support */
348 
349 #ifndef UNALIGNED
350 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
351 # define UNALIGNED __unaligned
352 # ifdef _WIN64
353 # define UNALIGNED64 __unaligned
354 # else
355 # define UNALIGNED64
356 # endif
357 #else
358 # define UNALIGNED
359 # define UNALIGNED64
360 #endif
361 #endif
362 
363 /* Alignment macros */
364 
365 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
366 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
367 #define MEMORY_ALLOCATION_ALIGNMENT 16
368 #else
369 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
370 #define MEMORY_ALLOCATION_ALIGNMENT 8
371 #endif
372 
373 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
374 # define TYPE_ALIGNMENT(t) __alignof(t)
375 #elif defined(__GNUC__)
376 # define TYPE_ALIGNMENT(t) __alignof__(t)
377 #else
378 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
379 #endif
380 
381 #ifdef _WIN64
382 # define PROBE_ALIGNMENT(_s) \
383  (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
384  TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
385 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
386 #else
387 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
388 #endif
389 
390 /* Compile time assertion */
391 
392 #define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
393 
394 /* Eliminate Microsoft C/C++ compiler warning 4715 */
395 #if defined(_MSC_VER) && (_MSC_VER > 1200)
396 # define DEFAULT_UNREACHABLE default: __assume(0)
397 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
398 # define DEFAULT_UNREACHABLE default: __builtin_unreachable()
399 #else
400 # define DEFAULT_UNREACHABLE default:
401 #endif
402 
403 /* Error Masks */
404 #define APPLICATION_ERROR_MASK 0x20000000
405 #define ERROR_SEVERITY_SUCCESS 0x00000000
406 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
407 #define ERROR_SEVERITY_WARNING 0x80000000
408 #define ERROR_SEVERITY_ERROR 0xC0000000
409 
410 #ifdef __cplusplus
411 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
412 extern "C++" { \
413  inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
414  inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
415  inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
416  inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
417  inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
418  inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
419  inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
420 }
421 #else
422 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
423 #endif
424 
425 /* Microsoft's macros for declaring functions */
426 
427 #ifdef __cplusplus
428 # define EXTERN_C extern "C"
429 #else
430 # define EXTERN_C extern
431 #endif
432 
433 #define STDMETHODCALLTYPE WINAPI
434 #define STDMETHODVCALLTYPE WINAPIV
435 #define STDAPICALLTYPE WINAPI
436 #define STDAPIVCALLTYPE WINAPIV
437 
438 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
439 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
440 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
441 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
442 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
443 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
444 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
445 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
446 
447 /* Define the basic types */
448 #ifndef VOID
449 #define VOID void
450 #endif
451 typedef VOID *PVOID;
452 typedef VOID *PVOID64;
454 typedef char CHAR, *PCHAR;
455 typedef short SHORT, *PSHORT;
456 #ifdef WINE_USE_LONG
457 typedef long LONG, *PLONG;
458 #else
459 typedef int LONG, *PLONG;
460 #endif
461 
462 /* Some systems might have wchar_t, but we really need 16 bit characters */
463 #if defined(WINE_UNICODE_NATIVE)
464 typedef wchar_t WCHAR;
465 #elif __cpp_unicode_literals >= 200710
466 typedef char16_t WCHAR;
467 #else
468 typedef unsigned short WCHAR;
469 #endif
470 typedef WCHAR *PWCHAR;
471 
472 typedef ULONG UCSCHAR;
473 #define MIN_UCSCHAR (0)
474 #define MAX_UCSCHAR (0x0010ffff)
475 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
476 
477 /* 'Extended/Wide' numerical types */
478 #ifndef _ULONGLONG_
479 # define _ULONGLONG_
480 # ifdef _MSC_VER
481 typedef signed __int64 LONGLONG, *PLONGLONG;
482 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
483 # else
486 # endif
487 #endif
488 
489 #ifndef _DWORDLONG_
490 # define _DWORDLONG_
491 # ifdef _MSC_VER
492 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
493 # else
495 # endif
496 #endif
497 
498 /* ANSI string types */
499 typedef CHAR *PCH, *LPCH, *PNZCH;
500 typedef const CHAR *PCCH, *LPCCH, *PCNZCH;
501 typedef CHAR *PSTR, *LPSTR, *NPSTR;
502 typedef const CHAR *PCSTR, *LPCSTR;
503 typedef CHAR *PZZSTR;
504 typedef const CHAR *PCZZSTR;
505 
506 /* Unicode string types */
507 typedef const WCHAR *PCWCHAR, *LPCUWCHAR, *PCUWCHAR;
508 typedef WCHAR *PWCH, *LPWCH;
509 typedef const WCHAR *PCWCH, *LPCWCH;
510 typedef WCHAR *PNZWCH, *PUNZWCH;
511 typedef const WCHAR *PCNZWCH, *PCUNZWCH;
512 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
513 typedef const WCHAR *PCWSTR, *LPCWSTR;
514 typedef WCHAR *PZZWSTR, *PUZZWSTR;
515 typedef const WCHAR *PCZZWSTR, *PCUZZWSTR;
516 typedef PWSTR *PZPWSTR;
517 typedef PCWSTR *PZPCWSTR;
518 
519 /* Neutral character and string types */
520 /* These are only defined for Winelib, i.e. _not_ defined for
521  * the emulator. The reason is they depend on the UNICODE
522  * macro which only exists in the user's code.
523  */
524 #ifndef WINE_NO_UNICODE_MACROS
525 # ifdef UNICODE
526 # ifndef _TCHAR_DEFINED
527 typedef WCHAR TCHAR, *PTCHAR;
528 # define _TCHAR_DEFINED
529 #endif
530 typedef LPWCH PTCH, LPTCH;
531 typedef LPCWCH PCTCH, LPCTCH;
532 typedef LPWSTR PTSTR, LPTSTR;
533 typedef LPCWSTR PCTSTR, LPCTSTR;
534 typedef LPWSTR PUTSTR, LPUTSTR;
535 typedef LPCWSTR PCUTSTR, LPCUTSTR;
536 typedef PNZWCH PNZTCH;
537 typedef PUNZWCH PUNZTCH;
538 typedef PCNZWCH PCNZTCH;
539 typedef PCUNZWCH PCUNZTCH;
540 typedef PZZWSTR PZZTSTR;
541 typedef PCZZWSTR PCZZTSTR;
542 typedef PUZZWSTR PUZZTSTR;
543 typedef PCUZZWSTR PCUZZTSTR;
544 # else /* UNICODE */
545 # ifndef _TCHAR_DEFINED
546 typedef CHAR TCHAR, *PTCHAR;
547 # define _TCHAR_DEFINED
548 # endif
549 typedef LPCH PTCH, LPTCH;
550 typedef LPCCH PCTCH, LPCTCH;
551 typedef LPSTR PTSTR, LPTSTR;
557 # endif /* UNICODE */
558 #endif /* WINE_NO_UNICODE_MACROS */
559 
560 /* UCS string types */
562 typedef const UCSCHAR *PCUCSCHAR, *PCUUCSCHAR;
564 typedef const UCSCHAR *PCUCSSTR, *PCUUCSSTR;
565 
566 /* Misc common WIN32 types */
567 typedef char CCHAR;
568 typedef DWORD LCID, *PLCID;
569 typedef WORD LANGID;
571 #ifndef _HRESULT_DEFINED
572 #define _HRESULT_DEFINED
573 typedef LONG HRESULT;
574 #endif
575 
576 /* Handle type */
577 
578 typedef void *HANDLE;
580 
581 #ifdef STRICT
582 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
583 #else /*STRICT*/
584 #define DECLARE_HANDLE(a) typedef HANDLE a
585 #endif /*STRICT*/
586 
587 typedef BYTE FCHAR;
588 typedef WORD FSHORT;
589 typedef DWORD FLONG;
590 
591 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
592 #ifndef __MSABI_LONG
593 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
594 # define __MSABI_LONG(x) x ## l
595 # else
596 # define __MSABI_LONG(x) x
597 # endif
598 #endif
599 
600 /* Defines */
601 
602 #ifndef WIN32_NO_STATUS
603 
604 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
605 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
606 #define STATUS_USER_APC ((DWORD) 0x000000C0)
607 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
608 #define STATUS_PENDING ((DWORD) 0x00000103)
609 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
610 #define STATUS_FATAL_APP_EXIT ((DWORD) 0x40000015)
611 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
612 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
613 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
614 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
615 #define STATUS_LONGJUMP ((DWORD) 0x80000026)
616 #define STATUS_UNWIND_CONSOLIDATE ((DWORD) 0x80000029)
617 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
618 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
619 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
620 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
621 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
622 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
623 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
624 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
625 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
626 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
627 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
628 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
629 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
630 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
631 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
632 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
633 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
634 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
635 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
636 #define STATUS_DLL_NOT_FOUND ((DWORD) 0xC0000135)
637 #define STATUS_ORDINAL_NOT_FOUND ((DWORD) 0xC0000138)
638 #define STATUS_ENTRYPOINT_NOT_FOUND ((DWORD) 0xC0000139)
639 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
640 #define STATUS_DLL_INIT_FAILED ((DWORD) 0xC0000142)
641 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
642 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
643 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
644 #define STATUS_HEAP_CORRUPTION ((DWORD) 0xC0000374)
645 #define STATUS_STACK_BUFFER_OVERRUN ((DWORD) 0xC0000409)
646 #define STATUS_INVALID_CRUNTIME_PARAMETER ((DWORD) 0xC0000417)
647 #define STATUS_ASSERTION_FAILURE ((DWORD) 0xC0000420)
648 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
649 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
650 
651 /* status values for ContinueDebugEvent */
652 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
653 #define DBG_CONTINUE ((DWORD) 0x00010002)
654 #define DBG_REPLY_LATER ((DWORD) 0x40010001)
655 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
656 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
657 #define DBG_CONTROL_C ((DWORD) 0x40010005)
658 #define DBG_PRINTEXCEPTION_C ((DWORD) 0x40010006)
659 #define DBG_RIPEXCEPTION ((DWORD) 0x40010007)
660 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
661 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
662 #define DBG_PRINTEXCEPTION_WIDE_C ((DWORD) 0x4001000A)
663 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
664 
665 #endif /* WIN32_NO_STATUS */
666 
667 /* Argument 1 passed to the DllEntryProc. */
668 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
669 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
670 #define DLL_THREAD_ATTACH 2 /* attach new thread */
671 #define DLL_THREAD_DETACH 3 /* detach thread */
672 #ifdef __WINESRC__
673 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
674 #endif
675 
676 /* u.x.wProcessorArchitecture (NT) */
677 #define PROCESSOR_ARCHITECTURE_INTEL 0
678 #define PROCESSOR_ARCHITECTURE_MIPS 1
679 #define PROCESSOR_ARCHITECTURE_ALPHA 2
680 #define PROCESSOR_ARCHITECTURE_PPC 3
681 #define PROCESSOR_ARCHITECTURE_SHX 4
682 #define PROCESSOR_ARCHITECTURE_ARM 5
683 #define PROCESSOR_ARCHITECTURE_IA64 6
684 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
685 #define PROCESSOR_ARCHITECTURE_MSIL 8
686 #define PROCESSOR_ARCHITECTURE_AMD64 9
687 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
688 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
689 #define PROCESSOR_ARCHITECTURE_ARM64 12
690 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
691 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14
692 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
693 
694 /* dwProcessorType */
695 #define PROCESSOR_INTEL_386 386
696 #define PROCESSOR_INTEL_486 486
697 #define PROCESSOR_INTEL_PENTIUM 586
698 #define PROCESSOR_INTEL_860 860
699 #define PROCESSOR_INTEL_IA64 2200
700 #define PROCESSOR_AMD_X8664 8664
701 #define PROCESSOR_MIPS_R2000 2000
702 #define PROCESSOR_MIPS_R3000 3000
703 #define PROCESSOR_MIPS_R4000 4000
704 #define PROCESSOR_ALPHA_21064 21064
705 #define PROCESSOR_PPC_601 601
706 #define PROCESSOR_PPC_603 603
707 #define PROCESSOR_PPC_604 604
708 #define PROCESSOR_PPC_620 620
709 #define PROCESSOR_HITACHI_SH3 10003
710 #define PROCESSOR_HITACHI_SH3E 10004
711 #define PROCESSOR_HITACHI_SH4 10005
712 #define PROCESSOR_MOTOROLA_821 821
713 #define PROCESSOR_SHx_SH3 103
714 #define PROCESSOR_SHx_SH4 104
715 #define PROCESSOR_STRONGARM 2577
716 #define PROCESSOR_ARM720 1824 /* 0x720 */
717 #define PROCESSOR_ARM820 2080 /* 0x820 */
718 #define PROCESSOR_ARM920 2336 /* 0x920 */
719 #define PROCESSOR_ARM_7TDMI 70001
720 #define PROCESSOR_OPTIL 18767
721 
722 #ifdef _WIN64
723 #define MAXIMUM_PROCESSORS 64
724 #else
725 #define MAXIMUM_PROCESSORS 32
726 #endif
727 
729 {
738 
739 #define MEM_EXTENDED_PARAMETER_TYPE_BITS 8
740 
750 
752  struct
753  {
756  } DUMMYSTRUCTNAME;
757 
758  union
759  {
765  } DUMMYUNIONNAME;
767 
768 #define PAGE_NOACCESS 0x01
769 #define PAGE_READONLY 0x02
770 #define PAGE_READWRITE 0x04
771 #define PAGE_WRITECOPY 0x08
772 #define PAGE_EXECUTE 0x10
773 #define PAGE_EXECUTE_READ 0x20
774 #define PAGE_EXECUTE_READWRITE 0x40
775 #define PAGE_EXECUTE_WRITECOPY 0x80
776 #define PAGE_GUARD 0x100
777 #define PAGE_NOCACHE 0x200
778 #define PAGE_WRITECOMBINE 0x400
779 
780 #define MEM_COMMIT 0x00001000
781 #define MEM_RESERVE 0x00002000
782 #define MEM_DECOMMIT 0x00004000
783 #define MEM_RELEASE 0x00008000
784 #define MEM_FREE 0x00010000
785 #define MEM_PRIVATE 0x00020000
786 #define MEM_MAPPED 0x00040000
787 #define MEM_RESET 0x00080000
788 #define MEM_TOP_DOWN 0x00100000
789 #define MEM_WRITE_WATCH 0x00200000
790 #define MEM_PHYSICAL 0x00400000
791 #define MEM_LARGE_PAGES 0x20000000
792 #define MEM_4MB_PAGES 0x80000000
793 
794 #define SEC_FILE 0x00800000
795 #define SEC_IMAGE 0x01000000
796 #define SEC_PROTECTED_IMAGE 0x02000000
797 #define SEC_RESERVE 0x04000000
798 #define SEC_COMMIT 0x08000000
799 #define SEC_NOCACHE 0x10000000
800 #define SEC_WRITECOMBINE 0x40000000
801 #define SEC_LARGE_PAGES 0x80000000
802 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
803 #define MEM_IMAGE SEC_IMAGE
804 
805 #define WRITE_WATCH_FLAG_RESET 0x00000001
806 
807 #define AT_ROUND_TO_PAGE 0x40000000
808 
809 #define MINCHAR 0x80
810 #define MAXCHAR 0x7f
811 #define MINSHORT 0x8000
812 #define MAXSHORT 0x7fff
813 #define MINLONG 0x80000000
814 #define MAXLONG 0x7fffffff
815 #define MAXBYTE 0xff
816 #define MAXWORD 0xffff
817 #define MAXDWORD 0xffffffff
818 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
819 
820 #define UNICODE_STRING_MAX_CHARS 32767
821 
822 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
823 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
824 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
825 
826 #define CONTAINING_RECORD(address, type, field) \
827  ((type *)((PCHAR)(address) - offsetof(type, field)))
828 
829 #define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
830 #ifdef __WINESRC__
831 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
832 #endif
833 
834 /* Types */
835 
836 typedef struct _LIST_ENTRY {
840 
841 typedef struct _SINGLE_LIST_ENTRY {
844 
845 #ifdef _WIN64
846 
847 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
848  struct _SLIST_ENTRY *Next;
850 
851 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
852  struct {
853  ULONGLONG Alignment;
854  ULONGLONG Region;
855  } DUMMYSTRUCTNAME;
856  struct {
857  ULONGLONG Depth:16;
858  ULONGLONG Sequence:9;
859  ULONGLONG NextEntry:39;
860  ULONGLONG HeaderType:1;
861  ULONGLONG Init:1;
862  ULONGLONG Reserved:59;
863  ULONGLONG Region:3;
864  } Header8;
865  struct {
866  ULONGLONG Depth:16;
867  ULONGLONG Sequence:48;
868  ULONGLONG HeaderType:1;
869  ULONGLONG Init:1;
871  ULONGLONG NextEntry:60;
872  } Header16;
874 
875 #else
876 
877 #undef SLIST_ENTRY /* for Mac OS */
878 #define SLIST_ENTRY SINGLE_LIST_ENTRY
879 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
880 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
881 
882 typedef union _SLIST_HEADER {
884  struct {
888  } DUMMYSTRUCTNAME;
890 
891 #endif
892 
899 
900 
901 /* Heap flags */
902 
903 #define HEAP_NO_SERIALIZE 0x00000001
904 #define HEAP_GROWABLE 0x00000002
905 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
906 #define HEAP_ZERO_MEMORY 0x00000008
907 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
908 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
909 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
910 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
911 #define HEAP_CREATE_ALIGN_16 0x00010000
912 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
913 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
914 
915 /* This flag allows it to create heaps shared by all processes under win95,
916  FIXME: correct name */
917 #define HEAP_SHARED 0x04000000
918 
922 
923 /* Processor feature flags. */
924 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
925 #define PF_FLOATING_POINT_EMULATED 1
926 #define PF_COMPARE_EXCHANGE_DOUBLE 2
927 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
928 #define PF_PPC_MOVEMEM_64BIT_OK 4
929 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
930 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
931 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
932 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
933 #define PF_PAE_ENABLED 9
934 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
935 #define PF_SSE_DAZ_MODE_AVAILABLE 11
936 #define PF_NX_ENABLED 12
937 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
938 #define PF_COMPARE_EXCHANGE128 14
939 #define PF_COMPARE64_EXCHANGE128 15
940 #define PF_CHANNELS_ENABLED 16
941 #define PF_XSAVE_ENABLED 17
942 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
943 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
944 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
945 #define PF_VIRT_FIRMWARE_ENABLED 21
946 #define PF_RDWRFSGSBASE_AVAILABLE 22
947 #define PF_FASTFAIL_AVAILABLE 23
948 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
949 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
950 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
951 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
952 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
953 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
954 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
955 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
956 #define PF_RDTSCP_INSTRUCTION_AVAILABLE 32
957 #define PF_RDPID_INSTRUCTION_AVAILABLE 33
958 #define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
959 #define PF_MONITORX_INSTRUCTION_AVAILABLE 35
960 #define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
961 #define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
962 #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
963 #define PF_AVX_INSTRUCTIONS_AVAILABLE 39
964 #define PF_AVX2_INSTRUCTIONS_AVAILABLE 40
965 #define PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
966 
967 
968 /* Execution state flags */
969 #define ES_SYSTEM_REQUIRED 0x00000001
970 #define ES_DISPLAY_REQUIRED 0x00000002
971 #define ES_USER_PRESENT 0x00000004
972 #define ES_CONTINUOUS 0x80000000
973 
974 #include <excpt.h>
975 
976 struct _CONTEXT;
977 struct _EXCEPTION_POINTERS;
978 struct _EXCEPTION_RECORD;
979 
981  struct _CONTEXT*,PVOID);
983 
984 /* The Win32 register context */
985 
986 /* i386 context definitions */
987 #ifdef __i386__
988 
989 #define SIZE_OF_80387_REGISTERS 80
990 
991 typedef struct _FLOATING_SAVE_AREA
992 {
993  DWORD ControlWord;
994  DWORD StatusWord;
995  DWORD TagWord;
996  DWORD ErrorOffset;
997  DWORD ErrorSelector;
998  DWORD DataOffset;
999  DWORD DataSelector;
1000  BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
1001  DWORD Cr0NpxState;
1002 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
1003 
1004 #define MAXIMUM_SUPPORTED_EXTENSION 512
1005 
1006 typedef struct _CONTEXT
1007 {
1008  DWORD ContextFlags; /* 000 */
1009 
1010  /* These are selected by CONTEXT_DEBUG_REGISTERS */
1011  DWORD Dr0; /* 004 */
1012  DWORD Dr1; /* 008 */
1013  DWORD Dr2; /* 00c */
1014  DWORD Dr3; /* 010 */
1015  DWORD Dr6; /* 014 */
1016  DWORD Dr7; /* 018 */
1017 
1018  /* These are selected by CONTEXT_FLOATING_POINT */
1019  FLOATING_SAVE_AREA FloatSave; /* 01c */
1020 
1021  /* These are selected by CONTEXT_SEGMENTS */
1022  DWORD SegGs; /* 08c */
1023  DWORD SegFs; /* 090 */
1024  DWORD SegEs; /* 094 */
1025  DWORD SegDs; /* 098 */
1026 
1027  /* These are selected by CONTEXT_INTEGER */
1028  DWORD Edi; /* 09c */
1029  DWORD Esi; /* 0a0 */
1030  DWORD Ebx; /* 0a4 */
1031  DWORD Edx; /* 0a8 */
1032  DWORD Ecx; /* 0ac */
1033  DWORD Eax; /* 0b0 */
1034 
1035  /* These are selected by CONTEXT_CONTROL */
1036  DWORD Ebp; /* 0b4 */
1037  DWORD Eip; /* 0b8 */
1038  DWORD SegCs; /* 0bc */
1039  DWORD EFlags; /* 0c0 */
1040  DWORD Esp; /* 0c4 */
1041  DWORD SegSs; /* 0c8 */
1042 
1043  BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */
1044 } CONTEXT, *PCONTEXT;
1045 
1046 #define CONTEXT_X86 0x00010000
1047 #define CONTEXT_i386 CONTEXT_X86
1048 #define CONTEXT_i486 CONTEXT_X86
1049 
1050 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
1051 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
1052 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1053 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1054 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1055 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1056 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040)
1057 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
1058 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
1059  CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
1060 
1061 #define EXCEPTION_READ_FAULT 0
1062 #define EXCEPTION_WRITE_FAULT 1
1063 #define EXCEPTION_EXECUTE_FAULT 8
1064 
1065 #endif /* __i386__ */
1066 
1067 typedef struct _LDT_ENTRY {
1070  union {
1071  struct {
1077  struct {
1078  unsigned BaseMid: 8;
1079  unsigned Type : 5;
1080  unsigned Dpl : 2;
1081  unsigned Pres : 1;
1082  unsigned LimitHi : 4;
1083  unsigned Sys : 1;
1084  unsigned Reserved_0 : 1;
1085  unsigned Default_Big : 1;
1086  unsigned Granularity : 1;
1087  unsigned BaseHi : 8;
1088  } Bits;
1091 
1092 typedef struct DECLSPEC_ALIGN(16) _M128A {
1096 
1097 typedef struct _XSAVE_FORMAT {
1098  WORD ControlWord; /* 000 */
1099  WORD StatusWord; /* 002 */
1100  BYTE TagWord; /* 004 */
1101  BYTE Reserved1; /* 005 */
1102  WORD ErrorOpcode; /* 006 */
1103  DWORD ErrorOffset; /* 008 */
1104  WORD ErrorSelector; /* 00c */
1105  WORD Reserved2; /* 00e */
1106  DWORD DataOffset; /* 010 */
1107  WORD DataSelector; /* 014 */
1108  WORD Reserved3; /* 016 */
1109  DWORD MxCsr; /* 018 */
1110  DWORD MxCsr_Mask; /* 01c */
1111  M128A FloatRegisters[8]; /* 020 */
1112  M128A XmmRegisters[16]; /* 0a0 */
1113  BYTE Reserved4[96]; /* 1a0 */
1115 
1116 /* x86-64 context definitions */
1117 #if defined(__x86_64__)
1118 
1119 #define CONTEXT_AMD64 0x00100000
1120 
1121 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
1122 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
1123 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1124 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1125 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1126 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x0040)
1127 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1128 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1129 
1130 #define EXCEPTION_READ_FAULT 0
1131 #define EXCEPTION_WRITE_FAULT 1
1132 #define EXCEPTION_EXECUTE_FAULT 8
1133 
1134 typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
1135 
1136 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
1137  DWORD64 P1Home; /* 000 */
1138  DWORD64 P2Home; /* 008 */
1139  DWORD64 P3Home; /* 010 */
1140  DWORD64 P4Home; /* 018 */
1141  DWORD64 P5Home; /* 020 */
1142  DWORD64 P6Home; /* 028 */
1143 
1144  /* Control flags */
1145  DWORD ContextFlags; /* 030 */
1146  DWORD MxCsr; /* 034 */
1147 
1148  /* Segment */
1149  WORD SegCs; /* 038 */
1150  WORD SegDs; /* 03a */
1151  WORD SegEs; /* 03c */
1152  WORD SegFs; /* 03e */
1153  WORD SegGs; /* 040 */
1154  WORD SegSs; /* 042 */
1155  DWORD EFlags; /* 044 */
1156 
1157  /* Debug */
1158  DWORD64 Dr0; /* 048 */
1159  DWORD64 Dr1; /* 050 */
1160  DWORD64 Dr2; /* 058 */
1161  DWORD64 Dr3; /* 060 */
1162  DWORD64 Dr6; /* 068 */
1163  DWORD64 Dr7; /* 070 */
1164 
1165  /* Integer */
1166  DWORD64 Rax; /* 078 */
1167  DWORD64 Rcx; /* 080 */
1168  DWORD64 Rdx; /* 088 */
1169  DWORD64 Rbx; /* 090 */
1170  DWORD64 Rsp; /* 098 */
1171  DWORD64 Rbp; /* 0a0 */
1172  DWORD64 Rsi; /* 0a8 */
1173  DWORD64 Rdi; /* 0b0 */
1174  DWORD64 R8; /* 0b8 */
1175  DWORD64 R9; /* 0c0 */
1176  DWORD64 R10; /* 0c8 */
1177  DWORD64 R11; /* 0d0 */
1178  DWORD64 R12; /* 0d8 */
1179  DWORD64 R13; /* 0e0 */
1180  DWORD64 R14; /* 0e8 */
1181  DWORD64 R15; /* 0f0 */
1182 
1183  /* Counter */
1184  DWORD64 Rip; /* 0f8 */
1185 
1186  /* Floating point */
1187  union {
1188  XMM_SAVE_AREA32 FltSave; /* 100 */
1189  struct {
1190  M128A Header[2]; /* 100 */
1191  M128A Legacy[8]; /* 120 */
1192  M128A Xmm0; /* 1a0 */
1193  M128A Xmm1; /* 1b0 */
1194  M128A Xmm2; /* 1c0 */
1195  M128A Xmm3; /* 1d0 */
1196  M128A Xmm4; /* 1e0 */
1197  M128A Xmm5; /* 1f0 */
1198  M128A Xmm6; /* 200 */
1199  M128A Xmm7; /* 210 */
1200  M128A Xmm8; /* 220 */
1201  M128A Xmm9; /* 230 */
1202  M128A Xmm10; /* 240 */
1203  M128A Xmm11; /* 250 */
1204  M128A Xmm12; /* 260 */
1205  M128A Xmm13; /* 270 */
1206  M128A Xmm14; /* 280 */
1207  M128A Xmm15; /* 290 */
1208  } DUMMYSTRUCTNAME;
1209  } DUMMYUNIONNAME;
1210 
1211  /* Vector */
1212  M128A VectorRegister[26]; /* 300 */
1213  DWORD64 VectorControl; /* 4a0 */
1214 
1215  /* Debug control */
1216  DWORD64 DebugControl; /* 4a8 */
1217  DWORD64 LastBranchToRip; /* 4b0 */
1218  DWORD64 LastBranchFromRip; /* 4b8 */
1219  DWORD64 LastExceptionToRip; /* 4c0 */
1220  DWORD64 LastExceptionFromRip; /* 4c8 */
1221 } CONTEXT, *PCONTEXT;
1222 
1223 typedef struct _RUNTIME_FUNCTION
1224 {
1225  DWORD BeginAddress;
1226  DWORD EndAddress;
1227  DWORD UnwindData;
1228 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1229 
1230 #define UNWIND_HISTORY_TABLE_SIZE 12
1231 
1232 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1233 {
1234  ULONG64 ImageBase;
1235  PRUNTIME_FUNCTION FunctionEntry;
1236 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1237 
1238 #define UNWIND_HISTORY_TABLE_NONE 0
1239 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1240 #define UNWIND_HISTORY_TABLE_LOCAL 2
1241 
1242 typedef struct _UNWIND_HISTORY_TABLE
1243 {
1244  ULONG Count;
1245  UCHAR Search;
1246  ULONG64 LowAddress;
1247  ULONG64 HighAddress;
1248  UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1249 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1250 
1251 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1252 {
1253  union
1254  {
1255  PM128A FloatingContext[16];
1256  struct
1257  {
1258  PM128A Xmm0;
1259  PM128A Xmm1;
1260  PM128A Xmm2;
1261  PM128A Xmm3;
1262  PM128A Xmm4;
1263  PM128A Xmm5;
1264  PM128A Xmm6;
1265  PM128A Xmm7;
1266  PM128A Xmm8;
1267  PM128A Xmm9;
1268  PM128A Xmm10;
1269  PM128A Xmm11;
1270  PM128A Xmm12;
1271  PM128A Xmm13;
1272  PM128A Xmm14;
1273  PM128A Xmm15;
1274  } DUMMYSTRUCTNAME;
1275  } DUMMYUNIONNAME;
1276 
1277  union
1278  {
1279  PULONG64 IntegerContext[16];
1280  struct
1281  {
1282  PULONG64 Rax;
1283  PULONG64 Rcx;
1284  PULONG64 Rdx;
1285  PULONG64 Rbx;
1286  PULONG64 Rsp;
1287  PULONG64 Rbp;
1288  PULONG64 Rsi;
1289  PULONG64 Rdi;
1290  PULONG64 R8;
1291  PULONG64 R9;
1292  PULONG64 R10;
1293  PULONG64 R11;
1294  PULONG64 R12;
1295  PULONG64 R13;
1296  PULONG64 R14;
1297  PULONG64 R15;
1298  } DUMMYSTRUCTNAME;
1299  } DUMMYUNIONNAME2;
1300 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1301 
1302 typedef struct _DISPATCHER_CONTEXT
1303 {
1304  ULONG64 ControlPc;
1305  ULONG64 ImageBase;
1306  PRUNTIME_FUNCTION FunctionEntry;
1307  ULONG64 EstablisherFrame;
1308  ULONG64 TargetIp;
1309  PCONTEXT ContextRecord;
1310  PEXCEPTION_ROUTINE LanguageHandler;
1311  PVOID HandlerData;
1312  PUNWIND_HISTORY_TABLE HistoryTable;
1313  DWORD ScopeIndex;
1314  DWORD Fill0;
1315 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
1316 
1317 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,PVOID);
1318 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,PVOID);
1319 
1320 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
1321 
1322 #define UNW_FLAG_NHANDLER 0
1323 #define UNW_FLAG_EHANDLER 1
1324 #define UNW_FLAG_UHANDLER 2
1325 #define UNW_FLAG_CHAININFO 4
1326 
1327 #endif /* __x86_64__ */
1328 
1329 #define XSTATE_LEGACY_FLOATING_POINT 0
1330 #define XSTATE_LEGACY_SSE 1
1331 #define XSTATE_GSSE 2
1332 #define XSTATE_AVX XSTATE_GSSE
1333 #define XSTATE_MPX_BNDREGS 3
1334 #define XSTATE_MPX_BNDCSR 4
1335 #define XSTATE_AVX512_KMASK 5
1336 #define XSTATE_AVX512_ZMM_H 6
1337 #define XSTATE_AVX512_ZMM 7
1338 #define XSTATE_IPT 8
1339 #define XSTATE_CET_U 11
1340 #define XSTATE_LWP 62
1341 #define MAXIMUM_XSTATE_FEATURES 64
1342 
1343 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1 << XSTATE_LEGACY_FLOATING_POINT)
1344 #define XSTATE_MASK_LEGACY_SSE (1 << XSTATE_LEGACY_SSE)
1345 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1346 #define XSTATE_MASK_GSSE (1 << XSTATE_GSSE)
1347 
1348 typedef struct _XSTATE_FEATURE
1349 {
1353 
1355 {
1362 
1369 
1370 typedef struct _YMMCONTEXT
1371 {
1388 }
1390 
1391 typedef struct _XSTATE
1392 {
1398 
1399 typedef struct _CONTEXT_CHUNK
1400 {
1404 
1405 typedef struct _CONTEXT_EX
1406 {
1410 #ifdef _WIN64
1411  ULONG64 align;
1412 #endif
1414 
1415 /* IA64 context definitions */
1416 #ifdef __ia64__
1417 
1418 #define CONTEXT_IA64 0x00080000
1419 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1420 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1421 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1422 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1423 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1424 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1425 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1426 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1427 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1428 
1429 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1430 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1431 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1432 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1433 
1434 typedef struct _CONTEXT
1435 {
1436  DWORD ContextFlags;
1437  DWORD Fill1[3];
1438  ULONGLONG DbI0;
1439  ULONGLONG DbI1;
1440  ULONGLONG DbI2;
1441  ULONGLONG DbI3;
1442  ULONGLONG DbI4;
1443  ULONGLONG DbI5;
1444  ULONGLONG DbI6;
1445  ULONGLONG DbI7;
1446  ULONGLONG DbD0;
1447  ULONGLONG DbD1;
1448  ULONGLONG DbD2;
1449  ULONGLONG DbD3;
1450  ULONGLONG DbD4;
1451  ULONGLONG DbD5;
1452  ULONGLONG DbD6;
1453  ULONGLONG DbD7;
1454  FLOAT128 FltS0;
1455  FLOAT128 FltS1;
1456  FLOAT128 FltS2;
1457  FLOAT128 FltS3;
1458  FLOAT128 FltT0;
1459  FLOAT128 FltT1;
1460  FLOAT128 FltT2;
1461  FLOAT128 FltT3;
1462  FLOAT128 FltT4;
1463  FLOAT128 FltT5;
1464  FLOAT128 FltT6;
1465  FLOAT128 FltT7;
1466  FLOAT128 FltT8;
1467  FLOAT128 FltT9;
1468  FLOAT128 FltS4;
1469  FLOAT128 FltS5;
1470  FLOAT128 FltS6;
1471  FLOAT128 FltS7;
1472  FLOAT128 FltS8;
1473  FLOAT128 FltS9;
1474  FLOAT128 FltS10;
1475  FLOAT128 FltS11;
1476  FLOAT128 FltS12;
1477  FLOAT128 FltS13;
1478  FLOAT128 FltS14;
1479  FLOAT128 FltS15;
1480  FLOAT128 FltS16;
1481  FLOAT128 FltS17;
1482  FLOAT128 FltS18;
1483  FLOAT128 FltS19;
1484  FLOAT128 FltF32;
1485  FLOAT128 FltF33;
1486  FLOAT128 FltF34;
1487  FLOAT128 FltF35;
1488  FLOAT128 FltF36;
1489  FLOAT128 FltF37;
1490  FLOAT128 FltF38;
1491  FLOAT128 FltF39;
1492  FLOAT128 FltF40;
1493  FLOAT128 FltF41;
1494  FLOAT128 FltF42;
1495  FLOAT128 FltF43;
1496  FLOAT128 FltF44;
1497  FLOAT128 FltF45;
1498  FLOAT128 FltF46;
1499  FLOAT128 FltF47;
1500  FLOAT128 FltF48;
1501  FLOAT128 FltF49;
1502  FLOAT128 FltF50;
1503  FLOAT128 FltF51;
1504  FLOAT128 FltF52;
1505  FLOAT128 FltF53;
1506  FLOAT128 FltF54;
1507  FLOAT128 FltF55;
1508  FLOAT128 FltF56;
1509  FLOAT128 FltF57;
1510  FLOAT128 FltF58;
1511  FLOAT128 FltF59;
1512  FLOAT128 FltF60;
1513  FLOAT128 FltF61;
1514  FLOAT128 FltF62;
1515  FLOAT128 FltF63;
1516  FLOAT128 FltF64;
1517  FLOAT128 FltF65;
1518  FLOAT128 FltF66;
1519  FLOAT128 FltF67;
1520  FLOAT128 FltF68;
1521  FLOAT128 FltF69;
1522  FLOAT128 FltF70;
1523  FLOAT128 FltF71;
1524  FLOAT128 FltF72;
1525  FLOAT128 FltF73;
1526  FLOAT128 FltF74;
1527  FLOAT128 FltF75;
1528  FLOAT128 FltF76;
1529  FLOAT128 FltF77;
1530  FLOAT128 FltF78;
1531  FLOAT128 FltF79;
1532  FLOAT128 FltF80;
1533  FLOAT128 FltF81;
1534  FLOAT128 FltF82;
1535  FLOAT128 FltF83;
1536  FLOAT128 FltF84;
1537  FLOAT128 FltF85;
1538  FLOAT128 FltF86;
1539  FLOAT128 FltF87;
1540  FLOAT128 FltF88;
1541  FLOAT128 FltF89;
1542  FLOAT128 FltF90;
1543  FLOAT128 FltF91;
1544  FLOAT128 FltF92;
1545  FLOAT128 FltF93;
1546  FLOAT128 FltF94;
1547  FLOAT128 FltF95;
1548  FLOAT128 FltF96;
1549  FLOAT128 FltF97;
1550  FLOAT128 FltF98;
1551  FLOAT128 FltF99;
1552  FLOAT128 FltF100;
1553  FLOAT128 FltF101;
1554  FLOAT128 FltF102;
1555  FLOAT128 FltF103;
1556  FLOAT128 FltF104;
1557  FLOAT128 FltF105;
1558  FLOAT128 FltF106;
1559  FLOAT128 FltF107;
1560  FLOAT128 FltF108;
1561  FLOAT128 FltF109;
1562  FLOAT128 FltF110;
1563  FLOAT128 FltF111;
1564  FLOAT128 FltF112;
1565  FLOAT128 FltF113;
1566  FLOAT128 FltF114;
1567  FLOAT128 FltF115;
1568  FLOAT128 FltF116;
1569  FLOAT128 FltF117;
1570  FLOAT128 FltF118;
1571  FLOAT128 FltF119;
1572  FLOAT128 FltF120;
1573  FLOAT128 FltF121;
1574  FLOAT128 FltF122;
1575  FLOAT128 FltF123;
1576  FLOAT128 FltF124;
1577  FLOAT128 FltF125;
1578  FLOAT128 FltF126;
1579  FLOAT128 FltF127;
1580  ULONGLONG StFPSR;
1581  ULONGLONG IntGp;
1582  ULONGLONG IntT0;
1583  ULONGLONG IntT1;
1584  ULONGLONG IntS0;
1585  ULONGLONG IntS1;
1586  ULONGLONG IntS2;
1587  ULONGLONG IntS3;
1588  ULONGLONG IntV0;
1589  ULONGLONG IntT2;
1590  ULONGLONG IntT3;
1591  ULONGLONG IntT4;
1592  ULONGLONG IntSp;
1593  ULONGLONG IntTeb;
1594  ULONGLONG IntT5;
1595  ULONGLONG IntT6;
1596  ULONGLONG IntT7;
1597  ULONGLONG IntT8;
1598  ULONGLONG IntT9;
1599  ULONGLONG IntT10;
1600  ULONGLONG IntT11;
1601  ULONGLONG IntT12;
1602  ULONGLONG IntT13;
1603  ULONGLONG IntT14;
1604  ULONGLONG IntT15;
1605  ULONGLONG IntT16;
1606  ULONGLONG IntT17;
1607  ULONGLONG IntT18;
1608  ULONGLONG IntT19;
1609  ULONGLONG IntT20;
1610  ULONGLONG IntT21;
1611  ULONGLONG IntT22;
1612  ULONGLONG IntNats;
1613  ULONGLONG Preds;
1614  ULONGLONG BrRp;
1615  ULONGLONG BrS0;
1616  ULONGLONG BrS1;
1617  ULONGLONG BrS2;
1618  ULONGLONG BrS3;
1619  ULONGLONG BrS4;
1620  ULONGLONG BrT0;
1621  ULONGLONG BrT1;
1622  ULONGLONG ApUNAT;
1623  ULONGLONG ApLC;
1624  ULONGLONG ApEC;
1625  ULONGLONG ApCCV;
1626  ULONGLONG ApDCR;
1627  ULONGLONG RsPFS;
1628  ULONGLONG RsBSP;
1629  ULONGLONG RsBSPSTORE;
1630  ULONGLONG RsRSC;
1631  ULONGLONG RsRNAT;
1632  ULONGLONG StIPSR;
1633  ULONGLONG StIIP;
1634  ULONGLONG StIFS;
1635  ULONGLONG StFCR;
1636  ULONGLONG Eflag;
1637  ULONGLONG SegCSD;
1638  ULONGLONG SegSSD;
1639  ULONGLONG Cflag;
1640  ULONGLONG StFSR;
1641  ULONGLONG StFIR;
1642  ULONGLONG StFDR;
1643  ULONGLONG UNUSEDPACK;
1644 } CONTEXT, *PCONTEXT;
1645 
1646 typedef struct _RUNTIME_FUNCTION
1647 {
1648  ULONG BeginAddress;
1649  ULONG EndAddress;
1650  ULONG UnwindInfoAddress;
1651 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1652 
1653 typedef struct _FRAME_POINTERS {
1654  ULONGLONG MemoryStackFp;
1655  ULONGLONG BackingStoreFp;
1656 } FRAME_POINTERS, *PFRAME_POINTERS;
1657 
1658 #define UNWIND_HISTORY_TABLE_SIZE 12
1659 
1660 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
1661  ULONG64 ImageBase;
1662  ULONG64 Gp;
1663  PRUNTIME_FUNCTION FunctionEntry;
1664 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1665 
1666 typedef struct _UNWIND_HISTORY_TABLE {
1667  ULONG Count;
1668  UCHAR Search;
1669  ULONG64 LowAddress;
1670  ULONG64 HighAddress;
1671  UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1672 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1673 
1674 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1675 {
1676  PFLOAT128 FltS0;
1677  PFLOAT128 FltS1;
1678  PFLOAT128 FltS2;
1679  PFLOAT128 FltS3;
1680  PFLOAT128 HighFloatingContext[10];
1681  PFLOAT128 FltS4;
1682  PFLOAT128 FltS5;
1683  PFLOAT128 FltS6;
1684  PFLOAT128 FltS7;
1685  PFLOAT128 FltS8;
1686  PFLOAT128 FltS9;
1687  PFLOAT128 FltS10;
1688  PFLOAT128 FltS11;
1689  PFLOAT128 FltS12;
1690  PFLOAT128 FltS13;
1691  PFLOAT128 FltS14;
1692  PFLOAT128 FltS15;
1693  PFLOAT128 FltS16;
1694  PFLOAT128 FltS17;
1695  PFLOAT128 FltS18;
1696  PFLOAT128 FltS19;
1697  PULONGLONG IntS0;
1698  PULONGLONG IntS1;
1699  PULONGLONG IntS2;
1700  PULONGLONG IntS3;
1701  PULONGLONG IntSp;
1702  PULONGLONG IntS0Nat;
1703  PULONGLONG IntS1Nat;
1704  PULONGLONG IntS2Nat;
1705  PULONGLONG IntS3Nat;
1706  PULONGLONG IntSpNat;
1707  PULONGLONG Preds;
1708  PULONGLONG BrRp;
1709  PULONGLONG BrS0;
1710  PULONGLONG BrS1;
1711  PULONGLONG BrS2;
1712  PULONGLONG BrS3;
1713  PULONGLONG BrS4;
1714  PULONGLONG ApUNAT;
1715  PULONGLONG ApLC;
1716  PULONGLONG ApEC;
1717  PULONGLONG RsPFS;
1718  PULONGLONG StFSR;
1719  PULONGLONG StFIR;
1720  PULONGLONG StFDR;
1721  PULONGLONG Cflag;
1722 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1723 
1724 NTSYSAPI ULONGLONG WINAPI RtlVirtualUnwind(ULONGLONG,ULONGLONG,RUNTIME_FUNCTION*,CONTEXT*,BOOLEAN*,FRAME_POINTERS*,KNONVOLATILE_CONTEXT_POINTERS*);
1725 
1726 #endif /* __ia64__ */
1727 
1728 /* Alpha context definitions */
1729 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1730 
1731 #define CONTEXT_ALPHA 0x00020000
1732 
1733 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1734 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1735 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1736 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1737 
1738 #define EXCEPTION_READ_FAULT 0
1739 #define EXCEPTION_WRITE_FAULT 1
1740 #define EXCEPTION_EXECUTE_FAULT 8
1741 
1742 typedef struct _CONTEXT
1743 {
1744  /* selected by CONTEXT_FLOATING_POINT */
1745  ULONGLONG FltF0;
1746  ULONGLONG FltF1;
1747  ULONGLONG FltF2;
1748  ULONGLONG FltF3;
1749  ULONGLONG FltF4;
1750  ULONGLONG FltF5;
1751  ULONGLONG FltF6;
1752  ULONGLONG FltF7;
1753  ULONGLONG FltF8;
1754  ULONGLONG FltF9;
1755  ULONGLONG FltF10;
1756  ULONGLONG FltF11;
1757  ULONGLONG FltF12;
1758  ULONGLONG FltF13;
1759  ULONGLONG FltF14;
1760  ULONGLONG FltF15;
1761  ULONGLONG FltF16;
1762  ULONGLONG FltF17;
1763  ULONGLONG FltF18;
1764  ULONGLONG FltF19;
1765  ULONGLONG FltF20;
1766  ULONGLONG FltF21;
1767  ULONGLONG FltF22;
1768  ULONGLONG FltF23;
1769  ULONGLONG FltF24;
1770  ULONGLONG FltF25;
1771  ULONGLONG FltF26;
1772  ULONGLONG FltF27;
1773  ULONGLONG FltF28;
1774  ULONGLONG FltF29;
1775  ULONGLONG FltF30;
1776  ULONGLONG FltF31;
1777 
1778  /* selected by CONTEXT_INTEGER */
1779  ULONGLONG IntV0;
1780  ULONGLONG IntT0;
1781  ULONGLONG IntT1;
1782  ULONGLONG IntT2;
1783  ULONGLONG IntT3;
1784  ULONGLONG IntT4;
1785  ULONGLONG IntT5;
1786  ULONGLONG IntT6;
1787  ULONGLONG IntT7;
1788  ULONGLONG IntS0;
1789  ULONGLONG IntS1;
1790  ULONGLONG IntS2;
1791  ULONGLONG IntS3;
1792  ULONGLONG IntS4;
1793  ULONGLONG IntS5;
1794  ULONGLONG IntFp;
1795  ULONGLONG IntA0;
1796  ULONGLONG IntA1;
1797  ULONGLONG IntA2;
1798  ULONGLONG IntA3;
1799  ULONGLONG IntA4;
1800  ULONGLONG IntA5;
1801  ULONGLONG IntT8;
1802  ULONGLONG IntT9;
1803  ULONGLONG IntT10;
1804  ULONGLONG IntT11;
1805  ULONGLONG IntRa;
1806  ULONGLONG IntT12;
1807  ULONGLONG IntAt;
1808  ULONGLONG IntGp;
1809  ULONGLONG IntSp;
1810  ULONGLONG IntZero;
1811 
1812  /* selected by CONTEXT_FLOATING_POINT */
1813  ULONGLONG Fpcr;
1814  ULONGLONG SoftFpcr;
1815 
1816  /* selected by CONTEXT_CONTROL */
1817  ULONGLONG Fir;
1818  DWORD Psr;
1819  DWORD ContextFlags;
1820  DWORD Fill[4];
1821 } CONTEXT, *PCONTEXT;
1822 
1823 #define _QUAD_PSR_OFFSET HighSoftFpcr
1824 #define _QUAD_FLAGS_OFFSET HighFir
1825 
1826 #endif /* _ALPHA_ */
1827 
1828 #ifdef __arm__
1829 
1830 /* The following flags control the contents of the CONTEXT structure. */
1831 
1832 #define CONTEXT_ARM 0x0200000
1833 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1834 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1835 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1836 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1837 
1838 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1839 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1840 
1841 #define EXCEPTION_READ_FAULT 0
1842 #define EXCEPTION_WRITE_FAULT 1
1843 #define EXCEPTION_EXECUTE_FAULT 8
1844 
1845 #define ARM_MAX_BREAKPOINTS 8
1846 #define ARM_MAX_WATCHPOINTS 1
1847 
1848 typedef struct _RUNTIME_FUNCTION
1849 {
1850  DWORD BeginAddress;
1851  union {
1852  DWORD UnwindData;
1853  struct {
1854  DWORD Flag : 2;
1855  DWORD FunctionLength : 11;
1856  DWORD Ret : 2;
1857  DWORD H : 1;
1858  DWORD Reg : 3;
1859  DWORD R : 1;
1860  DWORD L : 1;
1861  DWORD C : 1;
1862  DWORD StackAdjust : 10;
1863  } DUMMYSTRUCTNAME;
1864  } DUMMYUNIONNAME;
1865 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1866 
1867 #define UNWIND_HISTORY_TABLE_SIZE 12
1868 
1869 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1870 {
1871  DWORD ImageBase;
1872  PRUNTIME_FUNCTION FunctionEntry;
1873 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1874 
1875 typedef struct _UNWIND_HISTORY_TABLE
1876 {
1877  DWORD Count;
1878  BYTE LocalHint;
1879  BYTE GlobalHint;
1880  BYTE Search;
1881  BYTE Once;
1882  DWORD LowAddress;
1883  DWORD HighAddress;
1884  UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1885 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1886 
1887 typedef struct _NEON128
1888 {
1889  ULONGLONG Low;
1890  LONGLONG High;
1891 } NEON128, *PNEON128;
1892 
1893 typedef struct _CONTEXT
1894 {
1895  ULONG ContextFlags; /* 000 */
1896  /* CONTEXT_INTEGER */
1897  ULONG R0; /* 004 */
1898  ULONG R1; /* 008 */
1899  ULONG R2; /* 00c */
1900  ULONG R3; /* 010 */
1901  ULONG R4; /* 014 */
1902  ULONG R5; /* 018 */
1903  ULONG R6; /* 01c */
1904  ULONG R7; /* 020 */
1905  ULONG R8; /* 024 */
1906  ULONG R9; /* 028 */
1907  ULONG R10; /* 02c */
1908  ULONG R11; /* 030 */
1909  ULONG R12; /* 034 */
1910  /* CONTEXT_CONTROL */
1911  ULONG Sp; /* 038 */
1912  ULONG Lr; /* 03c */
1913  ULONG Pc; /* 040 */
1914  ULONG Cpsr; /* 044 */
1915  /* CONTEXT_FLOATING_POINT */
1916  ULONG Fpscr; /* 048 */
1917  ULONG Padding; /* 04c */
1918  union
1919  {
1920  NEON128 Q[16];
1921  ULONGLONG D[32];
1922  ULONG S[32];
1923  } DUMMYUNIONNAME; /* 050 */
1924  /* CONTEXT_DEBUG_REGISTERS */
1925  ULONG Bvr[ARM_MAX_BREAKPOINTS]; /* 150 */
1926  ULONG Bcr[ARM_MAX_BREAKPOINTS]; /* 170 */
1927  ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */
1928  ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */
1929  ULONG Padding2[2]; /* 198 */
1930 } CONTEXT, *PCONTEXT;
1931 
1932 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1933 {
1934  PDWORD R4;
1935  PDWORD R5;
1936  PDWORD R6;
1937  PDWORD R7;
1938  PDWORD R8;
1939  PDWORD R9;
1940  PDWORD R10;
1941  PDWORD R11;
1942  PDWORD Lr;
1943  PULONGLONG D8;
1944  PULONGLONG D9;
1945  PULONGLONG D10;
1946  PULONGLONG D11;
1947  PULONGLONG D12;
1948  PULONGLONG D13;
1949  PULONGLONG D14;
1950  PULONGLONG D15;
1951 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1952 
1953 typedef struct _DISPATCHER_CONTEXT
1954 {
1955  DWORD ControlPc;
1956  DWORD ImageBase;
1957  PRUNTIME_FUNCTION FunctionEntry;
1958  DWORD EstablisherFrame;
1959  DWORD TargetPc;
1960  PCONTEXT ContextRecord;
1961  PEXCEPTION_ROUTINE LanguageHandler;
1962  PVOID HandlerData;
1963  PUNWIND_HISTORY_TABLE HistoryTable;
1964  DWORD ScopeIndex;
1965  BOOLEAN ControlPcIsUnwound;
1966  PBYTE NonVolatileRegisters;
1967  DWORD Reserved;
1968 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
1969 
1970 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD);
1971 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD);
1972 
1973 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,DWORD,DWORD,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,DWORD*,KNONVOLATILE_CONTEXT_POINTERS*);
1974 
1975 #define UNW_FLAG_NHANDLER 0
1976 #define UNW_FLAG_EHANDLER 1
1977 #define UNW_FLAG_UHANDLER 2
1978 
1979 #endif /* __arm__ */
1980 
1981 #ifdef __aarch64__
1982 
1983 #define CONTEXT_ARM64 0x400000
1984 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001)
1985 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002)
1986 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1987 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1988 #define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x00000010)
1989 
1990 #define CONTEXT_UNWOUND_TO_CALL 0x20000000
1991 
1992 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1993 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_ARM64_X18)
1994 
1995 #define EXCEPTION_READ_FAULT 0
1996 #define EXCEPTION_WRITE_FAULT 1
1997 #define EXCEPTION_EXECUTE_FAULT 8
1998 
1999 #define ARM64_MAX_BREAKPOINTS 8
2000 #define ARM64_MAX_WATCHPOINTS 2
2001 
2002 typedef struct _RUNTIME_FUNCTION
2003 {
2004  DWORD BeginAddress;
2005  union
2006  {
2007  DWORD UnwindData;
2008  struct
2009  {
2010  DWORD Flag : 2;
2011  DWORD FunctionLength : 11;
2012  DWORD RegF : 3;
2013  DWORD RegI : 4;
2014  DWORD H : 1;
2015  DWORD CR : 2;
2016  DWORD FrameSize : 9;
2017  } DUMMYSTRUCTNAME;
2018  } DUMMYUNIONNAME;
2019 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
2020 
2021 #define UNWIND_HISTORY_TABLE_SIZE 12
2022 
2023 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
2024 {
2025  DWORD64 ImageBase;
2026  PRUNTIME_FUNCTION FunctionEntry;
2027 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
2028 
2029 typedef struct _UNWIND_HISTORY_TABLE
2030 {
2031  DWORD Count;
2032  BYTE LocalHint;
2033  BYTE GlobalHint;
2034  BYTE Search;
2035  BYTE Once;
2036  DWORD64 LowAddress;
2037  DWORD64 HighAddress;
2038  UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
2039 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
2040 
2041 typedef union _NEON128
2042 {
2043  struct
2044  {
2045  ULONGLONG Low;
2046  LONGLONG High;
2047  } DUMMYSTRUCTNAME;
2048  double D[2];
2049  float S[4];
2050  WORD H[8];
2051  BYTE B[16];
2052 } NEON128, *PNEON128;
2053 
2054 typedef struct _CONTEXT
2055 {
2056  ULONG ContextFlags; /* 000 */
2057  /* CONTEXT_INTEGER */
2058  ULONG Cpsr; /* 004 */
2059  union
2060  {
2061  struct
2062  {
2063  DWORD64 X0; /* 008 */
2064  DWORD64 X1; /* 010 */
2065  DWORD64 X2; /* 018 */
2066  DWORD64 X3; /* 020 */
2067  DWORD64 X4; /* 028 */
2068  DWORD64 X5; /* 030 */
2069  DWORD64 X6; /* 038 */
2070  DWORD64 X7; /* 040 */
2071  DWORD64 X8; /* 048 */
2072  DWORD64 X9; /* 050 */
2073  DWORD64 X10; /* 058 */
2074  DWORD64 X11; /* 060 */
2075  DWORD64 X12; /* 068 */
2076  DWORD64 X13; /* 070 */
2077  DWORD64 X14; /* 078 */
2078  DWORD64 X15; /* 080 */
2079  DWORD64 X16; /* 088 */
2080  DWORD64 X17; /* 090 */
2081  DWORD64 X18; /* 098 */
2082  DWORD64 X19; /* 0a0 */
2083  DWORD64 X20; /* 0a8 */
2084  DWORD64 X21; /* 0b0 */
2085  DWORD64 X22; /* 0b8 */
2086  DWORD64 X23; /* 0c0 */
2087  DWORD64 X24; /* 0c8 */
2088  DWORD64 X25; /* 0d0 */
2089  DWORD64 X26; /* 0d8 */
2090  DWORD64 X27; /* 0e0 */
2091  DWORD64 X28; /* 0e8 */
2092  DWORD64 Fp; /* 0f0 */
2093  DWORD64 Lr; /* 0f8 */
2094  } DUMMYSTRUCTNAME;
2095  DWORD64 X[31]; /* 008 */
2096  } DUMMYUNIONNAME;
2097  /* CONTEXT_CONTROL */
2098  DWORD64 Sp; /* 100 */
2099  DWORD64 Pc; /* 108 */
2100  /* CONTEXT_FLOATING_POINT */
2101  NEON128 V[32]; /* 110 */
2102  DWORD Fpcr; /* 310 */
2103  DWORD Fpsr; /* 314 */
2104  /* CONTEXT_DEBUG_REGISTERS */
2105  DWORD Bcr[ARM64_MAX_BREAKPOINTS]; /* 318 */
2106  DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */
2107  DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */
2108  DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */
2109 } CONTEXT, *PCONTEXT;
2110 
2111 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
2112 {
2113  PDWORD64 X19;
2114  PDWORD64 X20;
2115  PDWORD64 X21;
2116  PDWORD64 X22;
2117  PDWORD64 X23;
2118  PDWORD64 X24;
2119  PDWORD64 X25;
2120  PDWORD64 X26;
2121  PDWORD64 X27;
2122  PDWORD64 X28;
2123  PDWORD64 Fp;
2124  PDWORD64 Lr;
2125  PDWORD64 D8;
2126  PDWORD64 D9;
2127  PDWORD64 D10;
2128  PDWORD64 D11;
2129  PDWORD64 D12;
2130  PDWORD64 D13;
2131  PDWORD64 D14;
2132  PDWORD64 D15;
2133 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
2134 
2135 typedef struct _DISPATCHER_CONTEXT
2136 {
2137  ULONG_PTR ControlPc;
2138  ULONG_PTR ImageBase;
2139  PRUNTIME_FUNCTION FunctionEntry;
2140  ULONG_PTR EstablisherFrame;
2141  ULONG_PTR TargetPc;
2142  PCONTEXT ContextRecord;
2143  PEXCEPTION_ROUTINE LanguageHandler;
2144  PVOID HandlerData;
2145  PUNWIND_HISTORY_TABLE HistoryTable;
2146  DWORD ScopeIndex;
2147  BOOLEAN ControlPcIsUnwound;
2148  PBYTE NonVolatileRegisters;
2149 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
2150 
2151 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD64);
2152 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD64);
2153 
2154 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,ULONG_PTR,ULONG_PTR,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG_PTR*,KNONVOLATILE_CONTEXT_POINTERS*);
2155 
2156 #define UNW_FLAG_NHANDLER 0
2157 #define UNW_FLAG_EHANDLER 1
2158 #define UNW_FLAG_UHANDLER 2
2159 
2160 #endif /* __aarch64__ */
2161 
2162 
2163 /* Mips context definitions */
2164 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
2165 
2166 #define CONTEXT_R4000 0x00010000
2167 
2168 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
2169 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
2170 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
2171 
2172 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2173 
2174 #define EXCEPTION_READ_FAULT 0
2175 #define EXCEPTION_WRITE_FAULT 1
2176 #define EXCEPTION_EXECUTE_FAULT 8
2177 
2178 typedef struct _CONTEXT
2179 {
2180  DWORD Argument[4];
2181  /* These are selected by CONTEXT_FLOATING_POINT */
2182  DWORD FltF0;
2183  DWORD FltF1;
2184  DWORD FltF2;
2185  DWORD FltF3;
2186  DWORD FltF4;
2187  DWORD FltF5;
2188  DWORD FltF6;
2189  DWORD FltF7;
2190  DWORD FltF8;
2191  DWORD FltF9;
2192  DWORD FltF10;
2193  DWORD FltF11;
2194  DWORD FltF12;
2195  DWORD FltF13;
2196  DWORD FltF14;
2197  DWORD FltF15;
2198  DWORD FltF16;
2199  DWORD FltF17;
2200  DWORD FltF18;
2201  DWORD FltF19;
2202  DWORD FltF20;
2203  DWORD FltF21;
2204  DWORD FltF22;
2205  DWORD FltF23;
2206  DWORD FltF24;
2207  DWORD FltF25;
2208  DWORD FltF26;
2209  DWORD FltF27;
2210  DWORD FltF28;
2211  DWORD FltF29;
2212  DWORD FltF30;
2213  DWORD FltF31;
2214 
2215  /* These are selected by CONTEXT_INTEGER */
2216  DWORD IntZero;
2217  DWORD IntAt;
2218  DWORD IntV0;
2219  DWORD IntV1;
2220  DWORD IntA0;
2221  DWORD IntA1;
2222  DWORD IntA2;
2223  DWORD IntA3;
2224  DWORD IntT0;
2225  DWORD IntT1;
2226  DWORD IntT2;
2227  DWORD IntT3;
2228  DWORD IntT4;
2229  DWORD IntT5;
2230  DWORD IntT6;
2231  DWORD IntT7;
2232  DWORD IntS0;
2233  DWORD IntS1;
2234  DWORD IntS2;
2235  DWORD IntS3;
2236  DWORD IntS4;
2237  DWORD IntS5;
2238  DWORD IntS6;
2239  DWORD IntS7;
2240  DWORD IntT8;
2241  DWORD IntT9;
2242  DWORD IntK0;
2243  DWORD IntK1;
2244  DWORD IntGp;
2245  DWORD IntSp;
2246  DWORD IntS8;
2247  DWORD IntRa;
2248  DWORD IntLo;
2249  DWORD IntHi;
2250 
2251  /* These are selected by CONTEXT_FLOATING_POINT */
2252  DWORD Fsr;
2253 
2254  /* These are selected by CONTEXT_CONTROL */
2255  DWORD Fir;
2256  DWORD Psr;
2257 
2258  DWORD ContextFlags;
2259  DWORD Fill[2];
2260 } CONTEXT, *PCONTEXT;
2261 
2262 #endif /* _MIPS_ */
2263 
2264 /* PowerPC context definitions */
2265 #ifdef __powerpc__
2266 
2267 #define CONTEXT_CONTROL 0x0001
2268 #define CONTEXT_FLOATING_POINT 0x0002
2269 #define CONTEXT_INTEGER 0x0004
2270 #define CONTEXT_DEBUG_REGISTERS 0x0008
2271 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2272 
2273 #define EXCEPTION_READ_FAULT 0
2274 #define EXCEPTION_WRITE_FAULT 1
2275 #define EXCEPTION_EXECUTE_FAULT 8
2276 
2277 typedef struct
2278 {
2279  /* These are selected by CONTEXT_FLOATING_POINT */
2280  double Fpr0;
2281  double Fpr1;
2282  double Fpr2;
2283  double Fpr3;
2284  double Fpr4;
2285  double Fpr5;
2286  double Fpr6;
2287  double Fpr7;
2288  double Fpr8;
2289  double Fpr9;
2290  double Fpr10;
2291  double Fpr11;
2292  double Fpr12;
2293  double Fpr13;
2294  double Fpr14;
2295  double Fpr15;
2296  double Fpr16;
2297  double Fpr17;
2298  double Fpr18;
2299  double Fpr19;
2300  double Fpr20;
2301  double Fpr21;
2302  double Fpr22;
2303  double Fpr23;
2304  double Fpr24;
2305  double Fpr25;
2306  double Fpr26;
2307  double Fpr27;
2308  double Fpr28;
2309  double Fpr29;
2310  double Fpr30;
2311  double Fpr31;
2312  double Fpscr;
2313 
2314  /* These are selected by CONTEXT_INTEGER */
2315  DWORD Gpr0;
2316  DWORD Gpr1;
2317  DWORD Gpr2;
2318  DWORD Gpr3;
2319  DWORD Gpr4;
2320  DWORD Gpr5;
2321  DWORD Gpr6;
2322  DWORD Gpr7;
2323  DWORD Gpr8;
2324  DWORD Gpr9;
2325  DWORD Gpr10;
2326  DWORD Gpr11;
2327  DWORD Gpr12;
2328  DWORD Gpr13;
2329  DWORD Gpr14;
2330  DWORD Gpr15;
2331  DWORD Gpr16;
2332  DWORD Gpr17;
2333  DWORD Gpr18;
2334  DWORD Gpr19;
2335  DWORD Gpr20;
2336  DWORD Gpr21;
2337  DWORD Gpr22;
2338  DWORD Gpr23;
2339  DWORD Gpr24;
2340  DWORD Gpr25;
2341  DWORD Gpr26;
2342  DWORD Gpr27;
2343  DWORD Gpr28;
2344  DWORD Gpr29;
2345  DWORD Gpr30;
2346  DWORD Gpr31;
2347 
2348  DWORD Cr;
2349  DWORD Xer;
2350 
2351  /* These are selected by CONTEXT_CONTROL */
2352  DWORD Msr;
2353  DWORD Iar; /* Instruction Address Register , aka PC ... */
2354  DWORD Lr;
2355  DWORD Ctr;
2356 
2357  DWORD ContextFlags;
2358 
2359  DWORD Dar; /* Fault registers for coredump */
2360  DWORD Dsisr;
2361  DWORD Trap; /* number of powerpc exception taken */
2362 
2363  /* These are selected by CONTEXT_DEBUG_REGISTERS */
2364  DWORD Dr0;
2365  DWORD Dr1;
2366  DWORD Dr2;
2367  DWORD Dr3;
2368  DWORD Dr4;
2369  DWORD Dr5;
2370  DWORD Dr6;
2371  DWORD Dr7;
2372 } CONTEXT, *PCONTEXT;
2373 
2374 typedef struct _STACK_FRAME_HEADER
2375 {
2376  DWORD BackChain;
2377  DWORD GlueSaved1;
2378  DWORD GlueSaved2;
2379  DWORD Reserved1;
2380  DWORD Spare1;
2381  DWORD Spare2;
2382 
2383  DWORD Parameter0;
2384  DWORD Parameter1;
2385  DWORD Parameter2;
2386  DWORD Parameter3;
2387  DWORD Parameter4;
2388  DWORD Parameter5;
2389  DWORD Parameter6;
2390  DWORD Parameter7;
2391 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
2392 
2393 #endif /* __powerpc__ */
2394 
2395 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
2396 #error You need to define a CONTEXT for your CPU
2397 #endif
2398 
2400 
2401 #define WOW64_CONTEXT_i386 0x00010000
2402 #define WOW64_CONTEXT_i486 0x00010000
2403 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
2404 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
2405 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
2406 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
2407 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
2408 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
2409 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2410 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
2411 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
2412  WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
2413  WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
2414 
2415 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2416 
2417 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
2418 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
2419 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
2420 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
2421 
2422 #define WOW64_SIZE_OF_80387_REGISTERS 80
2423 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
2424 
2426 {
2437 
2438 #include "pshpack4.h"
2439 typedef struct _WOW64_CONTEXT
2440 {
2467 #include "poppack.h"
2468 
2469 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
2470 
2471 typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD_PTR,PVOID);
2472 
2473 NTSYSAPI BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD_PTR);
2474 NTSYSAPI DWORD WINAPI RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION,DWORD,DWORD,ULONG_PTR,ULONG_PTR);
2475 NTSYSAPI BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
2476 NTSYSAPI void WINAPI RtlDeleteGrowableFunctionTable(void*);
2477 NTSYSAPI void WINAPI RtlGrowFunctionTable(void*,DWORD);
2478 NTSYSAPI BOOLEAN CDECL RtlInstallFunctionTableCallback(DWORD_PTR,DWORD_PTR,DWORD,PGET_RUNTIME_FUNCTION_CALLBACK,PVOID,PCWSTR);
2479 NTSYSAPI PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD_PTR,DWORD_PTR*,UNWIND_HISTORY_TABLE*);
2480 NTSYSAPI void WINAPI RtlUnwindEx(PVOID,PVOID,struct _EXCEPTION_RECORD*,PVOID,CONTEXT*,UNWIND_HISTORY_TABLE*);
2481 #endif
2482 
2483 /*
2484  * Product types
2485  */
2486 #define PRODUCT_UNDEFINED 0x00000000
2487 #define PRODUCT_ULTIMATE 0x00000001
2488 #define PRODUCT_HOME_BASIC 0x00000002
2489 #define PRODUCT_HOME_PREMIUM 0x00000003
2490 #define PRODUCT_ENTERPRISE 0x00000004
2491 #define PRODUCT_HOME_BASIC_N 0x00000005
2492 #define PRODUCT_BUSINESS 0x00000006
2493 #define PRODUCT_STANDARD_SERVER 0x00000007
2494 #define PRODUCT_DATACENTER_SERVER 0x00000008
2495 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
2496 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
2497 #define PRODUCT_STARTER 0x0000000B
2498 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
2499 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
2500 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
2501 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
2502 #define PRODUCT_BUSINESS_N 0x00000010
2503 #define PRODUCT_WEB_SERVER 0x00000011
2504 #define PRODUCT_CLUSTER_SERVER 0x00000012
2505 #define PRODUCT_HOME_SERVER 0x00000013
2506 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2507 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2508 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2509 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2510 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
2511 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
2512 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
2513 #define PRODUCT_ENTERPRISE_N 0x0000001B
2514 #define PRODUCT_ULTIMATE_N 0x0000001C
2515 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2516 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
2517 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
2518 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
2519 #define PRODUCT_SERVER_FOUNDATION 0x00000021
2520 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
2521 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
2522 #define PRODUCT_STANDARD_SERVER_V 0x00000024
2523 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
2524 #define PRODUCT_SERVER_V 0x00000025
2525 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
2526 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
2527 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
2528 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
2529 #define PRODUCT_HYPERV 0x0000002A
2530 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
2531 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
2532 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
2533 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
2534 #define PRODUCT_STARTER_N 0x0000002F
2535 #define PRODUCT_PROFESSIONAL 0x00000030
2536 #define PRODUCT_PROFESSIONAL_N 0x00000031
2537 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2538 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2539 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2540 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2541 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2542 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2543 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2544 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2545 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2546 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2547 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2548 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2549 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2550 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2551 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2552 #define PRODUCT_EMBEDDED 0x00000041
2553 #define PRODUCT_STARTER_E 0x00000042
2554 #define PRODUCT_HOME_BASIC_E 0x00000043
2555 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2556 #define PRODUCT_PROFESSIONAL_E 0x00000045
2557 #define PRODUCT_ENTERPRISE_E 0x00000046
2558 #define PRODUCT_ULTIMATE_E 0x00000047
2559 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2560 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2561 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2562 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2563 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2564 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2565 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2566 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2567 #define PRODUCT_THINPC 0x00000057
2568 #define PRODUCT_EMBEDDED_A 0x00000058
2569 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2570 #define PRODUCT_EMBEDDED_E 0x0000005A
2571 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2572 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2573 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2574 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2575 #define PRODUCT_CORE_ARM 0x00000061
2576 #define PRODUCT_CORE_N 0x00000062
2577 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2578 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2579 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2580 #define PRODUCT_CORE 0x00000065
2581 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2582 #define PRODUCT_MOBILE_CORE 0x00000068
2583 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2584 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2585 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2586 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2587 #define PRODUCT_NANO_SERVER 0x0000006D
2588 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2589 #define PRODUCT_CORE_CONNECTED 0x0000006F
2590 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2591 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2592 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2593 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2594 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2595 #define PRODUCT_CONNECTED_CAR 0x00000075
2596 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2597 #define PRODUCT_PPI_PRO 0x00000077
2598 #define PRODUCT_ARM64_SERVER 0x00000078
2599 #define PRODUCT_EDUCATION 0x00000079
2600 #define PRODUCT_EDUCATION_N 0x0000007A
2601 #define PRODUCT_IOTUAP 0x0000007B
2602 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2603 #define PRODUCT_ENTERPRISE_S 0x0000007D
2604 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2605 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2606 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2607 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2608 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2609 #define PRODUCT_UNLICENSED 0xABCDABCD
2610 
2611 
2612 /*
2613  * Language IDs
2614  */
2615 
2616 #define MAKELCID(l, s) (MAKELONG(l, s))
2617 
2618 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2619 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2620 #define SUBLANGID(l) ((WORD)(l) >> 10)
2621 
2622 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2623 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2624 
2625 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2626 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2627 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2628 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2629 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2630 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2631 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2632 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2633 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2634 #define LOCALE_NAME_MAX_LENGTH 85
2635 
2636 
2637 #define UNREFERENCED_PARAMETER(u) (void)(u)
2638 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2639 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2640 
2641 #include <winnt.rh>
2642 
2643 
2644 /*
2645  * Definitions for IsTextUnicode()
2646  */
2647 
2648 #define IS_TEXT_UNICODE_ASCII16 0x0001
2649 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2650 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2651 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2652 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2653 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2654 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2655 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2656 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2657 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2658 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2659 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2660 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2661 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2662 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2663 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2664 
2665 #define MAXIMUM_WAIT_OBJECTS 64
2666 #define MAXIMUM_SUSPEND_COUNT 127
2667 
2668 #define WT_EXECUTEDEFAULT 0x00
2669 #define WT_EXECUTEINIOTHREAD 0x01
2670 #define WT_EXECUTEINUITHREAD 0x02
2671 #define WT_EXECUTEINWAITTHREAD 0x04
2672 #define WT_EXECUTEONLYONCE 0x08
2673 #define WT_EXECUTELONGFUNCTION 0x10
2674 #define WT_EXECUTEINTIMERTHREAD 0x20
2675 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2676 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2677 #define WT_EXECUTEINLONGTHREAD 0x10
2678 #define WT_EXECUTEDELETEWAIT 0x08
2679 #define WT_TRANSFER_IMPERSONATION 0x0100
2680 
2681 
2682 #define EXCEPTION_CONTINUABLE 0
2683 #define EXCEPTION_NONCONTINUABLE 0x01
2684 
2685 /*
2686  * The exception record used by Win32 to give additional information
2687  * about exception to exception handlers.
2688  */
2689 
2690 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2691 
2692 typedef struct _EXCEPTION_RECORD
2693 {
2697 
2702 
2703 typedef struct _EXCEPTION_RECORD32
2704 {
2712 
2713 typedef struct _EXCEPTION_RECORD64
2714 {
2723 
2724 /*
2725  * The exception pointers structure passed to exception filters
2726  * in except() and the UnhandledExceptionFilter().
2727  */
2728 
2729 typedef struct _EXCEPTION_POINTERS
2730 {
2732  PCONTEXT ContextRecord;
2734 
2735 
2736 /*
2737  * The exception frame, used for registering exception handlers
2738  * Win32 cares only about this, but compilers generally emit
2739  * larger exception frames for their own use.
2740  */
2741 
2743 
2745  PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
2746 
2748 {
2752 
2753 /*
2754  * function pointer to an exception filter
2755  */
2756 
2758 
2759 typedef struct _NT_TIB
2760 {
2765  union {
2768  } DUMMYUNIONNAME;
2770  struct _NT_TIB *Self;
2772 
2773 struct _TEB;
2774 
2775 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2776 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2777 {
2778  struct _TEB *teb;
2779  __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2780  return teb;
2781 }
2782 #elif defined(__i386__) && defined(_MSC_VER)
2783 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2784 {
2785  struct _TEB *teb;
2786  __asm mov eax, fs:[0x18];
2787  __asm mov teb, eax;
2788  return teb;
2789 }
2790 #elif defined(__x86_64__) && defined(__GNUC__)
2791 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2792 {
2793  struct _TEB *teb;
2794  __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
2795  return teb;
2796 }
2797 #elif defined(__x86_64__) && defined(_MSC_VER)
2798 unsigned __int64 __readgsqword(unsigned long);
2799 #pragma intrinsic(__readgsqword)
2800 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2801 {
2802  return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
2803 }
2804 #elif defined(__arm__) && defined(__MINGW32__)
2805 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2806 {
2807  struct _TEB *teb;
2808  __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb));
2809  return teb;
2810 }
2811 #else
2812 extern struct _TEB * WINAPI NtCurrentTeb(void);
2813 #endif
2814 
2815 #ifdef NONAMELESSUNION
2816 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2817 #else
2818 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2819 #endif
2820 #define GetFiberData() (*(void **)GetCurrentFiber())
2821 
2822 #define TLS_MINIMUM_AVAILABLE 64
2823 
2824 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2825 
2826 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2827 #define IO_REPARSE_TAG_RESERVED_ONE 1
2828 #define IO_REPARSE_TAG_RESERVED_TWO 2
2829 
2830 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2831 
2832 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2833 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2834 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2835 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2836 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2837 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2838 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2839 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2840 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2841 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2842 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2843 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2844 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2845 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2846 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2847 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2848 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2849 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2850 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2851 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2852 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2853 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2854 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2855 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2856 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2857 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2858 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2859 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2860 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2861 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2862 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2863 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2864 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2865 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2866 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2867 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2868 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2869 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2870 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2871 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2872 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2873 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2874 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2875 
2876 /*
2877  * File formats definitions
2878  */
2879 
2880 #include <pshpack2.h>
2881 typedef struct _IMAGE_DOS_HEADER {
2882  WORD e_magic; /* 00: MZ Header signature */
2883  WORD e_cblp; /* 02: Bytes on last page of file */
2884  WORD e_cp; /* 04: Pages in file */
2885  WORD e_crlc; /* 06: Relocations */
2886  WORD e_cparhdr; /* 08: Size of header in paragraphs */
2887  WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2888  WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2889  WORD e_ss; /* 0e: Initial (relative) SS value */
2890  WORD e_sp; /* 10: Initial SP value */
2891  WORD e_csum; /* 12: Checksum */
2892  WORD e_ip; /* 14: Initial IP value */
2893  WORD e_cs; /* 16: Initial (relative) CS value */
2894  WORD e_lfarlc; /* 18: File address of relocation table */
2895  WORD e_ovno; /* 1a: Overlay number */
2896  WORD e_res[4]; /* 1c: Reserved words */
2897  WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2898  WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2899  WORD e_res2[10]; /* 28: Reserved words */
2900  DWORD e_lfanew; /* 3c: Offset to extended header */
2902 #include <poppack.h>
2903 
2904 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2905 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2906 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2907 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2908 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2909 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2910 
2911 /*
2912  * This is the Windows executable (NE) header.
2913  * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2914  */
2915 #include <pshpack2.h>
2916 typedef struct
2917 {
2918  WORD ne_magic; /* 00 NE signature 'NE' */
2919  BYTE ne_ver; /* 02 Linker version number */
2920  BYTE ne_rev; /* 03 Linker revision number */
2921  WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2922  WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2923  LONG ne_crc; /* 08 Checksum */
2924  WORD ne_flags; /* 0c Flags about segments in this file */
2925  WORD ne_autodata; /* 0e Automatic data segment number */
2926  WORD ne_heap; /* 10 Initial size of local heap */
2927  WORD ne_stack; /* 12 Initial size of stack */
2928  DWORD ne_csip; /* 14 Initial CS:IP */
2929  DWORD ne_sssp; /* 18 Initial SS:SP */
2930  WORD ne_cseg; /* 1c # of entries in segment table */
2931  WORD ne_cmod; /* 1e # of entries in module reference tab. */
2932  WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2933  WORD ne_segtab; /* 22 Offset to segment table */
2934  WORD ne_rsrctab; /* 24 Offset to resource table */
2935  WORD ne_restab; /* 26 Offset to resident-name table */
2936  WORD ne_modtab; /* 28 Offset to module reference table */
2937  WORD ne_imptab; /* 2a Offset to imported name table */
2938  DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2939  WORD ne_cmovent; /* 30 # of movable entry points */
2940  WORD ne_align; /* 32 Logical sector alignment shift count */
2941  WORD ne_cres; /* 34 # of resource segments */
2942  BYTE ne_exetyp; /* 36 Flags indicating target OS */
2943  BYTE ne_flagsothers; /* 37 Additional information flags */
2944  WORD ne_pretthunks; /* 38 Offset to return thunks */
2945  WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2946  WORD ne_swaparea; /* 3c Reserved by Microsoft */
2947  WORD ne_expver; /* 3e Expected Windows version number */
2949 #include <poppack.h>
2950 
2951 #include <pshpack2.h>
2952 typedef struct _IMAGE_VXD_HEADER {
3005 #include <poppack.h>
3006 
3007 /* These defines describe the meanings of the bits in the Characteristics
3008  field */
3009 
3010 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
3011 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
3012 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
3013 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
3014 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
3015 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
3016 #define IMAGE_FILE_16BIT_MACHINE 0x0040
3017 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
3018 #define IMAGE_FILE_32BIT_MACHINE 0x0100
3019 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
3020 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
3021 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
3022 #define IMAGE_FILE_SYSTEM 0x1000
3023 #define IMAGE_FILE_DLL 0x2000
3024 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
3025 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
3026 
3027 /* These are the settings of the Machine field. */
3028 #define IMAGE_FILE_MACHINE_UNKNOWN 0
3029 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
3030 #define IMAGE_FILE_MACHINE_I860 0x014d
3031 #define IMAGE_FILE_MACHINE_I386 0x014c
3032 #define IMAGE_FILE_MACHINE_R3000 0x0162
3033 #define IMAGE_FILE_MACHINE_R4000 0x0166
3034 #define IMAGE_FILE_MACHINE_R10000 0x0168
3035 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
3036 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
3037 #define IMAGE_FILE_MACHINE_SH3 0x01a2
3038 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
3039 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
3040 #define IMAGE_FILE_MACHINE_SH4 0x01a6
3041 #define IMAGE_FILE_MACHINE_SH5 0x01a8
3042 #define IMAGE_FILE_MACHINE_ARM 0x01c0
3043 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
3044 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
3045 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
3046 #define IMAGE_FILE_MACHINE_AM33 0x01d3
3047 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
3048 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
3049 #define IMAGE_FILE_MACHINE_IA64 0x0200
3050 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
3051 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
3052 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
3053 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
3054 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
3055 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
3056 #define IMAGE_FILE_MACHINE_CEF 0x0cef
3057 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
3058 #define IMAGE_FILE_MACHINE_AMD64 0x8664
3059 #define IMAGE_FILE_MACHINE_M32R 0x9041
3060 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
3061 
3062 #define IMAGE_SIZEOF_FILE_HEADER 20
3063 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
3064 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
3065 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
3066 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
3067 #define IMAGE_SIZEOF_SHORT_NAME 8
3068 #define IMAGE_SIZEOF_SECTION_HEADER 40
3069 #define IMAGE_SIZEOF_SYMBOL 18
3070 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3071 #define IMAGE_SIZEOF_RELOCATION 10
3072 #define IMAGE_SIZEOF_BASE_RELOCATION 8
3073 #define IMAGE_SIZEOF_LINENUMBER 6
3074 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3075 
3076 /* Possible Magic values */
3077 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
3078 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
3079 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
3080 
3081 #ifdef _WIN64
3082 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
3083 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
3084 #else
3085 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
3086 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
3087 #endif
3088 
3089 /* These are indexes into the DataDirectory array */
3090 #define IMAGE_FILE_EXPORT_DIRECTORY 0
3091 #define IMAGE_FILE_IMPORT_DIRECTORY 1
3092 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
3093 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
3094 #define IMAGE_FILE_SECURITY_DIRECTORY 4
3095 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
3096 #define IMAGE_FILE_DEBUG_DIRECTORY 6
3097 #define IMAGE_FILE_DESCRIPTION_STRING 7
3098 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
3099 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
3100 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
3101 
3102 /* Directory Entries, indices into the DataDirectory array */
3103 
3104 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
3105 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
3106 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
3107 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
3108 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
3109 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
3110 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
3111 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
3112 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
3113 #define IMAGE_DIRECTORY_ENTRY_TLS 9
3114 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
3115 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
3116 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
3117 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
3118 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
3119 
3120 /* Subsystem Values */
3121 
3122 #define IMAGE_SUBSYSTEM_UNKNOWN 0
3123 #define IMAGE_SUBSYSTEM_NATIVE 1
3124 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
3125 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
3126 #define IMAGE_SUBSYSTEM_OS2_CUI 5
3127 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
3128 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
3129 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
3130 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
3131 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
3132 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
3133 #define IMAGE_SUBSYSTEM_EFI_ROM 13
3134 #define IMAGE_SUBSYSTEM_XBOX 14
3135 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
3136 
3137 /* DLL Characteristics */
3138 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
3139 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
3140 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
3141 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
3142 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
3143 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
3144 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
3145 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
3146 
3147 typedef struct _IMAGE_FILE_HEADER {
3156 
3157 typedef struct _IMAGE_DATA_DIRECTORY {
3161 
3162 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
3163 
3165  WORD Magic; /* 0x20b */
3196 
3197 typedef struct _IMAGE_NT_HEADERS64 {
3202 
3203 typedef struct _IMAGE_OPTIONAL_HEADER {
3204 
3205  /* Standard fields */
3206 
3207  WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
3216 
3217  /* NT additional fields */
3218 
3231  DWORD CheckSum; /* 0x40 */
3241  /* 0xE0 */
3243 
3244 typedef struct _IMAGE_NT_HEADERS {
3245  DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
3249 
3250 #ifdef _WIN64
3255 #else
3260 #endif
3261 
3262 #define IMAGE_SIZEOF_SHORT_NAME 8
3263 
3264 typedef struct _IMAGE_SECTION_HEADER {
3266  union {
3269  } Misc;
3279 
3280 #define IMAGE_SIZEOF_SECTION_HEADER 40
3281 
3282 #define IMAGE_FIRST_SECTION(ntheader) \
3283  ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
3284  ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
3285 
3286 /* These defines are for the Characteristics bitfield. */
3287 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
3288 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
3289 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
3290 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
3291 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
3292 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
3293 
3294 #define IMAGE_SCN_CNT_CODE 0x00000020
3295 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
3296 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
3297 
3298 #define IMAGE_SCN_LNK_OTHER 0x00000100
3299 #define IMAGE_SCN_LNK_INFO 0x00000200
3300 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
3301 #define IMAGE_SCN_LNK_REMOVE 0x00000800
3302 #define IMAGE_SCN_LNK_COMDAT 0x00001000
3303 
3304 /* 0x00002000 - Reserved */
3305 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
3306 #define IMAGE_SCN_MEM_FARDATA 0x00008000
3307 
3308 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
3309 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
3310 #define IMAGE_SCN_MEM_16BIT 0x00020000
3311 #define IMAGE_SCN_MEM_LOCKED 0x00040000
3312 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
3313 
3314 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
3315 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
3316 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
3317 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
3318 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
3319 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
3320 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
3321 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
3322 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
3323 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
3324 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
3325 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
3326 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
3327 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
3328 /* 0x00F00000 - Unused */
3329 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
3330 
3331 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3332 
3333 
3334 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3335 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3336 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3337 #define IMAGE_SCN_MEM_SHARED 0x10000000
3338 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3339 #define IMAGE_SCN_MEM_READ 0x40000000
3340 #define IMAGE_SCN_MEM_WRITE 0x80000000
3341 
3342 #include <pshpack2.h>
3343 
3344 typedef struct _IMAGE_SYMBOL {
3345  union {
3347  struct {
3350  } Name;
3352  } N;
3360 
3361 #define IMAGE_SIZEOF_SYMBOL 18
3362 
3363 typedef struct _IMAGE_LINENUMBER {
3364  union {
3367  } Type;
3371 
3372 #define IMAGE_SIZEOF_LINENUMBER 6
3373 
3374 typedef union _IMAGE_AUX_SYMBOL {
3375  struct {
3377  union {
3378  struct {
3381  } LnSz;
3383  } Misc;
3384  union {
3385  struct {
3389  struct {
3394  } Sym;
3395  struct {
3397  } File;
3398  struct {
3408 
3409 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3410 
3411 #include <poppack.h>
3412 
3413 #define IMAGE_SYM_UNDEFINED (SHORT)0
3414 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3415 #define IMAGE_SYM_DEBUG (SHORT)-2
3416 
3417 #define IMAGE_SYM_TYPE_NULL 0x0000
3418 #define IMAGE_SYM_TYPE_VOID 0x0001
3419 #define IMAGE_SYM_TYPE_CHAR 0x0002
3420 #define IMAGE_SYM_TYPE_SHORT 0x0003
3421 #define IMAGE_SYM_TYPE_INT 0x0004
3422 #define IMAGE_SYM_TYPE_LONG 0x0005
3423 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3424 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3425 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3426 #define IMAGE_SYM_TYPE_UNION 0x0009
3427 #define IMAGE_SYM_TYPE_ENUM 0x000A
3428 #define IMAGE_SYM_TYPE_MOE 0x000B
3429 #define IMAGE_SYM_TYPE_BYTE 0x000C
3430 #define IMAGE_SYM_TYPE_WORD 0x000D
3431 #define IMAGE_SYM_TYPE_UINT 0x000E
3432 #define IMAGE_SYM_TYPE_DWORD 0x000F
3433 #define IMAGE_SYM_TYPE_PCODE 0x8000
3434 
3435 #define IMAGE_SYM_DTYPE_NULL 0
3436 #define IMAGE_SYM_DTYPE_POINTER 1
3437 #define IMAGE_SYM_DTYPE_FUNCTION 2
3438 #define IMAGE_SYM_DTYPE_ARRAY 3
3439 
3440 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3441 #define IMAGE_SYM_CLASS_NULL 0x0000
3442 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3443 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3444 #define IMAGE_SYM_CLASS_STATIC 0x0003
3445 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3446 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3447 #define IMAGE_SYM_CLASS_LABEL 0x0006
3448 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3449 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3450 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3451 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3452 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3453 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3454 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3455 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3456 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3457 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3458 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3459 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3460 
3461 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3462 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3463 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3464 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3465 #define IMAGE_SYM_CLASS_FILE 0x0067
3466 #define IMAGE_SYM_CLASS_SECTION 0x0068
3467 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3468 
3469 #define N_BTMASK 0x000F
3470 #define N_TMASK 0x0030
3471 #define N_TMASK1 0x00C0
3472 #define N_TMASK2 0x00F0
3473 #define N_BTSHFT 4
3474 #define N_TSHIFT 2
3475 
3476 #define BTYPE(x) ((x) & N_BTMASK)
3477 
3478 #ifndef ISPTR
3479 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3480 #endif
3481 
3482 #ifndef ISFCN
3483 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3484 #endif
3485 
3486 #ifndef ISARY
3487 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3488 #endif
3489 
3490 #ifndef ISTAG
3491 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3492 #endif
3493 
3494 #ifndef INCREF
3495 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3496 #endif
3497 #ifndef DECREF
3498 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3499 #endif
3500 
3501 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3502 #define IMAGE_COMDAT_SELECT_ANY 2
3503 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3504 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3505 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3506 #define IMAGE_COMDAT_SELECT_LARGEST 6
3507 #define IMAGE_COMDAT_SELECT_NEWEST 7
3508 
3509 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3510 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3511 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3512 
3513 /* Export module directory */
3514 
3515 typedef struct _IMAGE_EXPORT_DIRECTORY {
3528 
3529 /* Import name entry */
3530 typedef struct _IMAGE_IMPORT_BY_NAME {
3534 
3535 #include <pshpack8.h>
3536 /* Import thunk */
3537 typedef struct _IMAGE_THUNK_DATA64 {
3538  union {
3543  } u1;
3545 #include <poppack.h>
3546 
3547 typedef struct _IMAGE_THUNK_DATA32 {
3548  union {
3553  } u1;
3555 
3556 /* Import module directory */
3557 
3559  union {
3560  DWORD Characteristics; /* 0 for terminating null import descriptor */
3561  DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
3562  } DUMMYUNIONNAME;
3563  DWORD TimeDateStamp; /* 0 if not bound,
3564  * -1 if bound, and real date\time stamp
3565  * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3566  * (new BIND)
3567  * otherwise date/time stamp of DLL bound to
3568  * (Old BIND)
3569  */
3570  DWORD ForwarderChain; /* -1 if no forwarders */
3572  /* RVA to IAT (if bound this IAT has actual addresses) */
3575 
3576 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3577 #define IMAGE_ORDINAL_FLAG32 0x80000000
3578 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3579 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3580 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3581 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3582 
3583 #ifdef _WIN64
3584 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3585 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3586 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3589 #else
3590 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3591 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3592 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3595 #endif
3596 
3598 {
3602 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3604 
3606 {
3611 
3613 {
3616  /* WORD TypeOffset[1]; */
3618 
3619 #include <pshpack2.h>
3620 
3621 typedef struct _IMAGE_RELOCATION
3622 {
3623  union {
3626  } DUMMYUNIONNAME;
3630 
3631 #include <poppack.h>
3632 
3633 #define IMAGE_SIZEOF_RELOCATION 10
3634 
3636 {
3637  union
3638  {
3640  struct
3641  {
3644  } DUMMYSTRUCTNAME;
3646 
3656 
3657 /* generic relocation types */
3658 #define IMAGE_REL_BASED_ABSOLUTE 0
3659 #define IMAGE_REL_BASED_HIGH 1
3660 #define IMAGE_REL_BASED_LOW 2
3661 #define IMAGE_REL_BASED_HIGHLOW 3
3662 #define IMAGE_REL_BASED_HIGHADJ 4
3663 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3664 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3665 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3666 #define IMAGE_REL_BASED_SECTION 6
3667 #define IMAGE_REL_BASED_REL 7
3668 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3669 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3670 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3671 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3672 #define IMAGE_REL_BASED_DIR64 10
3673 #define IMAGE_REL_BASED_HIGH3ADJ 11
3674 
3675 /* I386 relocation types */
3676 #define IMAGE_REL_I386_ABSOLUTE 0
3677 #define IMAGE_REL_I386_DIR16 1
3678 #define IMAGE_REL_I386_REL16 2
3679 #define IMAGE_REL_I386_DIR32 6
3680 #define IMAGE_REL_I386_DIR32NB 7
3681 #define IMAGE_REL_I386_SEG12 9
3682 #define IMAGE_REL_I386_SECTION 10
3683 #define IMAGE_REL_I386_SECREL 11
3684 #define IMAGE_REL_I386_TOKEN 12
3685 #define IMAGE_REL_I386_SECREL7 13
3686 #define IMAGE_REL_I386_REL32 20
3687 
3688 /* MIPS relocation types */
3689 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3690 #define IMAGE_REL_MIPS_REFHALF 0x0001
3691 #define IMAGE_REL_MIPS_REFWORD 0x0002
3692 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3693 #define IMAGE_REL_MIPS_REFHI 0x0004
3694 #define IMAGE_REL_MIPS_REFLO 0x0005
3695 #define IMAGE_REL_MIPS_GPREL 0x0006
3696 #define IMAGE_REL_MIPS_LITERAL 0x0007
3697 #define IMAGE_REL_MIPS_SECTION 0x000A
3698 #define IMAGE_REL_MIPS_SECREL 0x000B
3699 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3700 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3701 #define IMAGE_REL_MIPS_TOKEN 0x000E
3702 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3703 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3704 #define IMAGE_REL_MIPS_PAIR 0x0025
3705 
3706 /* ALPHA relocation types */
3707 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3708 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3709 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3710 #define IMAGE_REL_ALPHA_GPREL 0x0003
3711 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3712 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3713 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3714 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3715 #define IMAGE_REL_ALPHA_HINT 0x0008
3716 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3717 #define IMAGE_REL_ALPHA_REFHI 0x000A
3718 #define IMAGE_REL_ALPHA_REFLO 0x000B
3719 #define IMAGE_REL_ALPHA_PAIR 0x000C
3720 #define IMAGE_REL_ALPHA_MATCH 0x000D
3721 #define IMAGE_REL_ALPHA_SECTION 0x000E
3722 #define IMAGE_REL_ALPHA_SECREL 0x000F
3723 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3724 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3725 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3726 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3727 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3728 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3729 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3730 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3731 
3732 /* PowerPC relocation types */
3733 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3734 #define IMAGE_REL_PPC_ADDR64 0x0001
3735 #define IMAGE_REL_PPC_ADDR 0x0002
3736 #define IMAGE_REL_PPC_ADDR24 0x0003
3737 #define IMAGE_REL_PPC_ADDR16 0x0004
3738 #define IMAGE_REL_PPC_ADDR14 0x0005
3739 #define IMAGE_REL_PPC_REL24 0x0006
3740 #define IMAGE_REL_PPC_REL14 0x0007
3741 #define IMAGE_REL_PPC_TOCREL16 0x0008
3742 #define IMAGE_REL_PPC_TOCREL14 0x0009
3743 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3744 #define IMAGE_REL_PPC_SECREL 0x000B
3745 #define IMAGE_REL_PPC_SECTION 0x000C
3746 #define IMAGE_REL_PPC_IFGLUE 0x000D
3747 #define IMAGE_REL_PPC_IMGLUE 0x000E
3748 #define IMAGE_REL_PPC_SECREL16 0x000F
3749 #define IMAGE_REL_PPC_REFHI 0x0010
3750 #define IMAGE_REL_PPC_REFLO 0x0011
3751 #define IMAGE_REL_PPC_PAIR 0x0012
3752 #define IMAGE_REL_PPC_SECRELLO 0x0013
3753 #define IMAGE_REL_PPC_SECRELHI 0x0014
3754 #define IMAGE_REL_PPC_GPREL 0x0015
3755 #define IMAGE_REL_PPC_TOKEN 0x0016
3756 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3757 /* modifier bits */
3758 #define IMAGE_REL_PPC_NEG 0x0100
3759 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3760 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3761 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3762 
3763 /* SH3 relocation types */
3764 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3765 #define IMAGE_REL_SH3_DIRECT16 0x0001
3766 #define IMAGE_REL_SH3_DIRECT 0x0002
3767 #define IMAGE_REL_SH3_DIRECT8 0x0003
3768 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3769 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3770 #define IMAGE_REL_SH3_DIRECT4 0x0006
3771 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3772 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3773 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3774 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3775 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3776 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3777 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3778 #define IMAGE_REL_SH3_SECTION 0x000E
3779 #define IMAGE_REL_SH3_SECREL 0x000F
3780 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3781 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3782 #define IMAGE_REL_SH3_TOKEN 0x0012
3783 
3784 /* ARM relocation types */
3785 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3786 #define IMAGE_REL_ARM_ADDR 0x0001
3787 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3788 #define IMAGE_REL_ARM_BRANCH24 0x0003
3789 #define IMAGE_REL_ARM_BRANCH11 0x0004
3790 #define IMAGE_REL_ARM_TOKEN 0x0005
3791 #define IMAGE_REL_ARM_GPREL12 0x0006
3792 #define IMAGE_REL_ARM_GPREL7 0x0007
3793 #define IMAGE_REL_ARM_BLX24 0x0008
3794 #define IMAGE_REL_ARM_BLX11 0x0009
3795 #define IMAGE_REL_ARM_SECTION 0x000E
3796 #define IMAGE_REL_ARM_SECREL 0x000F
3797 #define IMAGE_REL_ARM_MOV32A 0x0010
3798 #define IMAGE_REL_ARM_MOV32T 0x0011
3799 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3800 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3801 #define IMAGE_REL_ARM_BLX23T 0x0015
3802 
3803 /* ARM64 relocation types */
3804 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3805 #define IMAGE_REL_ARM64_ADDR32 0x0001
3806 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3807 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3808 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3809 #define IMAGE_REL_ARM64_REL21 0x0005
3810 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3811 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3812 #define IMAGE_REL_ARM64_SECREL 0x0008
3813 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3814 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3815 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3816 #define IMAGE_REL_ARM64_TOKEN 0x000C
3817 #define IMAGE_REL_ARM64_SECTION 0x000D
3818 #define IMAGE_REL_ARM64_ADDR64 0x000E
3819 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3820 
3821 /* IA64 relocation types */
3822 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3823 #define IMAGE_REL_IA64_IMM14 0x0001
3824 #define IMAGE_REL_IA64_IMM22 0x0002
3825 #define IMAGE_REL_IA64_IMM64 0x0003
3826 #define IMAGE_REL_IA64_DIR 0x0004
3827 #define IMAGE_REL_IA64_DIR64 0x0005
3828 #define IMAGE_REL_IA64_PCREL21B 0x0006
3829 #define IMAGE_REL_IA64_PCREL21M 0x0007
3830 #define IMAGE_REL_IA64_PCREL21F 0x0008
3831 #define IMAGE_REL_IA64_GPREL22 0x0009
3832 #define IMAGE_REL_IA64_LTOFF22 0x000A
3833 #define IMAGE_REL_IA64_SECTION 0x000B
3834 #define IMAGE_REL_IA64_SECREL22 0x000C
3835 #define IMAGE_REL_IA64_SECREL64I 0x000D
3836 #define IMAGE_REL_IA64_SECREL 0x000E
3837 #define IMAGE_REL_IA64_LTOFF64 0x000F
3838 #define IMAGE_REL_IA64_DIR32NB 0x0010
3839 #define IMAGE_REL_IA64_SREL14 0x0011
3840 #define IMAGE_REL_IA64_SREL22 0x0012
3841 #define IMAGE_REL_IA64_SREL32 0x0013
3842 #define IMAGE_REL_IA64_UREL32 0x0014
3843 #define IMAGE_REL_IA64_PCREL60X 0x0015
3844 #define IMAGE_REL_IA64_PCREL60B 0x0016
3845 #define IMAGE_REL_IA64_PCREL60F 0x0017
3846 #define IMAGE_REL_IA64_PCREL60I 0x0018
3847 #define IMAGE_REL_IA64_PCREL60M 0x0019
3848 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3849 #define IMAGE_REL_IA64_TOKEN 0x001B
3850 #define IMAGE_REL_IA64_GPREL32 0x001C
3851 #define IMAGE_REL_IA64_ADDEND 0x001F
3852 
3853 /* AMD64 relocation types */
3854 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3855 #define IMAGE_REL_AMD64_ADDR64 0x0001
3856 #define IMAGE_REL_AMD64_ADDR32 0x0002
3857 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3858 #define IMAGE_REL_AMD64_REL32 0x0004
3859 #define IMAGE_REL_AMD64_REL32_1 0x0005
3860 #define IMAGE_REL_AMD64_REL32_2 0x0006
3861 #define IMAGE_REL_AMD64_REL32_3 0x0007
3862 #define IMAGE_REL_AMD64_REL32_4 0x0008
3863 #define IMAGE_REL_AMD64_REL32_5 0x0009
3864 #define IMAGE_REL_AMD64_SECTION 0x000A
3865 #define IMAGE_REL_AMD64_SECREL 0x000B
3866 #define IMAGE_REL_AMD64_SECREL7 0x000C
3867 #define IMAGE_REL_AMD64_TOKEN 0x000D
3868 #define IMAGE_REL_AMD64_SREL32 0x000E
3869 #define IMAGE_REL_AMD64_PAIR 0x000F
3870 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3871 
3872 /* archive format */
3873 
3874 #define IMAGE_ARCHIVE_START_SIZE 8
3875 #define IMAGE_ARCHIVE_START "!<arch>\n"
3876 #define IMAGE_ARCHIVE_END "`\n"
3877 #define IMAGE_ARCHIVE_PAD "\n"
3878 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3879 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3880 
3882 {
3883  BYTE Name[16];
3884  BYTE Date[12];
3888  BYTE Size[10];
3891 
3892 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3893 
3895 {
3902  union
3903  {
3906  } DUMMYUNIONNAME;
3907  WORD Type : 2;
3911 
3912 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3913 
3915 {
3920 
3922 {
3928 
3929 typedef struct _ANON_OBJECT_HEADER
3930 {
3939 
3940 /*
3941  * Resource directory stuff
3942  */
3950  /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3952 
3953 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3954 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3955 
3957  union {
3958  struct {
3959  unsigned NameOffset:31;
3960  unsigned NameIsString:1;
3961  } DUMMYSTRUCTNAME;
3964  } DUMMYUNIONNAME;
3965  union {
3967  struct {
3968  unsigned OffsetToDirectory:31;
3969  unsigned DataIsDirectory:1;
3970  } DUMMYSTRUCTNAME2;
3971  } DUMMYUNIONNAME2;
3973 
3974 
3979 
3984 
3991 
3992 
3994  LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3995 );
3996 
3997 typedef struct _IMAGE_TLS_DIRECTORY64 {
4005 
4006 typedef struct _IMAGE_TLS_DIRECTORY32 {
4014 
4015 #ifdef _WIN64
4018 #else
4021 #endif
4022 
4023 typedef struct _IMAGE_DEBUG_DIRECTORY {
4033 
4034 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
4035 #define IMAGE_DEBUG_TYPE_COFF 1
4036 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
4037 #define IMAGE_DEBUG_TYPE_FPO 3
4038 #define IMAGE_DEBUG_TYPE_MISC 4
4039 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
4040 #define IMAGE_DEBUG_TYPE_FIXUP 6
4041 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
4042 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
4043 #define IMAGE_DEBUG_TYPE_BORLAND 9
4044 #define IMAGE_DEBUG_TYPE_RESERVED10 10
4045 #define IMAGE_DEBUG_TYPE_CLSID 11
4046 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
4047 #define IMAGE_DEBUG_TYPE_POGO 13
4048 #define IMAGE_DEBUG_TYPE_ILTCG 14
4049 #define IMAGE_DEBUG_TYPE_MPX 15
4050 #define IMAGE_DEBUG_TYPE_REPRO 16
4051 
4053 {
4061 
4067 
4070 
4074 
4079 
4081 
4085 
4086 typedef struct IMAGE_COR20_HEADER
4087 {
4091 
4094  union {
4097  } DUMMYUNIONNAME;
4098 
4105 
4107 
4118 
4119 #define FRAME_FPO 0
4120 #define FRAME_TRAP 1
4121 #define FRAME_TSS 2
4122 #define FRAME_NONFPO 3
4123 
4124 typedef struct _FPO_DATA {
4136 
4159 
4182 
4183 #ifdef _WIN64
4186 #else
4189 #endif
4190 
4191 typedef struct _IMAGE_FUNCTION_ENTRY {
4196 
4197 #define IMAGE_DEBUG_MISC_EXENAME 1
4198 
4199 typedef struct _IMAGE_DEBUG_MISC {
4204  BYTE Data[ 1 ];
4206 
4207 /* This is the structure that appears at the very start of a .DBG file. */
4208 
4224 
4225 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
4226 
4227 
4233 #define MESSAGE_RESOURCE_UNICODE 0x0001
4234 
4240 
4245 
4246 /*
4247  * Here follows typedefs for security and tokens.
4248  */
4249 
4250 /*
4251  * First a constant for the following typedefs.
4252  */
4253 
4254 #define ANYSIZE_ARRAY 1
4255 
4256 /* FIXME: Orphan. What does it point to? */
4259 typedef PVOID PSID;
4260 
4266 
4267 /*
4268  * TOKEN_INFORMATION_CLASS
4269  */
4270 
4315 
4316 #define DISABLE_MAX_PRIVILEGE 0x1
4317 #define SANDBOX_INERT 0x2
4318 #define LUA_TOKEN 0x4
4319 #define WRITE_RESTRICTED 0x8
4320 
4321 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
4322 #define TOKEN_ADJUST_GROUPS 0x0040
4323 #define TOKEN_ADJUST_PRIVILEGES 0x0020
4324 #define TOKEN_ADJUST_SESSIONID 0x0100
4325 #define TOKEN_ASSIGN_PRIMARY 0x0001
4326 #define TOKEN_DUPLICATE 0x0002
4327 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
4328 #define TOKEN_IMPERSONATE 0x0004
4329 #define TOKEN_QUERY 0x0008
4330 #define TOKEN_QUERY_SOURCE 0x0010
4331 #define TOKEN_ADJUST_DEFAULT 0x0080
4332 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
4333 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
4334  TOKEN_ADJUST_PRIVILEGES | \
4335  TOKEN_ADJUST_GROUPS | \
4336  TOKEN_ADJUST_DEFAULT )
4337 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
4338  TOKEN_ASSIGN_PRIMARY | \
4339  TOKEN_DUPLICATE | \
4340  TOKEN_IMPERSONATE | \
4341  TOKEN_QUERY | \
4342  TOKEN_QUERY_SOURCE | \
4343  TOKEN_ADJUST_PRIVILEGES | \
4344  TOKEN_ADJUST_GROUPS | \
4345  TOKEN_ADJUST_SESSIONID | \
4346  TOKEN_ADJUST_DEFAULT )
4347 
4348 #ifndef _SECURITY_DEFINED
4349 #define _SECURITY_DEFINED
4350 
4352 
4353 typedef struct _GENERIC_MAPPING {
4359 
4360 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
4361 #define SID_IDENTIFIER_AUTHORITY_DEFINED
4362 typedef struct {
4363  BYTE Value[6];
4365 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
4366 
4367 #ifndef SID_DEFINED
4368 #define SID_DEFINED
4369 typedef struct _SID {
4375 #endif /* !defined(SID_DEFINED) */
4376 
4377 #define SID_REVISION (1) /* Current revision */
4378 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
4379 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
4380 
4381 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
4382 
4383 /*
4384  * ACL
4385  */
4386 
4387 #define ACL_REVISION1 1
4388 #define ACL_REVISION2 2
4389 #define ACL_REVISION3 3
4390 #define ACL_REVISION4 4
4391 
4392 #define MIN_ACL_REVISION ACL_REVISION2
4393 #define MAX_ACL_REVISION ACL_REVISION4
4394 
4395 #define ACL_REVISION 2
4396 
4397 typedef struct _ACL {
4403 } ACL, *PACL;
4404 
4406 {
4410 
4412 {
4415 
4417 {
4422 
4423 /* SECURITY_DESCRIPTOR */
4424 #define SECURITY_DESCRIPTOR_REVISION 1
4425 #define SECURITY_DESCRIPTOR_REVISION1 1
4426 
4427 
4428 /*
4429  * Privilege Names
4430  */
4431 #ifdef UNICODE
4432 #if defined(_MSC_VER) || defined(__MINGW32__)
4433 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4434 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4435 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4436 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4437 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4438 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4439 #define SE_TCB_NAME L"SeTcbPrivilege"
4440 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4441 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4442 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4443 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4444 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4445 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4446 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4447 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4448 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4449 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4450 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4451 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4452 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4453 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4454 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4455 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4456 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4457 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4458 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4459 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4460 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4461 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4462 #define SE_TRUSTED_CREDMAN_ACCESS_NAME L"SeTrustedCredManAccessPrivilege"
4463 #define SE_RELABEL_NAME L"SeRelabelPrivilege"
4464 #define SE_INC_WORKING_SET_NAME L"SeIncreaseWorkingSetPrivilege"
4465 #define SE_TIME_ZONE_NAME L"SeTimeZonePrivilege"
4466 #define SE_CREATE_SYMBOLIC_LINK_NAME L"SeCreateSymbolicLinkPrivilege"
4467 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME L"SeDelegateSessionUserImpersonatePrivilege"
4468 #else /* _MSC_VER/__MINGW32__ */
4469 static const WCHAR SE_CREATE_TOKEN_NAME[] = { 'S','e','C','r','e','a','t','e','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
4470 static const WCHAR SE_ASSIGNPRIMARYTOKEN_NAME[] = { 'S','e','A','s','s','i','g','n','P','r','i','m','a','r','y','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
4471 static const WCHAR SE_LOCK_MEMORY_NAME[] = { 'S','e','L','o','c','k','M','e','m','o','r','y','P','r','i','v','i','l','e','g','e',0 };
4472 static const WCHAR SE_INCREASE_QUOTA_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','Q','u','o','t','a','P','r','i','v','i','l','e','g','e',0 };
4473 static const WCHAR SE_UNSOLICITED_INPUT_NAME[] = { 'S','e','U','n','s','o','l','i','c','i','t','e','d','I','n','p','u','t','P','r','i','v','i','l','e','g','e',0 };
4474 static const WCHAR SE_MACHINE_ACCOUNT_NAME[] = { 'S','e','M','a','c','h','i','n','e','A','c','c','o','u','n','t','P','r','i','v','i','l','e','g','e',0 };
4475 static const WCHAR SE_TCB_NAME[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4476 static const WCHAR SE_SECURITY_NAME[] = { 'S','e','S','e','c','u','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
4477 static const WCHAR SE_TAKE_OWNERSHIP_NAME[] = { 'S','e','T','a','k','e','O','w','n','e','r','s','h','i','p','P','r','i','v','i','l','e','g','e',0 };
4478 static const WCHAR SE_LOAD_DRIVER_NAME[] = { 'S','e','L','o','a','d','D','r','i','v','e','r','P','r','i','v','i','l','e','g','e',0 };
4479 static const WCHAR SE_SYSTEM_PROFILE_NAME[] = { 'S','e','S','y','s','t','e','m','P','r','o','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
4480 static const WCHAR SE_SYSTEMTIME_NAME[] = { 'S','e','S','y','s','t','e','m','t','i','m','e','P','r','i','v','i','l','e','g','e',0 };
4481 static const WCHAR SE_PROF_SINGLE_PROCESS_NAME[] = { 'S','e','P','r','o','f','i','l','e','S','i','n','g','l','e','P','r','o','c','e','s','s','P','r','i','v','i','l','e','g','e',0 };
4482 static const WCHAR SE_INC_BASE_PRIORITY_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','B','a','s','e','P','r','i','o','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
4483 static const WCHAR SE_CREATE_PAGEFILE_NAME[] = { 'S','e','C','r','e','a','t','e','P','a','g','e','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
4484 static const WCHAR SE_CREATE_PERMANENT_NAME[] = { 'S','e','C','r','e','a','t','e','P','e','r','m','a','n','e','n','t','P','r','i','v','i','l','e','g','e',0 };
4485 static const WCHAR SE_BACKUP_NAME[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4486 static const WCHAR SE_RESTORE_NAME[] = { 'S','e','R','e','s','t','o','r','e','P','r','i','v','i','l','e','g','e',0 };
4487 static const WCHAR SE_SHUTDOWN_NAME[] = { 'S','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
4488 static const WCHAR SE_DEBUG_NAME[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4489 static const WCHAR SE_AUDIT_NAME[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4490 static const WCHAR SE_SYSTEM_ENVIRONMENT_NAME[] = { 'S','e','S','y','s','t','e','m','E','n','v','i','r','o','n','m','e','n','t','P','r','i','v','i','l','e','g','e',0 };
4491 static const WCHAR SE_CHANGE_NOTIFY_NAME[] = { 'S','e','C','h','a','n','g','e','N','o','t','i','f','y','P','r','i','v','i','l','e','g','e',0 };
4492 static const WCHAR SE_REMOTE_SHUTDOWN_NAME[] = { 'S','e','R','e','m','o','t','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
4493 static const WCHAR SE_UNDOCK_NAME[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4494 static const WCHAR SE_ENABLE_DELEGATION_NAME[] = { 'S','e','E','n','a','b','l','e','D','e','l','e','g','a','t','i','o','n','P','r','i','v','i','l','e','g','e',0 };
4495 static const WCHAR SE_MANAGE_VOLUME_NAME[] = { 'S','e','M','a','n','a','g','e','V','o','l','u','m','e','P','r','i','v','i','l','e','g','e',0 };
4496 static const WCHAR SE_IMPERSONATE_NAME[] = { 'S','e','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 };
4497 static const WCHAR SE_CREATE_GLOBAL_NAME[] = { 'S','e','C','r','e','a','t','e','G','l','o','b','a','l','P','r','i','v','i','l','e','g','e',0 };
4498 static const WCHAR SE_TRUSTED_CREDMAN_ACCESS_NAME[] = { 'S','e','T','r','u','s','t','e','d','C','r','e','d','M','a','n','A','c','c','e','s','s','P','r','i','v','i','l','e','g','e',0 };
4499 static const WCHAR SE_RELABEL_NAME[] = { 'S','e','R','e','l','a','b','e','l','P','r','i','v','i','l','e','g','e',0 };
4500 static const WCHAR SE_INC_WORKING_SET_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','W','o','r','k','i','n','g','S','e','t','P','r','i','v','i','l','e','g','e',0 };
4501 static const WCHAR SE_TIME_ZONE_NAME[] = { 'S','e','T','i','m','e','Z','o','n','e','P','r','i','v','i','l','e','g','e',0 };
4502 static const WCHAR SE_CREATE_SYMBOLIC_LINK_NAME[] = { 'S','e','C','r','e','a','t','e','S','y','m','b','o','l','i','c','L','i','n','k','P','r','i','v','i','l','e','g','e',0 };
4503 static const WCHAR SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME[] = { 'S','e','D','e','l','e','g','a','t','e','S','e','s','s','i','o','n','U','s','e','r','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 };
4504 #endif
4505 #else /* UNICODE */