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 MemExtendedParameterMax
781 } MEM_EXTENDED_PARAMETER_TYPE
, *PMEM_EXTENDED_PARAMETER_TYPE
;
783 typedef struct DECLSPEC_ALIGN(8) MEM_EXTENDED_PARAMETER
{
786 DWORD64 Type
: MEM_EXTENDED_PARAMETER_TYPE_BITS
;
787 DWORD64 Reserved
: 64 - MEM_EXTENDED_PARAMETER_TYPE_BITS
;
798 } MEM_EXTENDED_PARAMETER
, *PMEM_EXTENDED_PARAMETER
;
800 #define PAGE_NOACCESS 0x01
801 #define PAGE_READONLY 0x02
802 #define PAGE_READWRITE 0x04
803 #define PAGE_WRITECOPY 0x08
804 #define PAGE_EXECUTE 0x10
805 #define PAGE_EXECUTE_READ 0x20
806 #define PAGE_EXECUTE_READWRITE 0x40
807 #define PAGE_EXECUTE_WRITECOPY 0x80
808 #define PAGE_GUARD 0x100
809 #define PAGE_NOCACHE 0x200
810 #define PAGE_WRITECOMBINE 0x400
812 #define MEM_COMMIT 0x00001000
813 #define MEM_RESERVE 0x00002000
814 #define MEM_REPLACE_PLACEHOLDER 0x00004000
815 #define MEM_RESERVE_PLACEHOLDER 0x00040000
816 #define MEM_RESET 0x00080000
817 #define MEM_TOP_DOWN 0x00100000
818 #define MEM_PHYSICAL 0x00400000
819 #define MEM_RESET_UNDO 0x10000000
820 #define MEM_LARGE_PAGES 0x20000000
822 #define MEM_COALESCE_PLACEHOLDERS 0x00000001
823 #define MEM_PRESERVE_PLACEHOLDER 0x00000002
824 #define MEM_DECOMMIT 0x00004000
825 #define MEM_RELEASE 0x00008000
827 #define MEM_FREE 0x00010000
828 #define MEM_PRIVATE 0x00020000
829 #define MEM_MAPPED 0x00040000
830 #define MEM_WRITE_WATCH 0x00200000
831 #define MEM_4MB_PAGES 0x80000000
833 #define SEC_FILE 0x00800000
834 #define SEC_IMAGE 0x01000000
835 #define SEC_PROTECTED_IMAGE 0x02000000
836 #define SEC_RESERVE 0x04000000
837 #define SEC_COMMIT 0x08000000
838 #define SEC_NOCACHE 0x10000000
839 #define SEC_WRITECOMBINE 0x40000000
840 #define SEC_LARGE_PAGES 0x80000000
841 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
842 #define MEM_IMAGE SEC_IMAGE
844 #define WRITE_WATCH_FLAG_RESET 0x00000001
846 #define AT_ROUND_TO_PAGE 0x40000000
850 #define MINSHORT 0x8000
851 #define MAXSHORT 0x7fff
852 #define MINLONG 0x80000000
853 #define MAXLONG 0x7fffffff
855 #define MAXWORD 0xffff
856 #define MAXDWORD 0xffffffff
857 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
859 #define UNICODE_STRING_MAX_CHARS 32767
861 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
862 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
863 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
865 #define CONTAINING_RECORD(address, type, field) \
866 ((type *)((PCHAR)(address) - offsetof(type, field)))
868 #define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
870 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
875 typedef struct _LIST_ENTRY
{
876 struct _LIST_ENTRY
*Flink
;
877 struct _LIST_ENTRY
*Blink
;
878 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
880 typedef struct _SINGLE_LIST_ENTRY
{
881 struct _SINGLE_LIST_ENTRY
*Next
;
882 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
886 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
887 struct _SLIST_ENTRY
*Next
;
888 } SLIST_ENTRY
, *PSLIST_ENTRY
;
890 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
897 ULONGLONG Sequence
:9;
898 ULONGLONG NextEntry
:39;
899 ULONGLONG HeaderType
:1;
901 ULONGLONG Reserved
:59;
906 ULONGLONG Sequence
:48;
907 ULONGLONG HeaderType
:1;
909 ULONGLONG Reserved
:2;
910 ULONGLONG NextEntry
:60;
912 } SLIST_HEADER
, *PSLIST_HEADER
;
916 #undef SLIST_ENTRY /* for Mac OS */
917 #define SLIST_ENTRY SINGLE_LIST_ENTRY
918 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
919 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
921 typedef union _SLIST_HEADER
{
928 } SLIST_HEADER
, *PSLIST_HEADER
;
932 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
933 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
934 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
935 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
936 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
937 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
940 /* Fast fail (__fastfail) codes */
942 #define FAST_FAIL_LEGACY_GS_VIOLATION 0
943 #define FAST_FAIL_VTGUARD_CHECK_FAILURE 1
944 #define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE 2
945 #define FAST_FAIL_CORRUPT_LIST_ENTRY 3
946 #define FAST_FAIL_INCORRECT_STACK 4
947 #define FAST_FAIL_INVALID_ARG 5
948 #define FAST_FAIL_GS_COOKIE_INIT 6
949 #define FAST_FAIL_FATAL_APP_EXIT 7
950 #define FAST_FAIL_RANGE_CHECK_FAILURE 8
951 #define FAST_FAIL_UNSAFE_REGISTRY_ACCESS 9
952 #define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE 10
953 #define FAST_FAIL_GUARD_WRITE_CHECK_FAILURE 11
954 #define FAST_FAIL_INVALID_FIBER_SWITCH 12
955 #define FAST_FAIL_INVALID_SET_OF_CONTEXT 13
956 #define FAST_FAIL_INVALID_REFERENCE_COUNT 14
957 #define FAST_FAIL_INVALID_JUMP_BUFFER 18
958 #define FAST_FAIL_MRDATA_MODIFIED 19
959 #define FAST_FAIL_CERTIFICATION_FAILURE 20
960 #define FAST_FAIL_INVALID_EXCEPTION_CHAIN 21
961 #define FAST_FAIL_CRYPTO_LIBRARY 22
962 #define FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT 23
963 #define FAST_FAIL_INVALID_IMAGE_BASE 24
964 #define FAST_FAIL_DLOAD_PROTECTION_FAILURE 25
965 #define FAST_FAIL_UNSAFE_EXTENSION_CALL 26
966 #define FAST_FAIL_DEPRECATED_SERVICE_INVOKED 27
967 #define FAST_FAIL_INVALID_BUFFER_ACCESS 28
968 #define FAST_FAIL_INVALID_BALANCED_TREE 29
969 #define FAST_FAIL_INVALID_NEXT_THREAD 30
970 #define FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED 31
971 #define FAST_FAIL_APCS_DISABLED 32
972 #define FAST_FAIL_INVALID_IDLE_STATE 33
973 #define FAST_FAIL_MRDATA_PROTECTION_FAILURE 34
974 #define FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION 35
975 #define FAST_FAIL_INVALID_LOCK_STATE 36
976 #define FAST_FAIL_GUARD_JUMPTABLE 37
977 #define FAST_FAIL_INVALID_LONGJUMP_TARGET 38
978 #define FAST_FAIL_INVALID_DISPATCH_CONTEXT 39
979 #define FAST_FAIL_INVALID_THREAD 40
980 #define FAST_FAIL_INVALID_SYSCALL_NUMBER 41
981 #define FAST_FAIL_INVALID_FILE_OPERATION 42
982 #define FAST_FAIL_LPAC_ACCESS_DENIED 43
983 #define FAST_FAIL_GUARD_SS_FAILURE 44
984 #define FAST_FAIL_LOADER_CONTINUITY_FAILURE 45
985 #define FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE 46
986 #define FAST_FAIL_INVALID_CONTROL_STACK 47
987 #define FAST_FAIL_SET_CONTEXT_DENIED 48
988 #define FAST_FAIL_INVALID_IAT 49
989 #define FAST_FAIL_HEAP_METADATA_CORRUPTION 50
990 #define FAST_FAIL_PAYLOAD_RESTRICTION_VIOLATION 51
991 #define FAST_FAIL_LOW_LABEL_ACCESS_DENIED 52
992 #define FAST_FAIL_ENCLAVE_CALL_FAILURE 53
993 #define FAST_FAIL_UNHANDLED_LSS_EXCEPTON 54
994 #define FAST_FAIL_ADMINLESS_ACCESS_DENIED 55
995 #define FAST_FAIL_UNEXPECTED_CALL 56
996 #define FAST_FAIL_CONTROL_INVALID_RETURN_ADDRESS 57
997 #define FAST_FAIL_UNEXPECTED_HOST_BEHAVIOR 58
998 #define FAST_FAIL_FLAGS_CORRUPTION 59
999 #define FAST_FAIL_VEH_CORRUPTION 60
1000 #define FAST_FAIL_ETW_CORRUPTION 61
1001 #define FAST_FAIL_RIO_ABORT 62
1002 #define FAST_FAIL_INVALID_PFN 63
1003 #define FAST_FAIL_GUARD_ICALL_CHECK_FAILURE_XFG 64
1004 #define FAST_FAIL_CAST_GUARD 65
1005 #define FAST_FAIL_HOST_VISIBILITY_CHANGE 66
1006 #define FAST_FAIL_KERNEL_CET_SHADOW_STACK_ASSIST 67
1007 #define FAST_FAIL_PATCH_CALLBACK_FAILED 68
1008 #define FAST_FAIL_NTDLL_PATCH_FAILED 69
1009 #define FAST_FAIL_INVALID_FLS_DATA 70
1010 #define FAST_FAIL_INVALID_FAST_FAIL_CODE 0xFFFFFFFF
1014 #define HEAP_NO_SERIALIZE 0x00000001
1015 #define HEAP_GROWABLE 0x00000002
1016 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
1017 #define HEAP_ZERO_MEMORY 0x00000008
1018 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
1019 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
1020 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
1021 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
1022 #define HEAP_CREATE_ALIGN_16 0x00010000
1023 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
1024 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
1026 /* This flag allows it to create heaps shared by all processes under win95,
1027 FIXME: correct name */
1028 #define HEAP_SHARED 0x04000000
1030 typedef enum _HEAP_INFORMATION_CLASS
{
1031 HeapCompatibilityInformation
,
1032 } HEAP_INFORMATION_CLASS
;
1034 /* Processor feature flags. */
1035 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
1036 #define PF_FLOATING_POINT_EMULATED 1
1037 #define PF_COMPARE_EXCHANGE_DOUBLE 2
1038 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
1039 #define PF_PPC_MOVEMEM_64BIT_OK 4
1040 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
1041 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
1042 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
1043 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
1044 #define PF_PAE_ENABLED 9
1045 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
1046 #define PF_SSE_DAZ_MODE_AVAILABLE 11
1047 #define PF_NX_ENABLED 12
1048 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
1049 #define PF_COMPARE_EXCHANGE128 14
1050 #define PF_COMPARE64_EXCHANGE128 15
1051 #define PF_CHANNELS_ENABLED 16
1052 #define PF_XSAVE_ENABLED 17
1053 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
1054 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
1055 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
1056 #define PF_VIRT_FIRMWARE_ENABLED 21
1057 #define PF_RDWRFSGSBASE_AVAILABLE 22
1058 #define PF_FASTFAIL_AVAILABLE 23
1059 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
1060 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
1061 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
1062 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
1063 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
1064 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
1065 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
1066 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
1067 #define PF_RDTSCP_INSTRUCTION_AVAILABLE 32
1068 #define PF_RDPID_INSTRUCTION_AVAILABLE 33
1069 #define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
1070 #define PF_MONITORX_INSTRUCTION_AVAILABLE 35
1071 #define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
1072 #define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
1073 #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
1074 #define PF_AVX_INSTRUCTIONS_AVAILABLE 39
1075 #define PF_AVX2_INSTRUCTIONS_AVAILABLE 40
1076 #define PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
1077 #define PF_ERMS_AVAILABLE 42
1078 #define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
1079 #define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44
1080 #define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
1083 /* Execution state flags */
1084 #define ES_SYSTEM_REQUIRED 0x00000001
1085 #define ES_DISPLAY_REQUIRED 0x00000002
1086 #define ES_USER_PRESENT 0x00000004
1087 #define ES_CONTINUOUS 0x80000000
1091 /* The Win32 register context */
1093 /* i386 context definitions */
1095 #define I386_SIZE_OF_80387_REGISTERS 80
1097 typedef struct _I386_FLOATING_SAVE_AREA
1103 DWORD ErrorSelector
;
1106 BYTE RegisterArea
[I386_SIZE_OF_80387_REGISTERS
];
1108 } I386_FLOATING_SAVE_AREA
, WOW64_FLOATING_SAVE_AREA
, *PWOW64_FLOATING_SAVE_AREA
;
1110 #define I386_MAXIMUM_SUPPORTED_EXTENSION 512
1112 #include "pshpack4.h"
1113 typedef struct _I386_CONTEXT
1115 DWORD ContextFlags
; /* 000 */
1117 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1118 DWORD Dr0
; /* 004 */
1119 DWORD Dr1
; /* 008 */
1120 DWORD Dr2
; /* 00c */
1121 DWORD Dr3
; /* 010 */
1122 DWORD Dr6
; /* 014 */
1123 DWORD Dr7
; /* 018 */
1125 /* These are selected by CONTEXT_FLOATING_POINT */
1126 I386_FLOATING_SAVE_AREA FloatSave
; /* 01c */
1128 /* These are selected by CONTEXT_SEGMENTS */
1129 DWORD SegGs
; /* 08c */
1130 DWORD SegFs
; /* 090 */
1131 DWORD SegEs
; /* 094 */
1132 DWORD SegDs
; /* 098 */
1134 /* These are selected by CONTEXT_INTEGER */
1135 DWORD Edi
; /* 09c */
1136 DWORD Esi
; /* 0a0 */
1137 DWORD Ebx
; /* 0a4 */
1138 DWORD Edx
; /* 0a8 */
1139 DWORD Ecx
; /* 0ac */
1140 DWORD Eax
; /* 0b0 */
1142 /* These are selected by CONTEXT_CONTROL */
1143 DWORD Ebp
; /* 0b4 */
1144 DWORD Eip
; /* 0b8 */
1145 DWORD SegCs
; /* 0bc */
1146 DWORD EFlags
; /* 0c0 */
1147 DWORD Esp
; /* 0c4 */
1148 DWORD SegSs
; /* 0c8 */
1150 BYTE ExtendedRegisters
[I386_MAXIMUM_SUPPORTED_EXTENSION
]; /* 0xcc */
1151 } I386_CONTEXT
, WOW64_CONTEXT
, *PWOW64_CONTEXT
;
1152 #include "poppack.h"
1154 #define CONTEXT_i386 0x00010000
1155 #define CONTEXT_i486 0x00010000
1157 #define CONTEXT_I386_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
1158 #define CONTEXT_I386_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
1159 #define CONTEXT_I386_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1160 #define CONTEXT_I386_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1161 #define CONTEXT_I386_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1162 #define CONTEXT_I386_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1163 #define CONTEXT_I386_XSTATE (CONTEXT_i386 | 0x0040)
1164 #define CONTEXT_I386_FULL (CONTEXT_I386_CONTROL | CONTEXT_I386_INTEGER | CONTEXT_I386_SEGMENTS)
1165 #define CONTEXT_I386_ALL (CONTEXT_I386_FULL | CONTEXT_I386_FLOATING_POINT | CONTEXT_I386_DEBUG_REGISTERS | CONTEXT_I386_EXTENDED_REGISTERS)
1169 #define CONTEXT_CONTROL CONTEXT_I386_CONTROL
1170 #define CONTEXT_INTEGER CONTEXT_I386_INTEGER
1171 #define CONTEXT_SEGMENTS CONTEXT_I386_SEGMENTS
1172 #define CONTEXT_FLOATING_POINT CONTEXT_I386_FLOATING_POINT
1173 #define CONTEXT_DEBUG_REGISTERS CONTEXT_I386_DEBUG_REGISTERS
1174 #define CONTEXT_EXTENDED_REGISTERS CONTEXT_I386_EXTENDED_REGISTERS
1175 #define CONTEXT_XSTATE CONTEXT_I386_XSTATE
1176 #define CONTEXT_FULL CONTEXT_I386_FULL
1177 #define CONTEXT_ALL CONTEXT_I386_ALL
1178 #define SIZE_OF_80387_REGISTERS I386_SIZE_OF_80387_REGISTERS
1179 #define MAXIMUM_SUPPORTED_EXTENSION I386_MAXIMUM_SUPPORTED_EXTENSION
1181 typedef I386_FLOATING_SAVE_AREA FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
1182 typedef I386_CONTEXT CONTEXT
, *PCONTEXT
;
1184 #endif /* __i386__ */
1186 typedef struct _LDT_ENTRY
{
1197 unsigned BaseMid
: 8;
1201 unsigned LimitHi
: 4;
1203 unsigned Reserved_0
: 1;
1204 unsigned Default_Big
: 1;
1205 unsigned Granularity
: 1;
1206 unsigned BaseHi
: 8;
1209 } LDT_ENTRY
, *PLDT_ENTRY
, WOW64_LDT_ENTRY
, *PWOW64_LDT_ENTRY
;
1211 typedef struct DECLSPEC_ALIGN(16) _M128A
{
1216 typedef struct _XSAVE_FORMAT
{
1217 WORD ControlWord
; /* 000 */
1218 WORD StatusWord
; /* 002 */
1219 BYTE TagWord
; /* 004 */
1220 BYTE Reserved1
; /* 005 */
1221 WORD ErrorOpcode
; /* 006 */
1222 DWORD ErrorOffset
; /* 008 */
1223 WORD ErrorSelector
; /* 00c */
1224 WORD Reserved2
; /* 00e */
1225 DWORD DataOffset
; /* 010 */
1226 WORD DataSelector
; /* 014 */
1227 WORD Reserved3
; /* 016 */
1228 DWORD MxCsr
; /* 018 */
1229 DWORD MxCsr_Mask
; /* 01c */
1230 M128A FloatRegisters
[8]; /* 020 */
1231 M128A XmmRegisters
[16]; /* 0a0 */
1232 BYTE Reserved4
[96]; /* 1a0 */
1233 } XSAVE_FORMAT
, *PXSAVE_FORMAT
;
1235 /* x86-64 context definitions */
1237 typedef struct _AMD64_RUNTIME_FUNCTION
1242 } AMD64_RUNTIME_FUNCTION
;
1244 #define CONTEXT_AMD64 0x00100000
1246 #define CONTEXT_AMD64_CONTROL (CONTEXT_AMD64 | 0x0001)
1247 #define CONTEXT_AMD64_INTEGER (CONTEXT_AMD64 | 0x0002)
1248 #define CONTEXT_AMD64_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1249 #define CONTEXT_AMD64_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1250 #define CONTEXT_AMD64_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1251 #define CONTEXT_AMD64_XSTATE (CONTEXT_AMD64 | 0x0040)
1252 #define CONTEXT_AMD64_FULL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_FLOATING_POINT)
1253 #define CONTEXT_AMD64_ALL (CONTEXT_AMD64_CONTROL | CONTEXT_AMD64_INTEGER | CONTEXT_AMD64_SEGMENTS | CONTEXT_AMD64_FLOATING_POINT | CONTEXT_AMD64_DEBUG_REGISTERS)
1255 typedef XSAVE_FORMAT XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
1257 typedef struct DECLSPEC_ALIGN(16) _AMD64_CONTEXT
{
1258 DWORD64 P1Home
; /* 000 */
1259 DWORD64 P2Home
; /* 008 */
1260 DWORD64 P3Home
; /* 010 */
1261 DWORD64 P4Home
; /* 018 */
1262 DWORD64 P5Home
; /* 020 */
1263 DWORD64 P6Home
; /* 028 */
1266 DWORD ContextFlags
; /* 030 */
1267 DWORD MxCsr
; /* 034 */
1270 WORD SegCs
; /* 038 */
1271 WORD SegDs
; /* 03a */
1272 WORD SegEs
; /* 03c */
1273 WORD SegFs
; /* 03e */
1274 WORD SegGs
; /* 040 */
1275 WORD SegSs
; /* 042 */
1276 DWORD EFlags
; /* 044 */
1279 DWORD64 Dr0
; /* 048 */
1280 DWORD64 Dr1
; /* 050 */
1281 DWORD64 Dr2
; /* 058 */
1282 DWORD64 Dr3
; /* 060 */
1283 DWORD64 Dr6
; /* 068 */
1284 DWORD64 Dr7
; /* 070 */
1287 DWORD64 Rax
; /* 078 */
1288 DWORD64 Rcx
; /* 080 */
1289 DWORD64 Rdx
; /* 088 */
1290 DWORD64 Rbx
; /* 090 */
1291 DWORD64 Rsp
; /* 098 */
1292 DWORD64 Rbp
; /* 0a0 */
1293 DWORD64 Rsi
; /* 0a8 */
1294 DWORD64 Rdi
; /* 0b0 */
1295 DWORD64 R8
; /* 0b8 */
1296 DWORD64 R9
; /* 0c0 */
1297 DWORD64 R10
; /* 0c8 */
1298 DWORD64 R11
; /* 0d0 */
1299 DWORD64 R12
; /* 0d8 */
1300 DWORD64 R13
; /* 0e0 */
1301 DWORD64 R14
; /* 0e8 */
1302 DWORD64 R15
; /* 0f0 */
1305 DWORD64 Rip
; /* 0f8 */
1307 /* Floating point */
1309 XMM_SAVE_AREA32 FltSave
; /* 100 */
1311 M128A Header
[2]; /* 100 */
1312 M128A Legacy
[8]; /* 120 */
1313 M128A Xmm0
; /* 1a0 */
1314 M128A Xmm1
; /* 1b0 */
1315 M128A Xmm2
; /* 1c0 */
1316 M128A Xmm3
; /* 1d0 */
1317 M128A Xmm4
; /* 1e0 */
1318 M128A Xmm5
; /* 1f0 */
1319 M128A Xmm6
; /* 200 */
1320 M128A Xmm7
; /* 210 */
1321 M128A Xmm8
; /* 220 */
1322 M128A Xmm9
; /* 230 */
1323 M128A Xmm10
; /* 240 */
1324 M128A Xmm11
; /* 250 */
1325 M128A Xmm12
; /* 260 */
1326 M128A Xmm13
; /* 270 */
1327 M128A Xmm14
; /* 280 */
1328 M128A Xmm15
; /* 290 */
1333 M128A VectorRegister
[26]; /* 300 */
1334 DWORD64 VectorControl
; /* 4a0 */
1337 DWORD64 DebugControl
; /* 4a8 */
1338 DWORD64 LastBranchToRip
; /* 4b0 */
1339 DWORD64 LastBranchFromRip
; /* 4b8 */
1340 DWORD64 LastExceptionToRip
; /* 4c0 */
1341 DWORD64 LastExceptionFromRip
; /* 4c8 */
1346 #define CONTEXT_CONTROL CONTEXT_AMD64_CONTROL
1347 #define CONTEXT_INTEGER CONTEXT_AMD64_INTEGER
1348 #define CONTEXT_SEGMENTS CONTEXT_AMD64_SEGMENTS
1349 #define CONTEXT_FLOATING_POINT CONTEXT_AMD64_FLOATING_POINT
1350 #define CONTEXT_DEBUG_REGISTERS CONTEXT_AMD64_DEBUG_REGISTERS
1351 #define CONTEXT_XSTATE CONTEXT_AMD64_XSTATE
1352 #define CONTEXT_FULL CONTEXT_AMD64_FULL
1353 #define CONTEXT_ALL CONTEXT_AMD64_ALL
1355 typedef AMD64_CONTEXT CONTEXT
, *PCONTEXT
;
1356 typedef AMD64_RUNTIME_FUNCTION RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1358 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1362 PM128A FloatingContext
[16];
1386 PULONG64 IntegerContext
[16];
1407 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1409 #endif /* __x86_64__ */
1411 #define XSTATE_LEGACY_FLOATING_POINT 0
1412 #define XSTATE_LEGACY_SSE 1
1413 #define XSTATE_GSSE 2
1414 #define XSTATE_AVX XSTATE_GSSE
1415 #define XSTATE_MPX_BNDREGS 3
1416 #define XSTATE_MPX_BNDCSR 4
1417 #define XSTATE_AVX512_KMASK 5
1418 #define XSTATE_AVX512_ZMM_H 6
1419 #define XSTATE_AVX512_ZMM 7
1420 #define XSTATE_IPT 8
1421 #define XSTATE_CET_U 11
1422 #define XSTATE_LWP 62
1423 #define MAXIMUM_XSTATE_FEATURES 64
1425 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1 << XSTATE_LEGACY_FLOATING_POINT)
1426 #define XSTATE_MASK_LEGACY_SSE (1 << XSTATE_LEGACY_SSE)
1427 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1428 #define XSTATE_MASK_GSSE (1 << XSTATE_GSSE)
1430 typedef struct _XSTATE_FEATURE
1434 } XSTATE_FEATURE
, *PXSTATE_FEATURE
;
1436 typedef struct _XSTATE_CONFIGURATION
1438 ULONG64 EnabledFeatures
;
1439 ULONG64 EnabledVolatileFeatures
;
1441 ULONG OptimizedSave
:1;
1442 ULONG CompactionEnabled
:1;
1443 XSTATE_FEATURE Features
[MAXIMUM_XSTATE_FEATURES
];
1445 ULONG64 EnabledSupervisorFeatures
;
1446 ULONG64 AlignedFeatures
;
1447 ULONG AllFeatureSize
;
1448 ULONG AllFeatures
[MAXIMUM_XSTATE_FEATURES
];
1449 ULONG64 EnabledUserVisibleSupervisorFeatures
;
1450 } XSTATE_CONFIGURATION
, *PXSTATE_CONFIGURATION
;
1452 typedef struct _YMMCONTEXT
1471 YMMCONTEXT
, *PYMMCONTEXT
;
1473 typedef struct _XSTATE
1476 ULONG64 CompactionMask
;
1477 ULONG64 Reserved
[6];
1478 YMMCONTEXT YmmContext
;
1481 typedef struct _CONTEXT_CHUNK
1485 } CONTEXT_CHUNK
, *PCONTEXT_CHUNK
;
1487 typedef struct _CONTEXT_EX
1490 CONTEXT_CHUNK Legacy
;
1491 CONTEXT_CHUNK XState
;
1495 } CONTEXT_EX
, *PCONTEXT_EX
;
1497 #define CONTEXT_ARM 0x0200000
1498 #define CONTEXT_ARM_CONTROL (CONTEXT_ARM | 0x00000001)
1499 #define CONTEXT_ARM_INTEGER (CONTEXT_ARM | 0x00000002)
1500 #define CONTEXT_ARM_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1501 #define CONTEXT_ARM_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1502 #define CONTEXT_ARM_FULL (CONTEXT_ARM_CONTROL | CONTEXT_ARM_INTEGER)
1503 #define CONTEXT_ARM_ALL (CONTEXT_ARM_FULL | CONTEXT_ARM_FLOATING_POINT | CONTEXT_ARM_DEBUG_REGISTERS)
1505 #define ARM_MAX_BREAKPOINTS 8
1506 #define ARM_MAX_WATCHPOINTS 1
1508 typedef struct _IMAGE_ARM_RUNTIME_FUNCTION
1515 DWORD FunctionLength
: 11;
1522 DWORD StackAdjust
: 10;
1525 } IMAGE_ARM_RUNTIME_FUNCTION_ENTRY
, *PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY
;
1527 typedef struct _ARM_NEON128
1533 typedef struct _ARM_CONTEXT
1535 ULONG ContextFlags
; /* 000 */
1536 /* CONTEXT_INTEGER */
1547 ULONG R10
; /* 02c */
1548 ULONG R11
; /* 030 */
1549 ULONG R12
; /* 034 */
1550 /* CONTEXT_CONTROL */
1554 ULONG Cpsr
; /* 044 */
1555 /* CONTEXT_FLOATING_POINT */
1556 ULONG Fpscr
; /* 048 */
1557 ULONG Padding
; /* 04c */
1563 } DUMMYUNIONNAME
; /* 050 */
1564 /* CONTEXT_DEBUG_REGISTERS */
1565 ULONG Bvr
[ARM_MAX_BREAKPOINTS
]; /* 150 */
1566 ULONG Bcr
[ARM_MAX_BREAKPOINTS
]; /* 170 */
1567 ULONG Wvr
[ARM_MAX_WATCHPOINTS
]; /* 190 */
1568 ULONG Wcr
[ARM_MAX_WATCHPOINTS
]; /* 194 */
1569 ULONG Padding2
[2]; /* 198 */
1574 #define CONTEXT_CONTROL CONTEXT_ARM_CONTROL
1575 #define CONTEXT_INTEGER CONTEXT_ARM_INTEGER
1576 #define CONTEXT_FLOATING_POINT CONTEXT_ARM_FLOATING_POINT
1577 #define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM_DEBUG_REGISTERS
1578 #define CONTEXT_FULL CONTEXT_ARM_FULL
1579 #define CONTEXT_ALL CONTEXT_ARM_ALL
1581 typedef IMAGE_ARM_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1582 typedef ARM_NEON128 NEON128
, *PNEON128
;
1583 typedef ARM_CONTEXT CONTEXT
, *PCONTEXT
;
1585 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1604 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1606 #endif /* __arm__ */
1608 #define CONTEXT_ARM64 0x400000
1609 #define CONTEXT_ARM64_CONTROL (CONTEXT_ARM64 | 0x00000001)
1610 #define CONTEXT_ARM64_INTEGER (CONTEXT_ARM64 | 0x00000002)
1611 #define CONTEXT_ARM64_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1612 #define CONTEXT_ARM64_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1613 #define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x00000010)
1614 #define CONTEXT_ARM64_FULL (CONTEXT_ARM64_CONTROL | CONTEXT_ARM64_INTEGER | CONTEXT_ARM64_FLOATING_POINT)
1615 #define CONTEXT_ARM64_ALL (CONTEXT_ARM64_FULL | CONTEXT_ARM64_DEBUG_REGISTERS | CONTEXT_ARM64_X18)
1617 #define CONTEXT_UNWOUND_TO_CALL 0x20000000
1619 #define ARM64_MAX_BREAKPOINTS 8
1620 #define ARM64_MAX_WATCHPOINTS 2
1622 typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
1631 DWORD FunctionLength
: 11;
1636 DWORD FrameSize
: 9;
1639 } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
, *PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY
;
1641 typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY ARM64_RUNTIME_FUNCTION
, *PARM64_RUNTIME_FUNCTION
;
1643 typedef union _ARM64_NT_NEON128
1654 } ARM64_NT_NEON128
, *PARM64_NT_NEON128
;
1656 typedef struct DECLSPEC_ALIGN(16) _ARM64_NT_CONTEXT
1658 ULONG ContextFlags
; /* 000 */
1659 /* CONTEXT_INTEGER */
1660 ULONG Cpsr
; /* 004 */
1665 DWORD64 X0
; /* 008 */
1666 DWORD64 X1
; /* 010 */
1667 DWORD64 X2
; /* 018 */
1668 DWORD64 X3
; /* 020 */
1669 DWORD64 X4
; /* 028 */
1670 DWORD64 X5
; /* 030 */
1671 DWORD64 X6
; /* 038 */
1672 DWORD64 X7
; /* 040 */
1673 DWORD64 X8
; /* 048 */
1674 DWORD64 X9
; /* 050 */
1675 DWORD64 X10
; /* 058 */
1676 DWORD64 X11
; /* 060 */
1677 DWORD64 X12
; /* 068 */
1678 DWORD64 X13
; /* 070 */
1679 DWORD64 X14
; /* 078 */
1680 DWORD64 X15
; /* 080 */
1681 DWORD64 X16
; /* 088 */
1682 DWORD64 X17
; /* 090 */
1683 DWORD64 X18
; /* 098 */
1684 DWORD64 X19
; /* 0a0 */
1685 DWORD64 X20
; /* 0a8 */
1686 DWORD64 X21
; /* 0b0 */
1687 DWORD64 X22
; /* 0b8 */
1688 DWORD64 X23
; /* 0c0 */
1689 DWORD64 X24
; /* 0c8 */
1690 DWORD64 X25
; /* 0d0 */
1691 DWORD64 X26
; /* 0d8 */
1692 DWORD64 X27
; /* 0e0 */
1693 DWORD64 X28
; /* 0e8 */
1694 DWORD64 Fp
; /* 0f0 */
1695 DWORD64 Lr
; /* 0f8 */
1697 DWORD64 X
[31]; /* 008 */
1699 /* CONTEXT_CONTROL */
1700 DWORD64 Sp
; /* 100 */
1701 DWORD64 Pc
; /* 108 */
1702 /* CONTEXT_FLOATING_POINT */
1703 ARM64_NT_NEON128 V
[32]; /* 110 */
1704 DWORD Fpcr
; /* 310 */
1705 DWORD Fpsr
; /* 314 */
1706 /* CONTEXT_DEBUG_REGISTERS */
1707 DWORD Bcr
[ARM64_MAX_BREAKPOINTS
]; /* 318 */
1708 DWORD64 Bvr
[ARM64_MAX_BREAKPOINTS
]; /* 338 */
1709 DWORD Wcr
[ARM64_MAX_WATCHPOINTS
]; /* 378 */
1710 DWORD64 Wvr
[ARM64_MAX_WATCHPOINTS
]; /* 380 */
1711 } ARM64_NT_CONTEXT
, *PARM64_NT_CONTEXT
;
1715 #define CONTEXT_CONTROL CONTEXT_ARM64_CONTROL
1716 #define CONTEXT_INTEGER CONTEXT_ARM64_INTEGER
1717 #define CONTEXT_FLOATING_POINT CONTEXT_ARM64_FLOATING_POINT
1718 #define CONTEXT_DEBUG_REGISTERS CONTEXT_ARM64_DEBUG_REGISTERS
1719 #define CONTEXT_FULL CONTEXT_ARM64_FULL
1720 #define CONTEXT_ALL CONTEXT_ARM64_ALL
1722 typedef IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1723 typedef ARM64_NT_NEON128 NEON128
, *PNEON128
;
1724 typedef ARM64_NT_CONTEXT CONTEXT
, *PCONTEXT
;
1726 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1748 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1750 #endif /* __aarch64__ */
1752 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1753 #error You need to define a CONTEXT for your CPU
1756 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1758 #define WOW64_CONTEXT_i386 0x00010000
1759 #define WOW64_CONTEXT_i486 0x00010000
1760 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
1761 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
1762 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
1763 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
1764 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
1765 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
1766 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
1767 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
1768 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
1769 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
1770 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
1772 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
1773 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
1774 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
1775 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
1777 #define WOW64_SIZE_OF_80387_REGISTERS 80
1778 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
1780 /* Exception definitions */
1782 #define EXCEPTION_READ_FAULT 0
1783 #define EXCEPTION_WRITE_FAULT 1
1784 #define EXCEPTION_EXECUTE_FAULT 8
1786 struct _EXCEPTION_POINTERS
;
1787 struct _EXCEPTION_RECORD
;
1789 typedef EXCEPTION_DISPOSITION WINAPI
EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,PVOID
);
1790 typedef EXCEPTION_ROUTINE
*PEXCEPTION_ROUTINE
;
1794 #define UNWIND_HISTORY_TABLE_SIZE 12
1796 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1799 PRUNTIME_FUNCTION FunctionEntry
;
1800 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1802 #define UNWIND_HISTORY_TABLE_NONE 0
1803 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1804 #define UNWIND_HISTORY_TABLE_LOCAL 2
1806 typedef struct _UNWIND_HISTORY_TABLE
1811 ULONG64 HighAddress
;
1812 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1813 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1815 typedef struct _DISPATCHER_CONTEXT
1819 PRUNTIME_FUNCTION FunctionEntry
;
1820 ULONG64 EstablisherFrame
;
1822 PCONTEXT ContextRecord
;
1823 PEXCEPTION_ROUTINE LanguageHandler
;
1825 PUNWIND_HISTORY_TABLE HistoryTable
;
1828 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1830 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,PVOID
);
1831 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,PVOID
);
1833 #define UNW_FLAG_NHANDLER 0
1834 #define UNW_FLAG_EHANDLER 1
1835 #define UNW_FLAG_UHANDLER 2
1836 #define UNW_FLAG_CHAININFO 4
1838 #elif defined(__arm__)
1840 #define UNWIND_HISTORY_TABLE_SIZE 12
1842 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1845 PRUNTIME_FUNCTION FunctionEntry
;
1846 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1848 typedef struct _UNWIND_HISTORY_TABLE
1857 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1858 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1860 typedef struct _DISPATCHER_CONTEXT
1864 PRUNTIME_FUNCTION FunctionEntry
;
1865 DWORD EstablisherFrame
;
1867 PCONTEXT ContextRecord
;
1868 PEXCEPTION_ROUTINE LanguageHandler
;
1870 PUNWIND_HISTORY_TABLE HistoryTable
;
1872 BOOLEAN ControlPcIsUnwound
;
1873 PBYTE NonVolatileRegisters
;
1875 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1877 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD
);
1878 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD
);
1880 #define UNW_FLAG_NHANDLER 0
1881 #define UNW_FLAG_EHANDLER 1
1882 #define UNW_FLAG_UHANDLER 2
1884 #elif defined(__aarch64__)
1886 #define UNWIND_HISTORY_TABLE_SIZE 12
1888 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1891 PRUNTIME_FUNCTION FunctionEntry
;
1892 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1894 typedef struct _UNWIND_HISTORY_TABLE
1902 DWORD64 HighAddress
;
1903 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1904 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1906 typedef struct _DISPATCHER_CONTEXT
1908 ULONG_PTR ControlPc
;
1909 ULONG_PTR ImageBase
;
1910 PRUNTIME_FUNCTION FunctionEntry
;
1911 ULONG_PTR EstablisherFrame
;
1913 PCONTEXT ContextRecord
;
1914 PEXCEPTION_ROUTINE LanguageHandler
;
1916 PUNWIND_HISTORY_TABLE HistoryTable
;
1918 BOOLEAN ControlPcIsUnwound
;
1919 PBYTE NonVolatileRegisters
;
1920 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1922 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD64
);
1923 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD64
);
1925 #define UNW_FLAG_NHANDLER 0
1926 #define UNW_FLAG_EHANDLER 1
1927 #define UNW_FLAG_UHANDLER 2
1929 #endif /* __aarch64__ */
1931 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
1933 typedef PRUNTIME_FUNCTION (CALLBACK
*PGET_RUNTIME_FUNCTION_CALLBACK
)(DWORD_PTR
,PVOID
);
1935 NTSYSAPI BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD_PTR
);
1936 NTSYSAPI DWORD WINAPI
RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION
,DWORD
,DWORD
,ULONG_PTR
,ULONG_PTR
);
1937 NTSYSAPI BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
1938 NTSYSAPI
void WINAPI
RtlDeleteGrowableFunctionTable(void*);
1939 NTSYSAPI
void WINAPI
RtlGrowFunctionTable(void*,DWORD
);
1940 NTSYSAPI BOOLEAN CDECL
RtlInstallFunctionTableCallback(DWORD_PTR
,DWORD_PTR
,DWORD
,PGET_RUNTIME_FUNCTION_CALLBACK
,PVOID
,PCWSTR
);
1941 NTSYSAPI PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD_PTR
,DWORD_PTR
*,UNWIND_HISTORY_TABLE
*);
1942 NTSYSAPI
void WINAPI
RtlUnwindEx(PVOID
,PVOID
,struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,UNWIND_HISTORY_TABLE
*);
1943 NTSYSAPI PVOID WINAPI
RtlVirtualUnwind(DWORD
,ULONG_PTR
,ULONG_PTR
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG_PTR
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1950 #define PRODUCT_UNDEFINED 0x00000000
1951 #define PRODUCT_ULTIMATE 0x00000001
1952 #define PRODUCT_HOME_BASIC 0x00000002
1953 #define PRODUCT_HOME_PREMIUM 0x00000003
1954 #define PRODUCT_ENTERPRISE 0x00000004
1955 #define PRODUCT_HOME_BASIC_N 0x00000005
1956 #define PRODUCT_BUSINESS 0x00000006
1957 #define PRODUCT_STANDARD_SERVER 0x00000007
1958 #define PRODUCT_DATACENTER_SERVER 0x00000008
1959 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1960 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1961 #define PRODUCT_STARTER 0x0000000B
1962 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1963 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1964 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1965 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1966 #define PRODUCT_BUSINESS_N 0x00000010
1967 #define PRODUCT_WEB_SERVER 0x00000011
1968 #define PRODUCT_CLUSTER_SERVER 0x00000012
1969 #define PRODUCT_HOME_SERVER 0x00000013
1970 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1971 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1972 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1973 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1974 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1975 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
1976 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1977 #define PRODUCT_ENTERPRISE_N 0x0000001B
1978 #define PRODUCT_ULTIMATE_N 0x0000001C
1979 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1980 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1981 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1982 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1983 #define PRODUCT_SERVER_FOUNDATION 0x00000021
1984 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
1985 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1986 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1987 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
1988 #define PRODUCT_SERVER_V 0x00000025
1989 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1990 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1991 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1992 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1993 #define PRODUCT_HYPERV 0x0000002A
1994 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
1995 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
1996 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
1997 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
1998 #define PRODUCT_STARTER_N 0x0000002F
1999 #define PRODUCT_PROFESSIONAL 0x00000030
2000 #define PRODUCT_PROFESSIONAL_N 0x00000031
2001 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2002 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2003 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2004 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2005 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2006 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2007 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2008 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2009 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2010 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2011 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2012 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2013 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2014 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2015 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2016 #define PRODUCT_EMBEDDED 0x00000041
2017 #define PRODUCT_STARTER_E 0x00000042
2018 #define PRODUCT_HOME_BASIC_E 0x00000043
2019 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2020 #define PRODUCT_PROFESSIONAL_E 0x00000045
2021 #define PRODUCT_ENTERPRISE_E 0x00000046
2022 #define PRODUCT_ULTIMATE_E 0x00000047
2023 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2024 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2025 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2026 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2027 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2028 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2029 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2030 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2031 #define PRODUCT_THINPC 0x00000057
2032 #define PRODUCT_EMBEDDED_A 0x00000058
2033 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2034 #define PRODUCT_EMBEDDED_E 0x0000005A
2035 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2036 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2037 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2038 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2039 #define PRODUCT_CORE_ARM 0x00000061
2040 #define PRODUCT_CORE_N 0x00000062
2041 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2042 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2043 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2044 #define PRODUCT_CORE 0x00000065
2045 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2046 #define PRODUCT_MOBILE_CORE 0x00000068
2047 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2048 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2049 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2050 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2051 #define PRODUCT_NANO_SERVER 0x0000006D
2052 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2053 #define PRODUCT_CORE_CONNECTED 0x0000006F
2054 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2055 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2056 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2057 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2058 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2059 #define PRODUCT_CONNECTED_CAR 0x00000075
2060 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2061 #define PRODUCT_PPI_PRO 0x00000077
2062 #define PRODUCT_ARM64_SERVER 0x00000078
2063 #define PRODUCT_EDUCATION 0x00000079
2064 #define PRODUCT_EDUCATION_N 0x0000007A
2065 #define PRODUCT_IOTUAP 0x0000007B
2066 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2067 #define PRODUCT_ENTERPRISE_S 0x0000007D
2068 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2069 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2070 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2071 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2072 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2073 #define PRODUCT_UNLICENSED 0xABCDABCD
2080 #define MAKELCID(l, s) (MAKELONG(l, s))
2082 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2083 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2084 #define SUBLANGID(l) ((WORD)(l) >> 10)
2086 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2087 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2089 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2090 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2091 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2092 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2093 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2094 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2095 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2096 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2097 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2098 #define LOCALE_NAME_MAX_LENGTH 85
2101 #define UNREFERENCED_PARAMETER(u) (void)(u)
2102 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2103 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2109 * Definitions for IsTextUnicode()
2112 #define IS_TEXT_UNICODE_ASCII16 0x0001
2113 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2114 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2115 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2116 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2117 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2118 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2119 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2120 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2121 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2122 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2123 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2124 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2125 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2126 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2127 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2129 #define MAXIMUM_WAIT_OBJECTS 64
2130 #define MAXIMUM_SUSPEND_COUNT 127
2132 #define WT_EXECUTEDEFAULT 0x00
2133 #define WT_EXECUTEINIOTHREAD 0x01
2134 #define WT_EXECUTEINUITHREAD 0x02
2135 #define WT_EXECUTEINWAITTHREAD 0x04
2136 #define WT_EXECUTEONLYONCE 0x08
2137 #define WT_EXECUTELONGFUNCTION 0x10
2138 #define WT_EXECUTEINTIMERTHREAD 0x20
2139 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2140 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2141 #define WT_EXECUTEINLONGTHREAD 0x10
2142 #define WT_EXECUTEDELETEWAIT 0x08
2143 #define WT_TRANSFER_IMPERSONATION 0x0100
2146 #define EXCEPTION_CONTINUABLE 0
2147 #define EXCEPTION_NONCONTINUABLE 0x01
2150 * The exception record used by Win32 to give additional information
2151 * about exception to exception handlers.
2154 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2156 typedef struct _EXCEPTION_RECORD
2158 DWORD ExceptionCode
;
2159 DWORD ExceptionFlags
;
2160 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2162 PVOID ExceptionAddress
;
2163 DWORD NumberParameters
;
2164 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2165 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2167 typedef struct _EXCEPTION_RECORD32
2169 DWORD ExceptionCode
;
2170 DWORD ExceptionFlags
;
2171 DWORD ExceptionRecord
;
2172 DWORD ExceptionAddress
;
2173 DWORD NumberParameters
;
2174 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2175 } EXCEPTION_RECORD32
, *PEXCEPTION_RECORD32
;
2177 typedef struct _EXCEPTION_RECORD64
2179 DWORD ExceptionCode
;
2180 DWORD ExceptionFlags
;
2181 DWORD64 ExceptionRecord
;
2182 DWORD64 ExceptionAddress
;
2183 DWORD NumberParameters
;
2184 DWORD __unusedAlignment
;
2185 DWORD64 ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2186 } EXCEPTION_RECORD64
, *PEXCEPTION_RECORD64
;
2189 * The exception pointers structure passed to exception filters
2190 * in except() and the UnhandledExceptionFilter().
2193 typedef struct _EXCEPTION_POINTERS
2195 PEXCEPTION_RECORD ExceptionRecord
;
2196 PCONTEXT ContextRecord
;
2197 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2201 * The exception frame, used for registering exception handlers
2202 * Win32 cares only about this, but compilers generally emit
2203 * larger exception frames for their own use.
2206 struct _EXCEPTION_REGISTRATION_RECORD
;
2208 typedef DWORD (CDECL
*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2209 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2211 typedef struct _EXCEPTION_REGISTRATION_RECORD
2213 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2214 PEXCEPTION_HANDLER Handler
;
2215 } EXCEPTION_REGISTRATION_RECORD
;
2218 * function pointer to an exception filter
2221 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2223 typedef struct _NT_TIB
2225 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2233 PVOID ArbitraryUserPointer
;
2234 struct _NT_TIB
*Self
;
2239 #if defined(__i386__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2240 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2243 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2246 #elif defined(__i386__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2247 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2250 __asm mov eax
, fs
:[0x18];
2254 #elif defined(__x86_64__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2255 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2258 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2261 #elif defined(__x86_64__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2262 unsigned __int64
__readgsqword(unsigned long);
2263 #pragma intrinsic(__readgsqword)
2264 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2266 return (struct _TEB
*)__readgsqword(FIELD_OFFSET(NT_TIB
, Self
));
2268 #elif defined(__arm__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
2269 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2272 __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb
));
2275 #elif defined(__arm__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
2276 #pragma intrinsic(_MoveFromCoprocessor)
2277 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2279 return (struct _TEB
*)(ULONG_PTR
)_MoveFromCoprocessor(15, 0, 13, 0, 2);
2281 #elif defined(__GNUC__)
2282 extern struct _TEB
* WINAPI
NtCurrentTeb(void) __attribute__((pure
));
2284 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2287 #ifdef NONAMELESSUNION
2288 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2290 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2292 #define GetFiberData() (*(void **)GetCurrentFiber())
2294 #define TLS_MINIMUM_AVAILABLE 64
2296 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2298 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2299 #define IO_REPARSE_TAG_RESERVED_ONE 1
2300 #define IO_REPARSE_TAG_RESERVED_TWO 2
2302 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2304 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2305 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2306 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2307 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2308 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2309 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2310 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2311 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2312 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2313 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2314 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2315 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2316 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2317 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2318 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2319 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2320 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2321 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2322 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2323 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2324 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2325 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2326 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2327 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2328 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2329 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2330 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2331 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2332 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2333 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2334 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2335 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2336 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2337 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2338 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2339 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2340 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2341 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2342 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2343 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2344 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2345 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2346 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2349 * File formats definitions
2352 #include <pshpack2.h>
2353 typedef struct _IMAGE_DOS_HEADER
{
2354 WORD e_magic
; /* 00: MZ Header signature */
2355 WORD e_cblp
; /* 02: Bytes on last page of file */
2356 WORD e_cp
; /* 04: Pages in file */
2357 WORD e_crlc
; /* 06: Relocations */
2358 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2359 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2360 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2361 WORD e_ss
; /* 0e: Initial (relative) SS value */
2362 WORD e_sp
; /* 10: Initial SP value */
2363 WORD e_csum
; /* 12: Checksum */
2364 WORD e_ip
; /* 14: Initial IP value */
2365 WORD e_cs
; /* 16: Initial (relative) CS value */
2366 WORD e_lfarlc
; /* 18: File address of relocation table */
2367 WORD e_ovno
; /* 1a: Overlay number */
2368 WORD e_res
[4]; /* 1c: Reserved words */
2369 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2370 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2371 WORD e_res2
[10]; /* 28: Reserved words */
2372 DWORD e_lfanew
; /* 3c: Offset to extended header */
2373 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2374 #include <poppack.h>
2376 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2377 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2378 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2379 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2380 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2381 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2384 * This is the Windows executable (NE) header.
2385 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2387 #include <pshpack2.h>
2390 WORD ne_magic
; /* 00 NE signature 'NE' */
2391 BYTE ne_ver
; /* 02 Linker version number */
2392 BYTE ne_rev
; /* 03 Linker revision number */
2393 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2394 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2395 LONG ne_crc
; /* 08 Checksum */
2396 WORD ne_flags
; /* 0c Flags about segments in this file */
2397 WORD ne_autodata
; /* 0e Automatic data segment number */
2398 WORD ne_heap
; /* 10 Initial size of local heap */
2399 WORD ne_stack
; /* 12 Initial size of stack */
2400 DWORD ne_csip
; /* 14 Initial CS:IP */
2401 DWORD ne_sssp
; /* 18 Initial SS:SP */
2402 WORD ne_cseg
; /* 1c # of entries in segment table */
2403 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2404 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2405 WORD ne_segtab
; /* 22 Offset to segment table */
2406 WORD ne_rsrctab
; /* 24 Offset to resource table */
2407 WORD ne_restab
; /* 26 Offset to resident-name table */
2408 WORD ne_modtab
; /* 28 Offset to module reference table */
2409 WORD ne_imptab
; /* 2a Offset to imported name table */
2410 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2411 WORD ne_cmovent
; /* 30 # of movable entry points */
2412 WORD ne_align
; /* 32 Logical sector alignment shift count */
2413 WORD ne_cres
; /* 34 # of resource segments */
2414 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2415 BYTE ne_flagsothers
; /* 37 Additional information flags */
2416 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2417 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2418 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2419 WORD ne_expver
; /* 3e Expected Windows version number */
2420 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2421 #include <poppack.h>
2423 #include <pshpack2.h>
2424 typedef struct _IMAGE_VXD_HEADER
{
2439 DWORD e32_lastpagesize
;
2440 DWORD e32_fixupsize
;
2457 DWORD e32_impmodcnt
;
2463 DWORD e32_cbnrestab
;
2466 DWORD e32_debuginfo
;
2468 DWORD e32_instpreload
;
2469 DWORD e32_instdemand
;
2472 DWORD e32_winresoff
;
2473 DWORD e32_winreslen
;
2476 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2477 #include <poppack.h>
2479 /* These defines describe the meanings of the bits in the Characteristics
2482 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2483 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2484 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2485 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2486 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2487 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2488 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2489 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2490 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2491 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2492 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2493 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2494 #define IMAGE_FILE_SYSTEM 0x1000
2495 #define IMAGE_FILE_DLL 0x2000
2496 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2497 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2499 /* These are the settings of the Machine field. */
2500 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2501 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
2502 #define IMAGE_FILE_MACHINE_I860 0x014d
2503 #define IMAGE_FILE_MACHINE_I386 0x014c
2504 #define IMAGE_FILE_MACHINE_R3000 0x0162
2505 #define IMAGE_FILE_MACHINE_R4000 0x0166
2506 #define IMAGE_FILE_MACHINE_R10000 0x0168
2507 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2508 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2509 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2510 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2511 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2512 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2513 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2514 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2515 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2516 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
2517 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
2518 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2519 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2520 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2521 #define IMAGE_FILE_MACHINE_IA64 0x0200
2522 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2523 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2524 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2525 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2526 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2527 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2528 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2529 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2530 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2531 #define IMAGE_FILE_MACHINE_M32R 0x9041
2532 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2534 #define IMAGE_SIZEOF_FILE_HEADER 20
2535 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2536 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2537 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2538 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2539 #define IMAGE_SIZEOF_SHORT_NAME 8
2540 #define IMAGE_SIZEOF_SECTION_HEADER 40
2541 #define IMAGE_SIZEOF_SYMBOL 18
2542 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2543 #define IMAGE_SIZEOF_RELOCATION 10
2544 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2545 #define IMAGE_SIZEOF_LINENUMBER 6
2546 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2548 /* Possible Magic values */
2549 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2550 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2551 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2554 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2555 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2557 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2558 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2561 /* These are indexes into the DataDirectory array */
2562 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2563 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2564 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2565 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2566 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2567 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2568 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2569 #define IMAGE_FILE_DESCRIPTION_STRING 7
2570 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2571 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2572 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2574 /* Directory Entries, indices into the DataDirectory array */
2576 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2577 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2578 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2579 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2580 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2581 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2582 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2583 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2584 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2585 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2586 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2587 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2588 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2589 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2590 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2592 /* Subsystem Values */
2594 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2595 #define IMAGE_SUBSYSTEM_NATIVE 1
2596 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2597 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2598 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2599 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2600 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2601 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2602 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2603 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2604 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2605 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2606 #define IMAGE_SUBSYSTEM_XBOX 14
2607 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2609 /* DLL Characteristics */
2610 #define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA 0x0020
2611 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2612 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2613 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2614 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2615 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2616 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2617 #define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000
2618 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2619 #define IMAGE_DLLCHARACTERISTICS_GUARD_CF 0x4000
2620 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2622 typedef struct _IMAGE_FILE_HEADER
{
2624 WORD NumberOfSections
;
2625 DWORD TimeDateStamp
;
2626 DWORD PointerToSymbolTable
;
2627 DWORD NumberOfSymbols
;
2628 WORD SizeOfOptionalHeader
;
2629 WORD Characteristics
;
2630 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2632 typedef struct _IMAGE_DATA_DIRECTORY
{
2633 DWORD VirtualAddress
;
2635 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2637 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2639 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2640 WORD Magic
; /* 0x20b */
2641 BYTE MajorLinkerVersion
;
2642 BYTE MinorLinkerVersion
;
2644 DWORD SizeOfInitializedData
;
2645 DWORD SizeOfUninitializedData
;
2646 DWORD AddressOfEntryPoint
;
2648 ULONGLONG ImageBase
;
2649 DWORD SectionAlignment
;
2650 DWORD FileAlignment
;
2651 WORD MajorOperatingSystemVersion
;
2652 WORD MinorOperatingSystemVersion
;
2653 WORD MajorImageVersion
;
2654 WORD MinorImageVersion
;
2655 WORD MajorSubsystemVersion
;
2656 WORD MinorSubsystemVersion
;
2657 DWORD Win32VersionValue
;
2659 DWORD SizeOfHeaders
;
2662 WORD DllCharacteristics
;
2663 ULONGLONG SizeOfStackReserve
;
2664 ULONGLONG SizeOfStackCommit
;
2665 ULONGLONG SizeOfHeapReserve
;
2666 ULONGLONG SizeOfHeapCommit
;
2668 DWORD NumberOfRvaAndSizes
;
2669 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2670 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2672 typedef struct _IMAGE_NT_HEADERS64
{
2674 IMAGE_FILE_HEADER FileHeader
;
2675 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2676 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2678 typedef struct _IMAGE_OPTIONAL_HEADER
{
2680 /* Standard fields */
2682 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2683 BYTE MajorLinkerVersion
;
2684 BYTE MinorLinkerVersion
;
2686 DWORD SizeOfInitializedData
;
2687 DWORD SizeOfUninitializedData
;
2688 DWORD AddressOfEntryPoint
; /* 0x10 */
2692 /* NT additional fields */
2695 DWORD SectionAlignment
; /* 0x20 */
2696 DWORD FileAlignment
;
2697 WORD MajorOperatingSystemVersion
;
2698 WORD MinorOperatingSystemVersion
;
2699 WORD MajorImageVersion
;
2700 WORD MinorImageVersion
;
2701 WORD MajorSubsystemVersion
; /* 0x30 */
2702 WORD MinorSubsystemVersion
;
2703 DWORD Win32VersionValue
;
2705 DWORD SizeOfHeaders
;
2706 DWORD CheckSum
; /* 0x40 */
2708 WORD DllCharacteristics
;
2709 DWORD SizeOfStackReserve
;
2710 DWORD SizeOfStackCommit
;
2711 DWORD SizeOfHeapReserve
; /* 0x50 */
2712 DWORD SizeOfHeapCommit
;
2714 DWORD NumberOfRvaAndSizes
;
2715 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2717 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2719 typedef struct _IMAGE_NT_HEADERS
{
2720 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2721 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2722 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2723 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2726 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2727 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2728 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2729 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2731 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2732 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2733 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2734 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2737 #define IMAGE_SIZEOF_SHORT_NAME 8
2739 typedef struct _IMAGE_SECTION_HEADER
{
2740 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2742 DWORD PhysicalAddress
;
2745 DWORD VirtualAddress
;
2746 DWORD SizeOfRawData
;
2747 DWORD PointerToRawData
;
2748 DWORD PointerToRelocations
;
2749 DWORD PointerToLinenumbers
;
2750 WORD NumberOfRelocations
;
2751 WORD NumberOfLinenumbers
;
2752 DWORD Characteristics
;
2753 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2755 #define IMAGE_SIZEOF_SECTION_HEADER 40
2757 #define IMAGE_FIRST_SECTION(ntheader) \
2758 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2759 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2761 /* These defines are for the Characteristics bitfield. */
2762 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2763 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2764 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2765 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2766 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2767 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2769 #define IMAGE_SCN_CNT_CODE 0x00000020
2770 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2771 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2773 #define IMAGE_SCN_LNK_OTHER 0x00000100
2774 #define IMAGE_SCN_LNK_INFO 0x00000200
2775 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2776 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2777 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2779 /* 0x00002000 - Reserved */
2780 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2781 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2783 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2784 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2785 #define IMAGE_SCN_MEM_16BIT 0x00020000
2786 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2787 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2789 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2790 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2791 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2792 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2793 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2794 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2795 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2796 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2797 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2798 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2799 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2800 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2801 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2802 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2803 /* 0x00F00000 - Unused */
2804 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2806 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2809 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2810 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2811 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2812 #define IMAGE_SCN_MEM_SHARED 0x10000000
2813 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2814 #define IMAGE_SCN_MEM_READ 0x40000000
2815 #define IMAGE_SCN_MEM_WRITE 0x80000000
2817 #include <pshpack2.h>
2819 typedef struct _IMAGE_SYMBOL
{
2829 SHORT SectionNumber
;
2832 BYTE NumberOfAuxSymbols
;
2834 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2836 #define IMAGE_SIZEOF_SYMBOL 18
2838 typedef struct _IMAGE_LINENUMBER
{
2840 DWORD SymbolTableIndex
;
2841 DWORD VirtualAddress
;
2845 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2847 #define IMAGE_SIZEOF_LINENUMBER 6
2849 typedef union _IMAGE_AUX_SYMBOL
{
2861 DWORD PointerToLinenumber
;
2862 DWORD PointerToNextFunction
;
2871 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2875 WORD NumberOfRelocations
;
2876 WORD NumberOfLinenumbers
;
2882 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2884 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2886 #include <poppack.h>
2888 #define IMAGE_SYM_UNDEFINED (SHORT)0
2889 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2890 #define IMAGE_SYM_DEBUG (SHORT)-2
2892 #define IMAGE_SYM_TYPE_NULL 0x0000
2893 #define IMAGE_SYM_TYPE_VOID 0x0001
2894 #define IMAGE_SYM_TYPE_CHAR 0x0002
2895 #define IMAGE_SYM_TYPE_SHORT 0x0003
2896 #define IMAGE_SYM_TYPE_INT 0x0004
2897 #define IMAGE_SYM_TYPE_LONG 0x0005
2898 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2899 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2900 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2901 #define IMAGE_SYM_TYPE_UNION 0x0009
2902 #define IMAGE_SYM_TYPE_ENUM 0x000A
2903 #define IMAGE_SYM_TYPE_MOE 0x000B
2904 #define IMAGE_SYM_TYPE_BYTE 0x000C
2905 #define IMAGE_SYM_TYPE_WORD 0x000D
2906 #define IMAGE_SYM_TYPE_UINT 0x000E
2907 #define IMAGE_SYM_TYPE_DWORD 0x000F
2908 #define IMAGE_SYM_TYPE_PCODE 0x8000
2910 #define IMAGE_SYM_DTYPE_NULL 0
2911 #define IMAGE_SYM_DTYPE_POINTER 1
2912 #define IMAGE_SYM_DTYPE_FUNCTION 2
2913 #define IMAGE_SYM_DTYPE_ARRAY 3
2915 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2916 #define IMAGE_SYM_CLASS_NULL 0x0000
2917 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2918 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2919 #define IMAGE_SYM_CLASS_STATIC 0x0003
2920 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2921 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2922 #define IMAGE_SYM_CLASS_LABEL 0x0006
2923 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2924 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2925 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2926 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2927 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2928 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2929 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2930 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2931 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2932 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2933 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2934 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2936 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2937 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2938 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2939 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2940 #define IMAGE_SYM_CLASS_FILE 0x0067
2941 #define IMAGE_SYM_CLASS_SECTION 0x0068
2942 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2944 #define N_BTMASK 0x000F
2945 #define N_TMASK 0x0030
2946 #define N_TMASK1 0x00C0
2947 #define N_TMASK2 0x00F0
2951 #define BTYPE(x) ((x) & N_BTMASK)
2954 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2958 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2962 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2966 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2970 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2973 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2976 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2977 #define IMAGE_COMDAT_SELECT_ANY 2
2978 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2979 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2980 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2981 #define IMAGE_COMDAT_SELECT_LARGEST 6
2982 #define IMAGE_COMDAT_SELECT_NEWEST 7
2984 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2985 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2986 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2988 /* Export module directory */
2990 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2991 DWORD Characteristics
;
2992 DWORD TimeDateStamp
;
2997 DWORD NumberOfFunctions
;
2998 DWORD NumberOfNames
;
2999 DWORD AddressOfFunctions
;
3000 DWORD AddressOfNames
;
3001 DWORD AddressOfNameOrdinals
;
3002 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3004 /* Import name entry */
3005 typedef struct _IMAGE_IMPORT_BY_NAME
{
3008 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3010 #include <pshpack8.h>
3012 typedef struct _IMAGE_THUNK_DATA64
{
3014 ULONGLONG ForwarderString
;
3017 ULONGLONG AddressOfData
;
3019 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3020 #include <poppack.h>
3022 typedef struct _IMAGE_THUNK_DATA32
{
3024 DWORD ForwarderString
;
3027 DWORD AddressOfData
;
3029 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3031 /* Import module directory */
3033 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3035 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3036 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3038 DWORD TimeDateStamp
; /* 0 if not bound,
3039 * -1 if bound, and real date\time stamp
3040 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3042 * otherwise date/time stamp of DLL bound to
3045 DWORD ForwarderChain
; /* -1 if no forwarders */
3047 /* RVA to IAT (if bound this IAT has actual addresses) */
3049 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3051 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3052 #define IMAGE_ORDINAL_FLAG32 0x80000000
3053 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3054 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3055 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3056 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3059 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3060 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3061 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3062 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3063 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3065 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3066 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3067 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3068 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3069 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3072 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3074 DWORD TimeDateStamp
;
3075 WORD OffsetModuleName
;
3076 WORD NumberOfModuleForwarderRefs
;
3077 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3078 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3080 typedef struct _IMAGE_BOUND_FORWARDER_REF
3082 DWORD TimeDateStamp
;
3083 WORD OffsetModuleName
;
3085 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3087 typedef struct _IMAGE_BASE_RELOCATION
3089 DWORD VirtualAddress
;
3091 /* WORD TypeOffset[1]; */
3092 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3094 #include <pshpack2.h>
3096 typedef struct _IMAGE_RELOCATION
3099 DWORD VirtualAddress
;
3102 DWORD SymbolTableIndex
;
3104 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3106 #include <poppack.h>
3108 #define IMAGE_SIZEOF_RELOCATION 10
3110 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
3114 DWORD AllAttributes
;
3118 DWORD ReservedAttributes
:31;
3123 DWORD ModuleHandleRVA
;
3124 DWORD ImportAddressTableRVA
;
3125 DWORD ImportNameTableRVA
;
3126 DWORD BoundImportAddressTableRVA
;
3127 DWORD UnloadInformationTableRVA
;
3128 DWORD TimeDateStamp
;
3129 } IMAGE_DELAYLOAD_DESCRIPTOR
, *PIMAGE_DELAYLOAD_DESCRIPTOR
;
3130 typedef const IMAGE_DELAYLOAD_DESCRIPTOR
*PCIMAGE_DELAYLOAD_DESCRIPTOR
;
3132 /* generic relocation types */
3133 #define IMAGE_REL_BASED_ABSOLUTE 0
3134 #define IMAGE_REL_BASED_HIGH 1
3135 #define IMAGE_REL_BASED_LOW 2
3136 #define IMAGE_REL_BASED_HIGHLOW 3
3137 #define IMAGE_REL_BASED_HIGHADJ 4
3138 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3139 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3140 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3141 #define IMAGE_REL_BASED_SECTION 6
3142 #define IMAGE_REL_BASED_REL 7
3143 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3144 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3145 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3146 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3147 #define IMAGE_REL_BASED_DIR64 10
3148 #define IMAGE_REL_BASED_HIGH3ADJ 11
3150 /* I386 relocation types */
3151 #define IMAGE_REL_I386_ABSOLUTE 0
3152 #define IMAGE_REL_I386_DIR16 1
3153 #define IMAGE_REL_I386_REL16 2
3154 #define IMAGE_REL_I386_DIR32 6
3155 #define IMAGE_REL_I386_DIR32NB 7
3156 #define IMAGE_REL_I386_SEG12 9
3157 #define IMAGE_REL_I386_SECTION 10
3158 #define IMAGE_REL_I386_SECREL 11
3159 #define IMAGE_REL_I386_TOKEN 12
3160 #define IMAGE_REL_I386_SECREL7 13
3161 #define IMAGE_REL_I386_REL32 20
3163 /* MIPS relocation types */
3164 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3165 #define IMAGE_REL_MIPS_REFHALF 0x0001
3166 #define IMAGE_REL_MIPS_REFWORD 0x0002
3167 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3168 #define IMAGE_REL_MIPS_REFHI 0x0004
3169 #define IMAGE_REL_MIPS_REFLO 0x0005
3170 #define IMAGE_REL_MIPS_GPREL 0x0006
3171 #define IMAGE_REL_MIPS_LITERAL 0x0007
3172 #define IMAGE_REL_MIPS_SECTION 0x000A
3173 #define IMAGE_REL_MIPS_SECREL 0x000B
3174 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3175 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3176 #define IMAGE_REL_MIPS_TOKEN 0x000E
3177 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3178 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3179 #define IMAGE_REL_MIPS_PAIR 0x0025
3181 /* ALPHA relocation types */
3182 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3183 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3184 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3185 #define IMAGE_REL_ALPHA_GPREL 0x0003
3186 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3187 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3188 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3189 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3190 #define IMAGE_REL_ALPHA_HINT 0x0008
3191 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3192 #define IMAGE_REL_ALPHA_REFHI 0x000A
3193 #define IMAGE_REL_ALPHA_REFLO 0x000B
3194 #define IMAGE_REL_ALPHA_PAIR 0x000C
3195 #define IMAGE_REL_ALPHA_MATCH 0x000D
3196 #define IMAGE_REL_ALPHA_SECTION 0x000E
3197 #define IMAGE_REL_ALPHA_SECREL 0x000F
3198 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3199 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3200 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3201 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3202 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3203 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3204 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3205 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3207 /* PowerPC relocation types */
3208 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3209 #define IMAGE_REL_PPC_ADDR64 0x0001
3210 #define IMAGE_REL_PPC_ADDR 0x0002
3211 #define IMAGE_REL_PPC_ADDR24 0x0003
3212 #define IMAGE_REL_PPC_ADDR16 0x0004
3213 #define IMAGE_REL_PPC_ADDR14 0x0005
3214 #define IMAGE_REL_PPC_REL24 0x0006
3215 #define IMAGE_REL_PPC_REL14 0x0007
3216 #define IMAGE_REL_PPC_TOCREL16 0x0008
3217 #define IMAGE_REL_PPC_TOCREL14 0x0009
3218 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3219 #define IMAGE_REL_PPC_SECREL 0x000B
3220 #define IMAGE_REL_PPC_SECTION 0x000C
3221 #define IMAGE_REL_PPC_IFGLUE 0x000D
3222 #define IMAGE_REL_PPC_IMGLUE 0x000E
3223 #define IMAGE_REL_PPC_SECREL16 0x000F
3224 #define IMAGE_REL_PPC_REFHI 0x0010
3225 #define IMAGE_REL_PPC_REFLO 0x0011
3226 #define IMAGE_REL_PPC_PAIR 0x0012
3227 #define IMAGE_REL_PPC_SECRELLO 0x0013
3228 #define IMAGE_REL_PPC_SECRELHI 0x0014
3229 #define IMAGE_REL_PPC_GPREL 0x0015
3230 #define IMAGE_REL_PPC_TOKEN 0x0016
3231 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3233 #define IMAGE_REL_PPC_NEG 0x0100
3234 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3235 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3236 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3238 /* SH3 relocation types */
3239 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3240 #define IMAGE_REL_SH3_DIRECT16 0x0001
3241 #define IMAGE_REL_SH3_DIRECT 0x0002
3242 #define IMAGE_REL_SH3_DIRECT8 0x0003
3243 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3244 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3245 #define IMAGE_REL_SH3_DIRECT4 0x0006
3246 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3247 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3248 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3249 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3250 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3251 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3252 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3253 #define IMAGE_REL_SH3_SECTION 0x000E
3254 #define IMAGE_REL_SH3_SECREL 0x000F
3255 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3256 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3257 #define IMAGE_REL_SH3_TOKEN 0x0012
3259 /* ARM relocation types */
3260 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3261 #define IMAGE_REL_ARM_ADDR 0x0001
3262 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3263 #define IMAGE_REL_ARM_BRANCH24 0x0003
3264 #define IMAGE_REL_ARM_BRANCH11 0x0004
3265 #define IMAGE_REL_ARM_TOKEN 0x0005
3266 #define IMAGE_REL_ARM_GPREL12 0x0006
3267 #define IMAGE_REL_ARM_GPREL7 0x0007
3268 #define IMAGE_REL_ARM_BLX24 0x0008
3269 #define IMAGE_REL_ARM_BLX11 0x0009
3270 #define IMAGE_REL_ARM_SECTION 0x000E
3271 #define IMAGE_REL_ARM_SECREL 0x000F
3272 #define IMAGE_REL_ARM_MOV32A 0x0010
3273 #define IMAGE_REL_ARM_MOV32T 0x0011
3274 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3275 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3276 #define IMAGE_REL_ARM_BLX23T 0x0015
3278 /* ARM64 relocation types */
3279 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3280 #define IMAGE_REL_ARM64_ADDR32 0x0001
3281 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3282 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3283 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3284 #define IMAGE_REL_ARM64_REL21 0x0005
3285 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3286 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3287 #define IMAGE_REL_ARM64_SECREL 0x0008
3288 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3289 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3290 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3291 #define IMAGE_REL_ARM64_TOKEN 0x000C
3292 #define IMAGE_REL_ARM64_SECTION 0x000D
3293 #define IMAGE_REL_ARM64_ADDR64 0x000E
3294 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3296 /* IA64 relocation types */
3297 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3298 #define IMAGE_REL_IA64_IMM14 0x0001
3299 #define IMAGE_REL_IA64_IMM22 0x0002
3300 #define IMAGE_REL_IA64_IMM64 0x0003
3301 #define IMAGE_REL_IA64_DIR 0x0004
3302 #define IMAGE_REL_IA64_DIR64 0x0005
3303 #define IMAGE_REL_IA64_PCREL21B 0x0006
3304 #define IMAGE_REL_IA64_PCREL21M 0x0007
3305 #define IMAGE_REL_IA64_PCREL21F 0x0008
3306 #define IMAGE_REL_IA64_GPREL22 0x0009
3307 #define IMAGE_REL_IA64_LTOFF22 0x000A
3308 #define IMAGE_REL_IA64_SECTION 0x000B
3309 #define IMAGE_REL_IA64_SECREL22 0x000C
3310 #define IMAGE_REL_IA64_SECREL64I 0x000D
3311 #define IMAGE_REL_IA64_SECREL 0x000E
3312 #define IMAGE_REL_IA64_LTOFF64 0x000F
3313 #define IMAGE_REL_IA64_DIR32NB 0x0010
3314 #define IMAGE_REL_IA64_SREL14 0x0011
3315 #define IMAGE_REL_IA64_SREL22 0x0012
3316 #define IMAGE_REL_IA64_SREL32 0x0013
3317 #define IMAGE_REL_IA64_UREL32 0x0014
3318 #define IMAGE_REL_IA64_PCREL60X 0x0015
3319 #define IMAGE_REL_IA64_PCREL60B 0x0016
3320 #define IMAGE_REL_IA64_PCREL60F 0x0017
3321 #define IMAGE_REL_IA64_PCREL60I 0x0018
3322 #define IMAGE_REL_IA64_PCREL60M 0x0019
3323 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3324 #define IMAGE_REL_IA64_TOKEN 0x001B
3325 #define IMAGE_REL_IA64_GPREL32 0x001C
3326 #define IMAGE_REL_IA64_ADDEND 0x001F
3328 /* AMD64 relocation types */
3329 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3330 #define IMAGE_REL_AMD64_ADDR64 0x0001
3331 #define IMAGE_REL_AMD64_ADDR32 0x0002
3332 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3333 #define IMAGE_REL_AMD64_REL32 0x0004
3334 #define IMAGE_REL_AMD64_REL32_1 0x0005
3335 #define IMAGE_REL_AMD64_REL32_2 0x0006
3336 #define IMAGE_REL_AMD64_REL32_3 0x0007
3337 #define IMAGE_REL_AMD64_REL32_4 0x0008
3338 #define IMAGE_REL_AMD64_REL32_5 0x0009
3339 #define IMAGE_REL_AMD64_SECTION 0x000A
3340 #define IMAGE_REL_AMD64_SECREL 0x000B
3341 #define IMAGE_REL_AMD64_SECREL7 0x000C
3342 #define IMAGE_REL_AMD64_TOKEN 0x000D
3343 #define IMAGE_REL_AMD64_SREL32 0x000E
3344 #define IMAGE_REL_AMD64_PAIR 0x000F
3345 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3347 /* archive format */
3349 #define IMAGE_ARCHIVE_START_SIZE 8
3350 #define IMAGE_ARCHIVE_START "!<arch>\n"
3351 #define IMAGE_ARCHIVE_END "`\n"
3352 #define IMAGE_ARCHIVE_PAD "\n"
3353 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3354 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3356 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3365 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3367 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3369 typedef struct _IMPORT_OBJECT_HEADER
3375 DWORD TimeDateStamp
;
3385 } IMPORT_OBJECT_HEADER
;
3387 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3389 typedef enum IMPORT_OBJECT_TYPE
3391 IMPORT_OBJECT_CODE
= 0,
3392 IMPORT_OBJECT_DATA
= 1,
3393 IMPORT_OBJECT_CONST
= 2
3394 } IMPORT_OBJECT_TYPE
;
3396 typedef enum IMPORT_OBJECT_NAME_TYPE
3398 IMPORT_OBJECT_ORDINAL
= 0,
3399 IMPORT_OBJECT_NAME
= 1,
3400 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3401 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3402 } IMPORT_OBJECT_NAME_TYPE
;
3404 typedef struct _ANON_OBJECT_HEADER
3410 DWORD TimeDateStamp
;
3413 } ANON_OBJECT_HEADER
;
3416 * Resource directory stuff
3418 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3419 DWORD Characteristics
;
3420 DWORD TimeDateStamp
;
3423 WORD NumberOfNamedEntries
;
3424 WORD NumberOfIdEntries
;
3425 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3426 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3428 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3429 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3431 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3434 unsigned NameOffset
:31;
3435 unsigned NameIsString
:1;
3443 unsigned OffsetToDirectory
:31;
3444 unsigned DataIsDirectory
:1;
3447 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3450 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3452 CHAR NameString
[ 1 ];
3453 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3455 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3457 WCHAR NameString
[ 1 ];
3458 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3460 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3465 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3468 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3469 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3472 typedef struct _IMAGE_TLS_DIRECTORY64
{
3473 ULONGLONG StartAddressOfRawData
;
3474 ULONGLONG EndAddressOfRawData
;
3475 ULONGLONG AddressOfIndex
;
3476 ULONGLONG AddressOfCallBacks
;
3477 DWORD SizeOfZeroFill
;
3478 DWORD Characteristics
;
3479 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3481 typedef struct _IMAGE_TLS_DIRECTORY32
{
3482 DWORD StartAddressOfRawData
;
3483 DWORD EndAddressOfRawData
;
3484 DWORD AddressOfIndex
;
3485 DWORD AddressOfCallBacks
;
3486 DWORD SizeOfZeroFill
;
3487 DWORD Characteristics
;
3488 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3491 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3492 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3494 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3495 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3498 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3499 DWORD Characteristics
;
3500 DWORD TimeDateStamp
;
3505 DWORD AddressOfRawData
;
3506 DWORD PointerToRawData
;
3507 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3509 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3510 #define IMAGE_DEBUG_TYPE_COFF 1
3511 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3512 #define IMAGE_DEBUG_TYPE_FPO 3
3513 #define IMAGE_DEBUG_TYPE_MISC 4
3514 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3515 #define IMAGE_DEBUG_TYPE_FIXUP 6
3516 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3517 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3518 #define IMAGE_DEBUG_TYPE_BORLAND 9
3519 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3520 #define IMAGE_DEBUG_TYPE_CLSID 11
3521 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
3522 #define IMAGE_DEBUG_TYPE_POGO 13
3523 #define IMAGE_DEBUG_TYPE_ILTCG 14
3524 #define IMAGE_DEBUG_TYPE_MPX 15
3525 #define IMAGE_DEBUG_TYPE_REPRO 16
3527 typedef enum ReplacesCorHdrNumericDefines
3529 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3530 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3531 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3532 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3533 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT
= 0x00000010,
3534 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3535 COMIMAGE_FLAGS_32BITPREFERRED
= 0x00020000,
3537 COR_VERSION_MAJOR_V2
= 2,
3538 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3539 COR_VERSION_MINOR
= 5,
3540 COR_DELETED_NAME_LENGTH
= 8,
3541 COR_VTABLEGAP_NAME_LENGTH
= 8,
3543 NATIVE_TYPE_MAX_CB
= 1,
3544 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3546 IMAGE_COR_MIH_METHODRVA
= 0x01,
3547 IMAGE_COR_MIH_EHRVA
= 0x02,
3548 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3550 COR_VTABLE_32BIT
= 0x01,
3551 COR_VTABLE_64BIT
= 0x02,
3552 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3553 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3555 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3557 MAX_CLASS_NAME
= 1024,
3558 MAX_PACKAGE_NAME
= 1024,
3559 } ReplacesCorHdrNumericDefines
;
3561 typedef struct IMAGE_COR20_HEADER
3564 WORD MajorRuntimeVersion
;
3565 WORD MinorRuntimeVersion
;
3567 IMAGE_DATA_DIRECTORY MetaData
;
3570 DWORD EntryPointToken
;
3571 DWORD EntryPointRVA
;
3574 IMAGE_DATA_DIRECTORY Resources
;
3575 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3576 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3577 IMAGE_DATA_DIRECTORY VTableFixups
;
3578 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3579 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3581 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3583 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3584 DWORD NumberOfSymbols
;
3585 DWORD LvaToFirstSymbol
;
3586 DWORD NumberOfLinenumbers
;
3587 DWORD LvaToFirstLinenumber
;
3588 DWORD RvaToFirstByteOfCode
;
3589 DWORD RvaToLastByteOfCode
;
3590 DWORD RvaToFirstByteOfData
;
3591 DWORD RvaToLastByteOfData
;
3592 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3595 #define FRAME_TRAP 1
3597 #define FRAME_NONFPO 3
3599 typedef struct _FPO_DATA
{
3610 } FPO_DATA
, *PFPO_DATA
;
3612 typedef struct _IMAGE_LOAD_CONFIG_CODE_INTEGRITY
3616 DWORD CatalogOffset
;
3618 } IMAGE_LOAD_CONFIG_CODE_INTEGRITY
, *PIMAGE_LOAD_CONFIG_CODE_INTEGRITY
;
3620 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64
{
3621 DWORD Size
; /* 000 */
3622 DWORD TimeDateStamp
;
3625 DWORD GlobalFlagsClear
;
3626 DWORD GlobalFlagsSet
; /* 010 */
3627 DWORD CriticalSectionDefaultTimeout
;
3628 ULONGLONG DeCommitFreeBlockThreshold
;
3629 ULONGLONG DeCommitTotalFreeThreshold
; /* 020 */
3630 ULONGLONG LockPrefixTable
;
3631 ULONGLONG MaximumAllocationSize
; /* 030 */
3632 ULONGLONG VirtualMemoryThreshold
;
3633 ULONGLONG ProcessAffinityMask
; /* 040 */
3634 DWORD ProcessHeapFlags
;
3636 WORD DependentLoadFlags
;
3637 ULONGLONG EditList
; /* 050 */
3638 ULONGLONG SecurityCookie
;
3639 ULONGLONG SEHandlerTable
; /* 060 */
3640 ULONGLONG SEHandlerCount
;
3641 ULONGLONG GuardCFCheckFunctionPointer
; /* 070 */
3642 ULONGLONG GuardCFDispatchFunctionPointer
;
3643 ULONGLONG GuardCFFunctionTable
; /* 080 */
3644 ULONGLONG GuardCFFunctionCount
;
3645 DWORD GuardFlags
; /* 090 */
3646 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity
;
3647 ULONGLONG GuardAddressTakenIatEntryTable
; /* 0a0 */
3648 ULONGLONG GuardAddressTakenIatEntryCount
;
3649 ULONGLONG GuardLongJumpTargetTable
; /* 0b0 */
3650 ULONGLONG GuardLongJumpTargetCount
;
3651 ULONGLONG DynamicValueRelocTable
; /* 0c0 */
3652 ULONGLONG CHPEMetadataPointer
;
3653 ULONGLONG GuardRFFailureRoutine
; /* 0d0 */
3654 ULONGLONG GuardRFFailureRoutineFunctionPointer
;
3655 DWORD DynamicValueRelocTableOffset
; /* 0e0 */
3656 WORD DynamicValueRelocTableSection
;
3658 ULONGLONG GuardRFVerifyStackPointerFunctionPointer
;
3659 DWORD HotPatchTableOffset
; /* 0f0 */
3661 ULONGLONG EnclaveConfigurationPointer
;
3662 ULONGLONG VolatileMetadataPointer
; /* 100 */
3663 ULONGLONG GuardEHContinuationTable
;
3664 ULONGLONG GuardEHContinuationCount
; /* 110 */
3665 ULONGLONG GuardXFGCheckFunctionPointer
;
3666 ULONGLONG GuardXFGDispatchFunctionPointer
; /* 120 */
3667 ULONGLONG GuardXFGTableDispatchFunctionPointer
;
3668 ULONGLONG CastGuardOsDeterminedFailureMode
; /* 130 */
3669 ULONGLONG GuardMemcpyFunctionPointer
;
3670 } IMAGE_LOAD_CONFIG_DIRECTORY64
, *PIMAGE_LOAD_CONFIG_DIRECTORY64
;
3672 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32
{
3673 DWORD Size
; /* 000 */
3674 DWORD TimeDateStamp
;
3677 DWORD GlobalFlagsClear
;
3678 DWORD GlobalFlagsSet
; /* 010 */
3679 DWORD CriticalSectionDefaultTimeout
;
3680 DWORD DeCommitFreeBlockThreshold
;
3681 DWORD DeCommitTotalFreeThreshold
;
3682 DWORD LockPrefixTable
; /* 020 */
3683 DWORD MaximumAllocationSize
;
3684 DWORD VirtualMemoryThreshold
;
3685 DWORD ProcessHeapFlags
;
3686 DWORD ProcessAffinityMask
; /* 030 */
3688 WORD DependentLoadFlags
;
3690 DWORD SecurityCookie
;
3691 DWORD SEHandlerTable
; /* 040 */
3692 DWORD SEHandlerCount
;
3693 DWORD GuardCFCheckFunctionPointer
;
3694 DWORD GuardCFDispatchFunctionPointer
;
3695 DWORD GuardCFFunctionTable
; /* 050 */
3696 DWORD GuardCFFunctionCount
;
3698 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity
;
3699 DWORD GuardAddressTakenIatEntryTable
;
3700 DWORD GuardAddressTakenIatEntryCount
;
3701 DWORD GuardLongJumpTargetTable
; /* 070 */
3702 DWORD GuardLongJumpTargetCount
;
3703 DWORD DynamicValueRelocTable
;
3704 DWORD CHPEMetadataPointer
;
3705 DWORD GuardRFFailureRoutine
; /* 080 */
3706 DWORD GuardRFFailureRoutineFunctionPointer
;
3707 DWORD DynamicValueRelocTableOffset
;
3708 WORD DynamicValueRelocTableSection
;
3710 DWORD GuardRFVerifyStackPointerFunctionPointer
; /* 090 */
3711 DWORD HotPatchTableOffset
;
3713 DWORD EnclaveConfigurationPointer
;
3714 DWORD VolatileMetadataPointer
; /* 0a0 */
3715 DWORD GuardEHContinuationTable
;
3716 DWORD GuardEHContinuationCount
;
3717 DWORD GuardXFGCheckFunctionPointer
;
3718 DWORD GuardXFGDispatchFunctionPointer
; /* 0b0 */
3719 DWORD GuardXFGTableDispatchFunctionPointer
;
3720 DWORD CastGuardOsDeterminedFailureMode
;
3721 DWORD GuardMemcpyFunctionPointer
;
3722 } IMAGE_LOAD_CONFIG_DIRECTORY32
, *PIMAGE_LOAD_CONFIG_DIRECTORY32
;
3725 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY
;
3726 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY
;
3728 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY
;
3729 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY
;
3732 typedef struct _IMAGE_DYNAMIC_RELOCATION_TABLE
3736 } IMAGE_DYNAMIC_RELOCATION_TABLE
, *PIMAGE_DYNAMIC_RELOCATION_TABLE
;
3738 #include <pshpack1.h>
3740 typedef struct _IMAGE_DYNAMIC_RELOCATION32
3743 DWORD BaseRelocSize
;
3744 } IMAGE_DYNAMIC_RELOCATION32
, *PIMAGE_DYNAMIC_RELOCATION32
;
3746 typedef struct _IMAGE_DYNAMIC_RELOCATION64
3749 DWORD BaseRelocSize
;
3750 } IMAGE_DYNAMIC_RELOCATION64
, *PIMAGE_DYNAMIC_RELOCATION64
;
3752 typedef struct _IMAGE_DYNAMIC_RELOCATION32_V2
3755 DWORD FixupInfoSize
;
3759 } IMAGE_DYNAMIC_RELOCATION32_V2
, *PIMAGE_DYNAMIC_RELOCATION32_V2
;
3761 typedef struct _IMAGE_DYNAMIC_RELOCATION64_V2
3764 DWORD FixupInfoSize
;
3768 } IMAGE_DYNAMIC_RELOCATION64_V2
, *PIMAGE_DYNAMIC_RELOCATION64_V2
;
3770 #include <poppack.h>
3773 typedef IMAGE_DYNAMIC_RELOCATION64 IMAGE_DYNAMIC_RELOCATION
;
3774 typedef PIMAGE_DYNAMIC_RELOCATION64 PIMAGE_DYNAMIC_RELOCATION
;
3775 typedef IMAGE_DYNAMIC_RELOCATION64_V2 IMAGE_DYNAMIC_RELOCATION_V2
;
3776 typedef PIMAGE_DYNAMIC_RELOCATION64_V2 PIMAGE_DYNAMIC_RELOCATION_V2
;
3778 typedef IMAGE_DYNAMIC_RELOCATION32 IMAGE_DYNAMIC_RELOCATION
;
3779 typedef PIMAGE_DYNAMIC_RELOCATION32 PIMAGE_DYNAMIC_RELOCATION
;
3780 typedef IMAGE_DYNAMIC_RELOCATION32_V2 IMAGE_DYNAMIC_RELOCATION_V2
;
3781 typedef PIMAGE_DYNAMIC_RELOCATION32_V2 PIMAGE_DYNAMIC_RELOCATION_V2
;
3784 #define IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE 1
3785 #define IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE 2
3786 #define IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER 3
3787 #define IMAGE_DYNAMIC_RELOCATION_GUARD_INDIR_CONTROL_TRANSFER 4
3788 #define IMAGE_DYNAMIC_RELOCATION_GUARD_SWITCHTABLE_BRANCH 5
3789 #define IMAGE_DYNAMIC_RELOCATION_ARM64X 6
3791 typedef struct _IMAGE_FUNCTION_ENTRY
{
3792 DWORD StartingAddress
;
3793 DWORD EndingAddress
;
3794 DWORD EndOfPrologue
;
3795 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3797 #define IMAGE_DEBUG_MISC_EXENAME 1
3799 typedef struct _IMAGE_DEBUG_MISC
{
3805 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3807 /* This is the structure that appears at the very start of a .DBG file. */
3809 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3813 WORD Characteristics
;
3814 DWORD TimeDateStamp
;
3818 DWORD NumberOfSections
;
3819 DWORD ExportedNamesSize
;
3820 DWORD DebugDirectorySize
;
3821 DWORD SectionAlignment
;
3822 DWORD Reserved
[ 2 ];
3823 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3825 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3828 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3832 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3833 #define MESSAGE_RESOURCE_UNICODE 0x0001
3835 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3838 DWORD OffsetToEntries
;
3839 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3841 typedef struct tagMESSAGE_RESOURCE_DATA
{
3842 DWORD NumberOfBlocks
;
3843 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3844 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3847 * Here follows typedefs for security and tokens.
3851 * First a constant for the following typedefs.
3854 #define ANYSIZE_ARRAY 1
3856 /* FIXME: Orphan. What does it point to? */
3857 typedef PVOID PACCESS_TOKEN
;
3858 typedef PVOID PSECURITY_DESCRIPTOR
;
3861 typedef enum _TOKEN_ELEVATION_TYPE
{
3862 TokenElevationTypeDefault
= 1,
3863 TokenElevationTypeFull
,
3864 TokenElevationTypeLimited
3865 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
3868 * TOKEN_INFORMATION_CLASS
3871 typedef enum _TOKEN_INFORMATION_CLASS
{
3880 TokenImpersonationLevel
,
3882 TokenRestrictedSids
,
3884 TokenGroupsAndPrivileges
,
3885 TokenSessionReference
,
3892 TokenHasRestrictions
,
3893 TokenAccessInformation
,
3894 TokenVirtualizationAllowed
,
3895 TokenVirtualizationEnabled
,
3896 TokenIntegrityLevel
,
3898 TokenMandatoryPolicy
,
3900 TokenIsAppContainer
,
3902 TokenAppContainerSid
,
3903 TokenAppContainerNumber
,
3904 TokenUserClaimAttributes
,
3905 TokenDeviceClaimAttributes
,
3906 TokenRestrictedUserClaimAttributes
,
3907 TokenRestrictedDeviceClaimAttributes
,
3909 TokenRestrictedDeviceGroups
,
3910 TokenSecurityAttributes
,
3912 TokenProcessTrustLevel
,
3914 } TOKEN_INFORMATION_CLASS
;
3916 #define DISABLE_MAX_PRIVILEGE 0x1
3917 #define SANDBOX_INERT 0x2
3918 #define LUA_TOKEN 0x4
3919 #define WRITE_RESTRICTED 0x8
3921 #define TOKEN_ASSIGN_PRIMARY 0x0001
3922 #define TOKEN_DUPLICATE 0x0002
3923 #define TOKEN_IMPERSONATE 0x0004
3924 #define TOKEN_QUERY 0x0008
3925 #define TOKEN_QUERY_SOURCE 0x0010
3926 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3927 #define TOKEN_ADJUST_GROUPS 0x0040
3928 #define TOKEN_ADJUST_DEFAULT 0x0080
3929 #define TOKEN_ADJUST_SESSIONID 0x0100
3930 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3931 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3932 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3933 TOKEN_ADJUST_PRIVILEGES | \
3934 TOKEN_ADJUST_GROUPS | \
3935 TOKEN_ADJUST_DEFAULT )
3936 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3937 TOKEN_ASSIGN_PRIMARY | \
3939 TOKEN_IMPERSONATE | \
3941 TOKEN_QUERY_SOURCE | \
3942 TOKEN_ADJUST_PRIVILEGES | \
3943 TOKEN_ADJUST_GROUPS | \
3944 TOKEN_ADJUST_SESSIONID | \
3945 TOKEN_ADJUST_DEFAULT )
3947 #ifndef _SECURITY_DEFINED
3948 #define _SECURITY_DEFINED
3950 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3952 typedef struct _GENERIC_MAPPING
{
3953 ACCESS_MASK GenericRead
;
3954 ACCESS_MASK GenericWrite
;
3955 ACCESS_MASK GenericExecute
;
3956 ACCESS_MASK GenericAll
;
3957 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3959 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3960 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3963 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3964 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3968 typedef struct _SID
{
3970 BYTE SubAuthorityCount
;
3971 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3972 DWORD SubAuthority
[1];
3974 #endif /* !defined(SID_DEFINED) */
3976 #define CREATE_BOUNDARY_DESCRIPTOR_ADD_APPCONTAINER_SID 0x01
3978 #define SID_REVISION (1) /* Current revision */
3979 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3980 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3982 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3988 #define ACL_REVISION1 1
3989 #define ACL_REVISION2 2
3990 #define ACL_REVISION3 3
3991 #define ACL_REVISION4 4
3993 #define MIN_ACL_REVISION ACL_REVISION2
3994 #define MAX_ACL_REVISION ACL_REVISION4
3996 #define ACL_REVISION 2
3998 typedef struct _ACL
{
4006 typedef enum _ACL_INFORMATION_CLASS
4008 AclRevisionInformation
= 1,
4010 } ACL_INFORMATION_CLASS
;
4012 typedef struct _ACL_REVISION_INFORMATION
4015 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
4017 typedef struct _ACL_SIZE_INFORMATION
4020 DWORD AclBytesInUse
;
4022 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
4024 /* SECURITY_DESCRIPTOR */
4025 #define SECURITY_DESCRIPTOR_REVISION 1
4026 #define SECURITY_DESCRIPTOR_REVISION1 1
4033 #if defined(_MSC_VER) || defined(__MINGW32__)
4034 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4035 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4036 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4037 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4038 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4039 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4040 #define SE_TCB_NAME L"SeTcbPrivilege"
4041 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4042 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4043 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4044 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4045 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4046 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4047 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4048 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4049 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4050 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4051 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4052 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4053 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4054 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4055 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4056 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4057 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4058 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4059 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4060 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4061 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4062 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4063 #define SE_TRUSTED_CREDMAN_ACCESS_NAME L"SeTrustedCredManAccessPrivilege"
4064 #define SE_RELABEL_NAME L"SeRelabelPrivilege"
4065 #define SE_INC_WORKING_SET_NAME L"SeIncreaseWorkingSetPrivilege"
4066 #define SE_TIME_ZONE_NAME L"SeTimeZonePrivilege"
4067 #define SE_CREATE_SYMBOLIC_LINK_NAME L"SeCreateSymbolicLinkPrivilege"
4068 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME L"SeDelegateSessionUserImpersonatePrivilege"
4069 #else /* _MSC_VER/__MINGW32__ */
4070 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 };
4071 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 };
4072 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 };
4073 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 };
4074 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 };
4075 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 };
4076 static const WCHAR SE_TCB_NAME
[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4077 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 };
4078 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 };
4079 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 };
4080 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 };
4081 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 };
4082 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 };
4083 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 };
4084 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 };
4085 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 };
4086 static const WCHAR SE_BACKUP_NAME
[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4087 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 };
4088 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 };
4089 static const WCHAR SE_DEBUG_NAME
[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4090 static const WCHAR SE_AUDIT_NAME
[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4091 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 };
4092 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 };
4093 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 };
4094 static const WCHAR SE_UNDOCK_NAME
[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4095 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 };
4096 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 };
4097 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 };
4098 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 };
4099 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 };
4100 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 };
4101 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 };
4102 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 };
4103 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 };
4104 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 };
4107 #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
4108 #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
4109 #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
4110 #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
4111 #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
4112 #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
4113 #define SE_TCB_NAME "SeTcbPrivilege"
4114 #define SE_SECURITY_NAME "SeSecurityPrivilege"
4115 #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
4116 #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
4117 #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
4118 #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
4119 #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
4120 #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
4121 #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
4122 #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
4123 #define SE_BACKUP_NAME "SeBackupPrivilege"
4124 #define SE_RESTORE_NAME "SeRestorePrivilege"
4125 #define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
4126 #define SE_DEBUG_NAME "SeDebugPrivilege"
4127 #define SE_AUDIT_NAME "SeAuditPrivilege"
4128 #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
4129 #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
4130 #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
4131 #define SE_UNDOCK_NAME "SeUndockPrivilege"
4132 #define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
4133 #define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
4134 #define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
4135 #define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
4136 #define SE_TRUSTED_CREDMAN_ACCESS_NAME "SeTrustedCredManAccessPrivilege"
4137 #define SE_RELABEL_NAME "SeRelabelPrivilege"
4138 #define SE_INC_WORKING_SET_NAME "SeIncreaseWorkingSetPrivilege"
4139 #define SE_TIME_ZONE_NAME "SeTimeZonePrivilege"
4140 #define SE_CREATE_SYMBOLIC_LINK_NAME "SeCreateSymbolicLinkPrivilege"
4141 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME "SeDelegateSessionUserImpersonatePrivilege"
4144 #define SE_GROUP_MANDATORY 0x00000001
4145 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4146 #define SE_GROUP_ENABLED 0x00000004
4147 #define SE_GROUP_OWNER 0x00000008
4148 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4149 #define SE_GROUP_INTEGRITY 0x00000020
4150 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
4151 #define SE_GROUP_LOGON_ID 0xC0000000
4152 #define SE_GROUP_RESOURCE 0x20000000
4153 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
4155 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4156 #define SE_PRIVILEGE_ENABLED 0x00000002
4157 #define SE_PRIVILEGE_REMOVED 0x00000004
4158 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4159 #define SE_PRIVILEGE_VALID_ATTRIBUTES 0x80000007
4161 #define PRIVILEGE_SET_ALL_NECESSARY 1
4163 #define SE_OWNER_DEFAULTED 0x00000001
4164 #define SE_GROUP_DEFAULTED 0x00000002
4165 #define SE_DACL_PRESENT 0x00000004
4166 #define SE_DACL_DEFAULTED 0x00000008
4167 #define SE_SACL_PRESENT 0x00000010
4168 #define SE_SACL_DEFAULTED 0x00000020
4169 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4170 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4171 #define SE_DACL_AUTO_INHERITED 0x00000400
4172 #define SE_SACL_AUTO_INHERITED 0x00000800
4173 #define SE_DACL_PROTECTED 0x00001000
4174 #define SE_SACL_PROTECTED 0x00002000
4175 #define SE_RM_CONTROL_VALID 0x00004000
4176 #define SE_SELF_RELATIVE 0x00008000
4178 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4179 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4181 /* The security descriptor structure */
4185 SECURITY_DESCRIPTOR_CONTROL Control
;
4190 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4195 SECURITY_DESCRIPTOR_CONTROL Control
;
4200 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4202 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4204 #endif /* _SECURITY_DEFINED */
4207 * SID_AND_ATTRIBUTES
4210 typedef struct _SID_AND_ATTRIBUTES
{
4213 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4215 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY
[ANYSIZE_ARRAY
];
4216 typedef SID_AND_ATTRIBUTES_ARRAY
*PSID_AND_ATTRIBUTES_ARRAY
;
4218 #define SID_HASH_SIZE 32
4220 typedef ULONG_PTR SID_HASH_ENTRY
, *PSID_HASH_ENTRY
;
4222 typedef struct _SID_AND_ATTRIBUTES_HASH
{
4224 PSID_AND_ATTRIBUTES SidAttr
;
4225 SID_HASH_ENTRY Hash
[SID_HASH_SIZE
];
4226 } SID_AND_ATTRIBUTES_HASH
, *PSID_AND_ATTRIBUTES_HASH
;
4228 /* security entities */
4229 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
4230 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
4231 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
4233 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4236 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4239 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4240 #define SECURITY_LOCAL_LOGON_RID __MSABI_LONG(0X00000000)
4243 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4244 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
4245 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
4246 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
4247 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
4248 #define SECURITY_CREATOR_OWNER_RIGHTS_RID __MSABI_LONG(0x00000004)
4251 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4254 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4255 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
4256 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
4257 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
4258 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
4259 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
4260 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
4261 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
4262 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
4263 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
4264 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4265 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
4266 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
4267 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
4268 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
4269 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
4270 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
4271 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
4272 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
4273 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
4274 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
4275 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID __MSABI_LONG(0x00000016)
4276 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
4277 #define SECURITY_WRITE_RESTRICTED_CODE_RID __MSABI_LONG(0x00000021)
4279 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
4280 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
4281 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
4282 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
4283 #define SECURITY_CRED_TYPE_BASE_RID __MSABI_LONG(0x00000041)
4284 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID __MSABI_LONG(0x00000001)
4285 #define SECURITY_MIN_BASE_RID __MSABI_LONG(0x00000050)
4286 #define SECURITY_SERVICE_ID_BASE_RID __MSABI_LONG(0x00000050)
4287 #define SECURITY_RESERVED_ID_BASE_RID __MSABI_LONG(0x00000051)
4288 #define SECURITY_APPPOOL_ID_BASE_RID __MSABI_LONG(0x00000052)
4289 #define SECURITY_VIRTUALSERVER_ID_BASE_RID __MSABI_LONG(0x00000053)
4290 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID __MSABI_LONG(0x00000054)
4291 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID __MSABI_LONG(0x00000055)
4292 #define SECURITY_WMIHOST_ID_BASE_RID __MSABI_LONG(0x00000056)
4293 #define SECURITY_TASK_ID_BASE_RID __MSABI_LONG(0x00000057)
4294 #define SECURITY_NFS_ID_BASE_RID __MSABI_LONG(0x00000058)
4295 #define SECURITY_COM_ID_BASE_RID __MSABI_LONG(0x00000059)
4296 #define SECURITY_MAX_BASE_RID __MSABI_LONG(0x0000006F)
4297 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID __MSABI_LONG(0x00000070)
4298 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
4299 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
4300 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
4302 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS __MSABI_LONG(0x000001F2)
4304 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
4305 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
4306 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
4307 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
4308 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
4310 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
4311 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
4312 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
4313 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
4314 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
4315 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
4316 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
4317 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
4318 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
4319 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS __MSABI_LONG(0x00000209)
4321 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
4323 #define SECURITY_APP_PACKAGE_AUTHORITY {0,0,0,0,0,15}
4324 #define SECURITY_APP_PACKAGE_BASE_RID __MSABI_LONG(0x000000002)
4325 #define SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000002)
4326 #define SECURITY_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000008)
4327 #define SECURITY_CAPABILITY_BASE_RID __MSABI_LONG(0x000000003)
4328 #define SECURITY_CAPABILITY_APP_RID __MSABI_LONG(0x000000400)
4329 #define SECURITY_BUILTIN_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000002)
4330 #define SECURITY_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000005)
4331 #define SECURITY_PARENT_PACKAGE_RID_COUNT SECURITY_APP_PACKAGE_RID_COUNT
4332 #define SECURITY_CHILD_PACKAGE_RID_COUNT __MSABI_LONG(0x00000000c)
4333 #define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE __MSABI_LONG(0x000000001)
4335 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4336 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
4337 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
4338 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
4339 #define SECURITY_MANDATORY_MEDIUM_PLUS_RID __MSABI_LONG(0x00002100)
4340 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
4341 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
4342 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
4343 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
4345 #define MANDATORY_LEVEL_TO_MANDATORY_RID(ML) (ML * 0x1000)
4347 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
4348 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
4349 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
4350 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
4352 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
4353 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
4354 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
4355 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
4357 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
4358 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
4359 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
4360 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
4361 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
4362 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
4364 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
4365 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
4366 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
4367 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
4368 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
4369 #define DOMAIN_ALIAS_RID_IUSERS __MSABI_LONG(0x00000238)
4370 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS __MSABI_LONG(0x00000239)
4371 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023B)
4372 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023C)
4373 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP __MSABI_LONG(0x0000023D)
4374 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP __MSABI_LONG(0x0000023E)
4376 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4378 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
4379 #define SECURITY_CRED_TYPE_RID_COUNT __MSABI_LONG(2)
4380 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
4381 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT __MSABI_LONG(3)
4382 #define SECURITY_SERVICE_ID_RID_COUNT __MSABI_LONG(6)
4383 #define SECURITY_APPPOOL_ID_RID_COUNT __MSABI_LONG(6)
4384 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT __MSABI_LONG(6)
4385 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT __MSABI_LONG(6)
4386 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT __MSABI_LONG(6)
4387 #define SECURITY_WMIHOST_ID_RID_COUNT __MSABI_LONG(6)
4388 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT __MSABI_LONG(6)
4390 #define SYSTEM_LUID { 0x3e7, 0x0 }
4391 #define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 }
4392 #define LOCALSERVICE_LUID { 0x3e5, 0x0 }
4393 #define NETWORKSERVICE_LUID { 0x3e4, 0x0 }
4394 #define IUSER_LUID { 0x3e3, 0x0 }
4400 WinCreatorOwnerSid
= 3,
4401 WinCreatorGroupSid
= 4,
4402 WinCreatorOwnerServerSid
= 5,
4403 WinCreatorGroupServerSid
= 6,
4404 WinNtAuthoritySid
= 7,
4408 WinInteractiveSid
= 11,
4410 WinAnonymousSid
= 13,
4412 WinEnterpriseControllersSid
= 15,
4414 WinAuthenticatedUserSid
= 17,
4415 WinRestrictedCodeSid
= 18,
4416 WinTerminalServerSid
= 19,
4417 WinRemoteLogonIdSid
= 20,
4418 WinLogonIdsSid
= 21,
4419 WinLocalSystemSid
= 22,
4420 WinLocalServiceSid
= 23,
4421 WinNetworkServiceSid
= 24,
4422 WinBuiltinDomainSid
= 25,
4423 WinBuiltinAdministratorsSid
= 26,
4424 WinBuiltinUsersSid
= 27,
4425 WinBuiltinGuestsSid
= 28,
4426 WinBuiltinPowerUsersSid
= 29,
4427 WinBuiltinAccountOperatorsSid
= 30,
4428 WinBuiltinSystemOperatorsSid
= 31,
4429 WinBuiltinPrintOperatorsSid
= 32,
4430 WinBuiltinBackupOperatorsSid
= 33,
4431 WinBuiltinReplicatorSid
= 34,
4432 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4433 WinBuiltinRemoteDesktopUsersSid
= 36,
4434 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4435 WinAccountAdministratorSid
= 38,
4436 WinAccountGuestSid
= 39,
4437 WinAccountKrbtgtSid
= 40,
4438 WinAccountDomainAdminsSid
= 41,
4439 WinAccountDomainUsersSid
= 42,
4440 WinAccountDomainGuestsSid
= 43,
4441 WinAccountComputersSid
= 44,
4442 WinAccountControllersSid
= 45,
4443 WinAccountCertAdminsSid
= 46,
4444 WinAccountSchemaAdminsSid
= 47,
4445 WinAccountEnterpriseAdminsSid
= 48,
4446 WinAccountPolicyAdminsSid
= 49,
4447 WinAccountRasAndIasServersSid
= 50,
4448 WinNTLMAuthenticationSid
= 51,
4449 WinDigestAuthenticationSid
= 52,
4450 WinSChannelAuthenticationSid
= 53,
4451 WinThisOrganizationSid
= 54,
4452 WinOtherOrganizationSid
= 55,
4453 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4454 WinBuiltinPerfMonitoringUsersSid
= 57,
4455 WinBuiltinPerfLoggingUsersSid
= 58,
4456 WinBuiltinAuthorizationAccessSid
= 59,
4457 WinBuiltinTerminalServerLicenseServersSid
= 60,
4458 WinBuiltinDCOMUsersSid
= 61,
4459 WinBuiltinIUsersSid
= 62,
4461 WinBuiltinCryptoOperatorsSid
= 64,
4462 WinUntrustedLabelSid
= 65,
4463 WinLowLabelSid
= 66,
4464 WinMediumLabelSid
= 67,
4465 WinHighLabelSid
= 68,
4466 WinSystemLabelSid
= 69,
4467 WinWriteRestrictedCodeSid
= 70,
4468 WinCreatorOwnerRightsSid
= 71,
4469 WinCacheablePrincipalsGroupSid
= 72,
4470 WinNonCacheablePrincipalsGroupSid
= 73,
4471 WinEnterpriseReadonlyControllersSid
= 74,
4472 WinAccountReadonlyControllersSid
= 75,
4473 WinBuiltinEventLogReadersGroup
= 76,
4474 WinNewEnterpriseReadonlyControllersSid
= 77,
4475 WinBuiltinCertSvcDComAccessGroup
= 78,
4476 WinMediumPlusLabelSid
= 79,
4477 WinLocalLogonSid
= 80,
4478 WinConsoleLogonSid
= 81,
4479 WinThisOrganizationCertificateSid
= 82,
4480 WinApplicationPackageAuthoritySid
= 83,
4481 WinBuiltinAnyPackageSid
= 84,
4482 WinCapabilityInternetClientSid
= 85,
4483 WinCapabilityInternetClientServerSid
= 86,
4484 WinCapabilityPrivateNetworkClientServerSid
= 87,
4485 WinCapabilityPicturesLibrarySid
= 88,
4486 WinCapabilityVideosLibrarySid
= 89,
4487 WinCapabilityMusicLibrarySid
= 90,
4488 WinCapabilityDocumentsLibrarySid
= 91,
4489 WinCapabilitySharedUserCertificatesSid
= 92,
4490 WinCapabilityEnterpriseAuthenticationSid
= 93,
4491 WinCapabilityRemovableStorageSid
= 94,
4492 WinBuiltinRDSRemoteAccessServersSid
= 95,
4493 WinBuiltinRDSEndpointServersSid
= 96,
4494 WinBuiltinRDSManagementServersSid
= 97,
4495 WinUserModeDriversSid
= 98,
4496 WinBuiltinHyperVAdminsSid
= 99,
4497 WinAccountCloneableControllersSid
= 100,
4498 WinBuiltinAccessControlAssistanceOperatorsSid
= 101,
4499 WinBuiltinRemoteManagementUsersSid
= 102,
4500 WinAuthenticationAuthorityAssertedSid
= 103,
4501 WinAuthenticationServiceAssertedSid
= 104,
4502 WinLocalAccountSid
= 105,
4503 WinLocalAccountAndAdministratorSid
= 106,
4504 WinAccountProtectedUsersSid
= 107,
4505 } WELL_KNOWN_SID_TYPE
;
4511 typedef struct _TOKEN_USER
{
4512 SID_AND_ATTRIBUTES User
;
4513 } TOKEN_USER
, *PTOKEN_USER
;
4519 typedef struct _TOKEN_GROUPS
{
4521 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4522 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4525 * LUID_AND_ATTRIBUTES
4528 typedef union _LARGE_INTEGER
{
4530 #ifdef WORDS_BIGENDIAN
4538 #ifndef NONAMELESSSTRUCT
4540 #ifdef WORDS_BIGENDIAN
4550 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4552 typedef union _ULARGE_INTEGER
{
4554 #ifdef WORDS_BIGENDIAN
4562 #ifndef NONAMELESSSTRUCT
4564 #ifdef WORDS_BIGENDIAN
4574 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4577 * Locally Unique Identifier
4580 typedef struct _LUID
{
4585 #include <pshpack4.h>
4586 typedef struct _LUID_AND_ATTRIBUTES
{
4589 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4590 #include <poppack.h>
4596 typedef struct _PRIVILEGE_SET
{
4597 DWORD PrivilegeCount
;
4599 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4600 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4606 typedef struct _TOKEN_PRIVILEGES
{
4607 DWORD PrivilegeCount
;
4608 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4609 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4615 typedef struct _TOKEN_OWNER
{
4617 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4620 * TOKEN_PRIMARY_GROUP
4623 typedef struct _TOKEN_PRIMARY_GROUP
{
4625 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4629 * TOKEN_DEFAULT_DACL
4632 typedef struct _TOKEN_DEFAULT_DACL
{
4634 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4640 #define TOKEN_SOURCE_LENGTH 8
4642 typedef struct _TOKEN_SOURCE
{
4643 char SourceName
[TOKEN_SOURCE_LENGTH
];
4644 LUID SourceIdentifier
;
4645 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4651 typedef enum tagTOKEN_TYPE
{
4657 * SECURITY_IMPERSONATION_LEVEL
4660 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4662 SecurityIdentification
,
4663 SecurityImpersonation
,
4665 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4667 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4668 #define SECURITY_STATIC_TRACKING (FALSE)
4670 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4671 * PSECURITY_CONTEXT_TRACKING_MODE
;
4673 * Quality of Service
4676 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4678 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4679 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4680 BOOLEAN EffectiveOnly
;
4681 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4687 #include <pshpack4.h>
4688 typedef struct _TOKEN_STATISTICS
{
4690 LUID AuthenticationId
;
4691 LARGE_INTEGER ExpirationTime
;
4692 TOKEN_TYPE TokenType
;
4693 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4694 DWORD DynamicCharged
;
4695 DWORD DynamicAvailable
;
4697 DWORD PrivilegeCount
;
4700 #include <poppack.h>
4702 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4705 PSID_AND_ATTRIBUTES Sids
;
4706 DWORD RestrictedSidCount
;
4707 DWORD RestrictedSidLength
;
4708 PSID_AND_ATTRIBUTES RestrictedSids
;
4709 DWORD PrivilegeCount
;
4710 DWORD PrivilegeLength
;
4711 PLUID_AND_ATTRIBUTES Privileges
;
4712 LUID AuthenticationId
;
4713 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4715 typedef struct _TOKEN_ORIGIN
{
4716 LUID OriginatingLogonSession
;
4717 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4719 typedef struct _TOKEN_LINKED_TOKEN
{
4721 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4723 typedef struct _TOKEN_ELEVATION
{
4724 DWORD TokenIsElevated
;
4725 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4727 typedef struct _TOKEN_MANDATORY_LABEL
{
4728 SID_AND_ATTRIBUTES Label
;
4729 } TOKEN_MANDATORY_LABEL
, * PTOKEN_MANDATORY_LABEL
;
4731 #define TOKEN_MANDATORY_POLICY_OFF 0x0
4732 #define TOKEN_MANDATORY_POLICY_NO_WRITEUP 0x1
4733 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
4734 #define TOKEN_MANDATORY_POLICY_VALID_MASK 0x3
4736 typedef struct _TOKEN_MANDATORY_POLICY
{
4738 } TOKEN_MANDATORY_POLICY
, *PTOKEN_MANDATORY_POLICY
;
4740 typedef struct _TOKEN_APPCONTAINER_INFORMATION
{
4741 PSID TokenAppContainer
;
4742 } TOKEN_APPCONTAINER_INFORMATION
, * PTOKEN_APPCONTAINER_INFORMATION
;
4744 #define POLICY_AUDIT_SUBCATEGORY_COUNT 53
4746 typedef struct _TOKEN_AUDIT_POLICY
{
4747 BYTE PerUserPolicy
[((POLICY_AUDIT_SUBCATEGORY_COUNT
) >> 1) + 1];
4748 } TOKEN_AUDIT_POLICY
, *PTOKEN_AUDIT_POLICY
;
4750 typedef struct _TOKEN_ACCESS_INFORMATION
{
4751 PSID_AND_ATTRIBUTES_HASH SidHash
;
4752 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash
;
4753 PTOKEN_PRIVILEGES Privileges
;
4754 LUID AuthenticationId
;
4755 TOKEN_TYPE TokenType
;
4756 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4757 TOKEN_MANDATORY_POLICY MandatoryPolicy
;
4759 } TOKEN_ACCESS_INFORMATION
, *PTOKEN_ACCESS_INFORMATION
;
4761 typedef struct _TOKEN_CONTROL
{
4763 LUID AuthenticationId
;
4765 TOKEN_SOURCE TokenSource
;
4766 } TOKEN_CONTROL
, *PTOKEN_CONTROL
;
4772 /* ACEs, directly starting after an ACL */
4773 typedef struct _ACE_HEADER
{
4777 } ACE_HEADER
,*PACE_HEADER
;
4780 #define ACCESS_MIN_MS_ACE_TYPE 0x0
4781 #define ACCESS_ALLOWED_ACE_TYPE 0x0
4782 #define ACCESS_DENIED_ACE_TYPE 0x1
4783 #define SYSTEM_AUDIT_ACE_TYPE 0x2
4784 #define SYSTEM_ALARM_ACE_TYPE 0x3
4785 #define ACCESS_MAX_MS_V2_ACE_TYPE 0x3
4786 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4
4787 #define ACCESS_MAX_MS_V3_ACE_TYPE 0x4
4788 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE 0x5
4789 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5
4790 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6
4791 #define ACCESS_AUDIT_OBJECT_ACE_TYPE 0x7
4792 #define ACCESS_ALARM_OBJECT_ACE_TYPE 0x8
4793 #define ACCESS_MAX_MS_V4_ACE_TYPE 0x8
4794 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9
4795 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xa
4796 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xb
4797 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xc
4798 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xd
4799 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xe
4800 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xf
4801 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
4802 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
4803 #define SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE 0x12
4804 #define SYSTEM_SCOPED_POLICY_ID_ACE_TYPE 0x13
4805 #define SYSTEM_PROCESS_TRUST_LABEL_ACE_TYPE 0x14
4806 #define ACCESS_MAX_MS_V5_ACE_TYPE 0x14
4808 /* inherit AceFlags */
4809 #define OBJECT_INHERIT_ACE 0x01
4810 #define CONTAINER_INHERIT_ACE 0x02
4811 #define NO_PROPAGATE_INHERIT_ACE 0x04
4812 #define INHERIT_ONLY_ACE 0x08
4813 #define INHERITED_ACE 0x10
4814 #define VALID_INHERIT_FLAGS 0x1F
4816 /* AceFlags mask for what events we (should) audit */
4817 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4818 #define FAILED_ACCESS_ACE_FLAG 0x80
4820 /* different ACEs depending on AceType
4821 * SidStart marks the begin of a SID
4822 * so the thing finally looks like this:
4827 typedef struct _ACCESS_ALLOWED_ACE
{
4831 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4833 typedef struct _ACCESS_DENIED_ACE
{
4837 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4839 typedef struct _SYSTEM_AUDIT_ACE
{
4843 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4845 typedef struct _SYSTEM_ALARM_ACE
{
4849 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4851 typedef struct _SYSTEM_MANDATORY_LABEL_ACE
{
4855 } SYSTEM_MANDATORY_LABEL_ACE
,*PSYSTEM_MANDATORY_LABEL_ACE
;
4857 typedef struct _SYSTEM_PROCESS_TRUST_LABEL_ACE
{
4861 } SYSTEM_PROCESS_TRUST_LABEL_ACE
, *PSYSTEM_PROCESS_TRUST_LABEL_ACE
;
4863 typedef struct _ACCESS_ALLOWED_OBJECT_ACE
{
4868 GUID InheritedObjectType
;
4870 } ACCESS_ALLOWED_OBJECT_ACE
, *PACCESS_ALLOWED_OBJECT_ACE
;
4872 typedef struct _ACCESS_DENIED_OBJECT_ACE
{
4877 GUID InheritedObjectType
;
4879 } ACCESS_DENIED_OBJECT_ACE
, *PACCESS_DENIED_OBJECT_ACE
;
4881 typedef struct _SYSTEM_AUDIT_OBJECT_ACE
{
4886 GUID InheritedObjectType
;
4888 } SYSTEM_AUDIT_OBJECT_ACE
, *PSYSTEM_AUDIT_OBJECT_ACE
;
4890 typedef struct _SYSTEM_ALARM_OBJECT_ACE
{
4895 GUID InheritedObjectType
;
4897 } SYSTEM_ALARM_OBJECT_ACE
, *PSYSTEM_ALARM_OBJECT_aCE
;
4899 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE
{
4903 } ACCESS_ALLOWED_CALLBACK_ACE
,*PACCESS_ALLOWED_CALLBACK_ACE
;
4905 typedef struct _ACCESS_DENIED_CALLBACK_ACE
{
4909 } ACCESS_DENIED_CALLBACK_ACE
,*PACCESS_DENIED_CALLBACK_ACE
;
4911 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE
{
4915 } SYSTEM_AUDIT_CALLBACK_ACE
,*PSYSTEM_AUDIT_CALLBACK_ACE
;
4917 typedef struct _SYSTEM_ALARM_CALLBACK_ACE
{
4921 } SYSTEM_ALARM_CALLBACK_ACE
,*PSYSTEM_ALARM_CALLBACK_ACE
;
4923 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
{
4928 GUID InheritedObjectType
;
4930 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE
;
4932 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE
{
4937 GUID InheritedObjectType
;
4939 } ACCESS_DENIED_CALLBACK_OBJECT_ACE
, *PACCESS_DENIED_CALLBACK_OBJECT_ACE
;
4941 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
{
4946 GUID InheritedObjectType
;
4948 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE
;
4950 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
{
4955 GUID InheritedObjectType
;
4957 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE
, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE
;
4959 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
4960 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
4961 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
4962 #define SYSTEM_MANDATORY_LABEL_VALID_MASK 0x7
4963 #define SYSTEM_PROCESS_TRUST_LABEL_VALID_MASK 0x00ffffff
4964 #define SYSTEM_PROCESS_TRUST_NOCONSTRAINT_MASK 0xffffffff
4966 typedef enum tagSID_NAME_USE
{
4971 SidTypeWellKnownGroup
,
4972 SidTypeDeletedAccount
,
4975 } SID_NAME_USE
,*PSID_NAME_USE
;
4977 #define ACE_OBJECT_TYPE_PRESENT 0x1
4978 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4982 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4984 #define DELETE 0x00010000
4985 #define READ_CONTROL 0x00020000
4986 #define WRITE_DAC 0x00040000
4987 #define WRITE_OWNER 0x00080000
4988 #define SYNCHRONIZE 0x00100000
4989 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4991 #define STANDARD_RIGHTS_READ READ_CONTROL
4992 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4993 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4995 #define STANDARD_RIGHTS_ALL 0x001f0000
4997 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4999 #define GENERIC_READ 0x80000000
5000 #define GENERIC_WRITE 0x40000000
5001 #define GENERIC_EXECUTE 0x20000000
5002 #define GENERIC_ALL 0x10000000
5004 #define MAXIMUM_ALLOWED 0x02000000
5005 #define ACCESS_SYSTEM_SECURITY 0x01000000
5007 #define EVENT_QUERY_STATE 0x0001
5008 #define EVENT_MODIFY_STATE 0x0002
5009 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5011 #define SEMAPHORE_QUERY_STATE 0x0001
5012 #define SEMAPHORE_MODIFY_STATE 0x0002
5013 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5015 #define MUTANT_QUERY_STATE 0x0001
5016 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
5018 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
5019 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
5020 #define JOB_OBJECT_QUERY 0x0004
5021 #define JOB_OBJECT_TERMINATE 0x0008
5022 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
5023 #define JOB_OBJECT_IMPERSONATE 0x0020
5024 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3f)
5026 #define TIMER_QUERY_STATE 0x0001
5027 #define TIMER_MODIFY_STATE 0x0002
5028 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5030 #define PROCESS_TERMINATE 0x0001
5031 #define PROCESS_CREATE_THREAD 0x0002
5032 #define PROCESS_VM_OPERATION 0x0008
5033 #define PROCESS_VM_READ 0x0010
5034 #define PROCESS_VM_WRITE 0x0020
5035 #define PROCESS_DUP_HANDLE 0x0040
5036 #define PROCESS_CREATE_PROCESS 0x0080
5037 #define PROCESS_SET_QUOTA 0x0100
5038 #define PROCESS_SET_INFORMATION 0x0200
5039 #define PROCESS_QUERY_INFORMATION 0x0400
5040 #define PROCESS_SUSPEND_RESUME 0x0800
5041 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
5042 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
5043 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5045 #define THREAD_TERMINATE 0x0001
5046 #define THREAD_SUSPEND_RESUME 0x0002
5047 #define THREAD_GET_CONTEXT 0x0008
5048 #define THREAD_SET_CONTEXT 0x0010
5049 #define THREAD_SET_INFORMATION 0x0020
5050 #define THREAD_QUERY_INFORMATION 0x0040
5051 #define THREAD_SET_THREAD_TOKEN 0x0080
5052 #define THREAD_IMPERSONATE 0x0100
5053 #define THREAD_DIRECT_IMPERSONATION 0x0200
5054 #define THREAD_SET_LIMITED_INFORMATION 0x0400
5055 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
5056 #define THREAD_RESUME 0x1000
5057 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5059 #define THREAD_BASE_PRIORITY_LOWRT 15
5060 #define THREAD_BASE_PRIORITY_MAX 2
5061 #define THREAD_BASE_PRIORITY_MIN -2
5062 #define THREAD_BASE_PRIORITY_IDLE -15
5064 typedef struct _QUOTA_LIMITS
{
5065 SIZE_T PagedPoolLimit
;
5066 SIZE_T NonPagedPoolLimit
;
5067 SIZE_T MinimumWorkingSetSize
;
5068 SIZE_T MaximumWorkingSetSize
;
5069 SIZE_T PagefileLimit
;
5070 LARGE_INTEGER TimeLimit
;
5071 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
5073 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
5074 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
5075 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
5076 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
5077 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
5079 typedef union _RATE_QUOTA_LIMIT
{
5082 DWORD RatePercent
:7;
5085 } RATE_QUOTA_LIMIT
, *PRATE_QUOTA_LIMIT
;
5087 typedef struct _QUOTA_LIMITS_EX
{
5088 SIZE_T PagedPoolLimit
;
5089 SIZE_T NonPagedPoolLimit
;
5090 SIZE_T MinimumWorkingSetSize
;
5091 SIZE_T MaximumWorkingSetSize
;
5092 SIZE_T PagefileLimit
;
5093 LARGE_INTEGER TimeLimit
;
5094 SIZE_T WorkingSetLimit
;
5099 RATE_QUOTA_LIMIT CpuRateLimit
;
5100 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
5102 #define SECTION_QUERY 0x0001
5103 #define SECTION_MAP_WRITE 0x0002
5104 #define SECTION_MAP_READ 0x0004
5105 #define SECTION_MAP_EXECUTE 0x0008
5106 #define SECTION_EXTEND_SIZE 0x0010
5107 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
5108 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
5110 #define FILE_READ_DATA 0x0001 /* file & pipe */
5111 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
5112 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
5113 #define FILE_ADD_FILE 0x0002 /* directory */
5114 #define FILE_APPEND_DATA 0x0004 /* file */
5115 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
5116 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
5117 #define FILE_READ_EA 0x0008 /* file & directory */
5118 #define FILE_READ_PROPERTIES FILE_READ_EA
5119 #define FILE_WRITE_EA 0x0010 /* file & directory */
5120 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
5121 #define FILE_EXECUTE 0x0020 /* file */
5122 #define FILE_TRAVERSE 0x0020 /* directory */
5123 #define FILE_DELETE_CHILD 0x0040 /* directory */
5124 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
5125 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
5126 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
5128 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
5129 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
5131 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
5132 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
5133 FILE_APPEND_DATA | SYNCHRONIZE)
5134 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
5135 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
5137 #define DUPLICATE_CLOSE_SOURCE 0x00000001
5138 #define DUPLICATE_SAME_ACCESS 0x00000002
5140 #define DUPLICATE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
5143 /* File attribute flags */
5144 #define FILE_SHARE_READ 0x00000001
5145 #define FILE_SHARE_WRITE 0x00000002
5146 #define FILE_SHARE_DELETE 0x00000004
5148 #define FILE_ATTRIBUTE_READONLY 0x00000001
5149 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
5150 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
5151 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
5152 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
5153 #define FILE_ATTRIBUTE_DEVICE 0x00000040
5154 #define FILE_ATTRIBUTE_NORMAL 0x00000080
5155 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
5156 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
5157 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
5158 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
5159 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
5160 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
5161 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
5162 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
5163 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
5164 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
5165 #define FILE_ATTRIBUTE_EA 0x00040000
5167 /* File notification flags */
5168 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
5169 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
5170 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
5171 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
5172 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
5173 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
5174 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
5175 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
5176 #define FILE_NOTIFY_CHANGE_EA 0x00000080
5177 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
5178 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
5179 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
5180 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
5182 #define FILE_ACTION_ADDED 0x00000001
5183 #define FILE_ACTION_REMOVED 0x00000002
5184 #define FILE_ACTION_MODIFIED 0x00000003
5185 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
5186 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
5187 #define FILE_ACTION_ADDED_STREAM 0x00000006
5188 #define FILE_ACTION_REMOVED_STREAM 0x00000007
5189 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
5190 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
5191 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000a
5192 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000b
5194 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
5195 #define FILE_CASE_PRESERVED_NAMES 0x00000002
5196 #define FILE_UNICODE_ON_DISK 0x00000004
5197 #define FILE_PERSISTENT_ACLS 0x00000008
5198 #define FILE_FILE_COMPRESSION 0x00000010
5199 #define FILE_VOLUME_QUOTAS 0x00000020
5200 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
5201 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
5202 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
5203 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
5204 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
5205 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
5206 #define FILE_NAMED_STREAMS 0x00040000
5207 #define FILE_READ_ONLY_VOLUME 0x00080000
5208 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
5209 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
5210 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
5211 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
5212 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
5213 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
5214 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000
5215 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
5216 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000
5217 #define FILE_DAX_VOLUME 0x20000000
5218 #define FILE_SUPPORTS_GHOSTING 0x40000000
5220 /* File alignments (NT) */
5221 #define FILE_BYTE_ALIGNMENT 0x00000000
5222 #define FILE_WORD_ALIGNMENT 0x00000001
5223 #define FILE_LONG_ALIGNMENT 0x00000003
5224 #define FILE_QUAD_ALIGNMENT 0x00000007
5225 #define FILE_OCTA_ALIGNMENT 0x0000000f
5226 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
5227 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
5228 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
5229 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
5230 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
5232 #define COMPRESSION_FORMAT_NONE 0
5233 #define COMPRESSION_FORMAT_DEFAULT 1
5234 #define COMPRESSION_FORMAT_LZNT1 2
5235 #define COMPRESSION_ENGINE_STANDARD 0
5236 #define COMPRESSION_ENGINE_MAXIMUM 256
5238 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
5239 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
5241 #define REG_NONE 0 /* no type */
5242 #define REG_SZ 1 /* string type (ASCII) */
5243 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
5244 #define REG_BINARY 3 /* binary format, callerspecific */
5245 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
5246 #define REG_DWORD 4 /* DWORD in little endian format */
5247 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
5248 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
5249 #define REG_LINK 6 /* symbolic link (UNICODE) */
5250 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
5251 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
5252 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
5253 #define REG_RESOURCE_REQUIREMENTS_LIST 10
5254 #define REG_QWORD 11 /* QWORD in little endian format */
5255 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
5257 /* ----------------------------- begin power management --------------------- */
5259 typedef enum _LATENCY_TIME
{
5262 } LATENCY_TIME
, *PLATENCY_TIME
;
5264 #define DISCHARGE_POLICY_CRITICAL 0
5265 #define DISCHARGE_POLICY_LOW 1
5266 #define NUM_DISCHARGE_POLICIES 4
5268 #define PO_THROTTLE_NONE 0
5269 #define PO_THROTTLE_CONSTANT 1
5270 #define PO_THROTTLE_DEGRADE 2
5271 #define PO_THROTTLE_ADAPTIVE 3
5273 typedef enum _POWER_ACTION
{
5274 PowerActionNone
= 0,
5275 PowerActionReserved
,
5277 PowerActionHibernate
,
5278 PowerActionShutdown
,
5279 PowerActionShutdownReset
,
5280 PowerActionShutdownOff
,
5281 PowerActionWarmEject
5285 typedef enum _POWER_PLATFORM_ROLE
{
5286 PlatformRoleUnspecified
,
5287 PlatformRoleDesktop
,
5289 PlatformRoleWorkstation
,
5290 PlatformRoleEnterpriseServer
,
5291 PlatformRoleSOHOServer
,
5292 PlatformRoleAppliancePC
,
5293 PlatformRolePerformanceServer
,
5296 } POWER_PLATFORM_ROLE
, *PPOWER_PLATFORM_ROLE
;
5298 typedef enum _SYSTEM_POWER_STATE
{
5299 PowerSystemUnspecified
= 0,
5300 PowerSystemWorking
= 1,
5301 PowerSystemSleeping1
= 2,
5302 PowerSystemSleeping2
= 3,
5303 PowerSystemSleeping3
= 4,
5304 PowerSystemHibernate
= 5,
5305 PowerSystemShutdown
= 6,
5306 PowerSystemMaximum
= 7
5307 } SYSTEM_POWER_STATE
,
5308 *PSYSTEM_POWER_STATE
;
5310 typedef enum _DEVICE_POWER_STATE
{
5311 PowerDeviceUnspecified
,
5317 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
5319 typedef enum _POWER_INFORMATION_LEVEL
{
5320 SystemPowerPolicyAc
,
5321 SystemPowerPolicyDc
,
5322 VerifySystemPolicyAc
,
5323 VerifySystemPolicyDc
,
5324 SystemPowerCapabilities
,
5326 SystemPowerStateHandler
,
5327 ProcessorStateHandler
,
5328 SystemPowerPolicyCurrent
,
5329 AdministratorPowerPolicy
,
5330 SystemReserveHiberFile
,
5331 ProcessorInformation
,
5332 SystemPowerInformation
,
5333 ProcessorStateHandler2
,
5336 SystemExecutionState
,
5337 SystemPowerStateNotifyHandler
,
5338 ProcessorPowerPolicyAc
,
5339 ProcessorPowerPolicyDc
,
5340 VerifyProcessorPowerPolicyAc
,
5341 VerifyProcessorPowerPolicyDc
,
5342 ProcessorPowerPolicyCurrent
5343 } POWER_INFORMATION_LEVEL
;
5345 typedef struct _ADMINISTRATOR_POWER_POLICY
{
5346 SYSTEM_POWER_STATE MinSleep
;
5347 SYSTEM_POWER_STATE MaxSleep
;
5348 ULONG MinVideoTimeout
;
5349 ULONG MaxVideoTimeout
;
5350 ULONG MinSpindownTimeout
;
5351 ULONG MaxSpindownTimeout
;
5352 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
5357 } BATTERY_REPORTING_SCALE
,
5358 *PBATTERY_REPORTING_SCALE
;
5361 POWER_ACTION Action
;
5364 } POWER_ACTION_POLICY
,
5365 *PPOWER_ACTION_POLICY
;
5367 typedef struct _PROCESSOR_POWER_INFORMATION
{
5373 ULONG CurrentIdleState
;
5374 } PROCESSOR_POWER_INFORMATION
,
5375 *PPROCESSOR_POWER_INFORMATION
;
5377 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
5381 UCHAR DemotePercent
;
5382 UCHAR PromotePercent
;
5384 ULONG AllowDemotion
:1;
5385 ULONG AllowPromotion
:1;
5387 } PROCESSOR_POWER_POLICY_INFO
,
5388 *PPROCESSOR_POWER_POLICY_INFO
;
5390 typedef struct _PROCESSOR_POWER_POLICY
{
5392 BYTE DynamicThrottle
;
5394 DWORD DisableCStates
:1;
5397 PROCESSOR_POWER_POLICY_INFO Policy
[3];
5398 } PROCESSOR_POWER_POLICY
,
5399 *PPROCESSOR_POWER_POLICY
;
5403 BOOLEAN BatteryPresent
;
5405 BOOLEAN Discharging
;
5409 ULONG RemainingCapacity
;
5411 ULONG EstimatedTime
;
5412 ULONG DefaultAlert1
;
5413 ULONG DefaultAlert2
;
5414 } SYSTEM_BATTERY_STATE
,
5415 *PSYSTEM_BATTERY_STATE
;
5418 BOOLEAN PowerButtonPresent
;
5419 BOOLEAN SleepButtonPresent
;
5426 BOOLEAN HiberFilePresent
;
5428 BOOLEAN VideoDimPresent
;
5431 BOOLEAN ThermalControl
;
5432 BOOLEAN ProcessorThrottle
;
5433 UCHAR ProcessorMinThrottle
;
5434 UCHAR ProcessorMaxThrottle
;
5436 BOOLEAN DiskSpinDown
;
5438 BOOLEAN SystemBatteriesPresent
;
5439 BOOLEAN BatteriesAreShortTerm
;
5440 BATTERY_REPORTING_SCALE BatteryScale
[3];
5441 SYSTEM_POWER_STATE AcOnLineWake
;
5442 SYSTEM_POWER_STATE SoftLidWake
;
5443 SYSTEM_POWER_STATE RtcWake
;
5444 SYSTEM_POWER_STATE MinDeviceWakeState
;
5445 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
5446 } SYSTEM_POWER_CAPABILITIES
,
5447 *PSYSTEM_POWER_CAPABILITIES
;
5449 typedef struct _SYSTEM_POWER_INFORMATION
{
5450 ULONG MaxIdlenessAllowed
;
5452 ULONG TimeRemaining
;
5454 } SYSTEM_POWER_INFORMATION
,
5455 *PSYSTEM_POWER_INFORMATION
;
5457 typedef struct _SYSTEM_POWER_LEVEL
{
5461 POWER_ACTION_POLICY PowerPolicy
;
5462 SYSTEM_POWER_STATE MinSystemState
;
5463 } SYSTEM_POWER_LEVEL
,
5464 *PSYSTEM_POWER_LEVEL
;
5466 typedef struct _SYSTEM_POWER_POLICY
{
5468 POWER_ACTION_POLICY PowerButton
;
5469 POWER_ACTION_POLICY SleepButton
;
5470 POWER_ACTION_POLICY LidClose
;
5471 SYSTEM_POWER_STATE LidOpenWake
;
5473 POWER_ACTION_POLICY Idle
;
5475 UCHAR IdleSensitivity
;
5476 UCHAR DynamicThrottle
;
5478 SYSTEM_POWER_STATE MinSleep
;
5479 SYSTEM_POWER_STATE MaxSleep
;
5480 SYSTEM_POWER_STATE ReducedLatencySleep
;
5481 ULONG WinLogonFlags
;
5483 ULONG DozeS4Timeout
;
5484 ULONG BroadcastCapacityResolution
;
5485 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
5487 BOOLEAN VideoDimDisplay
;
5488 ULONG VideoReserved
[3];
5489 ULONG SpindownTimeout
;
5490 BOOLEAN OptimizeForPower
;
5491 UCHAR FanThrottleTolerance
;
5492 UCHAR ForcedThrottle
;
5494 POWER_ACTION_POLICY OverThrottled
;
5495 } SYSTEM_POWER_POLICY
,
5496 *PSYSTEM_POWER_POLICY
;
5498 typedef enum _POWER_REQUEST_TYPE
5500 PowerRequestDisplayRequired
,
5501 PowerRequestSystemRequired
,
5502 PowerRequestAwayModeRequired
5503 } POWER_REQUEST_TYPE
, *PPOWER_REQUEST_TYPE
;
5505 #define POWER_REQUEST_CONTEXT_VERSION 0
5507 #define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
5508 #define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
5510 typedef union _FILE_SEGMENT_ELEMENT
{
5512 ULONGLONG Alignment
;
5513 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
5515 typedef struct _FILE_NOTIFY_INFORMATION
{
5516 DWORD NextEntryOffset
;
5518 DWORD FileNameLength
;
5520 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
5522 /* ----------------------------- begin tape storage --------------------- */
5524 #define TAPE_FIXED_PARTITIONS 0
5525 #define TAPE_SELECT_PARTITIONS 1
5526 #define TAPE_INITIATOR_PARTITIONS 2
5527 #define TAPE_ERASE_SHORT 0
5528 #define TAPE_ERASE_LONG 1
5530 #define TAPE_UNLOAD 1
5531 #define TAPE_TENSION 2
5533 #define TAPE_UNLOCK 4
5534 #define TAPE_FORMAT 5
5535 #define TAPE_SETMARKS 0
5536 #define TAPE_FILEMARKS 1
5537 #define TAPE_SHORT_FILEMARKS 2
5538 #define TAPE_LONG_FILEMARKS 3
5539 #define TAPE_REWIND 0
5540 #define TAPE_ABSOLUTE_BLOCK 1
5541 #define TAPE_LOGICAL_BLOCK 2
5542 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5543 #define TAPE_SPACE_END_OF_DATA 4
5544 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5545 #define TAPE_SPACE_FILEMARKS 6
5546 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5547 #define TAPE_SPACE_SETMARKS 8
5548 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5550 typedef struct _TAPE_CREATE_PARTITION
{
5554 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5556 typedef struct _TAPE_ERASE
{
5559 } TAPE_ERASE
, *PTAPE_ERASE
;
5561 typedef struct _TAPE_PREPARE
{
5564 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5566 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5568 BOOLEAN Compression
;
5569 BOOLEAN DataPadding
;
5570 BOOLEAN ReportSetmarks
;
5571 ULONG EOTWarningZoneSize
;
5572 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5574 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5576 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5578 typedef struct _TAPE_WRITE_MARKS
{
5582 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5584 typedef struct _TAPE_GET_POSITION
{
5589 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5591 typedef struct _TAPE_SET_POSITION
{
5594 LARGE_INTEGER Offset
;
5596 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5598 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5600 BOOLEAN Compression
;
5601 BOOLEAN DataPadding
;
5602 BOOLEAN ReportSetmarks
;
5603 DWORD DefaultBlockSize
;
5604 DWORD MaximumBlockSize
;
5605 DWORD MinimumBlockSize
;
5606 DWORD MaximumPartitionCount
;
5609 DWORD EOTWarningZoneSize
;
5610 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5612 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5613 LARGE_INTEGER Capacity
;
5614 LARGE_INTEGER Remaining
;
5616 DWORD PartitionCount
;
5617 BOOLEAN WriteProtected
;
5618 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5620 /* ----------------------------- begin registry ----------------------------- */
5622 /* Registry security values */
5623 #define OWNER_SECURITY_INFORMATION 0x00000001
5624 #define GROUP_SECURITY_INFORMATION 0x00000002
5625 #define DACL_SECURITY_INFORMATION 0x00000004
5626 #define SACL_SECURITY_INFORMATION 0x00000008
5627 #define LABEL_SECURITY_INFORMATION 0x00000010
5629 #define REG_OPTION_RESERVED 0x00000000
5630 #define REG_OPTION_NON_VOLATILE 0x00000000
5631 #define REG_OPTION_VOLATILE 0x00000001
5632 #define REG_OPTION_CREATE_LINK 0x00000002
5633 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5634 #define REG_OPTION_OPEN_LINK 0x00000008
5635 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | \
5636 REG_OPTION_NON_VOLATILE | \
5637 REG_OPTION_VOLATILE | \
5638 REG_OPTION_CREATE_LINK | \
5639 REG_OPTION_BACKUP_RESTORE | \
5640 REG_OPTION_OPEN_LINK)
5643 #define REG_CREATED_NEW_KEY 0x00000001
5644 #define REG_OPENED_EXISTING_KEY 0x00000002
5646 /* For RegNotifyChangeKeyValue */
5647 #define REG_NOTIFY_CHANGE_NAME 0x01
5648 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5649 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5650 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5651 #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
5653 #define KEY_QUERY_VALUE 0x00000001
5654 #define KEY_SET_VALUE 0x00000002
5655 #define KEY_CREATE_SUB_KEY 0x00000004
5656 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5657 #define KEY_NOTIFY 0x00000010
5658 #define KEY_CREATE_LINK 0x00000020
5659 #define KEY_WOW64_64KEY 0x00000100
5660 #define KEY_WOW64_32KEY 0x00000200
5661 #define KEY_WOW64_RES 0x00000300
5663 /* for RegKeyRestore flags */
5664 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5665 #define REG_REFRESH_HIVE 0x00000002
5666 #define REG_NO_LAZY_FLUSH 0x00000004
5667 #define REG_FORCE_RESTORE 0x00000008
5668 #define REG_APP_HIVE 0x00000010
5669 #define REG_PROCESS_PRIVATE 0x00000020
5671 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5673 KEY_ENUMERATE_SUB_KEYS| \
5677 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5679 KEY_CREATE_SUB_KEY) \
5682 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5683 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5686 KEY_CREATE_SUB_KEY| \
5687 KEY_ENUMERATE_SUB_KEYS| \
5692 /* ------------------------------ end registry ------------------------------ */
5695 #define EVENTLOG_SUCCESS 0x0000
5696 #define EVENTLOG_ERROR_TYPE 0x0001
5697 #define EVENTLOG_WARNING_TYPE 0x0002
5698 #define EVENTLOG_INFORMATION_TYPE 0x0004
5699 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5700 #define EVENTLOG_AUDIT_FAILURE 0x0010
5702 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5703 #define EVENTLOG_SEEK_READ 0x0002
5704 #define EVENTLOG_FORWARDS_READ 0x0004
5705 #define EVENTLOG_BACKWARDS_READ 0x0008
5707 typedef struct _EVENTLOGRECORD
{
5711 DWORD TimeGenerated
;
5718 DWORD ClosingRecordNumber
;
5720 DWORD UserSidLength
;
5721 DWORD UserSidOffset
;
5724 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5726 #define SERVICE_BOOT_START 0x00000000
5727 #define SERVICE_SYSTEM_START 0x00000001
5728 #define SERVICE_AUTO_START 0x00000002
5729 #define SERVICE_DEMAND_START 0x00000003
5730 #define SERVICE_DISABLED 0x00000004
5732 #define SERVICE_ERROR_IGNORE 0x00000000
5733 #define SERVICE_ERROR_NORMAL 0x00000001
5734 #define SERVICE_ERROR_SEVERE 0x00000002
5735 #define SERVICE_ERROR_CRITICAL 0x00000003
5738 #define SERVICE_KERNEL_DRIVER 0x00000001
5739 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5740 #define SERVICE_ADAPTER 0x00000004
5741 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5743 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5744 SERVICE_RECOGNIZER_DRIVER )
5746 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5747 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5748 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5750 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5752 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5753 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5756 typedef enum _CM_SERVICE_NODE_TYPE
5758 DriverType
= SERVICE_KERNEL_DRIVER
,
5759 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5760 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5761 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5762 AdapterType
= SERVICE_ADAPTER
,
5763 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5764 } SERVICE_NODE_TYPE
;
5766 typedef enum _CM_SERVICE_LOAD_TYPE
5768 BootLoad
= SERVICE_BOOT_START
,
5769 SystemLoad
= SERVICE_SYSTEM_START
,
5770 AutoLoad
= SERVICE_AUTO_START
,
5771 DemandLoad
= SERVICE_DEMAND_START
,
5772 DisableLoad
= SERVICE_DISABLED
5773 } SERVICE_LOAD_TYPE
;
5775 typedef enum _CM_ERROR_CONTROL_TYPE
5777 IgnoreError
= SERVICE_ERROR_IGNORE
,
5778 NormalError
= SERVICE_ERROR_NORMAL
,
5779 SevereError
= SERVICE_ERROR_SEVERE
,
5780 CriticalError
= SERVICE_ERROR_CRITICAL
5781 } SERVICE_ERROR_TYPE
;
5783 NTSYSAPI SIZE_T WINAPI
RtlCompareMemory(const VOID
*, const VOID
*, SIZE_T
);
5784 NTSYSAPI SIZE_T WINAPI
RtlCompareMemoryUlong(VOID
*, SIZE_T
, ULONG
);
5786 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5787 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5788 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5789 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5790 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5792 static FORCEINLINE
void *RtlSecureZeroMemory(void *buffer
, SIZE_T length
)
5794 volatile char *ptr
= (volatile char *)buffer
;
5796 while (length
--) *ptr
++ = 0;
5800 #include <guiddef.h>
5802 typedef struct _OBJECT_TYPE_LIST
{
5806 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
5808 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5811 WORD CreatorBackTraceIndex
;
5812 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
5813 LIST_ENTRY ProcessLocksList
;
5815 DWORD ContentionCount
;
5816 #ifdef __WINESRC__ /* in Wine we store the name here */
5817 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
5821 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
5823 typedef struct _RTL_CRITICAL_SECTION
{
5824 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
5826 LONG RecursionCount
;
5827 HANDLE OwningThread
;
5828 HANDLE LockSemaphore
;
5829 ULONG_PTR SpinCount
;
5830 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
5832 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5833 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5834 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5835 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5836 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5838 typedef struct _RTL_SRWLOCK
{
5840 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
5842 #define RTL_SRWLOCK_INIT {0}
5844 typedef struct _RTL_CONDITION_VARIABLE
{
5846 } RTL_CONDITION_VARIABLE
, *PRTL_CONDITION_VARIABLE
;
5847 #define RTL_CONDITION_VARIABLE_INIT {0}
5848 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
5850 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
5851 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5853 #define RTL_RUN_ONCE_INIT {0}
5854 typedef union _RTL_RUN_ONCE
{
5856 } RTL_RUN_ONCE
, *PRTL_RUN_ONCE
;
5858 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
5859 #define RTL_RUN_ONCE_ASYNC 0x00000002
5860 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004
5862 typedef DWORD WINAPI
RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE
, PVOID
, PVOID
*);
5863 typedef RTL_RUN_ONCE_INIT_FN
*PRTL_RUN_ONCE_INIT_FN
;
5864 NTSYSAPI VOID WINAPI
RtlRunOnceInitialize(PRTL_RUN_ONCE
);
5865 NTSYSAPI DWORD WINAPI
RtlRunOnceExecuteOnce(PRTL_RUN_ONCE
,PRTL_RUN_ONCE_INIT_FN
,PVOID
,PVOID
*);
5866 NTSYSAPI DWORD WINAPI
RtlRunOnceBeginInitialize(PRTL_RUN_ONCE
, DWORD
, PVOID
*);
5867 NTSYSAPI DWORD WINAPI
RtlRunOnceComplete(PRTL_RUN_ONCE
, DWORD
, PVOID
);
5869 #include <pshpack8.h>
5870 typedef struct _IO_COUNTERS
{
5871 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5872 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5873 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5874 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5875 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5876 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5877 } IO_COUNTERS
, *PIO_COUNTERS
;
5878 #include <poppack.h>
5881 DWORD dwOSVersionInfoSize
;
5882 DWORD dwMajorVersion
;
5883 DWORD dwMinorVersion
;
5884 DWORD dwBuildNumber
;
5886 CHAR szCSDVersion
[128];
5887 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5890 DWORD dwOSVersionInfoSize
;
5891 DWORD dwMajorVersion
;
5892 DWORD dwMinorVersion
;
5893 DWORD dwBuildNumber
;
5895 WCHAR szCSDVersion
[128];
5896 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5898 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5899 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5900 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5903 DWORD dwOSVersionInfoSize
;
5904 DWORD dwMajorVersion
;
5905 DWORD dwMinorVersion
;
5906 DWORD dwBuildNumber
;
5908 CHAR szCSDVersion
[128];
5909 WORD wServicePackMajor
;
5910 WORD wServicePackMinor
;
5914 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5917 DWORD dwOSVersionInfoSize
;
5918 DWORD dwMajorVersion
;
5919 DWORD dwMinorVersion
;
5920 DWORD dwBuildNumber
;
5922 WCHAR szCSDVersion
[128];
5923 WORD wServicePackMajor
;
5924 WORD wServicePackMinor
;
5928 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5930 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5931 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5932 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5934 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5936 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5938 #define VER_PLATFORM_WIN32s 0
5939 #define VER_PLATFORM_WIN32_WINDOWS 1
5940 #define VER_PLATFORM_WIN32_NT 2
5942 #define VER_MINORVERSION 0x00000001
5943 #define VER_MAJORVERSION 0x00000002
5944 #define VER_BUILDNUMBER 0x00000004
5945 #define VER_PLATFORMID 0x00000008
5946 #define VER_SERVICEPACKMINOR 0x00000010
5947 #define VER_SERVICEPACKMAJOR 0x00000020
5948 #define VER_SUITENAME 0x00000040
5949 #define VER_PRODUCT_TYPE 0x00000080
5951 #define VER_NT_WORKSTATION 1
5952 #define VER_NT_DOMAIN_CONTROLLER 2
5953 #define VER_NT_SERVER 3
5955 #define VER_SUITE_SMALLBUSINESS 0x00000001
5956 #define VER_SUITE_ENTERPRISE 0x00000002
5957 #define VER_SUITE_BACKOFFICE 0x00000004
5958 #define VER_SUITE_COMMUNICATIONS 0x00000008
5959 #define VER_SUITE_TERMINAL 0x00000010
5960 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5961 #define VER_SUITE_EMBEDDEDNT 0x00000040
5962 #define VER_SUITE_DATACENTER 0x00000080
5963 #define VER_SUITE_SINGLEUSERTS 0x00000100
5964 #define VER_SUITE_PERSONAL 0x00000200
5965 #define VER_SUITE_BLADE 0x00000400
5966 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5967 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5968 #define VER_SUITE_STORAGE_SERVER 0x00002000
5969 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5970 #define VER_SUITE_WH_SERVER 0x00008000
5973 #define VER_GREATER 2
5974 #define VER_GREATER_EQUAL 3
5976 #define VER_LESS_EQUAL 5
5980 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5982 DWORD ulFormatVersion
;
5983 DWORD ulAssemblyCount
;
5984 DWORD ulRootManifestPathType
;
5985 DWORD ulRootManifestPathChars
;
5986 DWORD ulRootConfigurationPathType
;
5987 DWORD ulRootConfigurationPathChars
;
5988 DWORD ulAppDirPathType
;
5989 DWORD ulAppDirPathChars
;
5990 PCWSTR lpRootManifestPath
;
5991 PCWSTR lpRootConfigurationPath
;
5992 PCWSTR lpAppDirPath
;
5993 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5995 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5997 DWORD ulEncodedAssemblyIdentityLength
;
5998 DWORD ulManifestPathType
;
5999 DWORD ulManifestPathLength
;
6000 LARGE_INTEGER liManifestLastWriteTime
;
6001 DWORD ulPolicyPathType
;
6002 DWORD ulPolicyPathLength
;
6003 LARGE_INTEGER liPolicyLastWriteTime
;
6004 DWORD ulMetadataSatelliteRosterIndex
;
6005 DWORD ulManifestVersionMajor
;
6006 DWORD ulManifestVersionMinor
;
6007 DWORD ulPolicyVersionMajor
;
6008 DWORD ulPolicyVersionMinor
;
6009 DWORD ulAssemblyDirectoryNameLength
;
6010 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
6011 PCWSTR lpAssemblyManifestPath
;
6012 PCWSTR lpAssemblyPolicyPath
;
6013 PCWSTR lpAssemblyDirectoryName
;
6015 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
6017 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
6018 DWORD ulAssemblyIndex
;
6019 DWORD ulFileIndexInAssembly
;
6020 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
6022 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
6024 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
6026 DWORD ulFilenameLength
;
6030 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
6032 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
6035 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN
= 0,
6036 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS
,
6037 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION
,
6038 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED
6039 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE
;
6041 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT
{
6043 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type
;
6044 ULONGLONG MaxVersionTested
;
6045 } COMPATIBILITY_CONTEXT_ELEMENT
, *PCOMPATIBILITY_CONTEXT_ELEMENT
;
6047 #if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3)))
6048 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
6050 COMPATIBILITY_CONTEXT_ELEMENT Elements
[];
6051 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
;
6055 ACTCTX_RUN_LEVEL_UNSPECIFIED
= 0,
6056 ACTCTX_RUN_LEVEL_AS_INVOKER
,
6057 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
,
6058 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
,
6059 ACTCTX_RUN_LEVEL_NUMBERS
6060 } ACTCTX_REQUESTED_RUN_LEVEL
;
6062 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
{
6064 ACTCTX_REQUESTED_RUN_LEVEL RunLevel
;
6066 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6068 typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
*PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6070 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
6071 ActivationContextBasicInformation
= 1,
6072 ActivationContextDetailedInformation
= 2,
6073 AssemblyDetailedInformationInActivationContext
= 3,
6074 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
6075 RunlevelInformationInActivationContext
= 5,
6076 CompatibilityInformationInActivationContext
= 6,
6077 ActivationContextManifestResourceName
= 7,
6078 MaxActivationContextInfoClass
,
6079 AssemblyDetailedInformationInActivationContxt
= AssemblyDetailedInformationInActivationContext
,
6080 FileInformationInAssemblyOfAssemblyInActivationContxt
= FileInformationInAssemblyOfAssemblyInActivationContext
6081 } ACTIVATION_CONTEXT_INFO_CLASS
;
6083 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
6084 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
6085 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
6086 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
6088 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
6089 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
6090 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
6091 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
6092 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
6093 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
6094 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
6095 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
6096 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
6097 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10
6098 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11
6099 #define ACTIVATION_CONTEXT_SECTION_WINRT_ACTIVATABLE_CLASSES 12
6101 typedef enum _JOBOBJECTINFOCLASS
6103 JobObjectBasicAccountingInformation
= 1,
6104 JobObjectBasicLimitInformation
,
6105 JobObjectBasicProcessIdList
,
6106 JobObjectBasicUIRestrictions
,
6107 JobObjectSecurityLimitInformation
,
6108 JobObjectEndOfJobTimeInformation
,
6109 JobObjectAssociateCompletionPortInformation
,
6110 JobObjectBasicAndIoAccountingInformation
,
6111 JobObjectExtendedLimitInformation
,
6112 JobObjectJobSetInformation
,
6113 MaxJobObjectInfoClass
6114 } JOBOBJECTINFOCLASS
;
6116 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
{
6117 LARGE_INTEGER TotalUserTime
;
6118 LARGE_INTEGER TotalKernelTime
;
6119 LARGE_INTEGER ThisPeriodTotalUserTime
;
6120 LARGE_INTEGER ThisPeriodTotalKernelTime
;
6121 DWORD TotalPageFaultCount
;
6122 DWORD TotalProcesses
;
6123 DWORD ActiveProcesses
;
6124 DWORD TotalTerminatedProcesses
;
6125 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION
;
6127 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION
{
6128 LARGE_INTEGER PerProcessUserTimeLimit
;
6129 LARGE_INTEGER PerJobUserTimeLimit
;
6131 SIZE_T MinimumWorkingSetSize
;
6132 SIZE_T MaximumWorkingSetSize
;
6133 DWORD ActiveProcessLimit
;
6135 DWORD PriorityClass
;
6136 DWORD SchedulingClass
;
6137 } JOBOBJECT_BASIC_LIMIT_INFORMATION
, *PJOBOBJECT_BASIC_LIMIT_INFORMATION
;
6139 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST
{
6140 DWORD NumberOfAssignedProcesses
;
6141 DWORD NumberOfProcessIdsInList
;
6142 ULONG_PTR ProcessIdList
[1];
6143 } JOBOBJECT_BASIC_PROCESS_ID_LIST
, *PJOBOBJECT_BASIC_PROCESS_ID_LIST
;
6145 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS
{
6146 DWORD UIRestrictionsClass
;
6147 } JOBOBJECT_BASIC_UI_RESTRICTIONS
, *PJOBOBJECT_BASIC_UI_RESTRICTIONS
;
6149 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
6150 DWORD SecurityLimitFlags
;
6152 PTOKEN_GROUPS SidsToDisable
;
6153 PTOKEN_PRIVILEGES PrivilegesToDelete
;
6154 PTOKEN_GROUPS RestrictedSids
;
6155 } JOBOBJECT_SECURITY_LIMIT_INFORMATION
, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION
;
6157 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
{
6158 DWORD EndOfJobTimeAction
;
6159 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION
, PJOBOBJECT_END_OF_JOB_TIME_INFORMATION
;
6161 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
{
6162 PVOID CompletionKey
;
6163 HANDLE CompletionPort
;
6164 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT
, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT
;
6166 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
6167 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
6168 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
6169 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
6170 #define JOB_OBJECT_MSG_NEW_PROCESS 6
6171 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
6172 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
6173 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
6174 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
6176 typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
{
6177 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo
;
6179 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
;
6181 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
6182 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation
;
6184 SIZE_T ProcessMemoryLimit
;
6185 SIZE_T JobMemoryLimit
;
6186 SIZE_T PeakProcessMemoryUsed
;
6187 SIZE_T PeakJobMemoryUsed
;
6188 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION
, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION
;
6190 #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
6191 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
6192 #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
6193 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
6194 #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
6195 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
6196 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
6197 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
6198 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
6199 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
6200 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
6201 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
6202 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
6203 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
6204 #define JOB_OBJECT_LIMIT_SUBSET_AFFINITY 0x00004000
6206 #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
6207 #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
6208 #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00007fff
6210 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
6212 RelationProcessorCore
= 0,
6213 RelationNumaNode
= 1,
6215 RelationProcessorPackage
= 3,
6217 RelationProcessorDie
= 5,
6218 RelationNumaNodeEx
= 6,
6219 RelationProcessorModule
= 7,
6220 RelationAll
= 0xffff
6221 } LOGICAL_PROCESSOR_RELATIONSHIP
;
6223 #define LTP_PC_SMT 0x1
6225 typedef enum _PROCESSOR_CACHE_TYPE
6231 } PROCESSOR_CACHE_TYPE
;
6233 typedef struct _PROCESSOR_GROUP_INFO
6235 BYTE MaximumProcessorCount
;
6236 BYTE ActiveProcessorCount
;
6238 KAFFINITY ActiveProcessorMask
;
6239 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
6241 typedef struct _CACHE_DESCRIPTOR
6247 PROCESSOR_CACHE_TYPE Type
;
6248 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
6250 typedef struct _GROUP_AFFINITY
6255 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
6257 #define ALL_PROCESSOR_GROUPS 0xffff
6259 typedef struct _PROCESSOR_NUMBER
6264 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
6266 typedef struct _PROCESSOR_RELATIONSHIP
6269 BYTE EfficiencyClass
;
6272 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
6273 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
6275 typedef struct _NUMA_NODE_RELATIONSHIP
6279 GROUP_AFFINITY GroupMask
;
6280 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
6282 typedef struct _CACHE_RELATIONSHIP
6288 PROCESSOR_CACHE_TYPE Type
;
6290 GROUP_AFFINITY GroupMask
;
6291 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
6293 typedef struct _GROUP_RELATIONSHIP
6295 WORD MaximumGroupCount
;
6296 WORD ActiveGroupCount
;
6298 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
6299 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
6301 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
6303 ULONG_PTR ProcessorMask
;
6304 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6315 CACHE_DESCRIPTOR Cache
;
6316 ULONGLONG Reserved
[2];
6318 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
6320 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
6322 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6326 PROCESSOR_RELATIONSHIP Processor
;
6327 NUMA_NODE_RELATIONSHIP NumaNode
;
6328 CACHE_RELATIONSHIP Cache
;
6329 GROUP_RELATIONSHIP Group
;
6331 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
6333 typedef enum _CPU_SET_INFORMATION_TYPE
6336 } CPU_SET_INFORMATION_TYPE
, *PCPU_SET_INFORMATION_TYPE
;
6338 typedef struct _SYSTEM_CPU_SET_INFORMATION
6341 CPU_SET_INFORMATION_TYPE Type
;
6348 BYTE LogicalProcessorIndex
;
6350 BYTE LastLevelCacheIndex
;
6352 BYTE EfficiencyClass
;
6360 BYTE AllocatedToTargetProcess
: 1;
6362 BYTE ReservedFlags
: 4;
6367 BYTE SchedulingClass
;
6369 DWORD64 AllocationTag
;
6372 } SYSTEM_CPU_SET_INFORMATION
, *PSYSTEM_CPU_SET_INFORMATION
;
6374 /* Threadpool things */
6375 typedef DWORD TP_VERSION
,*PTP_VERSION
;
6377 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
,*PTP_CALLBACK_INSTANCE
;
6379 typedef VOID (CALLBACK
*PTP_SIMPLE_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
);
6381 typedef struct _TP_POOL TP_POOL
,*PTP_POOL
;
6383 typedef enum _TP_CALLBACK_PRIORITY
6385 TP_CALLBACK_PRIORITY_HIGH
,
6386 TP_CALLBACK_PRIORITY_NORMAL
,
6387 TP_CALLBACK_PRIORITY_LOW
,
6388 TP_CALLBACK_PRIORITY_INVALID
,
6389 TP_CALLBACK_PRIORITY_COUNT
= TP_CALLBACK_PRIORITY_INVALID
6390 } TP_CALLBACK_PRIORITY
;
6392 typedef struct _TP_POOL_STACK_INFORMATION
6394 SIZE_T StackReserve
;
6396 } TP_POOL_STACK_INFORMATION
,*PTP_POOL_STACK_INFORMATION
;
6398 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
,*PTP_CLEANUP_GROUP
;
6400 typedef VOID (CALLBACK
*PTP_CLEANUP_GROUP_CANCEL_CALLBACK
)(PVOID
,PVOID
);
6402 typedef struct _TP_CALLBACK_ENVIRON_V1
6406 PTP_CLEANUP_GROUP CleanupGroup
;
6407 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6409 struct _ACTIVATION_CONTEXT
* ActivationContext
;
6410 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6416 DWORD LongFunction
:1;
6421 } TP_CALLBACK_ENVIRON_V1
;
6423 typedef struct _TP_CALLBACK_ENVIRON_V3
6427 PTP_CLEANUP_GROUP CleanupGroup
;
6428 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6430 struct _ACTIVATION_CONTEXT
*ActivationContext
;
6431 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6437 DWORD LongFunction
:1;
6442 TP_CALLBACK_PRIORITY CallbackPriority
;
6444 } TP_CALLBACK_ENVIRON_V3
;
6446 typedef struct _TP_WORK TP_WORK
, *PTP_WORK
;
6447 typedef struct _TP_TIMER TP_TIMER
, *PTP_TIMER
;
6449 typedef DWORD TP_WAIT_RESULT
;
6450 typedef struct _TP_WAIT TP_WAIT
, *PTP_WAIT
;
6452 typedef struct _TP_IO TP_IO
, *PTP_IO
;
6454 typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON
, *PTP_CALLBACK_ENVIRON
;
6456 typedef VOID (CALLBACK
*PTP_WORK_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WORK
);
6457 typedef VOID (CALLBACK
*PTP_TIMER_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_TIMER
);
6458 typedef VOID (CALLBACK
*PTP_WAIT_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WAIT
,TP_WAIT_RESULT
);
6461 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
6463 typedef enum _RTL_UMS_THREAD_INFO_CLASS
6465 UmsThreadInvalidInfoClass
,
6466 UmsThreadUserContext
,
6470 UmsThreadIsSuspended
,
6471 UmsThreadIsTerminated
,
6472 UmsThreadMaxInfoClass
6473 } RTL_UMS_THREAD_INFO_CLASS
, *PRTL_UMS_THREAD_INFO_CLASS
;
6475 typedef enum _RTL_UMS_SCHEDULER_REASON
6477 UmsSchedulerStartup
,
6478 UmsSchedulerThreadBlocked
,
6479 UmsSchedulerThreadYield
,
6480 } RTL_UMS_SCHEDULER_REASON
, *PRTL_UMS_SCHEDULER_REASON
;
6482 typedef void (CALLBACK
*PRTL_UMS_SCHEDULER_ENTRY_POINT
)(RTL_UMS_SCHEDULER_REASON
,ULONG_PTR
,PVOID
);
6484 typedef enum _PROCESS_MITIGATION_POLICY
6488 ProcessDynamicCodePolicy
,
6489 ProcessStrictHandleCheckPolicy
,
6490 ProcessSystemCallDisablePolicy
,
6491 ProcessMitigationOptionsMask
,
6492 ProcessExtensionPointDisablePolicy
,
6493 ProcessControlFlowGuardPolicy
,
6494 ProcessSignaturePolicy
,
6495 ProcessFontDisablePolicy
,
6496 ProcessImageLoadPolicy
,
6497 ProcessSystemCallFilterPolicy
,
6498 ProcessPayloadRestrictionPolicy
,
6499 ProcessChildProcessPolicy
,
6500 ProcessSideChannelIsolationPolicy
,
6501 MaxProcessMitigationPolicy
6502 } PROCESS_MITIGATION_POLICY
, *PPROCESS_MITIGATION_POLICY
;
6504 typedef enum _FIRMWARE_TYPE
6506 FirmwareTypeUnknown
,
6510 } FIRMWARE_TYPE
, *PFIRMWARE_TYPE
;
6512 /* Intrinsic functions */
6514 #define BitScanForward _BitScanForward
6515 #define BitScanReverse _BitScanReverse
6516 #define InterlockedAdd _InlineInterlockedAdd
6517 #define InterlockedAnd _InterlockedAnd
6518 #define InterlockedAnd64 _InterlockedAnd64
6519 #define InterlockedCompareExchange _InterlockedCompareExchange
6520 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
6521 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
6522 #define InterlockedDecrement _InterlockedDecrement
6523 #define InterlockedDecrement16 _InterlockedDecrement16
6524 #define InterlockedDecrement64 _InterlockedDecrement64
6525 #define InterlockedExchange _InterlockedExchange
6526 #define InterlockedExchangeAdd _InterlockedExchangeAdd
6527 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
6528 #define InterlockedExchangePointer _InterlockedExchangePointer
6529 #define InterlockedIncrement _InterlockedIncrement
6530 #define InterlockedIncrement16 _InterlockedIncrement16
6531 #define InterlockedIncrement64 _InterlockedIncrement64
6532 #define InterlockedOr _InterlockedOr
6533 #define InterlockedOr64 _InterlockedOr64
6534 #define InterlockedXor _InterlockedXor
6535 #define InterlockedXor64 _InterlockedXor64
6539 #pragma intrinsic(_BitScanForward)
6540 #pragma intrinsic(_BitScanReverse)
6541 #pragma intrinsic(_InterlockedAnd)
6542 #pragma intrinsic(_InterlockedCompareExchange)
6543 #pragma intrinsic(_InterlockedCompareExchange64)
6544 #pragma intrinsic(_InterlockedExchange)
6545 #pragma intrinsic(_InterlockedExchangeAdd)
6546 #pragma intrinsic(_InterlockedIncrement)
6547 #pragma intrinsic(_InterlockedIncrement16)
6548 #pragma intrinsic(_InterlockedDecrement)
6549 #pragma intrinsic(_InterlockedDecrement16)
6550 #pragma intrinsic(_InterlockedOr)
6551 #pragma intrinsic(_InterlockedXor)
6552 #pragma intrinsic(__fastfail)
6554 BOOLEAN
_BitScanForward(unsigned long*,unsigned long);
6555 BOOLEAN
_BitScanReverse(unsigned long*,unsigned long);
6556 long _InterlockedAnd(long volatile *,long);
6557 long _InterlockedCompareExchange(long volatile*,long,long);
6558 long long _InterlockedCompareExchange64(long long volatile*,long long,long long);
6559 long _InterlockedDecrement(long volatile*);
6560 short _InterlockedDecrement16(short volatile*);
6561 long _InterlockedExchange(long volatile*,long);
6562 long _InterlockedExchangeAdd(long volatile*,long);
6563 long _InterlockedIncrement(long volatile*);
6564 short _InterlockedIncrement16(short volatile*);
6565 long _InterlockedOr(long volatile *,long);
6566 long _InterlockedXor(long volatile *,long);
6567 DECLSPEC_NORETURN
void __fastfail(unsigned int);
6571 #pragma intrinsic(_InterlockedAnd64)
6572 #pragma intrinsic(_InterlockedCompareExchangePointer)
6573 #pragma intrinsic(_InterlockedDecrement64)
6574 #pragma intrinsic(_InterlockedExchangeAdd64)
6575 #pragma intrinsic(_InterlockedExchangePointer)
6576 #pragma intrinsic(_InterlockedIncrement64)
6577 #pragma intrinsic(_InterlockedOr64)
6578 #pragma intrinsic(_InterlockedXor64)
6580 __int64
_InterlockedAnd64(__int64
volatile *, __int64
);
6581 void * _InterlockedCompareExchangePointer(void *volatile*,void*,void*);
6582 __int64
_InterlockedDecrement64(__int64
volatile *);
6583 __int64
_InterlockedExchangeAdd64(__int64
volatile *, __int64
);
6584 void * _InterlockedExchangePointer(void *volatile*,void*);
6585 __int64
_InterlockedIncrement64(__int64
volatile *);
6586 __int64
_InterlockedOr64(__int64
volatile *, __int64
);
6587 __int64
_InterlockedXor64(__int64
volatile *, __int64
);
6591 static FORCEINLINE __int64
InterlockedAnd64( __int64
volatile *dest
, __int64 val
)
6594 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
& val
, prev
) != prev
);
6598 static FORCEINLINE
void * WINAPI
InterlockedCompareExchangePointer( void *volatile *dest
, void *xchg
, void *compare
)
6600 return (void *)_InterlockedCompareExchange( (long volatile*)dest
, (long)xchg
, (long)compare
);
6603 static FORCEINLINE __int64
InterlockedExchangeAdd64( __int64
volatile *dest
, __int64 val
)
6606 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
+ val
, prev
) != prev
);
6610 static FORCEINLINE
void * WINAPI
InterlockedExchangePointer( void *volatile *dest
, void *val
)
6612 return (void *)_InterlockedExchange( (long volatile*)dest
, (long)val
);
6615 static FORCEINLINE __int64
InterlockedIncrement64( __int64
volatile *dest
)
6617 return InterlockedExchangeAdd64( dest
, 1 ) + 1;
6620 static FORCEINLINE __int64
InterlockedDecrement64( __int64
volatile *dest
)
6622 return InterlockedExchangeAdd64( dest
, -1 ) - 1;
6625 static FORCEINLINE __int64
InterlockedOr64( __int64
volatile *dest
, __int64 val
)
6628 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
| val
, prev
) != prev
);
6632 static FORCEINLINE __int64
InterlockedXor64( __int64
volatile *dest
, __int64 val
)
6635 do prev
= *dest
; while (InterlockedCompareExchange64( dest
, prev
^ val
, prev
) != prev
);
6639 #endif /* __i386__ */
6641 static FORCEINLINE
long InterlockedAdd( long volatile *dest
, long val
)
6643 return InterlockedExchangeAdd( dest
, val
) + val
;
6646 static FORCEINLINE __int64
InterlockedAdd64( __int64
volatile *dest
, __int64 val
)
6648 return InterlockedExchangeAdd64( dest
, val
) + val
;
6653 static FORCEINLINE
void MemoryBarrier(void)
6656 InterlockedOr(&dummy
, 0);
6659 #elif defined(__x86_64__)
6661 #pragma intrinsic(__faststorefence)
6662 void __faststorefence(void);
6664 static FORCEINLINE
void MemoryBarrier(void)
6669 #elif defined(__arm__)
6671 static FORCEINLINE
void MemoryBarrier(void)
6673 __dmb(_ARM_BARRIER_SY
);
6676 #elif defined(__aarch64__)
6678 static FORCEINLINE
void MemoryBarrier(void)
6680 __dmb(_ARM64_BARRIER_SY
);
6683 #endif /* __i386__ */
6685 /* Since Visual Studio 2012, volatile accesses do not always imply acquire and
6686 * release semantics. We explicitly use ISO volatile semantics, manually
6687 * placing barriers as appropriate.
6689 #if _MSC_VER >= 1700
6690 #pragma intrinsic(__iso_volatile_load32)
6691 #pragma intrinsic(__iso_volatile_store32)
6692 #define __WINE_LOAD32_NO_FENCE(src) (__iso_volatile_load32(src))
6693 #define __WINE_STORE32_NO_FENCE(dest, value) (__iso_volatile_store32(dest, value))
6694 #else /* _MSC_VER >= 1700 */
6695 #define __WINE_LOAD32_NO_FENCE(src) (*(src))
6696 #define __WINE_STORE32_NO_FENCE(dest, value) ((void)(*(dest) = (value)))
6697 #endif /* _MSC_VER >= 1700 */
6699 #if defined(__i386__) || defined(__x86_64__)
6700 #pragma intrinsic(_ReadWriteBarrier)
6701 void _ReadWriteBarrier(void);
6702 #endif /* defined(__i386__) || defined(__x86_64__) */
6704 static void __wine_memory_barrier_acq_rel(void)
6706 #if defined(__i386__) || defined(__x86_64__)
6707 #pragma warning(suppress:4996)
6708 _ReadWriteBarrier();
6709 #elif defined(__arm__)
6710 __dmb(_ARM_BARRIER_ISH
);
6711 #elif defined(__aarch64__)
6712 __dmb(_ARM64_BARRIER_ISH
);
6713 #endif /* defined(__i386__) || defined(__x86_64__) */
6716 static FORCEINLINE LONG
ReadAcquire( LONG
const volatile *src
)
6718 LONG value
= __WINE_LOAD32_NO_FENCE( (int const volatile *)src
);
6719 __wine_memory_barrier_acq_rel();
6723 static FORCEINLINE LONG
ReadNoFence( LONG
const volatile *src
)
6725 LONG value
= __WINE_LOAD32_NO_FENCE( (int const volatile *)src
);
6729 static FORCEINLINE
void WriteRelease( LONG
volatile *dest
, LONG value
)
6731 __wine_memory_barrier_acq_rel();
6732 __WINE_STORE32_NO_FENCE( (int volatile *)dest
, value
);
6735 static FORCEINLINE
void WriteNoFence( LONG
volatile *dest
, LONG value
)
6737 __WINE_STORE32_NO_FENCE( (int volatile *)dest
, value
);
6740 #elif defined(__GNUC__)
6742 static FORCEINLINE BOOLEAN WINAPI
BitScanForward(DWORD
*index
, DWORD mask
)
6744 *index
= __builtin_ctz( mask
);
6748 static FORCEINLINE BOOLEAN WINAPI
BitScanReverse(DWORD
*index
, DWORD mask
)
6750 *index
= 31 - __builtin_clz( mask
);
6754 static FORCEINLINE LONG WINAPI
InterlockedAdd( LONG
volatile *dest
, LONG val
)
6756 return __sync_add_and_fetch( dest
, val
);
6759 static FORCEINLINE LONGLONG WINAPI
InterlockedAdd64( LONGLONG
volatile *dest
, LONGLONG val
)
6761 return __sync_add_and_fetch( dest
, val
);
6764 static FORCEINLINE LONG WINAPI
InterlockedAnd( LONG
volatile *dest
, LONG val
)
6766 return __sync_fetch_and_and( dest
, val
);
6769 static FORCEINLINE LONGLONG WINAPI
InterlockedAnd64( LONGLONG
volatile *dest
, LONGLONG val
)
6771 return __sync_fetch_and_and( dest
, val
);
6774 static FORCEINLINE LONG WINAPI
InterlockedCompareExchange( LONG
volatile *dest
, LONG xchg
, LONG compare
)
6776 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6779 static FORCEINLINE
void * WINAPI
InterlockedCompareExchangePointer( void *volatile *dest
, void *xchg
, void *compare
)
6781 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6784 static FORCEINLINE LONGLONG WINAPI
InterlockedCompareExchange64( LONGLONG
volatile *dest
, LONGLONG xchg
, LONGLONG compare
)
6786 return __sync_val_compare_and_swap( dest
, compare
, xchg
);
6789 static FORCEINLINE LONG WINAPI
InterlockedExchange( LONG
volatile *dest
, LONG val
)
6792 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
6793 ret
= __atomic_exchange_n( dest
, val
, __ATOMIC_SEQ_CST
);
6794 #elif defined(__i386__) || defined(__x86_64__)
6795 __asm__
__volatile__( "lock; xchgl %0,(%1)"
6796 : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
6798 do ret
= *dest
; while (!__sync_bool_compare_and_swap( dest
, ret
, val
));
6803 static FORCEINLINE LONG WINAPI
InterlockedExchangeAdd( LONG
volatile *dest
, LONG incr
)
6805 return __sync_fetch_and_add( dest
, incr
);
6808 static FORCEINLINE LONGLONG WINAPI
InterlockedExchangeAdd64( LONGLONG
volatile *dest
, LONGLONG incr
)
6810 return __sync_fetch_and_add( dest
, incr
);
6813 static FORCEINLINE LONG WINAPI
InterlockedIncrement( LONG
volatile *dest
)
6815 return __sync_add_and_fetch( dest
, 1 );
6818 static FORCEINLINE
short WINAPI
InterlockedIncrement16( short volatile *dest
)
6820 return __sync_add_and_fetch( dest
, 1 );
6823 static FORCEINLINE LONGLONG WINAPI
InterlockedIncrement64( LONGLONG
volatile *dest
)
6825 return __sync_add_and_fetch( dest
, 1 );
6828 static FORCEINLINE LONG WINAPI
InterlockedDecrement( LONG
volatile *dest
)
6830 return __sync_add_and_fetch( dest
, -1 );
6833 static FORCEINLINE
short WINAPI
InterlockedDecrement16( short volatile *dest
)
6835 return __sync_add_and_fetch( dest
, -1 );
6838 static FORCEINLINE LONGLONG WINAPI
InterlockedDecrement64( LONGLONG
volatile *dest
)
6840 return __sync_add_and_fetch( dest
, -1 );
6843 static FORCEINLINE
void * WINAPI
InterlockedExchangePointer( void *volatile *dest
, void *val
)
6846 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
6847 ret
= __atomic_exchange_n( dest
, val
, __ATOMIC_SEQ_CST
);
6848 #elif defined(__x86_64__)
6849 __asm__
__volatile__( "lock; xchgq %0,(%1)" : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
6850 #elif defined(__i386__)
6851 __asm__
__volatile__( "lock; xchgl %0,(%1)" : "=r" (ret
) :"r" (dest
), "0" (val
) : "memory" );
6853 do ret
= *dest
; while (!__sync_bool_compare_and_swap( dest
, ret
, val
));
6858 static FORCEINLINE LONG WINAPI
InterlockedOr( LONG
volatile *dest
, LONG val
)
6860 return __sync_fetch_and_or( dest
, val
);
6863 static FORCEINLINE LONGLONG WINAPI
InterlockedOr64( LONGLONG
volatile *dest
, LONGLONG val
)
6865 return __sync_fetch_and_or( dest
, val
);
6868 static FORCEINLINE LONG WINAPI
InterlockedXor( LONG
volatile *dest
, LONG val
)
6870 return __sync_fetch_and_xor( dest
, val
);
6873 static FORCEINLINE LONGLONG WINAPI
InterlockedXor64( LONGLONG
volatile *dest
, LONGLONG val
)
6875 return __sync_fetch_and_xor( dest
, val
);
6878 static FORCEINLINE
void MemoryBarrier(void)
6880 __sync_synchronize();
6883 #if defined(__x86_64__) || defined(__i386__)
6884 /* On x86, Support old GCC with either no or buggy (GCC BZ#81316) __atomic_* support */
6885 #define __WINE_ATOMIC_LOAD_ACQUIRE(ptr, ret) do { *(ret) = *(ptr); __asm__ __volatile__( "" ::: "memory" ); } while (0)
6886 #define __WINE_ATOMIC_LOAD_RELAXED(ptr, ret) do { *(ret) = *(ptr); } while (0)
6887 #define __WINE_ATOMIC_STORE_RELEASE(ptr, val) do { __asm__ __volatile__( "" ::: "memory" ); *(ptr) = *(val); } while (0)
6888 #define __WINE_ATOMIC_STORE_RELAXED(ptr, val) do { *(ptr) = *(val); } while (0)
6890 #define __WINE_ATOMIC_LOAD_ACQUIRE(ptr, ret) __atomic_load(ptr, ret, __ATOMIC_ACQUIRE)
6891 #define __WINE_ATOMIC_LOAD_RELAXED(ptr, ret) __atomic_load(ptr, ret, __ATOMIC_RELAXED)
6892 #define __WINE_ATOMIC_STORE_RELEASE(ptr, val) __atomic_store(ptr, val, __ATOMIC_RELEASE)
6893 #define __WINE_ATOMIC_STORE_RELAXED(ptr, val) __atomic_store(ptr, val, __ATOMIC_RELAXED)
6894 #endif /* defined(__x86_64__) || defined(__i386__) */
6896 static FORCEINLINE LONG
ReadAcquire( LONG
const volatile *src
)
6899 __WINE_ATOMIC_LOAD_ACQUIRE( src
, &value
);
6903 static FORCEINLINE LONG
ReadNoFence( LONG
const volatile *src
)
6906 __WINE_ATOMIC_LOAD_RELAXED( src
, &value
);
6910 static FORCEINLINE
void WriteRelease( LONG
volatile *dest
, LONG value
)
6912 __WINE_ATOMIC_STORE_RELEASE( dest
, &value
);
6915 static FORCEINLINE
void WriteNoFence( LONG
volatile *dest
, LONG value
)
6917 __WINE_ATOMIC_STORE_RELAXED( dest
, &value
);
6920 static FORCEINLINE DECLSPEC_NORETURN
void __fastfail(unsigned int code
)
6922 #if defined(__x86_64__) || defined(__i386__)
6923 for (;;) __asm__
__volatile__( "int $0x29" :: "c" ((ULONG_PTR
)code
) : "memory" );
6924 #elif defined(__aarch64__)
6925 register ULONG_PTR val
__asm__("x0") = code
;
6926 for (;;) __asm__
__volatile__( "brk #0xf003" :: "r" (val
) : "memory" );
6927 #elif defined(__arm__)
6928 register ULONG_PTR val
__asm__("r0") = code
;
6929 for (;;) __asm__
__volatile__( "udf #0xfb" :: "r" (val
) : "memory" );
6933 #endif /* __GNUC__ */
6937 #define InterlockedCompareExchange128 _InterlockedCompareExchange128
6939 #if defined(_MSC_VER) && !defined(__clang__)
6941 #pragma intrinsic(_InterlockedCompareExchange128)
6942 unsigned char _InterlockedCompareExchange128(volatile __int64
*, __int64
, __int64
, __int64
*);
6946 static FORCEINLINE
unsigned char InterlockedCompareExchange128( volatile __int64
*dest
, __int64 xchg_high
, __int64 xchg_low
, __int64
*compare
)
6950 __asm__
__volatile__( "lock cmpxchg16b %0; setz %b2"
6951 : "=m" (dest
[0]), "=m" (dest
[1]), "=r" (ret
),
6952 "=a" (compare
[0]), "=d" (compare
[1])
6953 : "m" (dest
[0]), "m" (dest
[1]), "3" (compare
[0]), "4" (compare
[1]),
6954 "c" (xchg_high
), "b" (xchg_low
) );
6957 return __sync_bool_compare_and_swap( (__int128
*)dest
, *(__int128
*)compare
, ((__int128
)xchg_high
<< 64) | xchg_low
);
6963 #define InterlockedDecrementSizeT(a) InterlockeDecrement64((LONGLONG *)(a))
6964 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)(a), (b))
6965 #define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)(a))
6969 #define InterlockedDecrementSizeT(a) InterlockeDecrement((LONG *)(a))
6970 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)(a), (b))
6971 #define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)(a))
6975 static FORCEINLINE
void YieldProcessor(void)
6978 #if defined(__i386__) || defined(__x86_64__)
6979 __asm__
__volatile__( "rep; nop" : : : "memory" );
6980 #elif defined(__arm__) || defined(__aarch64__)
6981 __asm__
__volatile__( "dmb ishst\n\tyield" : : : "memory" );
6983 __asm__
__volatile__( "" : : : "memory" );
6992 #endif /* _WINNT_ */