2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
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.
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.
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
26 #include <winapifamily.h>
27 #include <specstrings.h>
36 #if defined(_MSC_VER) && (defined(__arm__) || defined(__aarch64__))
45 #if defined(_NTSYSTEM_) || defined(WINE_UNIX_LIB)
48 #define NTSYSAPI DECLSPEC_IMPORT
51 #define NTAPI __stdcall
52 #define FASTCALL __fastcall
55 # if defined(_MSC_VER)
56 # define DECLSPEC_IMPORT __declspec(dllimport)
57 # elif defined(__MINGW32__) || defined(__CYGWIN__)
58 # define DECLSPEC_IMPORT __attribute__((dllimport))
60 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
63 # define DECLSPEC_IMPORT
66 #ifndef DECLSPEC_NORETURN
67 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
68 # define DECLSPEC_NORETURN __declspec(noreturn)
69 # elif defined(__GNUC__)
70 # define DECLSPEC_NORETURN __attribute__((noreturn))
72 # define DECLSPEC_NORETURN
76 #ifndef DECLSPEC_ALIGN
77 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
78 # define DECLSPEC_ALIGN(x) __declspec(align(x))
79 # elif defined(__GNUC__)
80 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
82 # define DECLSPEC_ALIGN(x)
86 #ifndef DECLSPEC_NOTHROW
87 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
88 # define DECLSPEC_NOTHROW __declspec(nothrow)
89 # elif defined(__GNUC__)
90 # define DECLSPEC_NOTHROW __attribute__((nothrow))
92 # define DECLSPEC_NOTHROW
96 #ifndef DECLSPEC_CACHEALIGN
97 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
100 #ifndef DECLSPEC_UUID
101 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
102 # define DECLSPEC_UUID(x) __declspec(uuid(x))
104 # define DECLSPEC_UUID(x)
108 #ifndef DECLSPEC_NOVTABLE
109 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
110 # define DECLSPEC_NOVTABLE __declspec(novtable)
112 # define DECLSPEC_NOVTABLE
116 #ifndef DECLSPEC_SELECTANY
117 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
118 #define DECLSPEC_SELECTANY __declspec(selectany)
119 #elif defined(__MINGW32__)
120 #define DECLSPEC_SELECTANY __attribute__((selectany))
121 #elif defined(__GNUC__)
122 #define DECLSPEC_SELECTANY __attribute__((weak))
124 #define DECLSPEC_SELECTANY
129 # if defined(_MSC_VER)
130 # if (_MSC_VER >= 1210)
131 # define NOP_FUNCTION __noop
133 # define NOP_FUNCTION (void)0
136 # define NOP_FUNCTION(...)
140 #ifndef DECLSPEC_ADDRSAFE
141 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
142 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
144 # define DECLSPEC_ADDRSAFE
149 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
150 # define FORCEINLINE __forceinline
151 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
152 # define FORCEINLINE inline __attribute__((always_inline))
154 # define FORCEINLINE inline
158 #ifndef DECLSPEC_DEPRECATED
159 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
160 # define DECLSPEC_DEPRECATED __declspec(deprecated)
161 # define DEPRECATE_SUPPORTED
162 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
163 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
164 # define DEPRECATE_SUPPORTED
166 # define DECLSPEC_DEPRECATED
167 # undef DEPRECATE_SUPPORTED
171 /* a couple of useful Wine extensions */
174 # define DECLSPEC_EXPORT __declspec(dllexport)
175 #elif defined(__MINGW32__)
176 # define DECLSPEC_EXPORT __attribute__((dllexport))
177 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) && !defined(__sun)
178 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
180 # define DECLSPEC_EXPORT
183 #ifndef DECLSPEC_HIDDEN
184 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || defined(__sun)
185 # define DECLSPEC_HIDDEN
186 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
187 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
189 # define DECLSPEC_HIDDEN
193 #ifndef __has_attribute
194 # define __has_attribute(x) 0
197 #if ((defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) || __has_attribute(ms_hook_prologue)) && (defined(__i386__) || defined(__x86_64__))
198 #define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__))
200 #define DECLSPEC_HOTPATCH
203 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
204 #define __WINE_ALLOC_SIZE(...) __attribute__((__alloc_size__(__VA_ARGS__)))
206 #define __WINE_ALLOC_SIZE(...)
209 #if defined(__GNUC__) && (__GNUC__ > 10)
210 #define __WINE_DEALLOC(...) __attribute__((malloc (__VA_ARGS__)))
212 #define __WINE_DEALLOC(...)
215 #if defined(__GNUC__) && (__GNUC__ > 2)
216 #define __WINE_MALLOC __attribute__((malloc))
218 #define __WINE_MALLOC
221 /* Anonymous union/struct handling */
223 #ifndef NONAMELESSSTRUCT
225 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
226 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
227 # define NONAMELESSSTRUCT
229 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
230 # define NONAMELESSSTRUCT
232 #endif /* NONAMELESSSTRUCT */
234 #ifndef NONAMELESSUNION
236 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
237 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
238 # define NONAMELESSUNION
240 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
241 # define NONAMELESSUNION
243 #endif /* NONAMELESSUNION */
245 #undef DUMMYSTRUCTNAME
246 #undef DUMMYSTRUCTNAME1
247 #undef DUMMYSTRUCTNAME2
248 #undef DUMMYSTRUCTNAME3
249 #undef DUMMYSTRUCTNAME4
250 #undef DUMMYSTRUCTNAME5
251 #ifndef NONAMELESSSTRUCT
252 #define DUMMYSTRUCTNAME
253 #define DUMMYSTRUCTNAME1
254 #define DUMMYSTRUCTNAME2
255 #define DUMMYSTRUCTNAME3
256 #define DUMMYSTRUCTNAME4
257 #define DUMMYSTRUCTNAME5
258 #else /* !defined(NONAMELESSSTRUCT) */
259 #define DUMMYSTRUCTNAME s
260 #define DUMMYSTRUCTNAME1 s1
261 #define DUMMYSTRUCTNAME2 s2
262 #define DUMMYSTRUCTNAME3 s3
263 #define DUMMYSTRUCTNAME4 s4
264 #define DUMMYSTRUCTNAME5 s5
265 #endif /* !defined(NONAMELESSSTRUCT) */
267 #undef DUMMYUNIONNAME
268 #undef DUMMYUNIONNAME1
269 #undef DUMMYUNIONNAME2
270 #undef DUMMYUNIONNAME3
271 #undef DUMMYUNIONNAME4
272 #undef DUMMYUNIONNAME5
273 #undef DUMMYUNIONNAME6
274 #undef DUMMYUNIONNAME7
275 #undef DUMMYUNIONNAME8
276 #ifndef NONAMELESSUNION
277 #define DUMMYUNIONNAME
278 #define DUMMYUNIONNAME1
279 #define DUMMYUNIONNAME2
280 #define DUMMYUNIONNAME3
281 #define DUMMYUNIONNAME4
282 #define DUMMYUNIONNAME5
283 #define DUMMYUNIONNAME6
284 #define DUMMYUNIONNAME7
285 #define DUMMYUNIONNAME8
286 #else /* !defined(NONAMELESSUNION) */
287 #define DUMMYUNIONNAME u
288 #define DUMMYUNIONNAME1 u1
289 #define DUMMYUNIONNAME2 u2
290 #define DUMMYUNIONNAME3 u3
291 #define DUMMYUNIONNAME4 u4
292 #define DUMMYUNIONNAME5 u5
293 #define DUMMYUNIONNAME6 u6
294 #define DUMMYUNIONNAME7 u7
295 #define DUMMYUNIONNAME8 u8
296 #endif /* !defined(NONAMELESSUNION) */
298 #undef __C89_NAMELESS
299 #undef __C89_NAMELESSSTRUCTNAME
300 #undef __C89_NAMELESSSTRUCTNAME1
301 #undef __C89_NAMELESSSTRUCTNAME2
302 #undef __C89_NAMELESSSTRUCTNAME3
303 #undef __C89_NAMELESSSTRUCTNAME4
304 #undef __C89_NAMELESSSTRUCTNAME5
305 #undef __C89_NAMELESSUNIONNAME
306 #undef __C89_NAMELESSUNIONNAME1
307 #undef __C89_NAMELESSUNIONNAME2
308 #undef __C89_NAMELESSUNIONNAME3
309 #undef __C89_NAMELESSUNIONNAME4
310 #undef __C89_NAMELESSUNIONNAME5
311 #undef __C89_NAMELESSUNIONNAME6
312 #undef __C89_NAMELESSUNIONNAME7
313 #undef __C89_NAMELESSUNIONNAME8
315 #if !defined(WINE_NO_NAMELESS_EXTENSION)
317 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
318 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
319 # define __C89_NAMELESS __extension__
321 # elif defined(_MSC_VER)
322 # define __C89_NAMELESS
326 #ifdef __C89_NAMELESS
327 # define __C89_NAMELESSSTRUCTNAME
328 # define __C89_NAMELESSSTRUCTNAME1
329 # define __C89_NAMELESSSTRUCTNAME2
330 # define __C89_NAMELESSSTRUCTNAME3
331 # define __C89_NAMELESSSTRUCTNAME4
332 # define __C89_NAMELESSSTRUCTNAME5
333 # define __C89_NAMELESSUNIONNAME
334 # define __C89_NAMELESSUNIONNAME1
335 # define __C89_NAMELESSUNIONNAME2
336 # define __C89_NAMELESSUNIONNAME3
337 # define __C89_NAMELESSUNIONNAME4
338 # define __C89_NAMELESSUNIONNAME5
339 # define __C89_NAMELESSUNIONNAME6
340 # define __C89_NAMELESSUNIONNAME7
341 # define __C89_NAMELESSUNIONNAME8
343 # define __C89_NAMELESS
344 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
345 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
346 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
347 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
348 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
349 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
350 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
351 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
352 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
353 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
354 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
355 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
356 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
357 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
358 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
361 /* C99 restrict support */
363 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
364 # if defined(_MSC_VER) && defined(_M_MRX000)
365 # define RESTRICTED_POINTER __restrict
366 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
367 # define RESTRICTED_POINTER __restrict
369 # define RESTRICTED_POINTER
372 # define RESTRICTED_POINTER
375 /* C99 unaligned support */
378 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
379 # define UNALIGNED __unaligned
381 # define UNALIGNED64 __unaligned
391 /* Alignment macros */
394 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
395 #define MEMORY_ALLOCATION_ALIGNMENT 16
397 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
398 #define MEMORY_ALLOCATION_ALIGNMENT 8
401 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
402 # define TYPE_ALIGNMENT(t) __alignof(t)
403 #elif defined(__GNUC__)
404 # define TYPE_ALIGNMENT(t) __alignof__(t)
406 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
410 # define PROBE_ALIGNMENT(_s) \
411 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
412 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
413 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
415 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
418 /* Compile time assertion */
420 #define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
422 /* Eliminate Microsoft C/C++ compiler warning 4715 */
423 #if defined(_MSC_VER) && (_MSC_VER > 1200)
424 # define DEFAULT_UNREACHABLE default: __assume(0)
425 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
426 # define DEFAULT_UNREACHABLE default: __builtin_unreachable()
428 # define DEFAULT_UNREACHABLE default:
432 #define APPLICATION_ERROR_MASK 0x20000000
433 #define ERROR_SEVERITY_SUCCESS 0x00000000
434 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
435 #define ERROR_SEVERITY_WARNING 0x80000000
436 #define ERROR_SEVERITY_ERROR 0xC0000000
439 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
441 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
442 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
443 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
444 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
445 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
446 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
447 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
450 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
453 /* Microsoft's macros for declaring functions */
456 # define EXTERN_C extern "C"
458 # define EXTERN_C extern
461 #define STDMETHODCALLTYPE WINAPI
462 #define STDMETHODVCALLTYPE WINAPIV
463 #define STDAPICALLTYPE WINAPI
464 #define STDAPIVCALLTYPE WINAPIV
466 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
467 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
468 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
469 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
470 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
471 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
472 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
473 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
475 /* Define the basic types */
480 typedef VOID
*PVOID64
;
481 typedef BYTE BOOLEAN
, *PBOOLEAN
;
482 typedef char CHAR
, *PCHAR
;
483 typedef short SHORT
, *PSHORT
;
484 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
485 typedef long LONG
, *PLONG
;
487 typedef int LONG
, *PLONG
;
490 /* Some systems might have wchar_t, but we really need 16 bit characters */
491 #if defined(WINE_UNICODE_NATIVE)
492 typedef wchar_t WCHAR
;
493 #elif __cpp_unicode_literals >= 200710
494 typedef char16_t WCHAR
;
496 typedef unsigned short WCHAR
;
498 typedef WCHAR
*PWCHAR
;
500 typedef ULONG UCSCHAR
;
501 #define MIN_UCSCHAR (0)
502 #define MAX_UCSCHAR (0x0010ffff)
503 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
505 /* 'Extended/Wide' numerical types */
509 typedef signed __int64 LONGLONG
, *PLONGLONG
;
510 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
512 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
513 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
520 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
522 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
526 /* ANSI string types */
527 typedef CHAR
*PCH
, *LPCH
, *PNZCH
;
528 typedef const CHAR
*PCCH
, *LPCCH
, *PCNZCH
;
529 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
530 typedef const CHAR
*PCSTR
, *LPCSTR
;
531 typedef CHAR
*PZZSTR
;
532 typedef const CHAR
*PCZZSTR
;
534 /* Unicode string types */
535 typedef const WCHAR
*PCWCHAR
, *LPCUWCHAR
, *PCUWCHAR
;
536 typedef WCHAR
*PWCH
, *LPWCH
;
537 typedef const WCHAR
*PCWCH
, *LPCWCH
;
538 typedef WCHAR
*PNZWCH
, *PUNZWCH
;
539 typedef const WCHAR
*PCNZWCH
, *PCUNZWCH
;
540 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
541 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
542 typedef WCHAR
*PZZWSTR
, *PUZZWSTR
;
543 typedef const WCHAR
*PCZZWSTR
, *PCUZZWSTR
;
544 typedef PWSTR
*PZPWSTR
;
545 typedef PCWSTR
*PZPCWSTR
;
547 /* Neutral character and string types */
548 /* These are only defined for Winelib, i.e. _not_ defined for
549 * the emulator. The reason is they depend on the UNICODE
550 * macro which only exists in the user's code.
552 #ifndef WINE_NO_UNICODE_MACROS
554 # ifndef _TCHAR_DEFINED
555 typedef WCHAR TCHAR
, *PTCHAR
;
556 # define _TCHAR_DEFINED
558 typedef LPWCH PTCH
, LPTCH
;
559 typedef LPCWCH PCTCH
, LPCTCH
;
560 typedef LPWSTR PTSTR
, LPTSTR
;
561 typedef LPCWSTR PCTSTR
, LPCTSTR
;
562 typedef LPWSTR PUTSTR
, LPUTSTR
;
563 typedef LPCWSTR PCUTSTR
, LPCUTSTR
;
564 typedef PNZWCH PNZTCH
;
565 typedef PUNZWCH PUNZTCH
;
566 typedef PCNZWCH PCNZTCH
;
567 typedef PCUNZWCH PCUNZTCH
;
568 typedef PZZWSTR PZZTSTR
;
569 typedef PCZZWSTR PCZZTSTR
;
570 typedef PUZZWSTR PUZZTSTR
;
571 typedef PCUZZWSTR PCUZZTSTR
;
573 # ifndef _TCHAR_DEFINED
574 typedef CHAR TCHAR
, *PTCHAR
;
575 # define _TCHAR_DEFINED
577 typedef LPCH PTCH
, LPTCH
;
578 typedef LPCCH PCTCH
, LPCTCH
;
579 typedef LPSTR PTSTR
, LPTSTR
;
580 typedef LPCSTR PCTSTR
, LPCTSTR
;
581 typedef PNZCH PNZTCH
, PUNZTCH
;
582 typedef PCNZCH PCNZTCH
, PCUNZTCH
;
583 typedef PZZSTR PZZTSTR
, PUZZTSTR
;
584 typedef PCZZSTR PCZZTSTR
, PCUZZTSTR
;
585 # endif /* UNICODE */
586 #endif /* WINE_NO_UNICODE_MACROS */
588 /* UCS string types */
589 typedef UCSCHAR
*PUCSCHAR
, *PUUCSCHAR
;
590 typedef const UCSCHAR
*PCUCSCHAR
, *PCUUCSCHAR
;
591 typedef UCSCHAR
*PUCSSTR
, *PUUCSSTR
;
592 typedef const UCSCHAR
*PCUCSSTR
, *PCUUCSSTR
;
594 /* Misc common WIN32 types */
596 typedef DWORD LCID
, *PLCID
;
598 typedef DWORD EXECUTION_STATE
;
599 #ifndef _HRESULT_DEFINED
600 #define _HRESULT_DEFINED
601 typedef LONG HRESULT
;
606 typedef void *HANDLE
;
607 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
610 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
612 #define DECLARE_HANDLE(a) typedef HANDLE a
619 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
621 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
622 # define __MSABI_LONG(x) x ## l
624 # define __MSABI_LONG(x) x
630 #ifndef WIN32_NO_STATUS
632 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
633 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
634 #define STATUS_USER_APC ((DWORD) 0x000000C0)
635 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
636 #define STATUS_PENDING ((DWORD) 0x00000103)
637 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
638 #define STATUS_FATAL_APP_EXIT ((DWORD) 0x40000015)
639 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
640 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
641 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
642 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
643 #define STATUS_LONGJUMP ((DWORD) 0x80000026)
644 #define STATUS_UNWIND_CONSOLIDATE ((DWORD) 0x80000029)
645 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
646 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
647 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
648 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
649 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
650 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
651 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
652 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
653 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
654 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
655 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
656 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
657 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
658 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
659 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
660 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
661 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
662 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
663 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
664 #define STATUS_DLL_NOT_FOUND ((DWORD) 0xC0000135)
665 #define STATUS_ORDINAL_NOT_FOUND ((DWORD) 0xC0000138)
666 #define STATUS_ENTRYPOINT_NOT_FOUND ((DWORD) 0xC0000139)
667 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
668 #define STATUS_DLL_INIT_FAILED ((DWORD) 0xC0000142)
669 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
670 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
671 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
672 #define STATUS_HEAP_CORRUPTION ((DWORD) 0xC0000374)
673 #define STATUS_STACK_BUFFER_OVERRUN ((DWORD) 0xC0000409)
674 #define STATUS_INVALID_CRUNTIME_PARAMETER ((DWORD) 0xC0000417)
675 #define STATUS_ASSERTION_FAILURE ((DWORD) 0xC0000420)
676 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
677 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
679 /* status values for ContinueDebugEvent */
680 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
681 #define DBG_CONTINUE ((DWORD) 0x00010002)
682 #define DBG_REPLY_LATER ((DWORD) 0x40010001)
683 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
684 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
685 #define DBG_CONTROL_C ((DWORD) 0x40010005)
686 #define DBG_PRINTEXCEPTION_C ((DWORD) 0x40010006)
687 #define DBG_RIPEXCEPTION ((DWORD) 0x40010007)
688 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
689 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
690 #define DBG_PRINTEXCEPTION_WIDE_C ((DWORD) 0x4001000A)
691 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
693 #endif /* WIN32_NO_STATUS */
695 /* Argument 1 passed to the DllEntryProc. */
696 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
697 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
698 #define DLL_THREAD_ATTACH 2 /* attach new thread */
699 #define DLL_THREAD_DETACH 3 /* detach thread */
701 /* u.x.wProcessorArchitecture (NT) */
702 #define PROCESSOR_ARCHITECTURE_INTEL 0
703 #define PROCESSOR_ARCHITECTURE_MIPS 1
704 #define PROCESSOR_ARCHITECTURE_ALPHA 2
705 #define PROCESSOR_ARCHITECTURE_PPC 3
706 #define PROCESSOR_ARCHITECTURE_SHX 4
707 #define PROCESSOR_ARCHITECTURE_ARM 5
708 #define PROCESSOR_ARCHITECTURE_IA64 6
709 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
710 #define PROCESSOR_ARCHITECTURE_MSIL 8
711 #define PROCESSOR_ARCHITECTURE_AMD64 9
712 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
713 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
714 #define PROCESSOR_ARCHITECTURE_ARM64 12
715 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
716 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14
717 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
719 /* dwProcessorType */
720 #define PROCESSOR_INTEL_386 386
721 #define PROCESSOR_INTEL_486 486
722 #define PROCESSOR_INTEL_PENTIUM 586
723 #define PROCESSOR_INTEL_860 860
724 #define PROCESSOR_INTEL_IA64 2200
725 #define PROCESSOR_AMD_X8664 8664
726 #define PROCESSOR_MIPS_R2000 2000
727 #define PROCESSOR_MIPS_R3000 3000
728 #define PROCESSOR_MIPS_R4000 4000
729 #define PROCESSOR_ALPHA_21064 21064
730 #define PROCESSOR_PPC_601 601
731 #define PROCESSOR_PPC_603 603
732 #define PROCESSOR_PPC_604 604
733 #define PROCESSOR_PPC_620 620
734 #define PROCESSOR_HITACHI_SH3 10003
735 #define PROCESSOR_HITACHI_SH3E 10004
736 #define PROCESSOR_HITACHI_SH4 10005
737 #define PROCESSOR_MOTOROLA_821 821
738 #define PROCESSOR_SHx_SH3 103
739 #define PROCESSOR_SHx_SH4 104
740 #define PROCESSOR_STRONGARM 2577
741 #define PROCESSOR_ARM720 1824 /* 0x720 */
742 #define PROCESSOR_ARM820 2080 /* 0x820 */
743 #define PROCESSOR_ARM920 2336 /* 0x920 */
744 #define PROCESSOR_ARM_7TDMI 70001
745 #define PROCESSOR_OPTIL 18767
748 #define MAXIMUM_PROCESSORS 64
750 #define MAXIMUM_PROCESSORS 32
753 typedef struct _MEMORY_BASIC_INFORMATION
756 LPVOID AllocationBase
;
757 DWORD AllocationProtect
;
762 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
764 typedef struct _MEM_ADDRESS_REQUIREMENTS
766 void *LowestStartingAddress
;
767 void *HighestEndingAddress
;
769 } MEM_ADDRESS_REQUIREMENTS
, *PMEM_ADDRESS_REQUIREMENTS
;
771 #define MEM_EXTENDED_PARAMETER_TYPE_BITS 8
773 typedef enum MEM_EXTENDED_PARAMETER_TYPE
{
774 MemExtendedParameterInvalidType
= 0,
775 MemExtendedParameterAddressRequirements
,
776 MemExtendedParameterNumaNode
,
777 MemExtendedParameterPartitionHandle
,
778 MemExtendedParameterUserPhysicalHandle
,
779 MemExtendedParameterAttributeFlags
,
780 MemExtendedParameterImageMachine
,
781 MemExtendedParameterMax
782 } MEM_EXTENDED_PARAMETER_TYPE
, *PMEM_EXTENDED_PARAMETER_TYPE
;
784 typedef struct DECLSPEC_ALIGN(8) MEM_EXTENDED_PARAMETER
{
787 DWORD64 Type
: MEM_EXTENDED_PARAMETER_TYPE_BITS
;
788 DWORD64 Reserved
: 64 - MEM_EXTENDED_PARAMETER_TYPE_BITS
;
799 } MEM_EXTENDED_PARAMETER
, *PMEM_EXTENDED_PARAMETER
;
801 #define MEM_EXTENDED_PARAMETER_GRAPHICS 0x00000001
802 #define MEM_EXTENDED_PARAMETER_NONPAGED 0x00000002
803 #define MEM_EXTENDED_PARAMETER_ZERO_PAGES_OPTIONAL 0x00000004
804 #define MEM_EXTENDED_PARAMETER_NONPAGED_LARGE 0x00000008
805 #define MEM_EXTENDED_PARAMETER_NONPAGED_HUGE 0x00000010
806 #define MEM_EXTENDED_PARAMETER_SOFT_FAULT_PAGES 0x00000020
807 #define MEM_EXTENDED_PARAMETER_EC_CODE 0x00000040
808 #define MEM_EXTENDED_PARAMETER_IMAGE_NO_HPAT 0x00000080
810 #define PAGE_NOACCESS 0x01
811 #define PAGE_READONLY 0x02
812 #define PAGE_READWRITE 0x04
813 #define PAGE_WRITECOPY 0x08
814 #define PAGE_EXECUTE 0x10
815 #define PAGE_EXECUTE_READ 0x20
816 #define PAGE_EXECUTE_READWRITE 0x40
817 #define PAGE_EXECUTE_WRITECOPY 0x80
818 #define PAGE_GUARD 0x100
819 #define PAGE_NOCACHE 0x200
820 #define PAGE_WRITECOMBINE 0x400
822 #define MEM_COMMIT 0x00001000
823 #define MEM_RESERVE 0x00002000
824 #define MEM_REPLACE_PLACEHOLDER 0x00004000
825 #define MEM_RESERVE_PLACEHOLDER 0x00040000
826 #define MEM_RESET 0x00080000
827 #define MEM_TOP_DOWN 0x00100000
828 #define MEM_PHYSICAL 0x00400000
829 #define MEM_RESET_UNDO 0x10000000
830 #define MEM_LARGE_PAGES 0x20000000
832 #define MEM_COALESCE_PLACEHOLDERS 0x00000001
833 #define MEM_PRESERVE_PLACEHOLDER 0x00000002
834 #define MEM_DECOMMIT 0x00004000
835 #define MEM_RELEASE 0x00008000
837 #define MEM_FREE 0x00010000
838 #define MEM_PRIVATE 0x00020000
839 #define MEM_MAPPED 0x00040000
840 #define MEM_WRITE_WATCH 0x00200000
841 #define MEM_4MB_PAGES 0x80000000
843 #define SEC_FILE 0x00800000
844 #define SEC_IMAGE 0x01000000
845 #define SEC_PROTECTED_IMAGE 0x02000000
846 #define SEC_RESERVE 0x04000000
847 #define SEC_COMMIT 0x08000000
848 #define SEC_NOCACHE 0x10000000
849 #define SEC_WRITECOMBINE 0x40000000
850 #define SEC_LARGE_PAGES 0x80000000
851 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
852 #define MEM_IMAGE SEC_IMAGE
854 #define WRITE_WATCH_FLAG_RESET 0x00000001
856 #define AT_ROUND_TO_PAGE 0x40000000
860 #define MINSHORT 0x8000
861 #define MAXSHORT 0x7fff
862 #define MINLONG 0x80000000
863 #define MAXLONG 0x7fffffff
865 #define MAXWORD 0xffff
866 #define MAXDWORD 0xffffffff
867 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
869 #define UNICODE_STRING_MAX_CHARS 32767
871 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
872 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
873 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
875 #define CONTAINING_RECORD(address, type, field) \
876 ((type *)((PCHAR)(address) - offsetof(type, field)))
878 #define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
880 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
885 typedef struct _LIST_ENTRY
{
886 struct _LIST_ENTRY
*Flink
;
887 struct _LIST_ENTRY
*Blink
;
888 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
890 typedef struct _SINGLE_LIST_ENTRY
{
891 struct _SINGLE_LIST_ENTRY
*Next
;
892 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
896 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
897 struct _SLIST_ENTRY
*Next
;
898 } SLIST_ENTRY
, *PSLIST_ENTRY
;
900 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
907 ULONGLONG Sequence
:9;
908 ULONGLONG NextEntry
:39;
909 ULONGLONG HeaderType
:1;
911 ULONGLONG Reserved
:59;
916 ULONGLONG Sequence
:48;
917 ULONGLONG HeaderType
:1;
919 ULONGLONG Reserved
:2;
920 ULONGLONG NextEntry
:60;
922 } SLIST_HEADER
, *PSLIST_HEADER
;
926 #undef SLIST_ENTRY /* for Mac OS */
927 #define SLIST_ENTRY SINGLE_LIST_ENTRY
928 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
929 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
931 typedef union _SLIST_HEADER
{
938 } SLIST_HEADER
, *PSLIST_HEADER
;
942 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
943 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
944 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
945 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
946 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
947 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
950 /* Fast fail (__fastfail) codes */
952 #define FAST_FAIL_LEGACY_GS_VIOLATION 0
953 #define FAST_FAIL_VTGUARD_CHECK_FAILURE 1
954 #define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE 2
955 #define FAST_FAIL_CORRUPT_LIST_ENTRY 3
956 #define FAST_FAIL_INCORRECT_STACK 4
957 #define FAST_FAIL_INVALID_ARG 5
958 #define FAST_FAIL_GS_COOKIE_INIT 6
959 #define FAST_FAIL_FATAL_APP_EXIT 7
960 #define FAST_FAIL_RANGE_CHECK_FAILURE 8
961 #define FAST_FAIL_UNSAFE_REGISTRY_ACCESS 9
962 #define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE 10
963 #define FAST_FAIL_GUARD_WRITE_CHECK_FAILURE 11
964 #define FAST_FAIL_INVALID_FIBER_SWITCH 12
965 #define FAST_FAIL_INVALID_SET_OF_CONTEXT 13
966 #define FAST_FAIL_INVALID_REFERENCE_COUNT 14
967 #define FAST_FAIL_INVALID_JUMP_BUFFER 18
968 #define FAST_FAIL_MRDATA_MODIFIED 19
969 #define FAST_FAIL_CERTIFICATION_FAILURE 20
970 #define FAST_FAIL_INVALID_EXCEPTION_CHAIN 21
971 #define FAST_FAIL_CRYPTO_LIBRARY 22
972 #define FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT 23
973 #define FAST_FAIL_INVALID_IMAGE_BASE 24
974 #define FAST_FAIL_DLOAD_PROTECTION_FAILURE 25
975 #define FAST_FAIL_UNSAFE_EXTENSION_CALL 26
976 #define FAST_FAIL_DEPRECATED_SERVICE_INVOKED 27
977 #define FAST_FAIL_INVALID_BUFFER_ACCESS 28
978 #define FAST_FAIL_INVALID_BALANCED_TREE 29
979 #define FAST_FAIL_INVALID_NEXT_THREAD 30
980 #define FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED 31
981 #define FAST_FAIL_APCS_DISABLED 32
982 #define FAST_FAIL_INVALID_IDLE_STATE 33
983 #define FAST_FAIL_MRDATA_PROTECTION_FAILURE 34
984 #define FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION 35
985 #define FAST_FAIL_INVALID_LOCK_STATE 36
986 #define FAST_FAIL_GUARD_JUMPTABLE 37
987 #define FAST_FAIL_INVALID_LONGJUMP_TARGET 38
988 #define FAST_FAIL_INVALID_DISPATCH_CONTEXT 39
989 #define FAST_FAIL_INVALID_THREAD 40
990 #define FAST_FAIL_INVALID_SYSCALL_NUMBER 41
991 #define FAST_FAIL_INVALID_FILE_OPERATION 42
992 #define FAST_FAIL_LPAC_ACCESS_DENIED 43
993 #define FAST_FAIL_GUARD_SS_FAILURE 44
994 #define FAST_FAIL_LOADER_CONTINUITY_FAILURE 45
995 #define FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE 46
996 #define FAST_FAIL_INVALID_CONTROL_STACK 47
997 #define FAST_FAIL_SET_CONTEXT_DENIED 48
998 #define FAST_FAIL_INVALID_IAT 49
999 #define FAST_FAIL_HEAP_METADATA_CORRUPTION 50
1000 #define FAST_FAIL_PAYLOAD_RESTRICTION_VIOLATION 51
1001 #define FAST_FAIL_LOW_LABEL_ACCESS_DENIED 52
1002 #define FAST_FAIL_ENCLAVE_CALL_FAILURE 53
1003 #define FAST_FAIL_UNHANDLED_LSS_EXCEPTON 54
1004 #define FAST_FAIL_ADMINLESS_ACCESS_DENIED 55
1005 #define FAST_FAIL_UNEXPECTED_CALL 56
1006 #define FAST_FAIL_CONTROL_INVALID_RETURN_ADDRESS 57
1007 #define FAST_FAIL_UNEXPECTED_HOST_BEHAVIOR 58
1008 #define FAST_FAIL_FLAGS_CORRUPTION 59
1009 #define FAST_FAIL_VEH_CORRUPTION 60
1010 #define FAST_FAIL_ETW_CORRUPTION 61
1011 #define FAST_FAIL_RIO_ABORT 62
1012 #define FAST_FAIL_INVALID_PFN 63
1013 #define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE_XFG 64
1014 #define FAST_FAIL_CAST_GUARD 65
1015 #define FAST_FAIL_HOST_VISIBILITY_CHANGE 66
1016 #define FAST_FAIL_KERNEL_CET_SHADOW_STACK_ASSIST 67
1017 #define FAST_FAIL_PATCH_CALLBACK_FAILED 68
1018 #define FAST_FAIL_NTDLL_PATCH_FAILED 69
1019 #define FAST_FAIL_INVALID_FLS_DATA 70
1020 #define FAST_FAIL_INVALID_FAST_FAIL_CODE 0xFFFFFFFF
1024 #define HEAP_NO_SERIALIZE 0x00000001
1025 #define HEAP_GROWABLE 0x00000002
1026 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
1027 #define HEAP_ZERO_MEMORY 0x00000008
1028 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
1029 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
1030 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
1031 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
1032 #define HEAP_CREATE_ALIGN_16 0x00010000
1033 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
1034 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
1036 /* This flag allows it to create heaps shared by all processes under win95,
1037 FIXME: correct name */
1038 #define HEAP_SHARED 0x04000000
1040 typedef enum _HEAP_INFORMATION_CLASS
{
1041 HeapCompatibilityInformation
,
1042 } HEAP_INFORMATION_CLASS
;
1044 /* Processor feature flags. */
1045 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
1046 #define PF_FLOATING_POINT_EMULATED 1
1047 #define PF_COMPARE_EXCHANGE_DOUBLE 2
1048 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
1049 #define PF_PPC_MOVEMEM_64BIT_OK 4
1050 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
1051 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
1052 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
1053 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
1054 #define PF_PAE_ENABLED 9
1055 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
1056 #define PF_SSE_DAZ_MODE_AVAILABLE 11
1057 #define PF_NX_ENABLED 12
1058 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
1059 #define PF_COMPARE_EXCHANGE128 14
1060 #define PF_COMPARE64_EXCHANGE128 15
1061 #define PF_CHANNELS_ENABLED 16
1062 #define PF_XSAVE_ENABLED 17
1063 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
1064 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
1065 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
1066 #define PF_VIRT_FIRMWARE_ENABLED 21
1067 #define PF_RDWRFSGSBASE_AVAILABLE 22
1068 #define PF_FASTFAIL_AVAILABLE 23
1069 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
1070 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
1071 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
1072 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
1073 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
1074 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
1075 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
1076 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
1077 #define PF_RDTSCP_INSTRUCTION_AVAILABLE 32
1078 #define PF_RDPID_INSTRUCTION_AVAILABLE 33
1079 #define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
1080 #define PF_MONITORX_INSTRUCTION_AVAILABLE 35
1081 #define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
1082 #define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
1083 #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
1084 #define PF_AVX_INSTRUCTIONS_AVAILABLE 39
1085 #define PF_AVX2_INSTRUCTIONS_AVAILABLE 40
1086 #define PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
1087 #define PF_ERMS_AVAILABLE 42
1088 #define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
1089 #define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44
1090 #define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
1093 /* Execution state flags */
1094 #define ES_SYSTEM_REQUIRED 0x00000001
1095 #define ES_DISPLAY_REQUIRED 0x00000002
1096 #define ES_USER_PRESENT 0x00000004
1097 #define ES_CONTINUOUS 0x80000000
1101 /* The Win32 register context */
1103 /* i386 context definitions */
1105 #define I386_SIZE_OF_80387_REGISTERS 80
1107 typedef struct _I386_FLOATING_SAVE_AREA
1113 DWORD ErrorSelector
;
1116 BYTE RegisterArea
[I386_SIZE_OF_80387_REGISTERS
];
1118 } I386_FLOATING_SAVE_AREA
, WOW64_FLOATING_SAVE_AREA
, *PWOW64_FLOATING_SAVE_AREA
;
1120 #define I386_MAXIMUM_SUPPORTED_EXTENSION 512
1122 #include "pshpack4.h"
1123 typedef struct _I386_CONTEXT
1125 DWORD ContextFlags
; /* 000 */
1127 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1128 DWORD Dr0
; /* 004 */
1129 DWORD Dr1
; /* 008 */
1130 DWORD Dr2
; /* 00c */
1131 DWORD Dr3
; /* 010 */
1132 DWORD Dr6
; /* 014 */
1133 DWORD Dr7
; /* 018 */
1135 /* These are selected by CONTEXT_FLOATING_POINT */
1136 I386_FLOATING_SAVE_AREA FloatSave
; /* 01c */
1138 /* These are selected by CONTEXT_SEGMENTS */
1139 DWORD SegGs
; /* 08c */
1140 DWORD SegFs
; /* 090 */
1141 DWORD SegEs
; /* 094 */
1142 DWORD SegDs
; /* 098 */
1144 /* These are selected by CONTEXT_INTEGER */
1145 DWORD Edi
; /* 09c */
1146 DWORD Esi
; /* 0a0 */
1147 DWORD Ebx
; /* 0a4 */
1148 DWORD Edx
; /* 0a8 */
1149 DWORD Ecx
; /* 0ac */
1150 DWORD Eax
; /* 0b0 */
1152 /* These are selected by CONTEXT_CONTROL */
1153 DWORD Ebp
; /* 0b4 */
1154 DWORD Eip
; /* 0b8 */
1155 DWORD SegCs
; /* 0bc */
1156 DWORD EFlags
; /* 0c0 */
1157 DWORD Esp
; /* 0c4 */
1158 DWORD SegSs
; /* 0c8 */
1160 BYTE ExtendedRegisters
[I386_MAXIMUM_SUPPORTED_EXTENSION
]; /* 0xcc */
1161 } I386_CONTEXT
, WOW64_CONTEXT
, *PWOW64_CONTEXT
;
1162 #include "poppack.h"
1164 #define CONTEXT_i386 0x00010000
1165 #define CONTEXT_i486 0x00010000
1167 #define CONTEXT_I386_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
1168 #define CONTEXT_I386_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
1169 #define CONTEXT_I386_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1170 #define CONTEXT_I386_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1171 #define CONTEXT_I386_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1172 #define CONTEXT_I386_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1173 #define CONTEXT_I386_XSTATE (CONTEXT_i386 | 0x0040)
1174 #define CONTEXT_I386_FULL (CONTEXT_I386_CONTROL | CONTEXT_I386_INTEGER | CONTEXT_I386_SEGMENTS)
1175 #define CONTEXT_I386_ALL (CONTEXT_I386_FULL | CONTEXT_I386_FLOATING_POINT | CONTEXT_I386_DEBUG_REGISTERS | CONTEXT_I386_EXTENDED_REGISTERS)
1179 #define CONTEXT_CONTROL CONTEXT_I386_CONTROL
1180 #define CONTEXT_INTEGER CONTEXT_I386_INTEGER
1181 #define CONTEXT_SEGMENTS CONTEXT_I386_SEGMENTS
1182 #define CONTEXT_FLOATING_POINT CONTEXT_I386_FLOATING_POINT
1183 #define CONTEXT_DEBUG_REGISTERS CONTEXT_I386_DEBUG_REGISTERS
1184 #define CONTEXT_EXTENDED_REGISTERS CONTEXT_I386_EXTENDED_REGISTERS
1185 #define CONTEXT_XSTATE CONTEXT_I386_XSTATE
1186 #define CONTEXT_FULL CONTEXT_I386_FULL
1187 #define CONTEXT_ALL CONTEXT_I386_ALL
1188 #define SIZE_OF_80387_REGISTERS I386_SIZE_OF_80387_REGISTERS
1189 #define MAXIMUM_SUPPORTED_EXTENSION I386_MAXIMUM_SUPPORTED_EXTENSION
1191 typedef I386_FLOATING_SAVE_AREA FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
1192 typedef I386_CONTEXT CONTEXT
, *PCONTEXT
;
1194 #endif /* __i386__ */
1196 typedef struct _LDT_ENTRY
{
1207 unsigned BaseMid
: 8;
1211 unsigned LimitHi
: 4;
1213 unsigned Reserved_0
: 1;
1214 unsigned Default_Big
: 1;
1215 unsigned Granularity
: 1;
1216 unsigned BaseHi
: 8;
1219 } LDT_ENTRY
, *PLDT_ENTRY
, WOW64_LDT_ENTRY
, *PWOW64_LDT_ENTRY
;
1221 typedef struct DECLSPEC_ALIGN(16) _M128A
{
1226 typedef struct _XSAVE_FORMAT
{
1227 WORD ControlWord
; /* 000 */
1228 WORD StatusWord
; /* 002 */
1229 BYTE TagWord
; /* 004 */
1230 BYTE Reserved1
; /* 005 */
1231 WORD ErrorOpcode
; /* 006 */
1232 DWORD ErrorOffset
; /* 008 */
1233 WORD ErrorSelector
; /* 00c */
1234 WORD Reserved2
; /* 00e */
1235 DWORD DataOffset
; /* 010 */
1236 WORD DataSelector
; /* 014 */
1237 WORD Reserved3
; /* 016 */
1238 DWORD MxCsr
; /* 018 */
1239 DWORD MxCsr_Mask
; /* 01c */
1240 M128A FloatRegisters
[8]; /* 020 */
1241 M128A XmmRegisters
[16]; /* 0a0 */
1242 BYTE Reserved4
[96]; /* 1a0 */
1243 } XSAVE_FORMAT
, *PXSAVE_FORMAT
;
1245 /* x86-64 context definitions */
1247 typedef struct _AMD64_RUNTIME_FUNCTION
1252 } AMD64_RUNTIME_FUNCTION
;
1254 #define CONTEXT_AMD64 0x00100000
1256 #define CONTEXT_AMD64_CONTROL (CONTEXT_AMD64 | 0x0001)
1257 #define CONTEXT_AMD64_INTEGER (CONTEXT_AMD64 | 0x0002)
1258 #define CONTEXT_AMD64_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1259 #define CONTEXT_AMD64_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1260 #define CONTEXT_AMD64_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1261 #define CONTEXT_AMD64_XSTATE (CONTEXT_AMD64 | 0x0040)
1262 #define CONTEXT_AMD64_FULL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_FLOATING_POINT)
1263 #define CONTEXT_AMD64_ALL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_SEGMENTS | CONTEXT_AMD64_FLOATING_POINT | CONTEXT_AMD64_DEBUG_REGISTERS)
1265 typedef XSAVE_FORMAT XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
1267 typedef struct DECLSPEC_ALIGN(16) _AMD64_CONTEXT
{
1268 DWORD64 P1Home
; /* 000 */
1269 DWORD64 P2Home
; /* 008 */
1270 DWORD64 P3Home
; /* 010 */
1271 DWORD64 P4Home
; /* 018 */
1272 DWORD64 P5Home
; /* 020 */
1273 DWORD64 P6Home
; /* 028 */
1276 DWORD ContextFlags
; /* 030 */
1277 DWORD MxCsr
; /* 034 */
1280 WORD SegCs
; /* 038 */
1281 WORD SegDs
; /* 03a */
1282 WORD SegEs
; /* 03c */
1283 WORD SegFs
; /* 03e */
1284 WORD SegGs
; /* 040 */
1285 WORD SegSs
; /* 042 */
1286 DWORD EFlags
; /* 044 */
1289 DWORD64 Dr0
; /* 048 */
1290 DWORD64 Dr1
; /* 050 */
1291 DWORD64 Dr2
; /* 058 */
1292 DWORD64 Dr3
; /* 060 */
1293 DWORD64 Dr6
; /* 068 */
1294 DWORD64 Dr7
; /* 070 */
1297 DWORD64 Rax
; /* 078 */
1298 DWORD64 Rcx
; /* 080 */
1299 DWORD64 Rdx
; /* 088 */
1300 DWORD64 Rbx
; /* 090 */
1301 DWORD64 Rsp
; /* 098 */
1302 DWORD64 Rbp
; /* 0a0 */
1303 DWORD64 Rsi
; /* 0a8 */
1304 DWORD64 Rdi
; /* 0b0 */
1305 DWORD64 R8
; /* 0b8 */
1306 DWORD64 R9
; /* 0c0 */
1307 DWORD64 R10
; /* 0c8 */
1308 DWORD64 R11
; /* 0d0 */
1309 DWORD64 R12
; /* 0d8 */
1310 DWORD64 R13
; /* 0e0 */
1311 DWORD64 R14
; /* 0e8 */
1312 DWORD64 R15
; /* 0f0 */
1315 DWORD64 Rip
; /* 0f8 */
1317 /* Floating point */
1319 XMM_SAVE_AREA32 FltSave
; /* 100 */
1321 M128A Header
[2]; /* 100 */
1322 M128A Legacy
[8]; /* 120 */
1323 M128A Xmm0
; /* 1a0 */
1324 M128A Xmm1
; /* 1b0 */
1325 M128A Xmm2
; /* 1c0 */
1326 M128A Xmm3
; /* 1d0 */
1327 M128A Xmm4
; /* 1e0 */
1328 M128A Xmm5
; /* 1f0 */
1329 M128A Xmm6
; /* 200 */
1330 M128A Xmm7
; /* 210 */
1331 M128A Xmm8
; /* 220 */
1332 M128A Xmm9
; /* 230 */
1333 M128A Xmm10
; /* 240 */
1334 M128A Xmm11
; /* 250 */
1335 M128A Xmm12
; /* 260 */
1336 M128A Xmm13
; /* 270 */
1337 M128A Xmm14
; /* 280 */
1338 M128A Xmm15
; /* 290 */
1343 M128A VectorRegister
[26]; /* 300 */
1344 DWORD64 VectorControl
; /* 4a0 */
1347 DWORD64 DebugControl
; /* 4a8 */
1348 DWORD64 LastBranchToRip
; /* 4b0 */
1349 DWORD64 LastBranchFromRip
; /* 4b8 */
1350 DWORD64 LastExceptionToRip
; /* 4c0 */
1351 DWORD64 LastExceptionFromRip
; /* 4c8 */
1356 #define CONTEXT_CONTROL CONTEXT_AMD64_CONTROL
1357 #define CONTEXT_INTEGER CONTEXT_AMD64_INTEGER
1358 #define CONTEXT_SEGMENTS CONTEXT_AMD64_SEGMENTS
1359 #define CONTEXT_FLOATING_POINT CONTEXT_AMD64_FLOATING_POINT
1360 #define CONTEXT_DEBUG_REGISTERS CONTEXT_AMD64_DEBUG_REGISTERS
1361 #define CONTEXT_XSTATE CONTEXT_AMD64_XSTATE
1362 #define CONTEXT_FULL CONTEXT_AMD64_FULL
1363 #define CONTEXT_ALL CONTEXT_AMD64_ALL
1365 typedef AMD64_CONTEXT CONTEXT
, *PCONTEXT
;
1366 typedef AMD64_RUNTIME_FUNCTION RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1368 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1372 PM128A FloatingContext
[16];
1396 PULONG64 IntegerContext
[16];
1417 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1419 #endif /* __x86_64__ */
1421 #define XSTATE_LEGACY_FLOATING_POINT 0
1422 #define XSTATE_LEGACY_SSE 1
1423 #define XSTATE_GSSE 2
1424 #define XSTATE_AVX XSTATE_GSSE
1425 #define XSTATE_MPX_BNDREGS 3
1426 #define XSTATE_MPX_BNDCSR 4
1427 #define XSTATE_AVX512_KMASK 5
1428 #define XSTATE_AVX512_ZMM_H 6
1429 #define XSTATE_AVX512_ZMM 7
1430 #define XSTATE_IPT 8
1431 #define XSTATE_CET_U 11
1432 #define XSTATE_LWP 62
1433 #define MAXIMUM_XSTATE_FEATURES 64
1435 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1 << XSTATE_LEGACY_FLOATING_POINT)
1436 #define XSTATE_MASK_LEGACY_SSE (1 << XSTATE_LEGACY_SSE)
1437 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1438 #define XSTATE_MASK_GSSE (1 << XSTATE_GSSE)
1440 typedef struct _XSTATE_FEATURE
1444 } XSTATE_FEATURE
, *PXSTATE_FEATURE
;
1446 typedef struct _XSTATE_CONFIGURATION
1448 ULONG64 EnabledFeatures
;
1449 ULONG64 EnabledVolatileFeatures
;
1451 ULONG OptimizedSave
:1;
1452 ULONG CompactionEnabled
:1;
1453 XSTATE_FEATURE Features
[MAXIMUM_XSTATE_FEATURES
];
1455 ULONG64 EnabledSupervisorFeatures
;
1456 ULONG64 AlignedFeatures
;
1457 ULONG AllFeatureSize
;
1458 ULONG AllFeatures
[MAXIMUM_XSTATE_FEATURES
];
1459 ULONG64 EnabledUserVisibleSupervisorFeatures
;
1460 } XSTATE_CONFIGURATION
, *PXSTATE_CONFIGURATION
;
1462 typedef struct _YMMCONTEXT
1481 YMMCONTEXT
, *PYMMCONTEXT
;
1483 typedef struct _XSTATE
1486 ULONG64 CompactionMask
;
1487 ULONG64 Reserved
[6];
1488 YMMCONTEXT YmmContext
;
1491 typedef struct _CONTEXT_CHUNK
1495 } CONTEXT_CHUNK
, *PCONTEXT_CHUNK
;
1497 typedef struct _CONTEXT_EX
1500 CONTEXT_CHUNK Legacy
;
1501 CONTEXT_CHUNK XState
;
1505 } CONTEXT_EX
, *PCONTEXT_EX
;
1507 #define CONTEXT_ARM 0x0200000
1508 #define CONTEXT_ARM_CONTROL (CONTEXT_ARM | 0x00000001)
1509 #define CONTEXT_ARM_INTEGER (CONTEXT_ARM | 0x00000002)
1510 #define CONTEXT_ARM_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1511 #define CONTEXT_ARM_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1512 #define CONTEXT_ARM_FULL (CONTEXT_ARM_CONTROL | CONTEXT_ARM_INTEGER)
1513 #define CONTEXT_ARM_ALL (CONTEXT_ARM_FULL | CONTEXT_ARM_FLOATING_POINT | CONTEXT_ARM_DEBUG_REGISTERS)
1515 #define ARM_MAX_BREAKPOINTS 8
1516 #define ARM_MAX_WATCHPOINTS 1
1518 typedef struct _IMAGE_ARM_RUNTIME_FUNCTION
1525 DWORD FunctionLength
: 11;
1532 DWORD StackAdjust
: 10;
1535 } IMAGE_ARM_RUNTIME_FUNCTION_ENTRY
, *PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY
;
1537 typedef struct _ARM_NEON128
1543 typedef struct _ARM_CONTEXT
1545 ULONG ContextFlags
; /* 000 */
1546 /* CONTEXT_INTEGER */
1557 ULONG R10
; /* 02c */
1558 ULONG R11
; /* 030 */
1559 ULONG R12
; /* 034 */
1560 /* CONTEXT_CONTROL */
1564 ULONG Cpsr
; /* 044 */
1565 /* CONTEXT_FLOATING_POINT */
1566 ULONG Fpscr
; /* 048 */
1567 ULONG Padding
; /* 04c */
1573 } DUMMYUNIONNAME
; /* 050 */
1574 /* CONTEXT_DEBUG_REGISTERS */
1575 ULONG Bvr
[ARM_MAX_BREAKPOINTS
]; /* 150 */
1576 ULONG Bcr
[ARM_MAX_BREAKPOINTS
]; /* 170 */
1577 ULONG Wvr
[ARM_MAX_WATCHPOINTS
]; /* 190 */
1578 ULONG Wcr
[ARM_MAX_WATCHPOINTS
]; /* 194 */
1579 ULONG Padding2
[2]; /* 198 */
1584 #define CONTEXT_CONTROL CONTEXT_ARM_CONTROL
1585 #define CONTEXT_INTEGER CONTEXT_ARM_INTEGER
1586 #define CONTEXT_FLOATING_POINT CONTEXT_ARM_FLOATING_POINT
1587 #define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM_DEBUG_REGISTERS
1588 #define CONTEXT_FULL CONTEXT_ARM_FULL
1589 #define CONTEXT_ALL CONTEXT_ARM_ALL
1591 typedef IMAGE_ARM_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1592 typedef ARM_NEON128 NEON128
, *PNEON128
;
1593 typedef ARM_CONTEXT CONTEXT
, *PCONTEXT
;
1595 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1614 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1616 #endif /* __arm__ */
1618 #define CONTEXT_ARM64 0x400000
1619 #define CONTEXT_ARM64_CONTROL (CONTEXT_ARM64 | 0x00000001)
1620 #define CONTEXT_ARM64_INTEGER (CONTEXT_ARM64 | 0x00000002)
1621 #define CONTEXT_ARM64_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1622 #define CONTEXT_ARM64_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1623 #define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x00000010)
1624 #define CONTEXT_ARM64_FULL (CONTEXT_ARM64_CONTROL | CONTEXT_ARM64_INTEGER | CONTEXT_ARM64_FLOATING_POINT)
1625 #define CONTEXT_ARM64_ALL (CONTEXT_ARM64_FULL | CONTEXT_ARM64_DEBUG_REGISTERS | CONTEXT_ARM64_X18)
1627 #define CONTEXT_UNWOUND_TO_CALL 0x20000000
1629 #define ARM64_MAX_BREAKPOINTS 8
1630 #define ARM64_MAX_WATCHPOINTS 2
1632 typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
1641 DWORD FunctionLength
: 11;
1646 DWORD FrameSize
: 9;
1649 } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
, *PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
;
1651 typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY ARM64_RUNTIME_FUNCTION
, *PARM64_RUNTIME_FUNCTION
;
1653 typedef union _ARM64_NT_NEON128
1664 } ARM64_NT_NEON128
, *PARM64_NT_NEON128
;
1666 typedef struct DECLSPEC_ALIGN(16) _ARM64_NT_CONTEXT
1668 ULONG ContextFlags
; /* 000 */
1669 /* CONTEXT_INTEGER */
1670 ULONG Cpsr
; /* 004 */
1675 DWORD64 X0
; /* 008 */
1676 DWORD64 X1
; /* 010 */
1677 DWORD64 X2
; /* 018 */
1678 DWORD64 X3
; /* 020 */
1679 DWORD64 X4
; /* 028 */
1680 DWORD64 X5
; /* 030 */
1681 DWORD64 X6
; /* 038 */
1682 DWORD64 X7
; /* 040 */
1683 DWORD64 X8
; /* 048 */
1684 DWORD64 X9
; /* 050 */
1685 DWORD64 X10
; /* 058 */
1686 DWORD64 X11
; /* 060 */
1687 DWORD64 X12
; /* 068 */
1688 DWORD64 X13
; /* 070 */
1689 DWORD64 X14
; /* 078 */
1690 DWORD64 X15
; /* 080 */
1691 DWORD64 X16
; /* 088 */
1692 DWORD64 X17
; /* 090 */
1693 DWORD64 X18
; /* 098 */
1694 DWORD64 X19
; /* 0a0 */
1695 DWORD64 X20
; /* 0a8 */
1696 DWORD64 X21
; /* 0b0 */
1697 DWORD64 X22
; /* 0b8 */
1698 DWORD64 X23
; /* 0c0 */
1699 DWORD64 X24
; /* 0c8 */
1700 DWORD64 X25
; /* 0d0 */
1701 DWORD64 X26
; /* 0d8 */
1702 DWORD64 X27
; /* 0e0 */
1703 DWORD64 X28
; /* 0e8 */
1704 DWORD64 Fp
; /* 0f0 */
1705 DWORD64 Lr
; /* 0f8 */
1707 DWORD64 X
[31]; /* 008 */
1709 /* CONTEXT_CONTROL */
1710 DWORD64 Sp
; /* 100 */
1711 DWORD64 Pc
; /* 108 */
1712 /* CONTEXT_FLOATING_POINT */
1713 ARM64_NT_NEON128 V
[32]; /* 110 */
1714 DWORD Fpcr
; /* 310 */
1715 DWORD Fpsr
; /* 314 */
1716 /* CONTEXT_DEBUG_REGISTERS */
1717 DWORD Bcr
[ARM64_MAX_BREAKPOINTS
]; /* 318 */
1718 DWORD64 Bvr
[ARM64_MAX_BREAKPOINTS
]; /* 338 */
1719 DWORD Wcr
[ARM64_MAX_WATCHPOINTS
]; /* 378 */
1720 DWORD64 Wvr
[ARM64_MAX_WATCHPOINTS
]; /* 380 */
1721 } ARM64_NT_CONTEXT
, *PARM64_NT_CONTEXT
;
1723 typedef struct DECLSPEC_ALIGN(16) _ARM64EC_NT_CONTEXT
1729 DWORD64 AMD64_P1Home
; /* 000 */
1730 DWORD64 AMD64_P2Home
; /* 008 */
1731 DWORD64 AMD64_P3Home
; /* 010 */
1732 DWORD64 AMD64_P4Home
; /* 018 */
1733 DWORD64 AMD64_P5Home
; /* 020 */
1734 DWORD64 AMD64_P6Home
; /* 028 */
1735 DWORD ContextFlags
; /* 030 */
1736 DWORD AMD64_MxCsr_copy
; /* 034 */
1737 WORD AMD64_SegCs
; /* 038 */
1738 WORD AMD64_SegDs
; /* 03a */
1739 WORD AMD64_SegEs
; /* 03c */
1740 WORD AMD64_SegFs
; /* 03e */
1741 WORD AMD64_SegGs
; /* 040 */
1742 WORD AMD64_SegSs
; /* 042 */
1743 DWORD AMD64_EFlags
; /* 044 */
1744 DWORD64 AMD64_Dr0
; /* 048 */
1745 DWORD64 AMD64_Dr1
; /* 050 */
1746 DWORD64 AMD64_Dr2
; /* 058 */
1747 DWORD64 AMD64_Dr3
; /* 060 */
1748 DWORD64 AMD64_Dr6
; /* 068 */
1749 DWORD64 AMD64_Dr7
; /* 070 */
1750 DWORD64 X8
; /* 078 (Rax) */
1751 DWORD64 X0
; /* 080 (Rcx) */
1752 DWORD64 X1
; /* 088 (Rdx) */
1753 DWORD64 X27
; /* 090 (Rbx) */
1754 DWORD64 Sp
; /* 098 (Rsp) */
1755 DWORD64 Fp
; /* 0a0 (Rbp) */
1756 DWORD64 X25
; /* 0a8 (Rsi) */
1757 DWORD64 X26
; /* 0b0 (Rdi) */
1758 DWORD64 X2
; /* 0b8 (R8) */
1759 DWORD64 X3
; /* 0c0 (R9) */
1760 DWORD64 X4
; /* 0c8 (R10) */
1761 DWORD64 X5
; /* 0d0 (R11) */
1762 DWORD64 X19
; /* 0d8 (R12) */
1763 DWORD64 X20
; /* 0e0 (R13) */
1764 DWORD64 X21
; /* 0e8 (R14) */
1765 DWORD64 X22
; /* 0f0 (R15) */
1766 DWORD64 Pc
; /* 0f8 (Rip) */
1769 WORD AMD64_ControlWord
; /* 100 */
1770 WORD AMD64_StatusWord
; /* 102 */
1771 BYTE AMD64_TagWord
; /* 104 */
1772 BYTE AMD64_Reserved1
; /* 105 */
1773 WORD AMD64_ErrorOpcode
; /* 106 */
1774 DWORD AMD64_ErrorOffset
; /* 108 */
1775 WORD AMD64_ErrorSelector
; /* 10c */
1776 WORD AMD64_Reserved2
; /* 10e */
1777 DWORD AMD64_DataOffset
; /* 110 */
1778 WORD AMD64_DataSelector
; /* 114 */
1779 WORD AMD64_Reserved3
; /* 116 */
1780 DWORD AMD64_MxCsr
; /* 118 */
1781 DWORD AMD64_MxCsr_Mask
; /* 11c */
1782 DWORD64 Lr
; /* 120 (FloatRegisters[0]) */
1783 WORD X16_0
; /* 128 */
1784 WORD AMD64_St0_Reserved1
; /* 12a */
1785 DWORD AMD64_St0_Reserved2
; /* 12c */
1786 DWORD64 X6
; /* 130 (FloatRegisters[1]) */
1787 WORD X16_1
; /* 138 */
1788 WORD AMD64_St1_Reserved1
; /* 13a */
1789 DWORD AMD64_St1_Reserved2
; /* 13c */
1790 DWORD64 X7
; /* 140 (FloatRegisters[2]) */
1791 WORD X16_2
; /* 148 */
1792 WORD AMD64_St2_Reserved1
; /* 14a */
1793 DWORD AMD64_St2_Reserved2
; /* 14c */
1794 DWORD64 X9
; /* 150 (FloatRegisters[3]) */
1795 WORD X16_3
; /* 158 */
1796 WORD AMD64_St3_Reserved1
; /* 15a */
1797 DWORD AMD64_St3_Reserved2
; /* 15c */
1798 DWORD64 X10
; /* 160 (FloatRegisters[4]) */
1799 WORD X17_0
; /* 168 */
1800 WORD AMD64_St4_Reserved1
; /* 16a */
1801 DWORD AMD64_St4_Reserved2
; /* 16c */
1802 DWORD64 X11
; /* 170 (FloatRegisters[5]) */
1803 WORD X17_1
; /* 178 */
1804 WORD AMD64_St5_Reserved1
; /* 17a */
1805 DWORD AMD64_St5_Reserved2
; /* 17c */
1806 DWORD64 X12
; /* 180 (FloatRegisters[6]) */
1807 WORD X17_2
; /* 188 */
1808 WORD AMD64_St6_Reserved1
; /* 18a */
1809 DWORD AMD64_St6_Reserved2
; /* 18c */
1810 DWORD64 X15
; /* 190 (FloatRegisters[7]) */
1811 WORD X17_3
; /* 198 */
1812 WORD AMD64_St7_Reserved1
; /* 19a */
1813 DWORD AMD64_St7_Reserved2
; /* 19c */
1814 ARM64_NT_NEON128 V
[16]; /* 1a0 (XmmRegisters) */
1815 BYTE AMD64_XSAVE_FORMAT_Reserved4
[96]; /* 2a0 */
1817 M128A AMD64_VectorRegister
[26]; /* 300 */
1818 DWORD64 AMD64_VectorControl
; /* 4a0 */
1819 DWORD64 AMD64_DebugControl
; /* 4a8 */
1820 DWORD64 AMD64_LastBranchToRip
; /* 4b0 */
1821 DWORD64 AMD64_LastBranchFromRip
; /* 4b8 */
1822 DWORD64 AMD64_LastExceptionToRip
; /* 4c0 */
1823 DWORD64 AMD64_LastExceptionFromRip
; /* 4c8 */
1825 AMD64_CONTEXT AMD64_Context
;
1827 } ARM64EC_NT_CONTEXT
, *PARM64EC_NT_CONTEXT
;
1831 #define CONTEXT_CONTROL CONTEXT_ARM64_CONTROL
1832 #define CONTEXT_INTEGER CONTEXT_ARM64_INTEGER
1833 #define CONTEXT_FLOATING_POINT CONTEXT_ARM64_FLOATING_POINT
1834 #define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM64_DEBUG_REGISTERS
1835 #define CONTEXT_FULL CONTEXT_ARM64_FULL
1836 #define CONTEXT_ALL CONTEXT_ARM64_ALL
1838 typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1839 typedef ARM64_NT_NEON128 NEON128
, *PNEON128
;
1840 typedef ARM64_NT_CONTEXT CONTEXT
, *PCONTEXT
;
1842 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1864 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1866 #endif /* __aarch64__ */
1868 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1869 #error You need to define a CONTEXT for your CPU
1872 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1874 #define WOW64_CONTEXT_i386 0x00010000
1875 #define WOW64_CONTEXT_i486 0x00010000
1876 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
1877 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
1878 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
1879 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
1880 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
1881 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
1882 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
1883 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
1884 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
1885 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
1886 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
1888 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
1889 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
1890 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
1891 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
1893 #define WOW64_SIZE_OF_80387_REGISTERS 80
1894 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
1896 /* Exception definitions */
1898 #define EXCEPTION_READ_FAULT 0
1899 #define EXCEPTION_WRITE_FAULT 1
1900 #define EXCEPTION_EXECUTE_FAULT 8
1902 struct _EXCEPTION_POINTERS
;
1903 struct _EXCEPTION_RECORD
;
1905 typedef EXCEPTION_DISPOSITION WINAPI
EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,PVOID
);
1906 typedef EXCEPTION_ROUTINE
*PEXCEPTION_ROUTINE
;
1910 #define UNWIND_HISTORY_TABLE_SIZE 12
1912 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1915 PRUNTIME_FUNCTION FunctionEntry
;
1916 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1918 #define UNWIND_HISTORY_TABLE_NONE 0
1919 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1920 #define UNWIND_HISTORY_TABLE_LOCAL 2
1922 typedef struct _UNWIND_HISTORY_TABLE
1927 ULONG64 HighAddress
;
1928 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1929 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1931 typedef struct _DISPATCHER_CONTEXT
1935 PRUNTIME_FUNCTION FunctionEntry
;
1936 ULONG64 EstablisherFrame
;
1938 PCONTEXT ContextRecord
;
1939 PEXCEPTION_ROUTINE LanguageHandler
;
1941 PUNWIND_HISTORY_TABLE HistoryTable
;
1944 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1946 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,PVOID
);
1947 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,PVOID
);
1949 #define UNW_FLAG_NHANDLER 0
1950 #define UNW_FLAG_EHANDLER 1
1951 #define UNW_FLAG_UHANDLER 2
1952 #define UNW_FLAG_CHAININFO 4
1954 #elif defined(__arm__)
1956 #define UNWIND_HISTORY_TABLE_SIZE 12
1958 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1961 PRUNTIME_FUNCTION FunctionEntry
;
1962 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1964 typedef struct _UNWIND_HISTORY_TABLE
1973 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1974 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1976 typedef struct _DISPATCHER_CONTEXT
1980 PRUNTIME_FUNCTION FunctionEntry
;
1981 DWORD EstablisherFrame
;
1983 PCONTEXT ContextRecord
;
1984 PEXCEPTION_ROUTINE LanguageHandler
;
1986 PUNWIND_HISTORY_TABLE HistoryTable
;
1988 BOOLEAN ControlPcIsUnwound
;
1989 PBYTE NonVolatileRegisters
;
1991 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1993 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD
);
1994 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD
);
1996 #define UNW_FLAG_NHANDLER 0
1997 #define UNW_FLAG_EHANDLER 1
1998 #define UNW_FLAG_UHANDLER 2
2000 #elif defined(__aarch64__)
2002 #define UNWIND_HISTORY_TABLE_SIZE 12
2004 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
2007 PRUNTIME_FUNCTION FunctionEntry
;
2008 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
2010 typedef struct _UNWIND_HISTORY_TABLE
2018 DWORD64 HighAddress
;
2019 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
2020 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
2022 typedef struct _DISPATCHER_CONTEXT
2024 ULONG_PTR ControlPc
;
2025 ULONG_PTR ImageBase
;
2026 PRUNTIME_FUNCTION FunctionEntry
;
2027 ULONG_PTR EstablisherFrame
;
2029 PCONTEXT ContextRecord
;
2030 PEXCEPTION_ROUTINE LanguageHandler
;
2032 PUNWIND_HISTORY_TABLE HistoryTable
;
2034 BOOLEAN ControlPcIsUnwound
;
2035 PBYTE NonVolatileRegisters
;
2036 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
2038 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD64
);
2039 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD64
);
2041 #define UNW_FLAG_NHANDLER 0
2042 #define UNW_FLAG_EHANDLER 1
2043 #define UNW_FLAG_UHANDLER 2
2045 #endif /* __aarch64__ */
2047 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
2049 typedef PRUNTIME_FUNCTION (CALLBACK
*PGET_RUNTIME_FUNCTION_CALLBACK
)(DWORD_PTR
,PVOID
);
2051 NTSYSAPI BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD_PTR
);
2052 NTSYSAPI DWORD WINAPI
RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION
,DWORD
,DWORD
,ULONG_PTR
,ULONG_PTR
);
2053 NTSYSAPI BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
2054 NTSYSAPI
void WINAPI
RtlDeleteGrowableFunctionTable(void*);
2055 NTSYSAPI
void WINAPI
RtlGrowFunctionTable(void*,DWORD
);
2056 NTSYSAPI BOOLEAN CDECL
RtlInstallFunctionTableCallback(DWORD_PTR
,DWORD_PTR
,DWORD
,PGET_RUNTIME_FUNCTION_CALLBACK
,PVOID
,PCWSTR
);
2057 NTSYSAPI PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD_PTR
,DWORD_PTR
*,UNWIND_HISTORY_TABLE
*);
2058 NTSYSAPI
void WINAPI
RtlUnwindEx(PVOID
,PVOID
,struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,UNWIND_HISTORY_TABLE
*);
2059 NTSYSAPI PVOID WINAPI
RtlVirtualUnwind(DWORD
,ULONG_PTR
,ULONG_PTR
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG_PTR
*,KNONVOLATILE_CONTEXT_POINTERS
*);
2066 #define PRODUCT_UNDEFINED 0x00000000
2067 #define PRODUCT_ULTIMATE 0x00000001
2068 #define PRODUCT_HOME_BASIC 0x00000002
2069 #define PRODUCT_HOME_PREMIUM 0x00000003
2070 #define PRODUCT_ENTERPRISE 0x00000004
2071 #define PRODUCT_HOME_BASIC_N 0x00000005
2072 #define PRODUCT_BUSINESS 0x00000006
2073 #define PRODUCT_STANDARD_SERVER 0x00000007
2074 #define PRODUCT_DATACENTER_SERVER 0x00000008
2075 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
2076 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
2077 #define PRODUCT_STARTER 0x0000000B
2078 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
2079 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
2080 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
2081 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
2082 #define PRODUCT_BUSINESS_N 0x00000010
2083 #define PRODUCT_WEB_SERVER 0x00000011
2084 #define PRODUCT_CLUSTER_SERVER 0x00000012
2085 #define PRODUCT_HOME_SERVER 0x00000013
2086 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2087 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2088 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2089 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2090 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
2091 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
2092 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
2093 #define PRODUCT_ENTERPRISE_N 0x0000001B
2094 #define PRODUCT_ULTIMATE_N 0x0000001C
2095 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2096 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
2097 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
2098 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
2099 #define PRODUCT_SERVER_FOUNDATION 0x00000021
2100 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
2101 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
2102 #define PRODUCT_STANDARD_SERVER_V 0x00000024
2103 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
2104 #define PRODUCT_SERVER_V 0x00000025
2105 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
2106 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
2107 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
2108 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
2109 #define PRODUCT_HYPERV 0x0000002A
2110 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
2111 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
2112 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
2113 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
2114 #define PRODUCT_STARTER_N 0x0000002F
2115 #define PRODUCT_PROFESSIONAL 0x00000030
2116 #define PRODUCT_PROFESSIONAL_N 0x00000031
2117 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2118 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2119 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2120 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2121 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2122 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2123 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2124 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2125 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2126 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2127 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2128 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2129 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2130 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2131 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2132 #define PRODUCT_EMBEDDED 0x00000041
2133 #define PRODUCT_STARTER_E 0x00000042
2134 #define PRODUCT_HOME_BASIC_E 0x00000043
2135 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2136 #define PRODUCT_PROFESSIONAL_E 0x00000045
2137 #define PRODUCT_ENTERPRISE_E 0x00000046
2138 #define PRODUCT_ULTIMATE_E 0x00000047
2139 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2140 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2141 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2142 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2143 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2144 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2145 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2146 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2147 #define PRODUCT_THINPC 0x00000057
2148 #define PRODUCT_EMBEDDED_A 0x00000058
2149 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2150 #define PRODUCT_EMBEDDED_E 0x0000005A
2151 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2152 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2153 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2154 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2155 #define PRODUCT_CORE_ARM 0x00000061
2156 #define PRODUCT_CORE_N 0x00000062
2157 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2158 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2159 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2160 #define PRODUCT_CORE 0x00000065
2161 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2162 #define PRODUCT_MOBILE_CORE 0x00000068
2163 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2164 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2165 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2166 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2167 #define PRODUCT_NANO_SERVER 0x0000006D
2168 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2169 #define PRODUCT_CORE_CONNECTED 0x0000006F
2170 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2171 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2172 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2173 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2174 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2175 #define PRODUCT_CONNECTED_CAR 0x00000075
2176 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2177 #define PRODUCT_PPI_PRO 0x00000077
2178 #define PRODUCT_ARM64_SERVER 0x00000078
2179 #define PRODUCT_EDUCATION 0x00000079
2180 #define PRODUCT_EDUCATION_N 0x0000007A
2181 #define PRODUCT_IOTUAP 0x0000007B
2182 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2183 #define PRODUCT_ENTERPRISE_S 0x0000007D
2184 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2185 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2186 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2187 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2188 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2189 #define PRODUCT_UNLICENSED 0xABCDABCD
2196 #define MAKELCID(l, s) (MAKELONG(l, s))
2198 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2199 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2200 #define SUBLANGID(l) ((WORD)(l) >> 10)
2202 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2203 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2205 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2206 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2207 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2208 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2209 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2210 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2211 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2212 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2213 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2214 #define LOCALE_NAME_MAX_LENGTH 85
2217 #define UNREFERENCED_PARAMETER(u) (void)(u)
2218 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2219 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2225 * Definitions for IsTextUnicode()
2228 #define IS_TEXT_UNICODE_ASCII16 0x0001
2229 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2230 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2231 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2232 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2233 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2234 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2235 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2236 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2237 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2238 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2239 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2240 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2241 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2242 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2243 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2245 #define MAXIMUM_WAIT_OBJECTS 64
2246 #define MAXIMUM_SUSPEND_COUNT 127
2248 #define WT_EXECUTEDEFAULT 0x00
2249 #define WT_EXECUTEINIOTHREAD 0x01
2250 #define WT_EXECUTEINUITHREAD 0x02
2251 #define WT_EXECUTEINWAITTHREAD 0x04
2252 #define WT_EXECUTEONLYONCE 0x08
2253 #define WT_EXECUTELONGFUNCTION 0x10
2254 #define WT_EXECUTEINTIMERTHREAD 0x20
2255 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2256 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2257 #define WT_EXECUTEINLONGTHREAD 0x10
2258 #define WT_EXECUTEDELETEWAIT 0x08
2259 #define WT_TRANSFER_IMPERSONATION 0x0100
2262 #define EXCEPTION_CONTINUABLE 0
2263 #define EXCEPTION_NONCONTINUABLE 0x01
2266 * The exception record used by Win32 to give additional information
2267 * about exception to exception handlers.
2270 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2272 typedef struct _EXCEPTION_RECORD
2274 DWORD ExceptionCode
;
2275 DWORD ExceptionFlags
;
2276 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2278 PVOID ExceptionAddress
;
2279 DWORD NumberParameters
;
2280 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2281 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2283 typedef struct _EXCEPTION_RECORD32
2285 DWORD ExceptionCode
;
2286 DWORD ExceptionFlags
;
2287 DWORD ExceptionRecord
;
2288 DWORD ExceptionAddress
;
2289 DWORD NumberParameters
;
2290 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2291 } EXCEPTION_RECORD32
, *PEXCEPTION_RECORD32
;
2293 typedef struct _EXCEPTION_RECORD64
2295 DWORD ExceptionCode
;
2296 DWORD ExceptionFlags
;
2297 DWORD64 ExceptionRecord
;
2298 DWORD64 ExceptionAddress
;
2299 DWORD NumberParameters
;
2300 DWORD __unusedAlignment
;
2301 DWORD64 ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2302 } EXCEPTION_RECORD64
, *PEXCEPTION_RECORD64
;
2305 * The exception pointers structure passed to exception filters
2306 * in except() and the UnhandledExceptionFilter().
2309 typedef struct _EXCEPTION_POINTERS
2311 PEXCEPTION_RECORD ExceptionRecord
;
2312 PCONTEXT ContextRecord
;
2313 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2317 * The exception frame, used for registering exception handlers
2318 * Win32 cares only about this, but compilers generally emit
2319 * larger exception frames for their own use.
2322 struct _EXCEPTION_REGISTRATION_RECORD
;
2324 typedef DWORD (CDECL
*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2325 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2327 typedef struct _EXCEPTION_REGISTRATION_RECORD
2329 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2330 PEXCEPTION_HANDLER Handler
;
2331 } EXCEPTION_REGISTRATION_RECORD
;
2334 * function pointer to an exception filter
2337 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2339 typedef struct _NT_TIB
2341 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2349 PVOID ArbitraryUserPointer
;
2350 struct _NT_TIB
*Self
;
2355 #if defined(__i386__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2356 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2359 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2362 #elif defined(__i386__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2363 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2366 __asm mov eax
, fs
:[0x18];
2370 #elif defined(__x86_64__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2371 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2374 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2377 #elif defined(__x86_64__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2378 unsigned __int64
__readgsqword(unsigned long);
2379 #pragma intrinsic(__readgsqword)
2380 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2382 return (struct _TEB
*)__readgsqword(FIELD_OFFSET(NT_TIB
, Self
));
2384 #elif defined(__arm__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2385 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2388 __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb
));
2391 #elif defined(__arm__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2392 #pragma intrinsic(_MoveFromCoprocessor)
2393 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2395 return (struct _TEB
*)(ULONG_PTR
)_MoveFromCoprocessor(15, 0, 13, 0, 2);
2397 #elif defined(__GNUC__)
2398 extern struct _TEB
* WINAPI
NtCurrentTeb(void) __attribute__((pure
));
2400 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2403 #ifdef NONAMELESSUNION
2404 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2406 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2408 #define GetFiberData() (*(void **)GetCurrentFiber())
2410 #define TLS_MINIMUM_AVAILABLE 64
2412 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2414 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2415 #define IO_REPARSE_TAG_RESERVED_ONE 1
2416 #define IO_REPARSE_TAG_RESERVED_TWO 2
2418 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2420 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2421 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2422 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2423 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2424 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2425 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2426 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2427 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2428 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2429 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2430 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2431 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2432 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2433 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2434 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2435 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2436 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2437 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2438 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2439 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2440 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2441 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2442 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2443 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2444 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2445 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2446 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2447 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2448 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2449 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2450 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2451 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2452 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2453 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2454 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2455 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2456 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2457 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2458 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2459 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2460 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2461 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2462 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2465 * File formats definitions
2468 #include <pshpack2.h>
2469 typedef struct _IMAGE_DOS_HEADER
{
2470 WORD e_magic
; /* 00: MZ Header signature */
2471 WORD e_cblp
; /* 02: Bytes on last page of file */
2472 WORD e_cp
; /* 04: Pages in file */
2473 WORD e_crlc
; /* 06: Relocations */
2474 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2475 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2476 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2477 WORD e_ss
; /* 0e: Initial (relative) SS value */
2478 WORD e_sp
; /* 10: Initial SP value */
2479 WORD e_csum
; /* 12: Checksum */
2480 WORD e_ip
; /* 14: Initial IP value */
2481 WORD e_cs
; /* 16: Initial (relative) CS value */
2482 WORD e_lfarlc
; /* 18: File address of relocation table */
2483 WORD e_ovno
; /* 1a: Overlay number */
2484 WORD e_res
[4]; /* 1c: Reserved words */
2485 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2486 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2487 WORD e_res2
[10]; /* 28: Reserved words */
2488 DWORD e_lfanew
; /* 3c: Offset to extended header */
2489 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2490 #include <poppack.h>
2492 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2493 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2494 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2495 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2496 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2497 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2500 * This is the Windows executable (NE) header.
2501 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2503 #include <pshpack2.h>
2506 WORD ne_magic
; /* 00 NE signature 'NE' */
2507 BYTE ne_ver
; /* 02 Linker version number */
2508 BYTE ne_rev
; /* 03 Linker revision number */
2509 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2510 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2511 LONG ne_crc
; /* 08 Checksum */
2512 WORD ne_flags
; /* 0c Flags about segments in this file */
2513 WORD ne_autodata
; /* 0e Automatic data segment number */
2514 WORD ne_heap
; /* 10 Initial size of local heap */
2515 WORD ne_stack
; /* 12 Initial size of stack */
2516 DWORD ne_csip
; /* 14 Initial CS:IP */
2517 DWORD ne_sssp
; /* 18 Initial SS:SP */
2518 WORD ne_cseg
; /* 1c # of entries in segment table */
2519 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2520 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2521 WORD ne_segtab
; /* 22 Offset to segment table */
2522 WORD ne_rsrctab
; /* 24 Offset to resource table */
2523 WORD ne_restab
; /* 26 Offset to resident-name table */
2524 WORD ne_modtab
; /* 28 Offset to module reference table */
2525 WORD ne_imptab
; /* 2a Offset to imported name table */
2526 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2527 WORD ne_cmovent
; /* 30 # of movable entry points */
2528 WORD ne_align
; /* 32 Logical sector alignment shift count */
2529 WORD ne_cres
; /* 34 # of resource segments */
2530 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2531 BYTE ne_flagsothers
; /* 37 Additional information flags */
2532 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2533 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2534 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2535 WORD ne_expver
; /* 3e Expected Windows version number */
2536 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2537 #include <poppack.h>
2539 #include <pshpack2.h>
2540 typedef struct _IMAGE_VXD_HEADER
{
2555 DWORD e32_lastpagesize
;
2556 DWORD e32_fixupsize
;
2573 DWORD e32_impmodcnt
;
2579 DWORD e32_cbnrestab
;
2582 DWORD e32_debuginfo
;
2584 DWORD e32_instpreload
;
2585 DWORD e32_instdemand
;
2588 DWORD e32_winresoff
;
2589 DWORD e32_winreslen
;
2592 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2593 #include <poppack.h>
2595 /* These defines describe the meanings of the bits in the Characteristics
2598 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2599 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2600 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2601 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2602 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2603 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2604 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2605 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2606 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2607 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2608 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2609 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2610 #define IMAGE_FILE_SYSTEM 0x1000
2611 #define IMAGE_FILE_DLL 0x2000
2612 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2613 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2615 /* These are the settings of the Machine field. */
2616 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2617 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
2618 #define IMAGE_FILE_MACHINE_I386 0x014c
2619 #define IMAGE_FILE_MACHINE_R3000 0x0162
2620 #define IMAGE_FILE_MACHINE_R4000 0x0166
2621 #define IMAGE_FILE_MACHINE_R10000 0x0168
2622 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2623 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2624 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2625 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2626 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2627 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2628 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2629 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2630 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2631 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
2632 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2633 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2634 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2635 #define IMAGE_FILE_MACHINE_IA64 0x0200
2636 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2637 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2638 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2639 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2640 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2641 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2642 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2643 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2644 #define IMAGE_FILE_MACHINE_CHPE_X86 0x3a64
2645 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2646 #define IMAGE_FILE_MACHINE_M32R 0x9041
2647 #define IMAGE_FILE_MACHINE_ARM64EC 0xa641
2648 #define IMAGE_FILE_MACHINE_ARM64X 0xa64e
2649 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
2650 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2652 #define IMAGE_SIZEOF_FILE_HEADER 20
2653 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2654 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2655 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2656 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2657 #define IMAGE_SIZEOF_SHORT_NAME 8
2658 #define IMAGE_SIZEOF_SECTION_HEADER 40
2659 #define IMAGE_SIZEOF_SYMBOL 18
2660 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2661 #define IMAGE_SIZEOF_RELOCATION 10
2662 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2663 #define IMAGE_SIZEOF_LINENUMBER 6
2664 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2666 /* Possible Magic values */
2667 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2668 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2669 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2672 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2673 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2675 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2676 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2679 /* These are indexes into the DataDirectory array */
2680 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2681 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2682 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2683 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2684 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2685 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2686 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2687 #define IMAGE_FILE_DESCRIPTION_STRING 7
2688 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2689 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2690 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2692 /* Directory Entries, indices into the DataDirectory array */
2694 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2695 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2696 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2697 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2698 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2699 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2700 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2701 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2702 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2703 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2704 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2705 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2706 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2707 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2708 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2710 /* Subsystem Values */
2712 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2713 #define IMAGE_SUBSYSTEM_NATIVE 1
2714 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2715 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2716 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2717 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2718 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2719 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2720 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2721 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2722 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2723 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2724 #define IMAGE_SUBSYSTEM_XBOX 14
2725 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2727 /* DLL Characteristics */
2728 #define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA 0x0020
2729 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2730 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2731 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2732 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2733 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2734 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2735 #define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000
2736 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2737 #define IMAGE_DLLCHARACTERISTICS_GUARD_CF 0x4000
2738 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2740 typedef struct _IMAGE_FILE_HEADER
{
2742 WORD NumberOfSections
;
2743 DWORD TimeDateStamp
;
2744 DWORD PointerToSymbolTable
;
2745 DWORD NumberOfSymbols
;
2746 WORD SizeOfOptionalHeader
;
2747 WORD Characteristics
;
2748 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2750 typedef struct _IMAGE_DATA_DIRECTORY
{
2751 DWORD VirtualAddress
;
2753 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2755 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2757 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2758 WORD Magic
; /* 0x20b */
2759 BYTE MajorLinkerVersion
;
2760 BYTE MinorLinkerVersion
;
2762 DWORD SizeOfInitializedData
;
2763 DWORD SizeOfUninitializedData
;
2764 DWORD AddressOfEntryPoint
;
2766 ULONGLONG ImageBase
;
2767 DWORD SectionAlignment
;
2768 DWORD FileAlignment
;
2769 WORD MajorOperatingSystemVersion
;
2770 WORD MinorOperatingSystemVersion
;
2771 WORD MajorImageVersion
;
2772 WORD MinorImageVersion
;
2773 WORD MajorSubsystemVersion
;
2774 WORD MinorSubsystemVersion
;
2775 DWORD Win32VersionValue
;
2777 DWORD SizeOfHeaders
;
2780 WORD DllCharacteristics
;
2781 ULONGLONG SizeOfStackReserve
;
2782 ULONGLONG SizeOfStackCommit
;
2783 ULONGLONG SizeOfHeapReserve
;
2784 ULONGLONG SizeOfHeapCommit
;
2786 DWORD NumberOfRvaAndSizes
;
2787 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2788 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2790 typedef struct _IMAGE_NT_HEADERS64
{
2792 IMAGE_FILE_HEADER FileHeader
;
2793 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2794 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2796 typedef struct _IMAGE_OPTIONAL_HEADER
{
2798 /* Standard fields */
2800 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2801 BYTE MajorLinkerVersion
;
2802 BYTE MinorLinkerVersion
;
2804 DWORD SizeOfInitializedData
;
2805 DWORD SizeOfUninitializedData
;
2806 DWORD AddressOfEntryPoint
; /* 0x10 */
2810 /* NT additional fields */
2813 DWORD SectionAlignment
; /* 0x20 */
2814 DWORD FileAlignment
;
2815 WORD MajorOperatingSystemVersion
;
2816 WORD MinorOperatingSystemVersion
;
2817 WORD MajorImageVersion
;
2818 WORD MinorImageVersion
;
2819 WORD MajorSubsystemVersion
; /* 0x30 */
2820 WORD MinorSubsystemVersion
;
2821 DWORD Win32VersionValue
;
2823 DWORD SizeOfHeaders
;
2824 DWORD CheckSum
; /* 0x40 */
2826 WORD DllCharacteristics
;
2827 DWORD SizeOfStackReserve
;
2828 DWORD SizeOfStackCommit
;
2829 DWORD SizeOfHeapReserve
; /* 0x50 */
2830 DWORD SizeOfHeapCommit
;
2832 DWORD NumberOfRvaAndSizes
;
2833 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2835 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2837 typedef struct _IMAGE_NT_HEADERS
{
2838 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2839 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2840 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2841 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2844 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2845 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2846 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2847 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2849 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2850 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2851 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2852 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2855 #define IMAGE_SIZEOF_SHORT_NAME 8
2857 typedef struct _IMAGE_SECTION_HEADER
{
2858 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2860 DWORD PhysicalAddress
;
2863 DWORD VirtualAddress
;
2864 DWORD SizeOfRawData
;
2865 DWORD PointerToRawData
;
2866 DWORD PointerToRelocations
;
2867 DWORD PointerToLinenumbers
;
2868 WORD NumberOfRelocations
;
2869 WORD NumberOfLinenumbers
;
2870 DWORD Characteristics
;
2871 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2873 #define IMAGE_SIZEOF_SECTION_HEADER 40
2875 #define IMAGE_FIRST_SECTION(ntheader) \
2876 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2877 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2879 /* These defines are for the Characteristics bitfield. */
2880 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2881 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2882 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2883 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2884 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2885 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2887 #define IMAGE_SCN_CNT_CODE 0x00000020
2888 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2889 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2891 #define IMAGE_SCN_LNK_OTHER 0x00000100
2892 #define IMAGE_SCN_LNK_INFO 0x00000200
2893 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2894 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2895 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2897 /* 0x00002000 - Reserved */
2898 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2899 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2901 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2902 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2903 #define IMAGE_SCN_MEM_16BIT 0x00020000
2904 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2905 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2907 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2908 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2909 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2910 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2911 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2912 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2913 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2914 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2915 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2916 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2917 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2918 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2919 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2920 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2921 /* 0x00F00000 - Unused */
2922 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2924 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2927 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2928 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2929 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2930 #define IMAGE_SCN_MEM_SHARED 0x10000000
2931 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2932 #define IMAGE_SCN_MEM_READ 0x40000000
2933 #define IMAGE_SCN_MEM_WRITE 0x80000000
2935 #include <pshpack2.h>
2937 typedef struct _IMAGE_SYMBOL
{
2947 SHORT SectionNumber
;
2950 BYTE NumberOfAuxSymbols
;
2952 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2954 #define IMAGE_SIZEOF_SYMBOL 18
2956 typedef struct _IMAGE_LINENUMBER
{
2958 DWORD SymbolTableIndex
;
2959 DWORD VirtualAddress
;
2963 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2965 #define IMAGE_SIZEOF_LINENUMBER 6
2967 typedef union _IMAGE_AUX_SYMBOL
{
2979 DWORD PointerToLinenumber
;
2980 DWORD PointerToNextFunction
;
2989 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2993 WORD NumberOfRelocations
;
2994 WORD NumberOfLinenumbers
;
3000 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
3002 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3004 #include <poppack.h>
3006 #define IMAGE_SYM_UNDEFINED (SHORT)0
3007 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3008 #define IMAGE_SYM_DEBUG (SHORT)-2
3010 #define IMAGE_SYM_TYPE_NULL 0x0000
3011 #define IMAGE_SYM_TYPE_VOID 0x0001
3012 #define IMAGE_SYM_TYPE_CHAR 0x0002
3013 #define IMAGE_SYM_TYPE_SHORT 0x0003
3014 #define IMAGE_SYM_TYPE_INT 0x0004
3015 #define IMAGE_SYM_TYPE_LONG 0x0005
3016 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3017 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3018 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3019 #define IMAGE_SYM_TYPE_UNION 0x0009
3020 #define IMAGE_SYM_TYPE_ENUM 0x000A
3021 #define IMAGE_SYM_TYPE_MOE 0x000B
3022 #define IMAGE_SYM_TYPE_BYTE 0x000C
3023 #define IMAGE_SYM_TYPE_WORD 0x000D
3024 #define IMAGE_SYM_TYPE_UINT 0x000E
3025 #define IMAGE_SYM_TYPE_DWORD 0x000F
3026 #define IMAGE_SYM_TYPE_PCODE 0x8000
3028 #define IMAGE_SYM_DTYPE_NULL 0
3029 #define IMAGE_SYM_DTYPE_POINTER 1
3030 #define IMAGE_SYM_DTYPE_FUNCTION 2
3031 #define IMAGE_SYM_DTYPE_ARRAY 3
3033 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3034 #define IMAGE_SYM_CLASS_NULL 0x0000
3035 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3036 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3037 #define IMAGE_SYM_CLASS_STATIC 0x0003
3038 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3039 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3040 #define IMAGE_SYM_CLASS_LABEL 0x0006
3041 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3042 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3043 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3044 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3045 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3046 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3047 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3048 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3049 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3050 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3051 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3052 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3054 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3055 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3056 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3057 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3058 #define IMAGE_SYM_CLASS_FILE 0x0067
3059 #define IMAGE_SYM_CLASS_SECTION 0x0068
3060 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3062 #define N_BTMASK 0x000F
3063 #define N_TMASK 0x0030
3064 #define N_TMASK1 0x00C0
3065 #define N_TMASK2 0x00F0
3069 #define BTYPE(x) ((x) & N_BTMASK)
3072 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3076 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3080 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3084 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3088 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3091 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3094 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3095 #define IMAGE_COMDAT_SELECT_ANY 2
3096 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3097 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3098 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3099 #define IMAGE_COMDAT_SELECT_LARGEST 6
3100 #define IMAGE_COMDAT_SELECT_NEWEST 7
3102 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3103 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3104 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3106 /* Export module directory */
3108 typedef struct _IMAGE_EXPORT_DIRECTORY
{
3109 DWORD Characteristics
;
3110 DWORD TimeDateStamp
;
3115 DWORD NumberOfFunctions
;
3116 DWORD NumberOfNames
;
3117 DWORD AddressOfFunctions
;
3118 DWORD AddressOfNames
;
3119 DWORD AddressOfNameOrdinals
;
3120 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3122 /* Import name entry */
3123 typedef struct _IMAGE_IMPORT_BY_NAME
{
3126 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3128 #include <pshpack8.h>
3130 typedef struct _IMAGE_THUNK_DATA64
{
3132 ULONGLONG ForwarderString
;
3135 ULONGLONG AddressOfData
;
3137 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3138 #include <poppack.h>
3140 typedef struct _IMAGE_THUNK_DATA32
{
3142 DWORD ForwarderString
;
3145 DWORD AddressOfData
;
3147 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3149 /* Import module directory */
3151 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3153 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3154 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3156 DWORD TimeDateStamp
; /* 0 if not bound,
3157 * -1 if bound, and real date\time stamp
3158 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3160 * otherwise date/time stamp of DLL bound to
3163 DWORD ForwarderChain
; /* -1 if no forwarders */
3165 /* RVA to IAT (if bound this IAT has actual addresses) */
3167 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3169 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3170 #define IMAGE_ORDINAL_FLAG32 0x80000000
3171 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3172 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3173 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3174 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3177 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3178 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3179 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3180 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3181 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3183 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3184 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3185 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3186 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3187 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3190 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3192 DWORD TimeDateStamp
;
3193 WORD OffsetModuleName
;
3194 WORD NumberOfModuleForwarderRefs
;
3195 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3196 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3198 typedef struct _IMAGE_BOUND_FORWARDER_REF
3200 DWORD TimeDateStamp
;
3201 WORD OffsetModuleName
;
3203 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3205 typedef struct _IMAGE_BASE_RELOCATION
3207 DWORD VirtualAddress
;
3209 /* WORD TypeOffset[1]; */
3210 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3212 #include <pshpack2.h>
3214 typedef struct _IMAGE_RELOCATION
3217 DWORD VirtualAddress
;
3220 DWORD SymbolTableIndex
;
3222 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3224 #include <poppack.h>
3226 #define IMAGE_SIZEOF_RELOCATION 10
3228 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
3232 DWORD AllAttributes
;
3236 DWORD ReservedAttributes
:31;
3241 DWORD ModuleHandleRVA
;
3242 DWORD ImportAddressTableRVA
;
3243 DWORD ImportNameTableRVA
;
3244 DWORD BoundImportAddressTableRVA
;
3245 DWORD UnloadInformationTableRVA
;
3246 DWORD TimeDateStamp
;
3247 } IMAGE_DELAYLOAD_DESCRIPTOR
, *PIMAGE_DELAYLOAD_DESCRIPTOR
;
3248 typedef const IMAGE_DELAYLOAD_DESCRIPTOR
*PCIMAGE_DELAYLOAD_DESCRIPTOR
;
3250 /* generic relocation types */
3251 #define IMAGE_REL_BASED_ABSOLUTE 0
3252 #define IMAGE_REL_BASED_HIGH 1
3253 #define IMAGE_REL_BASED_LOW 2
3254 #define IMAGE_REL_BASED_HIGHLOW 3
3255 #define IMAGE_REL_BASED_HIGHADJ 4
3256 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3257 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3258 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3259 #define IMAGE_REL_BASED_SECTION 6
3260 #define IMAGE_REL_BASED_REL 7
3261 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3262 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3263 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3264 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3265 #define IMAGE_REL_BASED_DIR64 10
3266 #define IMAGE_REL_BASED_HIGH3ADJ 11
3268 /* I386 relocation types */
3269 #define IMAGE_REL_I386_ABSOLUTE 0
3270 #define IMAGE_REL_I386_DIR16 1
3271 #define IMAGE_REL_I386_REL16 2
3272 #define IMAGE_REL_I386_DIR32 6
3273 #define IMAGE_REL_I386_DIR32NB 7
3274 #define IMAGE_REL_I386_SEG12 9
3275 #define IMAGE_REL_I386_SECTION 10
3276 #define IMAGE_REL_I386_SECREL 11
3277 #define IMAGE_REL_I386_TOKEN 12
3278 #define IMAGE_REL_I386_SECREL7 13
3279 #define IMAGE_REL_I386_REL32 20
3281 /* MIPS relocation types */
3282 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3283 #define IMAGE_REL_MIPS_REFHALF 0x0001
3284 #define IMAGE_REL_MIPS_REFWORD 0x0002
3285 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3286 #define IMAGE_REL_MIPS_REFHI 0x0004
3287 #define IMAGE_REL_MIPS_REFLO 0x0005
3288 #define IMAGE_REL_MIPS_GPREL 0x0006
3289 #define IMAGE_REL_MIPS_LITERAL 0x0007
3290 #define IMAGE_REL_MIPS_SECTION 0x000A
3291 #define IMAGE_REL_MIPS_SECREL 0x000B
3292 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3293 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3294 #define IMAGE_REL_MIPS_TOKEN 0x000E
3295 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3296 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3297 #define IMAGE_REL_MIPS_PAIR 0x0025
3299 /* ALPHA relocation types */
3300 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3301 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3302 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3303 #define IMAGE_REL_ALPHA_GPREL 0x0003
3304 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3305 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3306 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3307 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3308 #define IMAGE_REL_ALPHA_HINT 0x0008
3309 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3310 #define IMAGE_REL_ALPHA_REFHI 0x000A
3311 #define IMAGE_REL_ALPHA_REFLO 0x000B
3312 #define IMAGE_REL_ALPHA_PAIR 0x000C
3313 #define IMAGE_REL_ALPHA_MATCH 0x000D
3314 #define IMAGE_REL_ALPHA_SECTION 0x000E
3315 #define IMAGE_REL_ALPHA_SECREL 0x000F
3316 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3317 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3318 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3319 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3320 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3321 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3322 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3323 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3325 /* PowerPC relocation types */
3326 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3327 #define IMAGE_REL_PPC_ADDR64 0x0001
3328 #define IMAGE_REL_PPC_ADDR 0x0002
3329 #define IMAGE_REL_PPC_ADDR24 0x0003
3330 #define IMAGE_REL_PPC_ADDR16 0x0004
3331 #define IMAGE_REL_PPC_ADDR14 0x0005
3332 #define IMAGE_REL_PPC_REL24 0x0006
3333 #define IMAGE_REL_PPC_REL14 0x0007
3334 #define IMAGE_REL_PPC_TOCREL16 0x0008
3335 #define IMAGE_REL_PPC_TOCREL14 0x0009
3336 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3337 #define IMAGE_REL_PPC_SECREL 0x000B
3338 #define IMAGE_REL_PPC_SECTION 0x000C
3339 #define IMAGE_REL_PPC_IFGLUE 0x000D
3340 #define IMAGE_REL_PPC_IMGLUE 0x000E
3341 #define IMAGE_REL_PPC_SECREL16 0x000F
3342 #define IMAGE_REL_PPC_REFHI 0x0010
3343 #define IMAGE_REL_PPC_REFLO 0x0011
3344 #define IMAGE_REL_PPC_PAIR 0x0012
3345 #define IMAGE_REL_PPC_SECRELLO 0x0013
3346 #define IMAGE_REL_PPC_SECRELHI 0x0014
3347 #define IMAGE_REL_PPC_GPREL 0x0015
3348 #define IMAGE_REL_PPC_TOKEN 0x0016
3349 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3351 #define IMAGE_REL_PPC_NEG 0x0100
3352 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3353 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3354 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3356 /* SH3 relocation types */
3357 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3358 #define IMAGE_REL_SH3_DIRECT16 0x0001
3359 #define IMAGE_REL_SH3_DIRECT 0x0002
3360 #define IMAGE_REL_SH3_DIRECT8 0x0003
3361 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3362 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3363 #define IMAGE_REL_SH3_DIRECT4 0x0006
3364 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3365 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3366 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3367 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3368 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3369 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3370 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3371 #define IMAGE_REL_SH3_SECTION 0x000E
3372 #define IMAGE_REL_SH3_SECREL 0x000F
3373 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3374 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3375 #define IMAGE_REL_SH3_TOKEN 0x0012
3377 /* ARM relocation types */
3378 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3379 #define IMAGE_REL_ARM_ADDR 0x0001
3380 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3381 #define IMAGE_REL_ARM_BRANCH24 0x0003
3382 #define IMAGE_REL_ARM_BRANCH11 0x0004
3383 #define IMAGE_REL_ARM_TOKEN 0x0005
3384 #define IMAGE_REL_ARM_GPREL12 0x0006
3385 #define IMAGE_REL_ARM_GPREL7 0x0007
3386 #define IMAGE_REL_ARM_BLX24 0x0008
3387 #define IMAGE_REL_ARM_BLX11 0x0009
3388 #define IMAGE_REL_ARM_SECTION 0x000E
3389 #define IMAGE_REL_ARM_SECREL 0x000F
3390 #define IMAGE_REL_ARM_MOV32A 0x0010
3391 #define IMAGE_REL_ARM_MOV32T 0x0011
3392 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3393 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3394 #define IMAGE_REL_ARM_BLX23T 0x0015
3396 /* ARM64 relocation types */
3397 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3398 #define IMAGE_REL_ARM64_ADDR32 0x0001
3399 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3400 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3401 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3402 #define IMAGE_REL_ARM64_REL21 0x0005
3403 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3404 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3405 #define IMAGE_REL_ARM64_SECREL 0x0008
3406 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3407 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3408 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3409 #define IMAGE_REL_ARM64_TOKEN 0x000C
3410 #define IMAGE_REL_ARM64_SECTION 0x000D
3411 #define IMAGE_REL_ARM64_ADDR64 0x000E
3412 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3414 /* IA64 relocation types */
3415 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3416 #define IMAGE_REL_IA64_IMM14 0x0001
3417 #define IMAGE_REL_IA64_IMM22 0x0002
3418 #define IMAGE_REL_IA64_IMM64 0x0003
3419 #define IMAGE_REL_IA64_DIR 0x0004
3420 #define IMAGE_REL_IA64_DIR64 0x0005
3421 #define IMAGE_REL_IA64_PCREL21B 0x0006
3422 #define IMAGE_REL_IA64_PCREL21M 0x0007
3423 #define IMAGE_REL_IA64_PCREL21F 0x0008
3424 #define IMAGE_REL_IA64_GPREL22 0x0009
3425 #define IMAGE_REL_IA64_LTOFF22 0x000A
3426 #define IMAGE_REL_IA64_SECTION 0x000B
3427 #define IMAGE_REL_IA64_SECREL22 0x000C
3428 #define IMAGE_REL_IA64_SECREL64I 0x000D
3429 #define IMAGE_REL_IA64_SECREL 0x000E
3430 #define IMAGE_REL_IA64_LTOFF64 0x000F
3431 #define IMAGE_REL_IA64_DIR32NB 0x0010
3432 #define IMAGE_REL_IA64_SREL14 0x0011
3433 #define IMAGE_REL_IA64_SREL22 0x0012
3434 #define IMAGE_REL_IA64_SREL32 0x0013
3435 #define IMAGE_REL_IA64_UREL32 0x0014
3436 #define IMAGE_REL_IA64_PCREL60X 0x0015
3437 #define IMAGE_REL_IA64_PCREL60B 0x0016
3438 #define IMAGE_REL_IA64_PCREL60F 0x0017
3439 #define IMAGE_REL_IA64_PCREL60I 0x0018
3440 #define IMAGE_REL_IA64_PCREL60M 0x0019
3441 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3442 #define IMAGE_REL_IA64_TOKEN 0x001B
3443 #define IMAGE_REL_IA64_GPREL32 0x001C
3444 #define IMAGE_REL_IA64_ADDEND 0x001F
3446 /* AMD64 relocation types */
3447 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3448 #define IMAGE_REL_AMD64_ADDR64 0x0001
3449 #define IMAGE_REL_AMD64_ADDR32 0x0002
3450 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3451 #define IMAGE_REL_AMD64_REL32 0x0004
3452 #define IMAGE_REL_AMD64_REL32_1 0x0005
3453 #define IMAGE_REL_AMD64_REL32_2 0x0006
3454 #define IMAGE_REL_AMD64_REL32_3 0x0007
3455 #define IMAGE_REL_AMD64_REL32_4 0x0008
3456 #define IMAGE_REL_AMD64_REL32_5 0x0009
3457 #define IMAGE_REL_AMD64_SECTION 0x000A
3458 #define IMAGE_REL_AMD64_SECREL 0x000B
3459 #define IMAGE_REL_AMD64_SECREL7 0x000C
3460 #define IMAGE_REL_AMD64_TOKEN 0x000D
3461 #define IMAGE_REL_AMD64_SREL32 0x000E
3462 #define IMAGE_REL_AMD64_PAIR 0x000F
3463 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3465 /* archive format */
3467 #define IMAGE_ARCHIVE_START_SIZE 8
3468 #define IMAGE_ARCHIVE_START "!<arch>\n"
3469 #define IMAGE_ARCHIVE_END "`\n"
3470 #define IMAGE_ARCHIVE_PAD "\n"
3471 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3472 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3474 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3483 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3485 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3487 typedef struct _IMPORT_OBJECT_HEADER
3493 DWORD TimeDateStamp
;
3503 } IMPORT_OBJECT_HEADER
;
3505 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3507 typedef enum IMPORT_OBJECT_TYPE
3509 IMPORT_OBJECT_CODE
= 0,
3510 IMPORT_OBJECT_DATA
= 1,
3511 IMPORT_OBJECT_CONST
= 2
3512 } IMPORT_OBJECT_TYPE
;
3514 typedef enum IMPORT_OBJECT_NAME_TYPE
3516 IMPORT_OBJECT_ORDINAL
= 0,
3517 IMPORT_OBJECT_NAME
= 1,
3518 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3519 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3520 } IMPORT_OBJECT_NAME_TYPE
;
3522 typedef struct _ANON_OBJECT_HEADER
3528 DWORD TimeDateStamp
;
3531 } ANON_OBJECT_HEADER
;
3534 * Resource directory stuff
3536 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3537 DWORD Characteristics
;
3538 DWORD TimeDateStamp
;
3541 WORD NumberOfNamedEntries
;
3542 WORD NumberOfIdEntries
;
3543 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3544 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3546 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3547 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3549 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3552 unsigned NameOffset
:31;
3553 unsigned NameIsString
:1;
3561 unsigned OffsetToDirectory
:31;
3562 unsigned DataIsDirectory
:1;
3565 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3568 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3570 CHAR NameString
[ 1 ];
3571 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3573 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3575 WCHAR NameString
[ 1 ];
3576 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3578 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3583 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3586 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3587 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3590 typedef struct _IMAGE_TLS_DIRECTORY64
{
3591 ULONGLONG StartAddressOfRawData
;
3592 ULONGLONG EndAddressOfRawData
;
3593 ULONGLONG AddressOfIndex
;
3594 ULONGLONG AddressOfCallBacks
;
3595 DWORD SizeOfZeroFill
;
3596 DWORD Characteristics
;
3597 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3599 typedef struct _IMAGE_TLS_DIRECTORY32
{
3600 DWORD StartAddressOfRawData
;
3601 DWORD EndAddressOfRawData
;
3602 DWORD AddressOfIndex
;
3603 DWORD AddressOfCallBacks
;
3604 DWORD SizeOfZeroFill
;
3605 DWORD Characteristics
;
3606 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3609 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3610 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3612 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3613 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3616 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3617 DWORD Characteristics
;
3618 DWORD TimeDateStamp
;
3623 DWORD AddressOfRawData
;
3624 DWORD PointerToRawData
;
3625 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3627 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3628 #define IMAGE_DEBUG_TYPE_COFF 1
3629 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3630 #define IMAGE_DEBUG_TYPE_FPO 3
3631 #define IMAGE_DEBUG_TYPE_MISC 4
3632 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3633 #define IMAGE_DEBUG_TYPE_FIXUP 6
3634 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3635 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3636 #define IMAGE_DEBUG_TYPE_BORLAND 9
3637 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3638 #define IMAGE_DEBUG_TYPE_CLSID 11
3639 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
3640 #define IMAGE_DEBUG_TYPE_POGO 13
3641 #define IMAGE_DEBUG_TYPE_ILTCG 14
3642 #define IMAGE_DEBUG_TYPE_MPX 15
3643 #define IMAGE_DEBUG_TYPE_REPRO 16
3645 typedef enum ReplacesCorHdrNumericDefines
3647 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3648 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3649 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3650 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3651 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT
= 0x00000010,
3652 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3653 COMIMAGE_FLAGS_32BITPREFERRED
= 0x00020000,
3655 COR_VERSION_MAJOR_V2
= 2,
3656 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3657 COR_VERSION_MINOR
= 5,
3658 COR_DELETED_NAME_LENGTH
= 8,
3659 COR_VTABLEGAP_NAME_LENGTH
= 8,
3661 NATIVE_TYPE_MAX_CB
= 1,
3662 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3664 IMAGE_COR_MIH_METHODRVA
= 0x01,
3665 IMAGE_COR_MIH_EHRVA
= 0x02,
3666 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3668 COR_VTABLE_32BIT
= 0x01,
3669 COR_VTABLE_64BIT
= 0x02,
3670 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3671 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3673 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3675 MAX_CLASS_NAME
= 1024,
3676 MAX_PACKAGE_NAME
= 1024,
3677 } ReplacesCorHdrNumericDefines
;
3679 typedef struct IMAGE_COR20_HEADER
3682 WORD MajorRuntimeVersion
;
3683 WORD MinorRuntimeVersion
;
3685 IMAGE_DATA_DIRECTORY MetaData
;
3688 DWORD EntryPointToken
;
3689 DWORD EntryPointRVA
;
3692 IMAGE_DATA_DIRECTORY Resources
;
3693 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3694 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3695 IMAGE_DATA_DIRECTORY VTableFixups
;
3696 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3697 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3699 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3701 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3702 DWORD NumberOfSymbols
;
3703 DWORD LvaToFirstSymbol
;
3704 DWORD NumberOfLinenumbers
;
3705 DWORD LvaToFirstLinenumber
;
3706 DWORD RvaToFirstByteOfCode
;
3707 DWORD RvaToLastByteOfCode
;
3708 DWORD RvaToFirstByteOfData
;
3709 DWORD RvaToLastByteOfData
;
3710 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3713 #define FRAME_TRAP 1
3715 #define FRAME_NONFPO 3
3717 typedef struct _FPO_DATA
{
3728 } FPO_DATA
, *PFPO_DATA
;
3730 typedef struct _IMAGE_LOAD_CONFIG_CODE_INTEGRITY
3734 DWORD CatalogOffset
;
3736 } IMAGE_LOAD_CONFIG_CODE_INTEGRITY
, *PIMAGE_LOAD_CONFIG_CODE_INTEGRITY
;
3738 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64
{
3739 DWORD Size
; /* 000 */
3740 DWORD TimeDateStamp
;
3743 DWORD GlobalFlagsClear
;
3744 DWORD GlobalFlagsSet
; /* 010 */
3745 DWORD CriticalSectionDefaultTimeout
;
3746 ULONGLONG DeCommitFreeBlockThreshold
;
3747 ULONGLONG DeCommitTotalFreeThreshold
; /* 020 */
3748 ULONGLONG LockPrefixTable
;
3749 ULONGLONG MaximumAllocationSize
; /* 030 */
3750 ULONGLONG VirtualMemoryThreshold
;
3751 ULONGLONG ProcessAffinityMask
; /* 040 */
3752 DWORD ProcessHeapFlags
;
3754 WORD DependentLoadFlags
;
3755 ULONGLONG EditList
; /* 050 */
3756 ULONGLONG SecurityCookie
;
3757 ULONGLONG SEHandlerTable
; /* 060 */
3758 ULONGLONG SEHandlerCount
;
3759 ULONGLONG GuardCFCheckFunctionPointer
; /* 070 */
3760 ULONGLONG GuardCFDispatchFunctionPointer
;
3761 ULONGLONG GuardCFFunctionTable
; /* 080 */
3762 ULONGLONG GuardCFFunctionCount
;
3763 DWORD GuardFlags
; /* 090 */
3764 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity
;
3765 ULONGLONG GuardAddressTakenIatEntryTable
; /* 0a0 */
3766 ULONGLONG GuardAddressTakenIatEntryCount
;
3767 ULONGLONG GuardLongJumpTargetTable
; /* 0b0 */
3768 ULONGLONG GuardLongJumpTargetCount
;
3769 ULONGLONG DynamicValueRelocTable
; /* 0c0 */
3770 ULONGLONG CHPEMetadataPointer
;
3771 ULONGLONG GuardRFFailureRoutine
; /* 0d0 */
3772 ULONGLONG GuardRFFailureRoutineFunctionPointer
;
3773 DWORD DynamicValueRelocTableOffset
; /* 0e0 */
3774 WORD DynamicValueRelocTableSection
;
3776 ULONGLONG GuardRFVerifyStackPointerFunctionPointer
;
3777 DWORD HotPatchTableOffset
; /* 0f0 */
3779 ULONGLONG EnclaveConfigurationPointer
;
3780 ULONGLONG VolatileMetadataPointer
; /* 100 */
3781 ULONGLONG GuardEHContinuationTable
;
3782 ULONGLONG GuardEHContinuationCount
; /* 110 */
3783 ULONGLONG GuardXFGCheckFunctionPointer
;
3784 ULONGLONG GuardXFGDispatchFunctionPointer
; /* 120 */
3785 ULONGLONG GuardXFGTableDispatchFunctionPointer
;
3786 ULONGLONG CastGuardOsDeterminedFailureMode
; /* 130 */
3787 ULONGLONG GuardMemcpyFunctionPointer
;
3788 } IMAGE_LOAD_CONFIG_DIRECTORY64
, *PIMAGE_LOAD_CONFIG_DIRECTORY64
;
3790 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32
{
3791 DWORD Size
; /* 000 */
3792 DWORD TimeDateStamp
;
3795 DWORD GlobalFlagsClear
;
3796 DWORD GlobalFlagsSet
; /* 010 */
3797 DWORD CriticalSectionDefaultTimeout
;
3798 DWORD DeCommitFreeBlockThreshold
;
3799 DWORD DeCommitTotalFreeThreshold
;
3800 DWORD LockPrefixTable
; /* 020 */
3801 DWORD MaximumAllocationSize
;
3802 DWORD VirtualMemoryThreshold
;
3803 DWORD ProcessHeapFlags
;
3804 DWORD ProcessAffinityMask
; /* 030 */
3806 WORD DependentLoadFlags
;
3808 DWORD SecurityCookie
;
3809 DWORD SEHandlerTable
; /* 040 */
3810 DWORD SEHandlerCount
;
3811 DWORD GuardCFCheckFunctionPointer
;
3812 DWORD GuardCFDispatchFunctionPointer
;
3813 DWORD GuardCFFunctionTable
; /* 050 */
3814 DWORD GuardCFFunctionCount
;
3816 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity
;
3817 DWORD GuardAddressTakenIatEntryTable
;
3818 DWORD GuardAddressTakenIatEntryCount
;
3819 DWORD GuardLongJumpTargetTable
; /* 070 */
3820 DWORD GuardLongJumpTargetCount
;
3821 DWORD DynamicValueRelocTable
;
3822 DWORD CHPEMetadataPointer
;
3823 DWORD GuardRFFailureRoutine
; /* 080 */
3824 DWORD GuardRFFailureRoutineFunctionPointer
;
3825 DWORD DynamicValueRelocTableOffset
;
3826 WORD DynamicValueRelocTableSection
;
3828 DWORD GuardRFVerifyStackPointerFunctionPointer
; /* 090 */
3829 DWORD HotPatchTableOffset
;
3831 DWORD EnclaveConfigurationPointer
;
3832 DWORD VolatileMetadataPointer
; /* 0a0 */
3833 DWORD GuardEHContinuationTable
;
3834 DWORD GuardEHContinuationCount
;
3835 DWORD GuardXFGCheckFunctionPointer
;
3836 DWORD GuardXFGDispatchFunctionPointer
; /* 0b0 */
3837 DWORD GuardXFGTableDispatchFunctionPointer
;
3838 DWORD CastGuardOsDeterminedFailureMode
;
3839 DWORD GuardMemcpyFunctionPointer
;
3840 } IMAGE_LOAD_CONFIG_DIRECTORY32
, *PIMAGE_LOAD_CONFIG_DIRECTORY32
;
3843 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY
;
3844 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY
;
3846 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY
;
3847 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY
;
3850 typedef struct _IMAGE_DYNAMIC_RELOCATION_TABLE
3854 } IMAGE_DYNAMIC_RELOCATION_TABLE
, *PIMAGE_DYNAMIC_RELOCATION_TABLE
;
3856 #include <pshpack1.h>
3858 typedef struct _IMAGE_DYNAMIC_RELOCATION32
3861 DWORD BaseRelocSize
;
3862 } IMAGE_DYNAMIC_RELOCATION32
, *PIMAGE_DYNAMIC_RELOCATION32
;
3864 typedef struct _IMAGE_DYNAMIC_RELOCATION64
3867 DWORD BaseRelocSize
;
3868 } IMAGE_DYNAMIC_RELOCATION64
, *PIMAGE_DYNAMIC_RELOCATION64
;
3870 typedef struct _IMAGE_DYNAMIC_RELOCATION32_V2
3873 DWORD FixupInfoSize
;
3877 } IMAGE_DYNAMIC_RELOCATION32_V2
, *PIMAGE_DYNAMIC_RELOCATION32_V2
;
3879 typedef struct _IMAGE_DYNAMIC_RELOCATION64_V2
3882 DWORD FixupInfoSize
;
3886 } IMAGE_DYNAMIC_RELOCATION64_V2
, *PIMAGE_DYNAMIC_RELOCATION64_V2
;
3888 #include <poppack.h>
3891 typedef IMAGE_DYNAMIC_RELOCATION64 IMAGE_DYNAMIC_RELOCATION
;
3892 typedef PIMAGE_DYNAMIC_RELOCATION64 PIMAGE_DYNAMIC_RELOCATION
;
3893 typedef IMAGE_DYNAMIC_RELOCATION64_V2 IMAGE_DYNAMIC_RELOCATION_V2
;
3894 typedef PIMAGE_DYNAMIC_RELOCATION64_V2 PIMAGE_DYNAMIC_RELOCATION_V2
;
3896 typedef IMAGE_DYNAMIC_RELOCATION32 IMAGE_DYNAMIC_RELOCATION
;
3897 typedef PIMAGE_DYNAMIC_RELOCATION32 PIMAGE_DYNAMIC_RELOCATION
;
3898 typedef IMAGE_DYNAMIC_RELOCATION32_V2 IMAGE_DYNAMIC_RELOCATION_V2
;
3899 typedef PIMAGE_DYNAMIC_RELOCATION32_V2 PIMAGE_DYNAMIC_RELOCATION_V2
;
3902 #define IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE 1
3903 #define IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE 2
3904 #define IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER 3
3905 #define IMAGE_DYNAMIC_RELOCATION_GUARD_INDIR_CONTROL_TRANSFER 4
3906 #define IMAGE_DYNAMIC_RELOCATION_GUARD_SWITCHTABLE_BRANCH 5
3907 #define IMAGE_DYNAMIC_RELOCATION_ARM64X 6
3909 typedef struct _IMAGE_CHPE_METADATA_X86
3912 ULONG CHPECodeAddressRangeOffset
;
3913 ULONG CHPECodeAddressRangeCount
;
3914 ULONG WowA64ExceptionHandlerFunctionPointer
;
3915 ULONG WowA64DispatchCallFunctionPointer
;
3916 ULONG WowA64DispatchIndirectCallFunctionPointer
;
3917 ULONG WowA64DispatchIndirectCallCfgFunctionPointer
;
3918 ULONG WowA64DispatchRetFunctionPointer
;
3919 ULONG WowA64DispatchRetLeafFunctionPointer
;
3920 ULONG WowA64DispatchJumpFunctionPointer
;
3921 ULONG CompilerIATPointer
;
3922 ULONG WowA64RdtscFunctionPointer
;
3924 } IMAGE_CHPE_METADATA_X86
, *PIMAGE_CHPE_METADATA_X86
;
3926 typedef struct _IMAGE_CHPE_RANGE_ENTRY
3933 ULONG NativeCode
: 1;
3934 ULONG AddressBits
: 31;
3938 } IMAGE_CHPE_RANGE_ENTRY
, *PIMAGE_CHPE_RANGE_ENTRY
;
3940 typedef struct _IMAGE_ARM64EC_METADATA
3945 ULONG CodeRangesToEntryPoints
;
3946 ULONG RedirectionMetadata
;
3947 ULONG __os_arm64x_dispatch_call_no_redirect
;
3948 ULONG __os_arm64x_dispatch_ret
;
3949 ULONG __os_arm64x_dispatch_call
;
3950 ULONG __os_arm64x_dispatch_icall
;
3951 ULONG __os_arm64x_dispatch_icall_cfg
;
3952 ULONG AlternateEntryPoint
;
3954 ULONG CodeRangesToEntryPointsCount
;
3955 ULONG RedirectionMetadataCount
;
3956 ULONG GetX64InformationFunctionPointer
;
3957 ULONG SetX64InformationFunctionPointer
;
3958 ULONG ExtraRFETable
;
3959 ULONG ExtraRFETableSize
;
3960 ULONG __os_arm64x_dispatch_fptr
;
3961 ULONG AuxiliaryIATCopy
;
3962 } IMAGE_ARM64EC_METADATA
;
3964 typedef struct _IMAGE_ARM64EC_REDIRECTION_ENTRY
3968 } IMAGE_ARM64EC_REDIRECTION_ENTRY
;
3970 typedef struct _IMAGE_ARM64EC_CODE_RANGE_ENTRY_POINT
3975 } IMAGE_ARM64EC_CODE_RANGE_ENTRY_POINT
;
3977 #define IMAGE_DVRT_ARM64X_FIXUP_TYPE_ZEROFILL 0
3978 #define IMAGE_DVRT_ARM64X_FIXUP_TYPE_VALUE 1
3979 #define IMAGE_DVRT_ARM64X_FIXUP_TYPE_DELTA 2
3981 #define IMAGE_DVRT_ARM64X_FIXUP_SIZE_2BYTES 1
3982 #define IMAGE_DVRT_ARM64X_FIXUP_SIZE_4BYTES 2
3983 #define IMAGE_DVRT_ARM64X_FIXUP_SIZE_8BYTES 3
3985 typedef struct _IMAGE_DVRT_ARM64X_FIXUP_RECORD
3990 } IMAGE_DVRT_ARM64X_FIXUP_RECORD
, *PIMAGE_DVRT_ARM64X_FIXUP_RECORD
;
3992 typedef struct _IMAGE_DVRT_ARM64X_DELTA_FIXUP_RECORD
3998 } IMAGE_DVRT_ARM64X_DELTA_FIXUP_RECORD
, *PIMAGE_DVRT_ARM64X_DELTA_FIXUP_RECORD
;
4000 typedef struct _IMAGE_FUNCTION_ENTRY
{
4001 DWORD StartingAddress
;
4002 DWORD EndingAddress
;
4003 DWORD EndOfPrologue
;
4004 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
4006 #define IMAGE_DEBUG_MISC_EXENAME 1
4008 typedef struct _IMAGE_DEBUG_MISC
{
4014 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
4016 /* This is the structure that appears at the very start of a .DBG file. */
4018 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
4022 WORD Characteristics
;
4023 DWORD TimeDateStamp
;
4027 DWORD NumberOfSections
;
4028 DWORD ExportedNamesSize
;
4029 DWORD DebugDirectorySize
;
4030 DWORD SectionAlignment
;
4031 DWORD Reserved
[ 2 ];
4032 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
4034 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
4037 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
4041 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
4042 #define MESSAGE_RESOURCE_UNICODE 0x0001
4044 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
4047 DWORD OffsetToEntries
;
4048 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
4050 typedef struct tagMESSAGE_RESOURCE_DATA
{
4051 DWORD NumberOfBlocks
;
4052 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
4053 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
4056 * Here follows typedefs for security and tokens.
4060 * First a constant for the following typedefs.
4063 #define ANYSIZE_ARRAY 1
4065 /* FIXME: Orphan. What does it point to? */
4066 typedef PVOID PACCESS_TOKEN
;
4067 typedef PVOID PSECURITY_DESCRIPTOR
;
4070 typedef enum _TOKEN_ELEVATION_TYPE
{
4071 TokenElevationTypeDefault
= 1,
4072 TokenElevationTypeFull
,
4073 TokenElevationTypeLimited
4074 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
4077 * TOKEN_INFORMATION_CLASS
4080 typedef enum _TOKEN_INFORMATION_CLASS
{
4089 TokenImpersonationLevel
,
4091 TokenRestrictedSids
,
4093 TokenGroupsAndPrivileges
,
4094 TokenSessionReference
,
4101 TokenHasRestrictions
,
4102 TokenAccessInformation
,
4103 TokenVirtualizationAllowed
,
4104 TokenVirtualizationEnabled
,
4105 TokenIntegrityLevel
,
4107 TokenMandatoryPolicy
,
4109 TokenIsAppContainer
,
4111 TokenAppContainerSid
,
4112 TokenAppContainerNumber
,
4113 TokenUserClaimAttributes
,
4114 TokenDeviceClaimAttributes
,
4115 TokenRestrictedUserClaimAttributes
,
4116 TokenRestrictedDeviceClaimAttributes
,
4118 TokenRestrictedDeviceGroups
,
4119 TokenSecurityAttributes
,
4121 TokenProcessTrustLevel
,
4123 } TOKEN_INFORMATION_CLASS
;
4125 #define DISABLE_MAX_PRIVILEGE 0x1
4126 #define SANDBOX_INERT 0x2
4127 #define LUA_TOKEN 0x4
4128 #define WRITE_RESTRICTED 0x8
4130 #define TOKEN_ASSIGN_PRIMARY 0x0001
4131 #define TOKEN_DUPLICATE 0x0002
4132 #define TOKEN_IMPERSONATE 0x0004
4133 #define TOKEN_QUERY 0x0008
4134 #define TOKEN_QUERY_SOURCE 0x0010
4135 #define TOKEN_ADJUST_PRIVILEGES 0x0020
4136 #define TOKEN_ADJUST_GROUPS 0x0040
4137 #define TOKEN_ADJUST_DEFAULT 0x0080
4138 #define TOKEN_ADJUST_SESSIONID 0x0100
4139 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
4140 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
4141 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
4142 TOKEN_ADJUST_PRIVILEGES | \
4143 TOKEN_ADJUST_GROUPS | \
4144 TOKEN_ADJUST_DEFAULT )
4145 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
4146 TOKEN_ASSIGN_PRIMARY | \
4148 TOKEN_IMPERSONATE | \
4150 TOKEN_QUERY_SOURCE | \
4151 TOKEN_ADJUST_PRIVILEGES | \
4152 TOKEN_ADJUST_GROUPS | \
4153 TOKEN_ADJUST_SESSIONID | \
4154 TOKEN_ADJUST_DEFAULT )
4156 #ifndef _SECURITY_DEFINED
4157 #define _SECURITY_DEFINED
4159 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
4161 typedef struct _GENERIC_MAPPING
{
4162 ACCESS_MASK GenericRead
;
4163 ACCESS_MASK GenericWrite
;
4164 ACCESS_MASK GenericExecute
;
4165 ACCESS_MASK GenericAll
;
4166 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
4168 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
4169 #define SID_IDENTIFIER_AUTHORITY_DEFINED
4172 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
4173 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
4177 typedef struct _SID
{
4179 BYTE SubAuthorityCount
;
4180 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
4181 DWORD SubAuthority
[1];
4183 #endif /* !defined(SID_DEFINED) */
4185 #define CREATE_BOUNDARY_DESCRIPTOR_ADD_APPCONTAINER_SID 0x01
4187 #define SID_REVISION (1) /* Current revision */
4188 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
4189 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
4191 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
4197 #define ACL_REVISION1 1
4198 #define ACL_REVISION2 2
4199 #define ACL_REVISION3 3
4200 #define ACL_REVISION4 4
4202 #define MIN_ACL_REVISION ACL_REVISION2
4203 #define MAX_ACL_REVISION ACL_REVISION4
4205 #define ACL_REVISION 2
4207 typedef struct _ACL
{
4215 typedef enum _ACL_INFORMATION_CLASS
4217 AclRevisionInformation
= 1,
4219 } ACL_INFORMATION_CLASS
;
4221 typedef struct _ACL_REVISION_INFORMATION
4224 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
4226 typedef struct _ACL_SIZE_INFORMATION
4229 DWORD AclBytesInUse
;
4231 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
4233 /* SECURITY_DESCRIPTOR */
4234 #define SECURITY_DESCRIPTOR_REVISION 1
4235 #define SECURITY_DESCRIPTOR_REVISION1 1
4242 #if defined(_MSC_VER) || defined(__MINGW32__)
4243 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4244 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4245 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4246 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4247 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4248 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4249 #define SE_TCB_NAME L"SeTcbPrivilege"
4250 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4251 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4252 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4253 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4254 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4255 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4256 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4257 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4258 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4259 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4260 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4261 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4262 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4263 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4264 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4265 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4266 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4267 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4268 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4269 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4270 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4271 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4272 #define SE_TRUSTED_CREDMAN_ACCESS_NAME L"SeTrustedCredManAccessPrivilege"
4273 #define SE_RELABEL_NAME L"SeRelabelPrivilege"
4274 #define SE_INC_WORKING_SET_NAME L"SeIncreaseWorkingSetPrivilege"
4275 #define SE_TIME_ZONE_NAME L"SeTimeZonePrivilege"
4276 #define SE_CREATE_SYMBOLIC_LINK_NAME L"SeCreateSymbolicLinkPrivilege"
4277 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME L"SeDelegateSessionUserImpersonatePrivilege"
4278 #else /* _MSC_VER/__MINGW32__ */
4279 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 };
4280 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 };
4281 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 };
4282 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 };
4283 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 };
4284 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 };
4285 static const WCHAR SE_TCB_NAME
[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4286 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 };
4287 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 };
4288 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 };
4289 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 };
4290 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 };
4291 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 };
4292 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 };
4293 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 };
4294 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 };
4295 static const WCHAR SE_BACKUP_NAME
[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4296 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 };
4297 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 };
4298 static const WCHAR SE_DEBUG_NAME
[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4299 static const WCHAR SE_AUDIT_NAME
[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4300 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 };
4301 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 };
4302 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 };
4303 static const WCHAR SE_UNDOCK_NAME
[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4304 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 };
4305 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 };
4306 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 };
4307 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 };
4308 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 };
4309 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 };
4310 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 };
4311 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 };
4312 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 };
4313 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 };
4316 #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
4317 #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
4318 #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
4319 #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
4320 #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
4321 #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
4322 #define SE_TCB_NAME "SeTcbPrivilege"
4323 #define SE_SECURITY_NAME "SeSecurityPrivilege"
4324 #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
4325 #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
4326 #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
4327 #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
4328 #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
4329 #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
4330 #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
4331 #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
4332 #define SE_BACKUP_NAME "SeBackupPrivilege"
4333 #define SE_RESTORE_NAME "SeRestorePrivilege"
4334 #define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
4335 #define SE_DEBUG_NAME "SeDebugPrivilege"
4336 #define SE_AUDIT_NAME "SeAuditPrivilege"
4337 #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
4338 #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
4339 #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
4340 #define SE_UNDOCK_NAME "SeUndockPrivilege"
4341 #define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
4342 #define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
4343 #define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
4344 #define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
4345 #define SE_TRUSTED_CREDMAN_ACCESS_NAME "SeTrustedCredManAccessPrivilege"
4346 #define SE_RELABEL_NAME "SeRelabelPrivilege"
4347 #define SE_INC_WORKING_SET_NAME "SeIncreaseWorkingSetPrivilege"
4348 #define SE_TIME_ZONE_NAME "SeTimeZonePrivilege"
4349 #define SE_CREATE_SYMBOLIC_LINK_NAME "SeCreateSymbolicLinkPrivilege"
4350 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME "SeDelegateSessionUserImpersonatePrivilege"
4353 #define SE_GROUP_MANDATORY 0x00000001
4354 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4355 #define SE_GROUP_ENABLED 0x00000004
4356 #define SE_GROUP_OWNER 0x00000008
4357 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4358 #define SE_GROUP_INTEGRITY 0x00000020
4359 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
4360 #define SE_GROUP_LOGON_ID 0xC0000000
4361 #define SE_GROUP_RESOURCE 0x20000000
4362 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
4364 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4365 #define SE_PRIVILEGE_ENABLED 0x00000002
4366 #define SE_PRIVILEGE_REMOVED 0x00000004
4367 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4368 #define SE_PRIVILEGE_VALID_ATTRIBUTES 0x80000007
4370 #define PRIVILEGE_SET_ALL_NECESSARY 1
4372 #define SE_OWNER_DEFAULTED 0x00000001
4373 #define SE_GROUP_DEFAULTED 0x00000002
4374 #define SE_DACL_PRESENT 0x00000004
4375 #define SE_DACL_DEFAULTED 0x00000008
4376 #define SE_SACL_PRESENT 0x00000010
4377 #define SE_SACL_DEFAULTED 0x00000020
4378 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4379 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4380 #define SE_DACL_AUTO_INHERITED 0x00000400
4381 #define SE_SACL_AUTO_INHERITED 0x00000800
4382 #define SE_DACL_PROTECTED 0x00001000
4383 #define SE_SACL_PROTECTED 0x00002000
4384 #define SE_RM_CONTROL_VALID 0x00004000
4385 #define SE_SELF_RELATIVE 0x00008000
4387 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4388 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4390 /* The security descriptor structure */
4394 SECURITY_DESCRIPTOR_CONTROL Control
;
4399 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4404 SECURITY_DESCRIPTOR_CONTROL Control
;
4409 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4411 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4413 #endif /* _SECURITY_DEFINED */
4416 * SID_AND_ATTRIBUTES
4419 typedef struct _SID_AND_ATTRIBUTES
{
4422 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4424 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY
[ANYSIZE_ARRAY
];
4425 typedef SID_AND_ATTRIBUTES_ARRAY
*PSID_AND_ATTRIBUTES_ARRAY
;
4427 #define SID_HASH_SIZE 32
4429 typedef ULONG_PTR SID_HASH_ENTRY
, *PSID_HASH_ENTRY
;
4431 typedef struct _SID_AND_ATTRIBUTES_HASH
{
4433 PSID_AND_ATTRIBUTES SidAttr
;
4434 SID_HASH_ENTRY Hash
[SID_HASH_SIZE
];
4435 } SID_AND_ATTRIBUTES_HASH
, *PSID_AND_ATTRIBUTES_HASH
;
4437 /* security entities */
4438 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
4439 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
4440 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
4442 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4445 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4448 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4449 #define SECURITY_LOCAL_LOGON_RID __MSABI_LONG(0X00000000)
4452 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4453 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
4454 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
4455 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
4456 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
4457 #define SECURITY_CREATOR_OWNER_RIGHTS_RID __MSABI_LONG(0x00000004)
4460 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4463 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4464 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
4465 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
4466 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
4467 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
4468 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
4469 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
4470 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
4471 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
4472 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
4473 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4474 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
4475 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
4476 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
4477 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
4478 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
4479 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
4480 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
4481 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
4482 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
4483 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
4484 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID __MSABI_LONG(0x00000016)
4485 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
4486 #define SECURITY_WRITE_RESTRICTED_CODE_RID __MSABI_LONG(0x00000021)
4488 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
4489 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
4490 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
4491 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
4492 #define SECURITY_CRED_TYPE_BASE_RID __MSABI_LONG(0x00000041)
4493 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID __MSABI_LONG(0x00000001)
4494 #define SECURITY_MIN_BASE_RID __MSABI_LONG(0x00000050)
4495 #define SECURITY_SERVICE_ID_BASE_RID __MSABI_LONG(0x00000050)
4496 #define SECURITY_RESERVED_ID_BASE_RID __MSABI_LONG(0x00000051)
4497 #define SECURITY_APPPOOL_ID_BASE_RID __MSABI_LONG(0x00000052)
4498 #define SECURITY_VIRTUALSERVER_ID_BASE_RID __MSABI_LONG(0x00000053)
4499 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID __MSABI_LONG(0x00000054)
4500 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID __MSABI_LONG(0x00000055)
4501 #define SECURITY_WMIHOST_ID_BASE_RID __MSABI_LONG(0x00000056)
4502 #define SECURITY_TASK_ID_BASE_RID __MSABI_LONG(0x00000057)
4503 #define SECURITY_NFS_ID_BASE_RID __MSABI_LONG(0x00000058)
4504 #define SECURITY_COM_ID_BASE_RID __MSABI_LONG(0x00000059)
4505 #define SECURITY_MAX_BASE_RID __MSABI_LONG(0x0000006F)
4506 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID __MSABI_LONG(0x00000070)
4507 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
4508 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
4509 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
4511 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS __MSABI_LONG(0x000001F2)
4513 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
4514 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
4515 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
4516 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
4517 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
4519 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
4520 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
4521 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
4522 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
4523 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
4524 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
4525 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
4526 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
4527 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
4528 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS __MSABI_LONG(0x00000209)
4530 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
4532 #define SECURITY_APP_PACKAGE_AUTHORITY {0,0,0,0,0,15}
4533 #define SECURITY_APP_PACKAGE_BASE_RID __MSABI_LONG(0x000000002)
4534 #define SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000002)
4535 #define SECURITY_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000008)
4536 #define SECURITY_CAPABILITY_BASE_RID __MSABI_LONG(0x000000003)
4537 #define SECURITY_CAPABILITY_APP_RID __MSABI_LONG(0x000000400)
4538 #define SECURITY_BUILTIN_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000002)
4539 #define SECURITY_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000005)
4540 #define SECURITY_PARENT_PACKAGE_RID_COUNT SECURITY_APP_PACKAGE_RID_COUNT
4541 #define SECURITY_CHILD_PACKAGE_RID_COUNT __MSABI_LONG(0x00000000c)
4542 #define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE __MSABI_LONG(0x000000001)
4544 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4545 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
4546 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
4547 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
4548 #define SECURITY_MANDATORY_MEDIUM_PLUS_RID __MSABI_LONG(0x00002100)
4549 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
4550 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
4551 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
4552 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
4554 #define MANDATORY_LEVEL_TO_MANDATORY_RID(ML) (ML * 0x1000)
4556 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
4557 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
4558 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
4559 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
4561 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
4562 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
4563 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
4564 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
4566 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
4567 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
4568 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
4569 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
4570 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
4571 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
4573 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
4574 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
4575 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
4576 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
4577 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
4578 #define DOMAIN_ALIAS_RID_IUSERS __MSABI_LONG(0x00000238)
4579 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS __MSABI_LONG(0x00000239)
4580 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023B)
4581 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023C)
4582 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP __MSABI_LONG(0x0000023D)
4583 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP __MSABI_LONG(0x0000023E)
4585 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4587 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
4588 #define SECURITY_CRED_TYPE_RID_COUNT __MSABI_LONG(2)
4589 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
4590 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT __MSABI_LONG(3)
4591 #define SECURITY_SERVICE_ID_RID_COUNT __MSABI_LONG(6)
4592 #define SECURITY_APPPOOL_ID_RID_COUNT __MSABI_LONG(6)
4593 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT __MSABI_LONG(6)
4594 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT __MSABI_LONG(6)
4595 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT __MSABI_LONG(6)
4596 #define SECURITY_WMIHOST_ID_RID_COUNT __MSABI_LONG(6)
4597 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT __MSABI_LONG(6)
4599 #define SYSTEM_LUID { 0x3e7, 0x0 }
4600 #define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 }
4601 #define LOCALSERVICE_LUID { 0x3e5, 0x0 }
4602 #define NETWORKSERVICE_LUID { 0x3e4, 0x0 }
4603 #define IUSER_LUID { 0x3e3, 0x0 }
4609 WinCreatorOwnerSid
= 3,
4610 WinCreatorGroupSid
= 4,
4611 WinCreatorOwnerServerSid
= 5,
4612 WinCreatorGroupServerSid
= 6,
4613 WinNtAuthoritySid
= 7,
4617 WinInteractiveSid
= 11,
4619 WinAnonymousSid
= 13,
4621 WinEnterpriseControllersSid
= 15,
4623 WinAuthenticatedUserSid
= 17,
4624 WinRestrictedCodeSid
= 18,
4625 WinTerminalServerSid
= 19,
4626 WinRemoteLogonIdSid
= 20,
4627 WinLogonIdsSid
= 21,
4628 WinLocalSystemSid
= 22,
4629 WinLocalServiceSid
= 23,
4630 WinNetworkServiceSid
= 24,
4631 WinBuiltinDomainSid
= 25,
4632 WinBuiltinAdministratorsSid
= 26,
4633 WinBuiltinUsersSid
= 27,
4634 WinBuiltinGuestsSid
= 28,
4635 WinBuiltinPowerUsersSid
= 29,
4636 WinBuiltinAccountOperatorsSid
= 30,
4637 WinBuiltinSystemOperatorsSid
= 31,
4638 WinBuiltinPrintOperatorsSid
= 32,
4639 WinBuiltinBackupOperatorsSid
= 33,
4640 WinBuiltinReplicatorSid
= 34,
4641 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4642 WinBuiltinRemoteDesktopUsersSid
= 36,
4643 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4644 WinAccountAdministratorSid
= 38,
4645 WinAccountGuestSid
= 39,
4646 WinAccountKrbtgtSid
= 40,
4647 WinAccountDomainAdminsSid
= 41,
4648 WinAccountDomainUsersSid
= 42,
4649 WinAccountDomainGuestsSid
= 43,
4650 WinAccountComputersSid
= 44,
4651 WinAccountControllersSid
= 45,
4652 WinAccountCertAdminsSid
= 46,
4653 WinAccountSchemaAdminsSid
= 47,
4654 WinAccountEnterpriseAdminsSid
= 48,
4655 WinAccountPolicyAdminsSid
= 49,
4656 WinAccountRasAndIasServersSid
= 50,
4657 WinNTLMAuthenticationSid
= 51,
4658 WinDigestAuthenticationSid
= 52,
4659 WinSChannelAuthenticationSid
= 53,
4660 WinThisOrganizationSid
= 54,
4661 WinOtherOrganizationSid
= 55,
4662 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4663 WinBuiltinPerfMonitoringUsersSid
= 57,
4664 WinBuiltinPerfLoggingUsersSid
= 58,
4665 WinBuiltinAuthorizationAccessSid
= 59,
4666 WinBuiltinTerminalServerLicenseServersSid
= 60,
4667 WinBuiltinDCOMUsersSid
= 61,
4668 WinBuiltinIUsersSid
= 62,
4670 WinBuiltinCryptoOperatorsSid
= 64,
4671 WinUntrustedLabelSid
= 65,
4672 WinLowLabelSid
= 66,
4673 WinMediumLabelSid
= 67,
4674 WinHighLabelSid
= 68,
4675 WinSystemLabelSid
= 69,
4676 WinWriteRestrictedCodeSid
= 70,
4677 WinCreatorOwnerRightsSid
= 71,
4678 WinCacheablePrincipalsGroupSid
= 72,
4679 WinNonCacheablePrincipalsGroupSid
= 73,
4680 WinEnterpriseReadonlyControllersSid
= 74,
4681 WinAccountReadonlyControllersSid
= 75,
4682 WinBuiltinEventLogReadersGroup
= 76,
4683 WinNewEnterpriseReadonlyControllersSid
= 77,
4684 WinBuiltinCertSvcDComAccessGroup
= 78,
4685 WinMediumPlusLabelSid
= 79,
4686 WinLocalLogonSid
= 80,
4687 WinConsoleLogonSid
= 81,
4688 WinThisOrganizationCertificateSid
= 82,
4689 WinApplicationPackageAuthoritySid
= 83,
4690 WinBuiltinAnyPackageSid
= 84,
4691 WinCapabilityInternetClientSid
= 85,
4692 WinCapabilityInternetClientServerSid
= 86,
4693 WinCapabilityPrivateNetworkClientServerSid
= 87,
4694 WinCapabilityPicturesLibrarySid
= 88,
4695 WinCapabilityVideosLibrarySid
= 89,
4696 WinCapabilityMusicLibrarySid
= 90,
4697 WinCapabilityDocumentsLibrarySid
= 91,
4698 WinCapabilitySharedUserCertificatesSid
= 92,
4699 WinCapabilityEnterpriseAuthenticationSid
= 93,
4700 WinCapabilityRemovableStorageSid
= 94,
4701 WinBuiltinRDSRemoteAccessServersSid
= 95,
4702 WinBuiltinRDSEndpointServersSid
= 96,
4703 WinBuiltinRDSManagementServersSid
= 97,
4704 WinUserModeDriversSid
= 98,
4705 WinBuiltinHyperVAdminsSid
= 99,
4706 WinAccountCloneableControllersSid
= 100,
4707 WinBuiltinAccessControlAssistanceOperatorsSid
= 101,
4708 WinBuiltinRemoteManagementUsersSid
= 102,
4709 WinAuthenticationAuthorityAssertedSid
= 103,
4710 WinAuthenticationServiceAssertedSid
= 104,
4711 WinLocalAccountSid
= 105,
4712 WinLocalAccountAndAdministratorSid
= 106,
4713 WinAccountProtectedUsersSid
= 107,
4714 } WELL_KNOWN_SID_TYPE
;
4720 typedef struct _TOKEN_USER
{
4721 SID_AND_ATTRIBUTES User
;
4722 } TOKEN_USER
, *PTOKEN_USER
;
4728 typedef struct _TOKEN_GROUPS
{
4730 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4731 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4734 * LUID_AND_ATTRIBUTES
4737 typedef union _LARGE_INTEGER
{
4739 #ifdef WORDS_BIGENDIAN
4747 #ifndef NONAMELESSSTRUCT
4749 #ifdef WORDS_BIGENDIAN
4759 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4761 typedef union _ULARGE_INTEGER
{
4763 #ifdef WORDS_BIGENDIAN
4771 #ifndef NONAMELESSSTRUCT
4773 #ifdef WORDS_BIGENDIAN
4783 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4786 * Locally Unique Identifier
4789 typedef struct _LUID
{
4794 #include <pshpack4.h>
4795 typedef struct _LUID_AND_ATTRIBUTES
{
4798 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4799 #include <poppack.h>
4805 typedef struct _PRIVILEGE_SET
{
4806 DWORD PrivilegeCount
;
4808 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4809 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4815 typedef struct _TOKEN_PRIVILEGES
{
4816 DWORD PrivilegeCount
;
4817 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4818 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4824 typedef struct _TOKEN_OWNER
{
4826 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4829 * TOKEN_PRIMARY_GROUP
4832 typedef struct _TOKEN_PRIMARY_GROUP
{
4834 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4838 * TOKEN_DEFAULT_DACL
4841 typedef struct _TOKEN_DEFAULT_DACL
{
4843 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4849 #define TOKEN_SOURCE_LENGTH 8
4851 typedef struct _TOKEN_SOURCE
{
4852 char SourceName
[TOKEN_SOURCE_LENGTH
];
4853 LUID SourceIdentifier
;
4854 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4860 typedef enum tagTOKEN_TYPE
{
4866 * SECURITY_IMPERSONATION_LEVEL
4869 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4871 SecurityIdentification
,
4872 SecurityImpersonation
,
4874 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4876 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4877 #define SECURITY_STATIC_TRACKING (FALSE)
4879 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4880 * PSECURITY_CONTEXT_TRACKING_MODE
;
4882 * Quality of Service
4885 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4887 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4888 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4889 BOOLEAN EffectiveOnly
;
4890 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4896 #include <pshpack4.h>
4897 typedef struct _TOKEN_STATISTICS
{
4899 LUID AuthenticationId
;
4900 LARGE_INTEGER ExpirationTime
;
4901 TOKEN_TYPE TokenType
;
4902 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4903 DWORD DynamicCharged
;
4904 DWORD DynamicAvailable
;
4906 DWORD PrivilegeCount
;
4909 #include <poppack.h>
4911 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4914 PSID_AND_ATTRIBUTES Sids
;
4915 DWORD RestrictedSidCount
;
4916 DWORD RestrictedSidLength
;
4917 PSID_AND_ATTRIBUTES RestrictedSids
;
4918 DWORD PrivilegeCount
;
4919 DWORD PrivilegeLength
;
4920 PLUID_AND_ATTRIBUTES Privileges
;
4921 LUID AuthenticationId
;
4922 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4924 typedef struct _TOKEN_ORIGIN
{
4925 LUID OriginatingLogonSession
;
4926 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4928 typedef struct _TOKEN_LINKED_TOKEN
{
4930 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4932 typedef struct _TOKEN_ELEVATION
{
4933 DWORD TokenIsElevated
;
4934 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4936 typedef struct _TOKEN_MANDATORY_LABEL
{
4937 SID_AND_ATTRIBUTES Label
;
4938 } TOKEN_MANDATORY_LABEL
, * PTOKEN_MANDATORY_LABEL
;
4940 #define TOKEN_MANDATORY_POLICY_OFF 0x0
4941 #define TOKEN_MANDATORY_POLICY_NO_WRITEUP 0x1
4942 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
4943 #define TOKEN_MANDATORY_POLICY_VALID_MASK 0x3
4945 typedef struct _TOKEN_MANDATORY_POLICY
{
4947 } TOKEN_MANDATORY_POLICY
, *PTOKEN_MANDATORY_POLICY
;
4949 typedef struct _TOKEN_APPCONTAINER_INFORMATION
{
4950 PSID TokenAppContainer
;
4951 } TOKEN_APPCONTAINER_INFORMATION
, * PTOKEN_APPCONTAINER_INFORMATION
;
4953 #define POLICY_AUDIT_SUBCATEGORY_COUNT 53
4955 typedef struct _TOKEN_AUDIT_POLICY
{
4956 BYTE PerUserPolicy
[((POLICY_AUDIT_SUBCATEGORY_COUNT
) >> 1) + 1];
4957 } TOKEN_AUDIT_POLICY
, *PTOKEN_AUDIT_POLICY
;
4959 typedef struct _TOKEN_ACCESS_INFORMATION
{
4960 PSID_AND_ATTRIBUTES_HASH SidHash
;
4961 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash
;
4962 PTOKEN_PRIVILEGES Privileges
;
4963 LUID AuthenticationId
;
4964 TOKEN_TYPE TokenType
;
4965 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4966 TOKEN_MANDATORY_POLICY MandatoryPolicy
;
4968 } TOKEN_ACCESS_INFORMATION
, *PTOKEN_ACCESS_INFORMATION
;
4970 typedef struct _TOKEN_CONTROL
{
4972 LUID AuthenticationId
;
4974 TOKEN_SOURCE TokenSource
;
4975 } TOKEN_CONTROL
, *PTOKEN_CONTROL
;
4981 /* ACEs, directly starting after an ACL */
4982 typedef struct _ACE_HEADER
{
4986 } ACE_HEADER
,*PACE_HEADER
;
4989 #define ACCESS_MIN_MS_ACE_TYPE 0x0
4990 #define ACCESS_ALLOWED_ACE_TYPE 0x0
4991 #define ACCESS_DENIED_ACE_TYPE 0x1
4992 #define SYSTEM_AUDIT_ACE_TYPE 0x2
4993 #define SYSTEM_ALARM_ACE_TYPE 0x3
4994 #define ACCESS_MAX_MS_V2_ACE_TYPE 0x3
4995 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4
4996 #define ACCESS_MAX_MS_V3_ACE_TYPE 0x4
4997 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE 0x5
4998 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5
4999 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6
5000 #define ACCESS_AUDIT_OBJECT_ACE_TYPE 0x7
5001 #define ACCESS_ALARM_OBJECT_ACE_TYPE 0x8
5002 #define ACCESS_MAX_MS_V4_ACE_TYPE 0x8
5003 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9
5004 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xa
5005 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xb
5006 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xc
5007 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xd
5008 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xe
5009 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xf
5010 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
5011 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
5012 #define SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE 0x12
5013 #define SYSTEM_SCOPED_POLICY_ID_ACE_TYPE 0x13
5014 #define SYSTEM_PROCESS_TRUST_LABEL_ACE_TYPE 0x14
5015 #define ACCESS_MAX_MS_V5_ACE_TYPE 0x14
5017 /* inherit AceFlags */
5018 #define OBJECT_INHERIT_ACE 0x01
5019 #define CONTAINER_INHERIT_ACE 0x02
5020 #define NO_PROPAGATE_INHERIT_ACE 0x04
5021 #define INHERIT_ONLY_ACE 0x08
5022 #define INHERITED_ACE 0x10
5023 #define VALID_INHERIT_FLAGS 0x1F
5025 /* AceFlags mask for what events we (should) audit */
5026 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
5027 #define FAILED_ACCESS_ACE_FLAG 0x80
5029 /* different ACEs depending on AceType
5030 * SidStart marks the begin of a SID
5031 * so the thing finally looks like this:
5036 typedef struct _ACCESS_ALLOWED_ACE
{
5040 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
5042 typedef struct _ACCESS_DENIED_ACE
{
5046 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
5048 typedef struct _SYSTEM_AUDIT_ACE
{
5052 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
5054 typedef struct _SYSTEM_ALARM_ACE
{
5058 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
5060 typedef struct _SYSTEM_MANDATORY_LABEL_ACE
{
5064 } SYSTEM_MANDATORY_LABEL_ACE
,*PSYSTEM_MANDATORY_LABEL_ACE
;
5066 typedef struct _SYSTEM_PROCESS_TRUST_LABEL_ACE
{
5070 } SYSTEM_PROCESS_TRUST_LABEL_ACE
, *PSYSTEM_PROCESS_TRUST_LABEL_ACE
;
5072 typedef struct _ACCESS_ALLOWED_OBJECT_ACE
{
5077 GUID InheritedObjectType
;
5079 } ACCESS_ALLOWED_OBJECT_ACE
, *PACCESS_ALLOWED_OBJECT_ACE
;
5081 typedef struct _ACCESS_DENIED_OBJECT_ACE
{
5086 GUID InheritedObjectType
;
5088 } ACCESS_DENIED_OBJECT_ACE
, *PACCESS_DENIED_OBJECT_ACE
;
5090 typedef struct _SYSTEM_AUDIT_OBJECT_ACE
{
5095 GUID InheritedObjectType
;
5097 } SYSTEM_AUDIT_OBJECT_ACE
, *PSYSTEM_AUDIT_OBJECT_ACE
;
5099 typedef struct _SYSTEM_ALARM_OBJECT_ACE
{
5104 GUID InheritedObjectType
;
5106 } SYSTEM_ALARM_OBJECT_ACE
, *PSYSTEM_ALARM_OBJECT_aCE
;
5108 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE
{
5112 } ACCESS_ALLOWED_CALLBACK_ACE
,*PACCESS_ALLOWED_CALLBACK_ACE
;
5114 typedef struct _ACCESS_DENIED_CALLBACK_ACE
{
5118 } ACCESS_DENIED_CALLBACK_ACE
,*PACCESS_DENIED_CALLBACK_ACE
;
5120 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE
{
5124 } SYSTEM_AUDIT_CALLBACK_ACE
,*PSYSTEM_AUDIT_CALLBACK_ACE
;
5126 typedef struct _SYSTEM_ALARM_CALLBACK_ACE
{
5130 } SYSTEM_ALARM_CALLBACK_ACE
,*PSYSTEM_ALARM_CALLBACK_ACE
;
5132 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
{
5137 GUID InheritedObjectType
;
5139 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE
;
5141 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE
{
5146 GUID InheritedObjectType
;
5148 } ACCESS_DENIED_CALLBACK_OBJECT_ACE
, *PACCESS_DENIED_CALLBACK_OBJECT_ACE
;
5150 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
{
5155 GUID InheritedObjectType
;
5157 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE
;
5159 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
{
5164 GUID InheritedObjectType
;
5166 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE
, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE
;
5168 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
5169 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
5170 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
5171 #define SYSTEM_MANDATORY_LABEL_VALID_MASK 0x7
5172 #define SYSTEM_PROCESS_TRUST_LABEL_VALID_MASK 0x00ffffff
5173 #define SYSTEM_PROCESS_TRUST_NOCONSTRAINT_MASK 0xffffffff
5175 typedef enum tagSID_NAME_USE
{
5180 SidTypeWellKnownGroup
,
5181 SidTypeDeletedAccount
,
5184 } SID_NAME_USE
,*PSID_NAME_USE
;
5186 #define ACE_OBJECT_TYPE_PRESENT 0x1
5187 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
5191 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
5193 #define DELETE 0x00010000
5194 #define READ_CONTROL 0x00020000
5195 #define WRITE_DAC 0x00040000
5196 #define WRITE_OWNER 0x00080000
5197 #define SYNCHRONIZE 0x00100000
5198 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
5200 #define STANDARD_RIGHTS_READ READ_CONTROL
5201 #define STANDARD_RIGHTS_WRITE READ_CONTROL
5202 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
5204 #define STANDARD_RIGHTS_ALL 0x001f0000
5206 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
5208 #define GENERIC_READ 0x80000000
5209 #define GENERIC_WRITE 0x40000000
5210 #define GENERIC_EXECUTE 0x20000000
5211 #define GENERIC_ALL 0x10000000
5213 #define MAXIMUM_ALLOWED 0x02000000
5214 #define ACCESS_SYSTEM_SECURITY 0x01000000
5216 #define EVENT_QUERY_STATE 0x0001
5217 #define EVENT_MODIFY_STATE 0x0002
5218 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5220 #define SEMAPHORE_QUERY_STATE 0x0001
5221 #define SEMAPHORE_MODIFY_STATE 0x0002
5222 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5224 #define MUTANT_QUERY_STATE 0x0001
5225 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
5227 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
5228 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
5229 #define JOB_OBJECT_QUERY 0x0004
5230 #define JOB_OBJECT_TERMINATE 0x0008
5231 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
5232 #define JOB_OBJECT_IMPERSONATE 0x0020
5233 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3f)
5235 #define TIMER_QUERY_STATE 0x0001
5236 #define TIMER_MODIFY_STATE 0x0002
5237 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5239 #define PROCESS_TERMINATE 0x0001
5240 #define PROCESS_CREATE_THREAD 0x0002
5241 #define PROCESS_VM_OPERATION 0x0008
5242 #define PROCESS_VM_READ 0x0010
5243 #define PROCESS_VM_WRITE 0x0020
5244 #define PROCESS_DUP_HANDLE 0x0040
5245 #define PROCESS_CREATE_PROCESS 0x0080
5246 #define PROCESS_SET_QUOTA 0x0100
5247 #define PROCESS_SET_INFORMATION 0x0200
5248 #define PROCESS_QUERY_INFORMATION 0x0400
5249 #define PROCESS_SUSPEND_RESUME 0x0800
5250 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
5251 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
5252 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5254 #define THREAD_TERMINATE 0x0001
5255 #define THREAD_SUSPEND_RESUME 0x0002
5256 #define THREAD_GET_CONTEXT 0x0008
5257 #define THREAD_SET_CONTEXT 0x0010
5258 #define THREAD_SET_INFORMATION 0x0020
5259 #define THREAD_QUERY_INFORMATION 0x0040
5260 #define THREAD_SET_THREAD_TOKEN 0x0080
5261 #define THREAD_IMPERSONATE 0x0100
5262 #define THREAD_DIRECT_IMPERSONATION 0x0200
5263 #define THREAD_SET_LIMITED_INFORMATION 0x0400
5264 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
5265 #define THREAD_RESUME 0x1000
5266 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5268 #define THREAD_BASE_PRIORITY_LOWRT 15
5269 #define THREAD_BASE_PRIORITY_MAX 2
5270 #define THREAD_BASE_PRIORITY_MIN -2
5271 #define THREAD_BASE_PRIORITY_IDLE -15
5273 typedef struct _QUOTA_LIMITS
{
5274 SIZE_T PagedPoolLimit
;
5275 SIZE_T NonPagedPoolLimit
;
5276 SIZE_T MinimumWorkingSetSize
;
5277 SIZE_T MaximumWorkingSetSize
;
5278 SIZE_T PagefileLimit
;
5279 LARGE_INTEGER TimeLimit
;
5280 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
5282 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
5283 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
5284 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
5285 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
5286 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
5288 typedef union _RATE_QUOTA_LIMIT
{
5291 DWORD RatePercent
:7;
5294 } RATE_QUOTA_LIMIT
, *PRATE_QUOTA_LIMIT
;
5296 typedef struct _QUOTA_LIMITS_EX
{
5297 SIZE_T PagedPoolLimit
;
5298 SIZE_T NonPagedPoolLimit
;
5299 SIZE_T MinimumWorkingSetSize
;
5300 SIZE_T MaximumWorkingSetSize
;
5301 SIZE_T PagefileLimit
;
5302 LARGE_INTEGER TimeLimit
;
5303 SIZE_T WorkingSetLimit
;
5308 RATE_QUOTA_LIMIT CpuRateLimit
;
5309 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
5311 #define SECTION_QUERY 0x0001
5312 #define SECTION_MAP_WRITE 0x0002
5313 #define SECTION_MAP_READ 0x0004
5314 #define SECTION_MAP_EXECUTE 0x0008
5315 #define SECTION_EXTEND_SIZE 0x0010
5316 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
5317 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
5319 #define FILE_READ_DATA 0x0001 /* file & pipe */
5320 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
5321 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
5322 #define FILE_ADD_FILE 0x0002 /* directory */
5323 #define FILE_APPEND_DATA 0x0004 /* file */
5324 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
5325 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
5326 #define FILE_READ_EA 0x0008 /* file & directory */
5327 #define FILE_READ_PROPERTIES FILE_READ_EA
5328 #define FILE_WRITE_EA 0x0010 /* file & directory */
5329 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
5330 #define FILE_EXECUTE 0x0020 /* file */
5331 #define FILE_TRAVERSE 0x0020 /* directory */
5332 #define FILE_DELETE_CHILD 0x0040 /* directory */
5333 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
5334 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
5335 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
5337 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
5338 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
5340 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
5341 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
5342 FILE_APPEND_DATA | SYNCHRONIZE)
5343 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
5344 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
5346 #define DUPLICATE_CLOSE_SOURCE 0x00000001
5347 #define DUPLICATE_SAME_ACCESS 0x00000002
5349 #define DUPLICATE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
5352 /* File attribute flags */
5353 #define FILE_SHARE_READ 0x00000001
5354 #define FILE_SHARE_WRITE 0x00000002
5355 #define FILE_SHARE_DELETE 0x00000004
5357 #define FILE_ATTRIBUTE_READONLY 0x00000001
5358 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
5359 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
5360 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
5361 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
5362 #define FILE_ATTRIBUTE_DEVICE 0x00000040
5363 #define FILE_ATTRIBUTE_NORMAL 0x00000080
5364 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
5365 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
5366 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
5367 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
5368 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
5369 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
5370 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
5371 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
5372 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
5373 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
5374 #define FILE_ATTRIBUTE_EA 0x00040000
5376 /* File notification flags */
5377 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
5378 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
5379 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
5380 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
5381 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
5382 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
5383 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
5384 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
5385 #define FILE_NOTIFY_CHANGE_EA 0x00000080
5386 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
5387 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
5388 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
5389 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
5391 #define FILE_ACTION_ADDED 0x00000001
5392 #define FILE_ACTION_REMOVED 0x00000002
5393 #define FILE_ACTION_MODIFIED 0x00000003
5394 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
5395 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
5396 #define FILE_ACTION_ADDED_STREAM 0x00000006
5397 #define FILE_ACTION_REMOVED_STREAM 0x00000007
5398 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
5399 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
5400 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000a
5401 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000b
5403 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
5404 #define FILE_CASE_PRESERVED_NAMES 0x00000002
5405 #define FILE_UNICODE_ON_DISK 0x00000004
5406 #define FILE_PERSISTENT_ACLS 0x00000008
5407 #define FILE_FILE_COMPRESSION 0x00000010
5408 #define FILE_VOLUME_QUOTAS 0x00000020
5409 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
5410 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
5411 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
5412 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
5413 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
5414 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
5415 #define FILE_NAMED_STREAMS 0x00040000
5416 #define FILE_READ_ONLY_VOLUME 0x00080000
5417 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
5418 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
5419 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
5420 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
5421 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
5422 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
5423 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000
5424 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
5425 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000
5426 #define FILE_DAX_VOLUME 0x20000000
5427 #define FILE_SUPPORTS_GHOSTING 0x40000000
5429 /* File alignments (NT) */
5430 #define FILE_BYTE_ALIGNMENT 0x00000000
5431 #define FILE_WORD_ALIGNMENT 0x00000001
5432 #define FILE_LONG_ALIGNMENT 0x00000003
5433 #define FILE_QUAD_ALIGNMENT 0x00000007
5434 #define FILE_OCTA_ALIGNMENT 0x0000000f
5435 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
5436 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
5437 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
5438 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
5439 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
5441 #define COMPRESSION_FORMAT_NONE 0
5442 #define COMPRESSION_FORMAT_DEFAULT 1
5443 #define COMPRESSION_FORMAT_LZNT1 2
5444 #define COMPRESSION_ENGINE_STANDARD 0
5445 #define COMPRESSION_ENGINE_MAXIMUM 256
5447 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
5448 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
5450 #define REG_NONE 0 /* no type */
5451 #define REG_SZ 1 /* string type (ASCII) */
5452 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
5453 #define REG_BINARY 3 /* binary format, callerspecific */
5454 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
5455 #define REG_DWORD 4 /* DWORD in little endian format */
5456 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
5457 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
5458 #define REG_LINK 6 /* symbolic link (UNICODE) */
5459 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
5460 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
5461 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
5462 #define REG_RESOURCE_REQUIREMENTS_LIST 10
5463 #define REG_QWORD 11 /* QWORD in little endian format */
5464 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
5466 /* ----------------------------- begin power management --------------------- */
5468 typedef enum _LATENCY_TIME
{
5471 } LATENCY_TIME
, *PLATENCY_TIME
;
5473 #define DISCHARGE_POLICY_CRITICAL 0
5474 #define DISCHARGE_POLICY_LOW 1
5475 #define NUM_DISCHARGE_POLICIES 4
5477 #define PO_THROTTLE_NONE 0
5478 #define PO_THROTTLE_CONSTANT 1
5479 #define PO_THROTTLE_DEGRADE 2
5480 #define PO_THROTTLE_ADAPTIVE 3
5482 typedef enum _POWER_ACTION
{
5483 PowerActionNone
= 0,
5484 PowerActionReserved
,
5486 PowerActionHibernate
,
5487 PowerActionShutdown
,
5488 PowerActionShutdownReset
,
5489 PowerActionShutdownOff
,
5490 PowerActionWarmEject
5494 typedef enum _POWER_PLATFORM_ROLE
{
5495 PlatformRoleUnspecified
,
5496 PlatformRoleDesktop
,
5498 PlatformRoleWorkstation
,
5499 PlatformRoleEnterpriseServer
,
5500 PlatformRoleSOHOServer
,
5501 PlatformRoleAppliancePC
,
5502 PlatformRolePerformanceServer
,
5505 } POWER_PLATFORM_ROLE
, *PPOWER_PLATFORM_ROLE
;
5507 typedef enum _SYSTEM_POWER_STATE
{
5508 PowerSystemUnspecified
= 0,
5509 PowerSystemWorking
= 1,
5510 PowerSystemSleeping1
= 2,
5511 PowerSystemSleeping2
= 3,
5512 PowerSystemSleeping3
= 4,
5513 PowerSystemHibernate
= 5,
5514 PowerSystemShutdown
= 6,
5515 PowerSystemMaximum
= 7
5516 } SYSTEM_POWER_STATE
,
5517 *PSYSTEM_POWER_STATE
;
5519 typedef enum _DEVICE_POWER_STATE
{
5520 PowerDeviceUnspecified
,
5526 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
5528 typedef enum _POWER_INFORMATION_LEVEL
{
5529 SystemPowerPolicyAc
,
5530 SystemPowerPolicyDc
,
5531 VerifySystemPolicyAc
,
5532 VerifySystemPolicyDc
,
5533 SystemPowerCapabilities
,
5535 SystemPowerStateHandler
,
5536 ProcessorStateHandler
,
5537 SystemPowerPolicyCurrent
,
5538 AdministratorPowerPolicy
,
5539 SystemReserveHiberFile
,
5540 ProcessorInformation
,
5541 SystemPowerInformation
,
5542 ProcessorStateHandler2
,
5545 SystemExecutionState
,
5546 SystemPowerStateNotifyHandler
,
5547 ProcessorPowerPolicyAc
,
5548 ProcessorPowerPolicyDc
,
5549 VerifyProcessorPowerPolicyAc
,
5550 VerifyProcessorPowerPolicyDc
,
5551 ProcessorPowerPolicyCurrent
5552 } POWER_INFORMATION_LEVEL
;
5554 typedef struct _ADMINISTRATOR_POWER_POLICY
{
5555 SYSTEM_POWER_STATE MinSleep
;
5556 SYSTEM_POWER_STATE MaxSleep
;
5557 ULONG MinVideoTimeout
;
5558 ULONG MaxVideoTimeout
;
5559 ULONG MinSpindownTimeout
;
5560 ULONG MaxSpindownTimeout
;
5561 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
5566 } BATTERY_REPORTING_SCALE
,
5567 *PBATTERY_REPORTING_SCALE
;
5570 POWER_ACTION Action
;
5573 } POWER_ACTION_POLICY
,
5574 *PPOWER_ACTION_POLICY
;
5576 typedef struct _PROCESSOR_POWER_INFORMATION
{
5582 ULONG CurrentIdleState
;
5583 } PROCESSOR_POWER_INFORMATION
,
5584 *PPROCESSOR_POWER_INFORMATION
;
5586 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
5590 UCHAR DemotePercent
;
5591 UCHAR PromotePercent
;
5593 ULONG AllowDemotion
:1;
5594 ULONG AllowPromotion
:1;
5596 } PROCESSOR_POWER_POLICY_INFO
,
5597 *PPROCESSOR_POWER_POLICY_INFO
;
5599 typedef struct _PROCESSOR_POWER_POLICY
{
5601 BYTE DynamicThrottle
;
5603 DWORD DisableCStates
:1;
5606 PROCESSOR_POWER_POLICY_INFO Policy
[3];
5607 } PROCESSOR_POWER_POLICY
,
5608 *PPROCESSOR_POWER_POLICY
;
5612 BOOLEAN BatteryPresent
;
5614 BOOLEAN Discharging
;
5618 ULONG RemainingCapacity
;
5620 ULONG EstimatedTime
;
5621 ULONG DefaultAlert1
;
5622 ULONG DefaultAlert2
;
5623 } SYSTEM_BATTERY_STATE
,
5624 *PSYSTEM_BATTERY_STATE
;
5627 BOOLEAN PowerButtonPresent
;
5628 BOOLEAN SleepButtonPresent
;
5635 BOOLEAN HiberFilePresent
;
5637 BOOLEAN VideoDimPresent
;
5640 BOOLEAN ThermalControl
;
5641 BOOLEAN ProcessorThrottle
;
5642 UCHAR ProcessorMinThrottle
;
5643 UCHAR ProcessorMaxThrottle
;
5645 BOOLEAN DiskSpinDown
;
5647 BOOLEAN SystemBatteriesPresent
;
5648 BOOLEAN BatteriesAreShortTerm
;
5649 BATTERY_REPORTING_SCALE BatteryScale
[3];
5650 SYSTEM_POWER_STATE AcOnLineWake
;
5651 SYSTEM_POWER_STATE SoftLidWake
;
5652 SYSTEM_POWER_STATE RtcWake
;
5653 SYSTEM_POWER_STATE MinDeviceWakeState
;
5654 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
5655 } SYSTEM_POWER_CAPABILITIES
,
5656 *PSYSTEM_POWER_CAPABILITIES
;
5658 typedef struct _SYSTEM_POWER_INFORMATION
{
5659 ULONG MaxIdlenessAllowed
;
5661 ULONG TimeRemaining
;
5663 } SYSTEM_POWER_INFORMATION
,
5664 *PSYSTEM_POWER_INFORMATION
;
5666 typedef struct _SYSTEM_POWER_LEVEL
{
5670 POWER_ACTION_POLICY PowerPolicy
;
5671 SYSTEM_POWER_STATE MinSystemState
;
5672 } SYSTEM_POWER_LEVEL
,
5673 *PSYSTEM_POWER_LEVEL
;
5675 typedef struct _SYSTEM_POWER_POLICY
{
5677 POWER_ACTION_POLICY PowerButton
;
5678 POWER_ACTION_POLICY SleepButton
;
5679 POWER_ACTION_POLICY LidClose
;
5680 SYSTEM_POWER_STATE LidOpenWake
;
5682 POWER_ACTION_POLICY Idle
;
5684 UCHAR IdleSensitivity
;
5685 UCHAR DynamicThrottle
;
5687 SYSTEM_POWER_STATE MinSleep
;
5688 SYSTEM_POWER_STATE MaxSleep
;
5689 SYSTEM_POWER_STATE ReducedLatencySleep
;
5690 ULONG WinLogonFlags
;
5692 ULONG DozeS4Timeout
;
5693 ULONG BroadcastCapacityResolution
;
5694 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
5696 BOOLEAN VideoDimDisplay
;
5697 ULONG VideoReserved
[3];
5698 ULONG SpindownTimeout
;
5699 BOOLEAN OptimizeForPower
;
5700 UCHAR FanThrottleTolerance
;
5701 UCHAR ForcedThrottle
;
5703 POWER_ACTION_POLICY OverThrottled
;
5704 } SYSTEM_POWER_POLICY
,
5705 *PSYSTEM_POWER_POLICY
;
5707 typedef enum _POWER_REQUEST_TYPE
5709 PowerRequestDisplayRequired
,
5710 PowerRequestSystemRequired
,
5711 PowerRequestAwayModeRequired
5712 } POWER_REQUEST_TYPE
, *PPOWER_REQUEST_TYPE
;
5714 #define POWER_REQUEST_CONTEXT_VERSION 0
5716 #define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
5717 #define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
5719 typedef union _FILE_SEGMENT_ELEMENT
{
5721 ULONGLONG Alignment
;
5722 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
5724 typedef struct _FILE_NOTIFY_INFORMATION
{
5725 DWORD NextEntryOffset
;
5727 DWORD FileNameLength
;
5729 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
5731 /* ----------------------------- begin tape storage --------------------- */
5733 #define TAPE_FIXED_PARTITIONS 0
5734 #define TAPE_SELECT_PARTITIONS 1
5735 #define TAPE_INITIATOR_PARTITIONS 2
5736 #define TAPE_ERASE_SHORT 0
5737 #define TAPE_ERASE_LONG 1
5739 #define TAPE_UNLOAD 1
5740 #define TAPE_TENSION 2
5742 #define TAPE_UNLOCK 4
5743 #define TAPE_FORMAT 5
5744 #define TAPE_SETMARKS 0
5745 #define TAPE_FILEMARKS 1
5746 #define TAPE_SHORT_FILEMARKS 2
5747 #define TAPE_LONG_FILEMARKS 3
5748 #define TAPE_REWIND 0
5749 #define TAPE_ABSOLUTE_BLOCK 1
5750 #define TAPE_LOGICAL_BLOCK 2
5751 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5752 #define TAPE_SPACE_END_OF_DATA 4
5753 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5754 #define TAPE_SPACE_FILEMARKS 6
5755 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5756 #define TAPE_SPACE_SETMARKS 8
5757 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5759 typedef struct _TAPE_CREATE_PARTITION
{
5763 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5765 typedef struct _TAPE_ERASE
{
5768 } TAPE_ERASE
, *PTAPE_ERASE
;
5770 typedef struct _TAPE_PREPARE
{
5773 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5775 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5777 BOOLEAN Compression
;
5778 BOOLEAN DataPadding
;
5779 BOOLEAN ReportSetmarks
;
5780 ULONG EOTWarningZoneSize
;
5781 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5783 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5785 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5787 typedef struct _TAPE_WRITE_MARKS
{
5791 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5793 typedef struct _TAPE_GET_POSITION
{
5798 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5800 typedef struct _TAPE_SET_POSITION
{
5803 LARGE_INTEGER Offset
;
5805 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5807 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5809 BOOLEAN Compression
;
5810 BOOLEAN DataPadding
;
5811 BOOLEAN ReportSetmarks
;
5812 DWORD DefaultBlockSize
;
5813 DWORD MaximumBlockSize
;
5814 DWORD MinimumBlockSize
;
5815 DWORD MaximumPartitionCount
;
5818 DWORD EOTWarningZoneSize
;
5819 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5821 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5822 LARGE_INTEGER Capacity
;
5823 LARGE_INTEGER Remaining
;
5825 DWORD PartitionCount
;
5826 BOOLEAN WriteProtected
;
5827 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5829 /* ----------------------------- begin registry ----------------------------- */
5831 /* Registry security values */
5832 #define OWNER_SECURITY_INFORMATION 0x00000001
5833 #define GROUP_SECURITY_INFORMATION 0x00000002
5834 #define DACL_SECURITY_INFORMATION 0x00000004
5835 #define SACL_SECURITY_INFORMATION 0x00000008
5836 #define LABEL_SECURITY_INFORMATION 0x00000010
5838 #define REG_OPTION_RESERVED 0x00000000
5839 #define REG_OPTION_NON_VOLATILE 0x00000000
5840 #define REG_OPTION_VOLATILE 0x00000001
5841 #define REG_OPTION_CREATE_LINK 0x00000002
5842 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5843 #define REG_OPTION_OPEN_LINK 0x00000008
5844 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | \
5845 REG_OPTION_NON_VOLATILE | \
5846 REG_OPTION_VOLATILE | \
5847 REG_OPTION_CREATE_LINK | \
5848 REG_OPTION_BACKUP_RESTORE | \
5849 REG_OPTION_OPEN_LINK)
5852 #define REG_CREATED_NEW_KEY 0x00000001
5853 #define REG_OPENED_EXISTING_KEY 0x00000002
5855 /* For RegNotifyChangeKeyValue */
5856 #define REG_NOTIFY_CHANGE_NAME 0x01
5857 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5858 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5859 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5860 #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
5862 #define KEY_QUERY_VALUE 0x00000001
5863 #define KEY_SET_VALUE 0x00000002
5864 #define KEY_CREATE_SUB_KEY 0x00000004
5865 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5866 #define KEY_NOTIFY 0x00000010
5867 #define KEY_CREATE_LINK 0x00000020
5868 #define KEY_WOW64_64KEY 0x00000100
5869 #define KEY_WOW64_32KEY 0x00000200
5870 #define KEY_WOW64_RES 0x00000300
5872 /* for RegKeyRestore flags */
5873 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5874 #define REG_REFRESH_HIVE 0x00000002
5875 #define REG_NO_LAZY_FLUSH 0x00000004
5876 #define REG_FORCE_RESTORE 0x00000008
5877 #define REG_APP_HIVE 0x00000010
5878 #define REG_PROCESS_PRIVATE 0x00000020
5880 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5882 KEY_ENUMERATE_SUB_KEYS| \
5886 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5888 KEY_CREATE_SUB_KEY) \
5891 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5892 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5895 KEY_CREATE_SUB_KEY| \
5896 KEY_ENUMERATE_SUB_KEYS| \
5901 /* ------------------------------ end registry ------------------------------ */
5904 #define EVENTLOG_SUCCESS 0x0000
5905 #define EVENTLOG_ERROR_TYPE 0x0001
5906 #define EVENTLOG_WARNING_TYPE 0x0002
5907 #define EVENTLOG_INFORMATION_TYPE 0x0004
5908 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5909 #define EVENTLOG_AUDIT_FAILURE 0x0010
5911 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5912 #define EVENTLOG_SEEK_READ 0x0002
5913 #define EVENTLOG_FORWARDS_READ 0x0004
5914 #define EVENTLOG_BACKWARDS_READ 0x0008
5916 typedef struct _EVENTLOGRECORD
{
5920 DWORD TimeGenerated
;
5927 DWORD ClosingRecordNumber
;
5929 DWORD UserSidLength
;
5930 DWORD UserSidOffset
;
5933 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5935 #define SERVICE_BOOT_START 0x00000000
5936 #define SERVICE_SYSTEM_START 0x00000001
5937 #define SERVICE_AUTO_START 0x00000002
5938 #define SERVICE_DEMAND_START 0x00000003
5939 #define SERVICE_DISABLED 0x00000004
5941 #define SERVICE_ERROR_IGNORE 0x00000000
5942 #define SERVICE_ERROR_NORMAL 0x00000001
5943 #define SERVICE_ERROR_SEVERE 0x00000002
5944 #define SERVICE_ERROR_CRITICAL 0x00000003
5947 #define SERVICE_KERNEL_DRIVER 0x00000001
5948 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5949 #define SERVICE_ADAPTER 0x00000004
5950 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5952 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5953 SERVICE_RECOGNIZER_DRIVER )
5955 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5956 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5957 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5959 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5961 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5962 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5965 typedef enum _CM_SERVICE_NODE_TYPE
5967 DriverType
= SERVICE_KERNEL_DRIVER
,
5968 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5969 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5970 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5971 AdapterType
= SERVICE_ADAPTER
,
5972 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5973 } SERVICE_NODE_TYPE
;
5975 typedef enum _CM_SERVICE_LOAD_TYPE
5977 BootLoad
= SERVICE_BOOT_START
,
5978 SystemLoad
= SERVICE_SYSTEM_START
,
5979 AutoLoad
= SERVICE_AUTO_START
,
5980 DemandLoad
= SERVICE_DEMAND_START
,
5981 DisableLoad
= SERVICE_DISABLED
5982 } SERVICE_LOAD_TYPE
;
5984 typedef enum _CM_ERROR_CONTROL_TYPE
5986 IgnoreError
= SERVICE_ERROR_IGNORE
,
5987 NormalError
= SERVICE_ERROR_NORMAL
,
5988 SevereError
= SERVICE_ERROR_SEVERE
,
5989 CriticalError
= SERVICE_ERROR_CRITICAL
5990 } SERVICE_ERROR_TYPE
;
5992 NTSYSAPI SIZE_T WINAPI
RtlCompareMemory(const VOID
*, const VOID
*, SIZE_T
);
5993 NTSYSAPI SIZE_T WINAPI
RtlCompareMemoryUlong(VOID
*, SIZE_T
, ULONG
);
5995 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5996 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5997 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5998 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5999 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
6001 static FORCEINLINE
void *RtlSecureZeroMemory(void *buffer
, SIZE_T length
)
6003 volatile char *ptr
= (volatile char *)buffer
;
6005 while (length
--) *ptr
++ = 0;
6009 #include <guiddef.h>
6011 typedef struct _OBJECT_TYPE_LIST
{
6015 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
6017 typedef struct _RTL_CRITICAL_SECTION_DEBUG
6020 WORD CreatorBackTraceIndex
;
6021 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
6022 LIST_ENTRY ProcessLocksList
;
6024 DWORD ContentionCount
;
6025 #ifdef __WINESRC__ /* in Wine we store the name here */
6026 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
6030 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
6032 typedef struct _RTL_CRITICAL_SECTION
{
6033 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
6035 LONG RecursionCount
;
6036 HANDLE OwningThread
;
6037 HANDLE LockSemaphore
;
6038 ULONG_PTR SpinCount
;
6039 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
6041 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
6042 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
6043 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
6044 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
6045 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
6047 typedef struct _RTL_SRWLOCK
{
6049 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
6051 #define RTL_SRWLOCK_INIT {0}
6053 typedef struct _RTL_CONDITION_VARIABLE
{
6055 } RTL_CONDITION_VARIABLE
, *PRTL_CONDITION_VARIABLE
;
6056 #define RTL_CONDITION_VARIABLE_INIT {0}
6057 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
6059 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
6060 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
6062 #define RTL_RUN_ONCE_INIT {0}
6063 typedef union _RTL_RUN_ONCE
{
6065 } RTL_RUN_ONCE
, *PRTL_RUN_ONCE
;
6067 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
6068 #define RTL_RUN_ONCE_ASYNC 0x00000002
6069 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004
6071 typedef DWORD WINAPI
RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE
, PVOID
, PVOID
*);
6072 typedef RTL_RUN_ONCE_INIT_FN
*PRTL_RUN_ONCE_INIT_FN
;
6073 NTSYSAPI VOID WINAPI
RtlRunOnceInitialize(PRTL_RUN_ONCE
);
6074 NTSYSAPI DWORD WINAPI
RtlRunOnceExecuteOnce(PRTL_RUN_ONCE
,PRTL_RUN_ONCE_INIT_FN
,PVOID
,PVOID
*);
6075 NTSYSAPI DWORD WINAPI
RtlRunOnceBeginInitialize(PRTL_RUN_ONCE
, DWORD
, PVOID
*);
6076 NTSYSAPI DWORD WINAPI
RtlRunOnceComplete(PRTL_RUN_ONCE
, DWORD
, PVOID
);
6078 #include <pshpack8.h>
6079 typedef struct _IO_COUNTERS
{
6080 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
6081 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
6082 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
6083 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
6084 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
6085 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
6086 } IO_COUNTERS
, *PIO_COUNTERS
;
6087 #include <poppack.h>
6090 DWORD dwOSVersionInfoSize
;
6091 DWORD dwMajorVersion
;
6092 DWORD dwMinorVersion
;
6093 DWORD dwBuildNumber
;
6095 CHAR szCSDVersion
[128];
6096 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
6099 DWORD dwOSVersionInfoSize
;
6100 DWORD dwMajorVersion
;
6101 DWORD dwMinorVersion
;
6102 DWORD dwBuildNumber
;
6104 WCHAR szCSDVersion
[128];
6105 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
6107 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
6108 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
6109 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
6112 DWORD dwOSVersionInfoSize
;
6113 DWORD dwMajorVersion
;
6114 DWORD dwMinorVersion
;
6115 DWORD dwBuildNumber
;
6117 CHAR szCSDVersion
[128];
6118 WORD wServicePackMajor
;
6119 WORD wServicePackMinor
;
6123 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
6126 DWORD dwOSVersionInfoSize
;
6127 DWORD dwMajorVersion
;
6128 DWORD dwMinorVersion
;
6129 DWORD dwBuildNumber
;
6131 WCHAR szCSDVersion
[128];
6132 WORD wServicePackMajor
;
6133 WORD wServicePackMinor
;
6137 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
6139 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
6140 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
6141 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
6143 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
6145 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
6147 #define VER_PLATFORM_WIN32s 0
6148 #define VER_PLATFORM_WIN32_WINDOWS 1
6149 #define VER_PLATFORM_WIN32_NT 2
6151 #define VER_MINORVERSION 0x00000001
6152 #define VER_MAJORVERSION 0x00000002
6153 #define VER_BUILDNUMBER 0x00000004
6154 #define VER_PLATFORMID 0x00000008
6155 #define VER_SERVICEPACKMINOR 0x00000010
6156 #define VER_SERVICEPACKMAJOR 0x00000020
6157 #define VER_SUITENAME 0x00000040
6158 #define VER_PRODUCT_TYPE 0x00000080
6160 #define VER_NT_WORKSTATION 1
6161 #define VER_NT_DOMAIN_CONTROLLER 2
6162 #define VER_NT_SERVER 3
6164 #define VER_SUITE_SMALLBUSINESS 0x00000001
6165 #define VER_SUITE_ENTERPRISE 0x00000002
6166 #define VER_SUITE_BACKOFFICE 0x00000004
6167 #define VER_SUITE_COMMUNICATIONS 0x00000008
6168 #define VER_SUITE_TERMINAL 0x00000010
6169 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
6170 #define VER_SUITE_EMBEDDEDNT 0x00000040
6171 #define VER_SUITE_DATACENTER 0x00000080
6172 #define VER_SUITE_SINGLEUSERTS 0x00000100
6173 #define VER_SUITE_PERSONAL 0x00000200
6174 #define VER_SUITE_BLADE 0x00000400
6175 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
6176 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
6177 #define VER_SUITE_STORAGE_SERVER 0x00002000
6178 #define VER_SUITE_COMPUTE_SERVER 0x00004000
6179 #define VER_SUITE_WH_SERVER 0x00008000
6182 #define VER_GREATER 2
6183 #define VER_GREATER_EQUAL 3
6185 #define VER_LESS_EQUAL 5
6189 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
6191 DWORD ulFormatVersion
;
6192 DWORD ulAssemblyCount
;
6193 DWORD ulRootManifestPathType
;
6194 DWORD ulRootManifestPathChars
;
6195 DWORD ulRootConfigurationPathType
;
6196 DWORD ulRootConfigurationPathChars
;
6197 DWORD ulAppDirPathType
;
6198 DWORD ulAppDirPathChars
;
6199 PCWSTR lpRootManifestPath
;
6200 PCWSTR lpRootConfigurationPath
;
6201 PCWSTR lpAppDirPath
;
6202 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
6204 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
6206 DWORD ulEncodedAssemblyIdentityLength
;
6207 DWORD ulManifestPathType
;
6208 DWORD ulManifestPathLength
;
6209 LARGE_INTEGER liManifestLastWriteTime
;
6210 DWORD ulPolicyPathType
;
6211 DWORD ulPolicyPathLength
;
6212 LARGE_INTEGER liPolicyLastWriteTime
;
6213 DWORD ulMetadataSatelliteRosterIndex
;
6214 DWORD ulManifestVersionMajor
;
6215 DWORD ulManifestVersionMinor
;
6216 DWORD ulPolicyVersionMajor
;
6217 DWORD ulPolicyVersionMinor
;
6218 DWORD ulAssemblyDirectoryNameLength
;
6219 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
6220 PCWSTR lpAssemblyManifestPath
;
6221 PCWSTR lpAssemblyPolicyPath
;
6222 PCWSTR lpAssemblyDirectoryName
;
6224 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
6226 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
6227 DWORD ulAssemblyIndex
;
6228 DWORD ulFileIndexInAssembly
;
6229 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
6231 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
6233 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
6235 DWORD ulFilenameLength
;
6239 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
6241 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
6244 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN
= 0,
6245 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS
,
6246 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION
,
6247 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED
6248 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE
;
6250 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT
{
6252 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type
;
6253 ULONGLONG MaxVersionTested
;
6254 } COMPATIBILITY_CONTEXT_ELEMENT
, *PCOMPATIBILITY_CONTEXT_ELEMENT
;
6256 #if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3)))
6257 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
6259 COMPATIBILITY_CONTEXT_ELEMENT Elements
[];
6260 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
;
6264 ACTCTX_RUN_LEVEL_UNSPECIFIED
= 0,
6265 ACTCTX_RUN_LEVEL_AS_INVOKER
,
6266 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
,
6267 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
,
6268 ACTCTX_RUN_LEVEL_NUMBERS
6269 } ACTCTX_REQUESTED_RUN_LEVEL
;
6271 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
{
6273 ACTCTX_REQUESTED_RUN_LEVEL RunLevel
;
6275 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6277 typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
*PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6279 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
6280 ActivationContextBasicInformation
= 1,
6281 ActivationContextDetailedInformation
= 2,
6282 AssemblyDetailedInformationInActivationContext
= 3,
6283 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
6284 RunlevelInformationInActivationContext
= 5,
6285 CompatibilityInformationInActivationContext
= 6,
6286 ActivationContextManifestResourceName
= 7,
6287 MaxActivationContextInfoClass
,
6288 AssemblyDetailedInformationInActivationContxt
= AssemblyDetailedInformationInActivationContext
,
6289 FileInformationInAssemblyOfAssemblyInActivationContxt
= FileInformationInAssemblyOfAssemblyInActivationContext
6290 } ACTIVATION_CONTEXT_INFO_CLASS
;
6292 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
6293 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
6294 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
6295 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
6297 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
6298 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
6299 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
6300 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
6301 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
6302 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
6303 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
6304 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
6305 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
6306 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10
6307 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11
6308 #define ACTIVATION_CONTEXT_SECTION_WINRT_ACTIVATABLE_CLASSES 12
6310 typedef enum _JOBOBJECTINFOCLASS
6312 JobObjectBasicAccountingInformation
= 1,
6313 JobObjectBasicLimitInformation
,
6314 JobObjectBasicProcessIdList
,
6315 JobObjectBasicUIRestrictions
,
6316 JobObjectSecurityLimitInformation
,
6317 JobObjectEndOfJobTimeInformation
,
6318 JobObjectAssociateCompletionPortInformation
,
6319 JobObjectBasicAndIoAccountingInformation
,
6320 JobObjectExtendedLimitInformation
,
6321 JobObjectJobSetInformation
,
6322 MaxJobObjectInfoClass
6323 } JOBOBJECTINFOCLASS
;
6325 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
{
6326 LARGE_INTEGER TotalUserTime
;
6327 LARGE_INTEGER TotalKernelTime
;
6328 LARGE_INTEGER ThisPeriodTotalUserTime
;
6329 LARGE_INTEGER ThisPeriodTotalKernelTime
;
6330 DWORD TotalPageFaultCount
;
6331 DWORD TotalProcesses
;
6332 DWORD ActiveProcesses
;
6333 DWORD TotalTerminatedProcesses
;
6334 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION
;
6336 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION
{
6337 LARGE_INTEGER PerProcessUserTimeLimit
;
6338 LARGE_INTEGER PerJobUserTimeLimit
;
6340 SIZE_T MinimumWorkingSetSize
;
6341 SIZE_T MaximumWorkingSetSize
;
6342 DWORD ActiveProcessLimit
;
6344 DWORD PriorityClass
;
6345 DWORD SchedulingClass
;
6346 } JOBOBJECT_BASIC_LIMIT_INFORMATION
, *PJOBOBJECT_BASIC_LIMIT_INFORMATION
;
6348 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST
{
6349 DWORD NumberOfAssignedProcesses
;
6350 DWORD NumberOfProcessIdsInList
;
6351 ULONG_PTR ProcessIdList
[1];
6352 } JOBOBJECT_BASIC_PROCESS_ID_LIST
, *PJOBOBJECT_BASIC_PROCESS_ID_LIST
;
6354 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS
{
6355 DWORD UIRestrictionsClass
;
6356 } JOBOBJECT_BASIC_UI_RESTRICTIONS
, *PJOBOBJECT_BASIC_UI_RESTRICTIONS
;
6358 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
6359 DWORD SecurityLimitFlags
;
6361 PTOKEN_GROUPS SidsToDisable
;
6362 PTOKEN_PRIVILEGES PrivilegesToDelete
;
6363 PTOKEN_GROUPS RestrictedSids
;
6364 } JOBOBJECT_SECURITY_LIMIT_INFORMATION
, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION
;
6366 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
{
6367 DWORD EndOfJobTimeAction
;
6368 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION
, PJOBOBJECT_END_OF_JOB_TIME_INFORMATION
;
6370 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
{
6371 PVOID CompletionKey
;
6372 HANDLE CompletionPort
;
6373 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT
, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT
;
6375 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
6376 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
6377 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
6378 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
6379 #define JOB_OBJECT_MSG_NEW_PROCESS 6
6380 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
6381 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
6382 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
6383 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
6385 typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
{
6386 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo
;
6388 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
;
6390 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
6391 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation
;
6393 SIZE_T ProcessMemoryLimit
;
6394 SIZE_T JobMemoryLimit
;
6395 SIZE_T PeakProcessMemoryUsed
;
6396 SIZE_T PeakJobMemoryUsed
;
6397 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION
, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION
;
6399 #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
6400 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
6401 #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
6402 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
6403 #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
6404 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
6405 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
6406 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
6407 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
6408 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
6409 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
6410 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
6411 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
6412 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
6413 #define JOB_OBJECT_LIMIT_SUBSET_AFFINITY 0x00004000
6415 #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
6416 #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
6417 #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00007fff
6419 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
6421 RelationProcessorCore
= 0,
6422 RelationNumaNode
= 1,
6424 RelationProcessorPackage
= 3,
6426 RelationProcessorDie
= 5,
6427 RelationNumaNodeEx
= 6,
6428 RelationProcessorModule
= 7,
6429 RelationAll
= 0xffff
6430 } LOGICAL_PROCESSOR_RELATIONSHIP
;
6432 #define LTP_PC_SMT 0x1
6434 typedef enum _PROCESSOR_CACHE_TYPE
6440 } PROCESSOR_CACHE_TYPE
;
6442 typedef struct _PROCESSOR_GROUP_INFO
6444 BYTE MaximumProcessorCount
;
6445 BYTE ActiveProcessorCount
;
6447 KAFFINITY ActiveProcessorMask
;
6448 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
6450 typedef struct _CACHE_DESCRIPTOR
6456 PROCESSOR_CACHE_TYPE Type
;
6457 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
6459 typedef struct _GROUP_AFFINITY
6464 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
6466 #define ALL_PROCESSOR_GROUPS 0xffff
6468 typedef struct _PROCESSOR_NUMBER
6473 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
6475 typedef struct _PROCESSOR_RELATIONSHIP
6478 BYTE EfficiencyClass
;
6481 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
6482 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
6484 typedef struct _NUMA_NODE_RELATIONSHIP
6488 GROUP_AFFINITY GroupMask
;
6489 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
6491 typedef struct _CACHE_RELATIONSHIP
6497 PROCESSOR_CACHE_TYPE Type
;
6499 GROUP_AFFINITY GroupMask
;
6500 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
6502 typedef struct _GROUP_RELATIONSHIP
6504 WORD MaximumGroupCount
;
6505 WORD ActiveGroupCount
;
6507 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
6508 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
6510 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
6512 ULONG_PTR ProcessorMask
;
6513 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6524 CACHE_DESCRIPTOR Cache
;
6525 ULONGLONG Reserved
[2];
6527 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
6529 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
6531 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6535 PROCESSOR_RELATIONSHIP Processor
;
6536 NUMA_NODE_RELATIONSHIP NumaNode
;
6537 CACHE_RELATIONSHIP Cache
;
6538 GROUP_RELATIONSHIP Group
;
6540 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
6542 typedef enum _CPU_SET_INFORMATION_TYPE
6545 } CPU_SET_INFORMATION_TYPE
, *PCPU_SET_INFORMATION_TYPE
;
6547 typedef struct _SYSTEM_CPU_SET_INFORMATION
6550 CPU_SET_INFORMATION_TYPE Type
;
6557 BYTE LogicalProcessorIndex
;
6559 BYTE LastLevelCacheIndex
;
6561 BYTE EfficiencyClass
;
6569 BYTE AllocatedToTargetProcess
: 1;
6571 BYTE ReservedFlags
: 4;
6576 BYTE SchedulingClass
;
6578 DWORD64 AllocationTag
;
6581 } SYSTEM_CPU_SET_INFORMATION
, *PSYSTEM_CPU_SET_INFORMATION
;
6583 /* Threadpool things */
6584 typedef DWORD TP_VERSION
,*PTP_VERSION
;
6586 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
,*PTP_CALLBACK_INSTANCE
;
6588 typedef VOID (CALLBACK
*PTP_SIMPLE_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
);
6590 typedef struct _TP_POOL TP_POOL
,*PTP_POOL
;
6592 typedef enum _TP_CALLBACK_PRIORITY
6594 TP_CALLBACK_PRIORITY_HIGH
,
6595 TP_CALLBACK_PRIORITY_NORMAL
,
6596 TP_CALLBACK_PRIORITY_LOW
,
6597 TP_CALLBACK_PRIORITY_INVALID
,
6598 TP_CALLBACK_PRIORITY_COUNT
= TP_CALLBACK_PRIORITY_INVALID
6599 } TP_CALLBACK_PRIORITY
;
6601 typedef struct _TP_POOL_STACK_INFORMATION
6603 SIZE_T StackReserve
;
6605 } TP_POOL_STACK_INFORMATION
,*PTP_POOL_STACK_INFORMATION
;
6607 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
,*PTP_CLEANUP_GROUP
;
6609 typedef VOID (CALLBACK
*PTP_CLEANUP_GROUP_CANCEL_CALLBACK
)(PVOID
,PVOID
);
6611 typedef struct _TP_CALLBACK_ENVIRON_V1
6615 PTP_CLEANUP_GROUP CleanupGroup
;
6616 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6618 struct _ACTIVATION_CONTEXT
* ActivationContext
;
6619 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6625 DWORD LongFunction
:1;
6630 } TP_CALLBACK_ENVIRON_V1
;
6632 typedef struct _TP_CALLBACK_ENVIRON_V3
6636 PTP_CLEANUP_GROUP CleanupGroup
;
6637 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6639 struct _ACTIVATION_CONTEXT
*ActivationContext
;
6640 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6646 DWORD LongFunction
:1;
6651 TP_CALLBACK_PRIORITY CallbackPriority
;
6653 } TP_CALLBACK_ENVIRON_V3
;
6655 typedef struct _TP_WORK TP_WORK
, *PTP_WORK
;
6656 typedef struct _TP_TIMER TP_TIMER
, *PTP_TIMER
;
6658 typedef DWORD TP_WAIT_RESULT
;
6659 typedef struct _TP_WAIT TP_WAIT
, *PTP_WAIT
;
6661 typedef struct _TP_IO TP_IO
, *PTP_IO
;
6663 typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON
, *PTP_CALLBACK_ENVIRON
;
6665 typedef VOID (CALLBACK
*PTP_WORK_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WORK
);
6666 typedef VOID (CALLBACK
*PTP_TIMER_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_TIMER
);
6667 typedef VOID (CALLBACK
*PTP_WAIT_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WAIT
,TP_WAIT_RESULT
);
6670 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
6672 typedef enum _RTL_UMS_THREAD_INFO_CLASS
6674 UmsThreadInvalidInfoClass
,
6675 UmsThreadUserContext
,
6679 UmsThreadIsSuspended
,
6680 UmsThreadIsTerminated
,
6681 UmsThreadMaxInfoClass
6682 } RTL_UMS_THREAD_INFO_CLASS
, *PRTL_UMS_THREAD_INFO_CLASS
;
6684 typedef enum _RTL_UMS_SCHEDULER_REASON
6686 UmsSchedulerStartup
,
6687 UmsSchedulerThreadBlocked
,
6688 UmsSchedulerThreadYield
,
6689 } RTL_UMS_SCHEDULER_REASON
, *PRTL_UMS_SCHEDULER_REASON
;
6691 typedef void (CALLBACK
*PRTL_UMS_SCHEDULER_ENTRY_POINT
)(RTL_UMS_SCHEDULER_REASON
,ULONG_PTR
,PVOID
);
6693 typedef enum _PROCESS_MITIGATION_POLICY
6697 ProcessDynamicCodePolicy
,
6698 ProcessStrictHandleCheckPolicy
,
6699 ProcessSystemCallDisablePolicy
,
6700 ProcessMitigationOptionsMask
,
6701 ProcessExtensionPointDisablePolicy
,
6702 ProcessControlFlowGuardPolicy
,
6703 ProcessSignaturePolicy
,
6704 ProcessFontDisablePolicy
,
6705 ProcessImageLoadPolicy
,
6706 ProcessSystemCallFilterPolicy
,
6707 ProcessPayloadRestrictionPolicy
,
6708 ProcessChildProcessPolicy
,
6709 ProcessSideChannelIsolationPolicy
,
6710 MaxProcessMitigationPolicy
6711 } PROCESS_MITIGATION_POLICY
, *PPROCESS_MITIGATION_POLICY
;
6713 typedef enum _FIRMWARE_TYPE
6715 FirmwareTypeUnknown
,
6719 } FIRMWARE_TYPE
, *PFIRMWARE_TYPE
;
6721 /* Intrinsic functions */
6723 #define BitScanForward _BitScanForward
6724 #define BitScanReverse _BitScanReverse
6725 #define InterlockedAdd _InlineInterlockedAdd
6726 #define InterlockedAnd _InterlockedAnd
6727 #define InterlockedAnd64 _InterlockedAnd64
6728 #define InterlockedCompareExchange _InterlockedCompareExchange
6729 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
6730 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
6731 #define InterlockedDecrement _InterlockedDecrement
6732 #define InterlockedDecrement16 _InterlockedDecrement16
6733 #define InterlockedDecrement64 _InterlockedDecrement64
6734 #define InterlockedExchange _InterlockedExchange
6735 #define InterlockedExchangeAdd _InterlockedExchangeAdd
6736 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
6737 #define InterlockedExchangePointer _InterlockedExchangePointer
6738 #define InterlockedIncrement _InterlockedIncrement
6739 #define InterlockedIncrement16 _InterlockedIncrement16
6740 #define InterlockedIncrement64 _InterlockedIncrement64
6741 #define InterlockedOr _InterlockedOr
6742 #define InterlockedOr64 _InterlockedOr64
6743 #define InterlockedXor _InterlockedXor
6744 #define InterlockedXor64 _InterlockedXor64
6748 #pragma intrinsic(_BitScanForward)
6749 #pragma intrinsic(_BitScanReverse)
6750 #pragma intrinsic(_InterlockedAnd)
6751 #pragma intrinsic(_InterlockedCompareExchange)
6752 #pragma intrinsic(_InterlockedCompareExchange64)
6753 #pragma intrinsic(_InterlockedCompareExchangePointer)
6754 #pragma intrinsic(_InterlockedExchange)
6755 #pragma intrinsic(_InterlockedExchangeAdd)
6756 #pragma intrinsic(_InterlockedExchangePointer)
6757 #pragma intrinsic(_InterlockedIncrement)
6758 #pragma intrinsic(_InterlockedIncrement16)
6759 #pragma intrinsic(_InterlockedDecrement)
6760 #pragma intrinsic(_InterlockedDecrement16)
6761 #pragma intrinsic(_InterlockedOr)
6762 #pragma intrinsic(_InterlockedXor)
6763 #pragma intrinsic(__fastfail)
6765 BOOLEAN
_BitScanForward(unsigned long*,unsigned long);
6766 BOOLEAN
_BitScanReverse(unsigned long*,unsigned long);
6767 long _InterlockedAnd(long volatile *,long);
6768 long _InterlockedCompareExchange(long volatile*,long,long);
6769 long long _InterlockedCompareExchange64(long long volatile*,long long,long long);
6770 void * _InterlockedCompareExchangePointer(void *volatile*,void*,void*);
6771 long _InterlockedDecrement(long volatile*);
6772 short _InterlockedDecrement16(short volatile*);
6773 long _InterlockedExchange(long volatile*,long);
6774 long _InterlockedExchangeAdd(long volatile*,long);
6775 void * _InterlockedExchangePointer(void *volatile*,void*);
6776 long _InterlockedIncrement(long volatile*);
6777 short _InterlockedIncrement16(short volatile*);
6778 long _InterlockedOr(long volatile *,long);
6779 long _InterlockedXor(long volatile *,long);
6780 DECLSPEC_NORETURN
void __fastfail(unsigned int);
6784 #pragma intrinsic(_InterlockedAnd64)
6785 #pragma intrinsic(_InterlockedDecrement64)
6786 #pragma intrinsic(_InterlockedExchangeAdd64)
6787 #pragma intrinsic(_InterlockedIncrement64)
6788 #pragma intrinsic(_InterlockedOr64)
6789 #pragma intrinsic(_InterlockedXor64)
6791 __int64
_InterlockedAnd64(__int64
volatile *, __int64
);
6792 __int64
_InterlockedDecrement64(__int64
volatile *);
6793 __int64
_InterlockedExchangeAdd64(__int64
volatile *, __int64
);
6794 __int64
_InterlockedIncrement64(__int64
volatile *);
6795 __int64
_InterlockedOr64(__int64
volatile *, __int64
);
6796 __int64
_InterlockedXor64(__int64
volatile *, __int64
);
6800 static FORCEINLINE __int64
InterlockedAnd64( __int64
volatile *dest
, __int64 val
)
6803 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
& val
, prev
) != prev
);
6807 static FORCEINLINE __int64
InterlockedExchangeAdd64( __int64
volatile *dest
, __int64 val
)
6810 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
+ val
, prev
) != prev
);
6814 static FORCEINLINE __int64
InterlockedIncrement64( __int64
volatile *dest
)
6816 return InterlockedExchangeAdd64( dest
, 1 ) + 1;
6819 static FORCEINLINE __int64
InterlockedDecrement64( __int64
volatile *dest
)
6821 return InterlockedExchangeAdd64( dest
, -1 ) - 1;
6824 static FORCEINLINE __int64
InterlockedOr64( __int64
volatile *dest
, __int64 val
)
6827 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
| val
, prev
) != prev
);
6831 static FORCEINLINE __int64
InterlockedXor64( __int64
volatile *dest
, __int64 val
)
6834 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
^ val
, prev
) != prev
);
6838 #endif /* __i386__ */
6840 static FORCEINLINE
long InterlockedAdd( long volatile *dest
, long val
)
6842 return InterlockedExchangeAdd( dest
, val
) + val
;
6845 static FORCEINLINE __int64
InterlockedAdd64( __int64
volatile *dest
, __int64 val
)
6847 return InterlockedExchangeAdd64( dest
, val
) + val
;
6852 static FORCEINLINE
void MemoryBarrier(void)
6855 InterlockedOr(&dummy
, 0);
6858 #elif defined(__x86_64__)
6860 #pragma intrinsic(__faststorefence)
6861 void __faststorefence(void);
6863 static FORCEINLINE
void MemoryBarrier(void)
6868 #elif defined(__arm__)
6870 static FORCEINLINE
void MemoryBarrier(void)
6872 __dmb(_ARM_BARRIER_SY
);
6875 #elif defined(__aarch64__)
6877 static FORCEINLINE
void MemoryBarrier(void)
6879 __dmb(_ARM64_BARRIER_SY
);
6882 #endif /* __i386__ */
6884 /* Since Visual Studio 2012, volatile accesses do not always imply acquire and
6885 * release semantics. We explicitly use ISO volatile semantics, manually
6886 * placing barriers as appropriate.
6888 #if _MSC_VER >= 1700
6889 #pragma intrinsic(__iso_volatile_load32)
6890 #pragma intrinsic(__iso_volatile_store32)
6891 #define __WINE_LOAD32_NO_FENCE(src) (__iso_volatile_load32(src))
6892 #define __WINE_STORE32_NO_FENCE(dest, value) (__iso_volatile_store32(dest, value))
6893 #else /* _MSC_VER >= 1700 */
6894 #define __WINE_LOAD32_NO_FENCE(src) (*(src))
6895 #define __WINE_STORE32_NO_FENCE(dest, value) ((void)(*(dest) = (value)))
6896 #endif /* _MSC_VER >= 1700 */
6898 #if defined(__i386__) || defined(__x86_64__)
6899 #pragma intrinsic(_ReadWriteBarrier)
6900 void _ReadWriteBarrier(void);
6901 #endif /* defined(__i386__) || defined(__x86_64__) */
6903 static void __wine_memory_barrier_acq_rel(void)
6905 #if defined(__i386__) || defined(__x86_64__)
6906 #pragma warning(suppress:4996)
6907 _ReadWriteBarrier();
6908 #elif defined(__arm__)
6909 __dmb(_ARM_BARRIER_ISH
);
6910 #elif defined(__aarch64__)
6911 __dmb(_ARM64_BARRIER_ISH
);
6912 #endif /* defined(__i386__) || defined(__x86_64__) */
6915 static FORCEINLINE LONG
ReadAcquire( LONG
const volatile *src
)
6917 LONG value
= __WINE_LOAD32_NO_FENCE( (int const volatile *)src
);
6918 __wine_memory_barrier_acq_rel();
6922 static FORCEINLINE LONG
ReadNoFence( LONG
const volatile *src
)
6924 LONG value
= __WINE_LOAD32_NO_FENCE( (int const volatile *)src
);
6928 static FORCEINLINE
void WriteRelease( LONG
volatile *dest
, LONG value
)
6930 __wine_memory_barrier_acq_rel();
6931 __WINE_STORE32_NO_FENCE( (int volatile *)dest
, value
);
6934 static FORCEINLINE
void WriteNoFence( LONG
volatile *dest
, LONG value
)
6936 __WINE_STORE32_NO_FENCE( (int volatile *)dest
, value
);
6939 #elif defined(__GNUC__)
6941 static FORCEINLINE BOOLEAN WINAPI
BitScanForward(DWORD
*index
, DWORD mask
)
6943 *index
= __builtin_ctz( mask
);
6947 static FORCEINLINE BOOLEAN WINAPI
BitScanReverse(DWORD
*index
, DWORD mask
)
6949 *index
= 31 - __builtin_clz( mask
);
6953 static FORCEINLINE LONG WINAPI
InterlockedAdd( LONG
volatile *dest
, LONG val
)
6955 return __sync_add_and_fetch( dest
, val
);
6958 static FORCEINLINE LONGLONG WINAPI
InterlockedAdd64( LONGLONG
volatile *dest
, LONGLONG val
)
6960 return __sync_add_and_fetch( dest
, val
);
6963 static FORCEINLINE LONG WINAPI
InterlockedAnd( LONG
volatile *dest
, LONG val
)
6965 return __sync_fetch_and_and( dest
, val
);
6968 static FORCEINLINE LONGLONG WINAPI
InterlockedAnd64( LONGLONG
volatile *dest
, LONGLONG val
)
6970 return __sync_fetch_and_and( dest
, val
);
6973 static FORCEINLINE LONG WINAPI
InterlockedCompareExchange( LONG
volatile *dest
, LONG xchg
, LONG compare
)
6975 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6978 static FORCEINLINE
void * WINAPI
InterlockedCompareExchangePointer( void *volatile *dest
, void *xchg
, void *compare
)
6980 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6983 static FORCEINLINE LONGLONG WINAPI
InterlockedCompareExchange64( LONGLONG
volatile *dest
, LONGLONG xchg
, LONGLONG compare
)
6985 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6988 static FORCEINLINE LONG WINAPI
InterlockedExchange( LONG
volatile *dest
, LONG val
)
6991 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
6992 ret
= __atomic_exchange_n( dest
, val
, __ATOMIC_SEQ_CST
);
6993 #elif defined(__i386__) || defined(__x86_64__)
6994 __asm__
__volatile__( "lock; xchgl %0,(%1)"
6995 : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
6997 do ret
= *dest
; while (!__sync_bool_compare_and_swap( dest
, ret
, val
));
7002 static FORCEINLINE LONG WINAPI
InterlockedExchangeAdd( LONG
volatile *dest
, LONG incr
)
7004 return __sync_fetch_and_add( dest
, incr
);
7007 static FORCEINLINE LONGLONG WINAPI
InterlockedExchangeAdd64( LONGLONG
volatile *dest
, LONGLONG incr
)
7009 return __sync_fetch_and_add( dest
, incr
);
7012 static FORCEINLINE LONG WINAPI
InterlockedIncrement( LONG
volatile *dest
)
7014 return __sync_add_and_fetch( dest
, 1 );
7017 static FORCEINLINE
short WINAPI
InterlockedIncrement16( short volatile *dest
)
7019 return __sync_add_and_fetch( dest
, 1 );
7022 static FORCEINLINE LONGLONG WINAPI
InterlockedIncrement64( LONGLONG
volatile *dest
)
7024 return __sync_add_and_fetch( dest
, 1 );
7027 static FORCEINLINE LONG WINAPI
InterlockedDecrement( LONG
volatile *dest
)
7029 return __sync_add_and_fetch( dest
, -1 );
7032 static FORCEINLINE
short WINAPI
InterlockedDecrement16( short volatile *dest
)
7034 return __sync_add_and_fetch( dest
, -1 );
7037 static FORCEINLINE LONGLONG WINAPI
InterlockedDecrement64( LONGLONG
volatile *dest
)
7039 return __sync_add_and_fetch( dest
, -1 );
7042 static FORCEINLINE
void * WINAPI
InterlockedExchangePointer( void *volatile *dest
, void *val
)
7045 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
7046 ret
= __atomic_exchange_n( dest
, val
, __ATOMIC_SEQ_CST
);
7047 #elif defined(__x86_64__)
7048 __asm__
__volatile__( "lock; xchgq %0,(%1)" : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
7049 #elif defined(__i386__)
7050 __asm__
__volatile__( "lock; xchgl %0,(%1)" : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
7052 do ret
= *dest
; while (!__sync_bool_compare_and_swap( dest
, ret
, val
));
7057 static FORCEINLINE LONG WINAPI
InterlockedOr( LONG
volatile *dest
, LONG val
)
7059 return __sync_fetch_and_or( dest
, val
);
7062 static FORCEINLINE LONGLONG WINAPI
InterlockedOr64( LONGLONG
volatile *dest
, LONGLONG val
)
7064 return __sync_fetch_and_or( dest
, val
);
7067 static FORCEINLINE LONG WINAPI
InterlockedXor( LONG
volatile *dest
, LONG val
)
7069 return __sync_fetch_and_xor( dest
, val
);
7072 static FORCEINLINE LONGLONG WINAPI
InterlockedXor64( LONGLONG
volatile *dest
, LONGLONG val
)
7074 return __sync_fetch_and_xor( dest
, val
);
7077 static FORCEINLINE
void MemoryBarrier(void)
7079 __sync_synchronize();
7082 #if defined(__x86_64__) || defined(__i386__)
7083 /* On x86, Support old GCC with either no or buggy (GCC BZ#81316) __atomic_* support */
7084 #define __WINE_ATOMIC_LOAD_ACQUIRE(ptr, ret) do { *(ret) = *(ptr); __asm__ __volatile__( "" ::: "memory" ); } while (0)
7085 #define __WINE_ATOMIC_LOAD_RELAXED(ptr, ret) do { *(ret) = *(ptr); } while (0)
7086 #define __WINE_ATOMIC_STORE_RELEASE(ptr, val) do { __asm__ __volatile__( "" ::: "memory" ); *(ptr) = *(val); } while (0)
7087 #define __WINE_ATOMIC_STORE_RELAXED(ptr, val) do { *(ptr) = *(val); } while (0)
7089 #define __WINE_ATOMIC_LOAD_ACQUIRE(ptr, ret) __atomic_load(ptr, ret, __ATOMIC_ACQUIRE)
7090 #define __WINE_ATOMIC_LOAD_RELAXED(ptr, ret) __atomic_load(ptr, ret, __ATOMIC_RELAXED)
7091 #define __WINE_ATOMIC_STORE_RELEASE(ptr, val) __atomic_store(ptr, val, __ATOMIC_RELEASE)
7092 #define __WINE_ATOMIC_STORE_RELAXED(ptr, val) __atomic_store(ptr, val, __ATOMIC_RELAXED)
7093 #endif /* defined(__x86_64__) || defined(__i386__) */
7095 static FORCEINLINE LONG
ReadAcquire( LONG
const volatile *src
)
7098 __WINE_ATOMIC_LOAD_ACQUIRE( src
, &value
);
7102 static FORCEINLINE LONG
ReadNoFence( LONG
const volatile *src
)
7105 __WINE_ATOMIC_LOAD_RELAXED( src
, &value
);
7109 static FORCEINLINE
void WriteRelease( LONG
volatile *dest
, LONG value
)
7111 __WINE_ATOMIC_STORE_RELEASE( dest
, &value
);
7114 static FORCEINLINE
void WriteNoFence( LONG
volatile *dest
, LONG value
)
7116 __WINE_ATOMIC_STORE_RELAXED( dest
, &value
);
7119 static FORCEINLINE DECLSPEC_NORETURN
void __fastfail(unsigned int code
)
7121 #if defined(__x86_64__) || defined(__i386__)
7122 for (;;) __asm__
__volatile__( "int $0x29" :: "c" ((ULONG_PTR
)code
) : "memory" );
7123 #elif defined(__aarch64__)
7124 register ULONG_PTR val
__asm__("x0") = code
;
7125 for (;;) __asm__
__volatile__( "brk #0xf003" :: "r" (val
) : "memory" );
7126 #elif defined(__arm__)
7127 register ULONG_PTR val
__asm__("r0") = code
;
7128 for (;;) __asm__
__volatile__( "udf #0xfb" :: "r" (val
) : "memory" );
7132 #endif /* __GNUC__ */
7136 #define InterlockedCompareExchange128 _InterlockedCompareExchange128
7138 #if defined(_MSC_VER) && !defined(__clang__)
7140 #pragma intrinsic(_InterlockedCompareExchange128)
7141 unsigned char _InterlockedCompareExchange128(volatile __int64
*, __int64
, __int64
, __int64
*);
7145 static FORCEINLINE
unsigned char InterlockedCompareExchange128( volatile __int64
*dest
, __int64 xchg_high
, __int64 xchg_low
, __int64
*compare
)
7149 __asm__
__volatile__( "lock cmpxchg16b %0; setz %b2"
7150 : "=m" (dest
[0]), "=m" (dest
[1]), "=r" (ret
),
7151 "=a" (compare
[0]), "=d" (compare
[1])
7152 : "m" (dest
[0]), "m" (dest
[1]), "3" (compare
[0]), "4" (compare
[1]),
7153 "c" (xchg_high
), "b" (xchg_low
) );
7156 return __sync_bool_compare_and_swap( (__int128
*)dest
, *(__int128
*)compare
, ((__int128
)xchg_high
<< 64) | xchg_low
);
7162 #define InterlockedDecrementSizeT(a) InterlockeDecrement64((LONGLONG *)(a))
7163 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)(a), (b))
7164 #define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)(a))
7168 #define InterlockedDecrementSizeT(a) InterlockeDecrement((LONG *)(a))
7169 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)(a), (b))
7170 #define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)(a))
7174 static FORCEINLINE
void YieldProcessor(void)
7177 #if defined(__i386__) || defined(__x86_64__)
7178 __asm__
__volatile__( "rep; nop" : : : "memory" );
7179 #elif defined(__arm__) || defined(__aarch64__)
7180 __asm__
__volatile__( "dmb ishst\n\tyield" : : : "memory" );
7182 __asm__
__volatile__( "" : : : "memory" );
7191 #endif /* _WINNT_ */