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
41 #define NTSYSAPI DECLSPEC_IMPORT
44 #define NTAPI __stdcall
45 #define FASTCALL __fastcall
48 # if defined(_MSC_VER)
49 # define DECLSPEC_IMPORT __declspec(dllimport)
50 # elif defined(__MINGW32__) || defined(__CYGWIN__)
51 # define DECLSPEC_IMPORT __attribute__((dllimport))
53 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
56 # define DECLSPEC_IMPORT
59 #ifndef DECLSPEC_NORETURN
60 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
61 # define DECLSPEC_NORETURN __declspec(noreturn)
62 # elif defined(__GNUC__)
63 # define DECLSPEC_NORETURN __attribute__((noreturn))
65 # define DECLSPEC_NORETURN
69 #ifndef DECLSPEC_ALIGN
70 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
71 # define DECLSPEC_ALIGN(x) __declspec(align(x))
72 # elif defined(__GNUC__)
73 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
75 # define DECLSPEC_ALIGN(x)
79 #ifndef DECLSPEC_NOTHROW
80 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
81 # define DECLSPEC_NOTHROW __declspec(nothrow)
82 # elif defined(__GNUC__)
83 # define DECLSPEC_NOTHROW __attribute__((nothrow))
85 # define DECLSPEC_NOTHROW
89 #ifndef DECLSPEC_CACHEALIGN
90 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
94 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
95 # define DECLSPEC_UUID(x) __declspec(uuid(x))
97 # define DECLSPEC_UUID(x)
101 #ifndef DECLSPEC_NOVTABLE
102 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
103 # define DECLSPEC_NOVTABLE __declspec(novtable)
105 # define DECLSPEC_NOVTABLE
109 #ifndef DECLSPEC_SELECTANY
110 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
111 #define DECLSPEC_SELECTANY __declspec(selectany)
113 #define DECLSPEC_SELECTANY
118 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
119 # define NOP_FUNCTION __noop
121 # define NOP_FUNCTION (void)0
125 #ifndef DECLSPEC_ADDRSAFE
126 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
127 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
129 # define DECLSPEC_ADDRSAFE
134 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
135 # define FORCEINLINE __forceinline
136 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
137 # define FORCEINLINE inline __attribute__((always_inline))
139 # define FORCEINLINE inline
143 #ifndef DECLSPEC_DEPRECATED
144 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
145 # define DECLSPEC_DEPRECATED __declspec(deprecated)
146 # define DEPRECATE_SUPPORTED
147 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
148 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
149 # define DEPRECATE_SUPPORTED
151 # define DECLSPEC_DEPRECATED
152 # undef DEPRECATE_SUPPORTED
156 /* a couple of useful Wine extensions */
159 # define DECLSPEC_EXPORT __declspec(dllexport)
160 #elif defined(__MINGW32__)
161 # define DECLSPEC_EXPORT __attribute__((dllexport))
162 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) && !defined(__sun)
163 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
165 # define DECLSPEC_EXPORT
168 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || defined(__sun)
169 # define DECLSPEC_HIDDEN
170 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
171 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
173 # define DECLSPEC_HIDDEN
176 #ifndef __has_attribute
177 # define __has_attribute(x) 0
180 #if ((defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) || __has_attribute(ms_hook_prologue)) && (defined(__i386__) || defined(__x86_64__))
181 #define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__))
183 #define DECLSPEC_HOTPATCH
186 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
187 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
189 #define __WINE_ALLOC_SIZE(x)
192 /* Anonymous union/struct handling */
194 #ifndef NONAMELESSSTRUCT
196 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
197 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
198 # define NONAMELESSSTRUCT
200 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
201 # define NONAMELESSSTRUCT
203 #endif /* NONAMELESSSTRUCT */
205 #ifndef NONAMELESSUNION
207 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
208 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
209 # define NONAMELESSUNION
211 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
212 # define NONAMELESSUNION
214 #endif /* NONAMELESSUNION */
216 #undef DUMMYSTRUCTNAME
217 #undef DUMMYSTRUCTNAME1
218 #undef DUMMYSTRUCTNAME2
219 #undef DUMMYSTRUCTNAME3
220 #undef DUMMYSTRUCTNAME4
221 #undef DUMMYSTRUCTNAME5
222 #ifndef NONAMELESSSTRUCT
223 #define DUMMYSTRUCTNAME
224 #define DUMMYSTRUCTNAME1
225 #define DUMMYSTRUCTNAME2
226 #define DUMMYSTRUCTNAME3
227 #define DUMMYSTRUCTNAME4
228 #define DUMMYSTRUCTNAME5
229 #else /* !defined(NONAMELESSSTRUCT) */
230 #define DUMMYSTRUCTNAME s
231 #define DUMMYSTRUCTNAME1 s1
232 #define DUMMYSTRUCTNAME2 s2
233 #define DUMMYSTRUCTNAME3 s3
234 #define DUMMYSTRUCTNAME4 s4
235 #define DUMMYSTRUCTNAME5 s5
236 #endif /* !defined(NONAMELESSSTRUCT) */
238 #undef DUMMYUNIONNAME
239 #undef DUMMYUNIONNAME1
240 #undef DUMMYUNIONNAME2
241 #undef DUMMYUNIONNAME3
242 #undef DUMMYUNIONNAME4
243 #undef DUMMYUNIONNAME5
244 #undef DUMMYUNIONNAME6
245 #undef DUMMYUNIONNAME7
246 #undef DUMMYUNIONNAME8
247 #ifndef NONAMELESSUNION
248 #define DUMMYUNIONNAME
249 #define DUMMYUNIONNAME1
250 #define DUMMYUNIONNAME2
251 #define DUMMYUNIONNAME3
252 #define DUMMYUNIONNAME4
253 #define DUMMYUNIONNAME5
254 #define DUMMYUNIONNAME6
255 #define DUMMYUNIONNAME7
256 #define DUMMYUNIONNAME8
257 #else /* !defined(NONAMELESSUNION) */
258 #define DUMMYUNIONNAME u
259 #define DUMMYUNIONNAME1 u1
260 #define DUMMYUNIONNAME2 u2
261 #define DUMMYUNIONNAME3 u3
262 #define DUMMYUNIONNAME4 u4
263 #define DUMMYUNIONNAME5 u5
264 #define DUMMYUNIONNAME6 u6
265 #define DUMMYUNIONNAME7 u7
266 #define DUMMYUNIONNAME8 u8
267 #endif /* !defined(NONAMELESSUNION) */
269 #undef __C89_NAMELESS
270 #undef __C89_NAMELESSSTRUCTNAME
271 #undef __C89_NAMELESSSTRUCTNAME1
272 #undef __C89_NAMELESSSTRUCTNAME2
273 #undef __C89_NAMELESSSTRUCTNAME3
274 #undef __C89_NAMELESSSTRUCTNAME4
275 #undef __C89_NAMELESSSTRUCTNAME5
276 #undef __C89_NAMELESSUNIONNAME
277 #undef __C89_NAMELESSUNIONNAME1
278 #undef __C89_NAMELESSUNIONNAME2
279 #undef __C89_NAMELESSUNIONNAME3
280 #undef __C89_NAMELESSUNIONNAME4
281 #undef __C89_NAMELESSUNIONNAME5
282 #undef __C89_NAMELESSUNIONNAME6
283 #undef __C89_NAMELESSUNIONNAME7
284 #undef __C89_NAMELESSUNIONNAME8
286 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
288 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
289 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
290 # define __C89_NAMELESS __extension__
292 # elif defined(_MSC_VER)
293 # define __C89_NAMELESS
297 #ifdef __C89_NAMELESS
298 # define __C89_NAMELESSSTRUCTNAME
299 # define __C89_NAMELESSSTRUCTNAME1
300 # define __C89_NAMELESSSTRUCTNAME2
301 # define __C89_NAMELESSSTRUCTNAME3
302 # define __C89_NAMELESSSTRUCTNAME4
303 # define __C89_NAMELESSSTRUCTNAME5
304 # define __C89_NAMELESSUNIONNAME
305 # define __C89_NAMELESSUNIONNAME1
306 # define __C89_NAMELESSUNIONNAME2
307 # define __C89_NAMELESSUNIONNAME3
308 # define __C89_NAMELESSUNIONNAME4
309 # define __C89_NAMELESSUNIONNAME5
310 # define __C89_NAMELESSUNIONNAME6
311 # define __C89_NAMELESSUNIONNAME7
312 # define __C89_NAMELESSUNIONNAME8
314 # define __C89_NAMELESS
315 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
316 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
317 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
318 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
319 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
320 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
321 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
322 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
323 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
324 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
325 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
326 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
327 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
328 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
329 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
332 /* C99 restrict support */
334 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
335 # if defined(_MSC_VER) && defined(_M_MRX000)
336 # define RESTRICTED_POINTER __restrict
337 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
338 # define RESTRICTED_POINTER __restrict
340 # define RESTRICTED_POINTER
343 # define RESTRICTED_POINTER
346 /* C99 unaligned support */
349 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
350 # define UNALIGNED __unaligned
352 # define UNALIGNED64 __unaligned
362 /* Alignment macros */
364 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
365 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
366 #define MEMORY_ALLOCATION_ALIGNMENT 16
368 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
369 #define MEMORY_ALLOCATION_ALIGNMENT 8
372 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
373 # define TYPE_ALIGNMENT(t) __alignof(t)
374 #elif defined(__GNUC__)
375 # define TYPE_ALIGNMENT(t) __alignof__(t)
377 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
381 # define PROBE_ALIGNMENT(_s) \
382 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
383 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
384 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
386 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
389 /* Compile time assertion */
391 #if defined(_MSC_VER)
392 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
394 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
397 /* Eliminate Microsoft C/C++ compiler warning 4715 */
398 #if defined(_MSC_VER) && (_MSC_VER > 1200)
399 # define DEFAULT_UNREACHABLE default: __assume(0)
400 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
401 # define DEFAULT_UNREACHABLE default: __builtin_unreachable()
403 # define DEFAULT_UNREACHABLE default:
407 #define APPLICATION_ERROR_MASK 0x20000000
408 #define ERROR_SEVERITY_SUCCESS 0x00000000
409 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
410 #define ERROR_SEVERITY_WARNING 0x80000000
411 #define ERROR_SEVERITY_ERROR 0xC0000000
414 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
416 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
417 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
418 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
419 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
420 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
421 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
422 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
425 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
428 /* Microsoft's macros for declaring functions */
431 # define EXTERN_C extern "C"
433 # define EXTERN_C extern
436 #define STDMETHODCALLTYPE WINAPI
437 #define STDMETHODVCALLTYPE WINAPIV
438 #define STDAPICALLTYPE WINAPI
439 #define STDAPIVCALLTYPE WINAPIV
441 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
442 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
443 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
444 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
445 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
446 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
447 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
448 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
450 /* Define the basic types */
455 typedef VOID
*PVOID64
;
456 typedef BYTE BOOLEAN
, *PBOOLEAN
;
457 typedef char CHAR
, *PCHAR
;
458 typedef short SHORT
, *PSHORT
;
460 typedef long LONG
, *PLONG
;
462 typedef int LONG
, *PLONG
;
465 /* Some systems might have wchar_t, but we really need 16 bit characters */
466 #if defined(WINE_UNICODE_NATIVE)
467 typedef wchar_t WCHAR
;
468 #elif defined(WINE_UNICODE_CHAR16)
469 typedef char16_t WCHAR
;
471 typedef unsigned short WCHAR
;
473 typedef WCHAR
*PWCHAR
;
475 typedef ULONG UCSCHAR
;
476 #define MIN_UCSCHAR (0)
477 #define MAX_UCSCHAR (0x0010ffff)
478 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
480 /* 'Extended/Wide' numerical types */
484 typedef signed __int64 LONGLONG
, *PLONGLONG
;
485 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
487 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
488 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
495 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
497 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
501 /* ANSI string types */
502 typedef CHAR
*PCH
, *LPCH
, *PNZCH
;
503 typedef const CHAR
*PCCH
, *LPCCH
, *PCNZCH
;
504 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
505 typedef const CHAR
*PCSTR
, *LPCSTR
;
506 typedef CHAR
*PZZSTR
;
507 typedef const CHAR
*PCZZSTR
;
509 /* Unicode string types */
510 typedef const WCHAR
*PCWCHAR
, *LPCUWCHAR
, *PCUWCHAR
;
511 typedef WCHAR
*PWCH
, *LPWCH
;
512 typedef const WCHAR
*PCWCH
, *LPCWCH
;
513 typedef WCHAR
*PNZWCH
, *PUNZWCH
;
514 typedef const WCHAR
*PCNZWCH
, *PCUNZWCH
;
515 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
516 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
517 typedef WCHAR
*PZZWSTR
, *PUZZWSTR
;
518 typedef const WCHAR
*PCZZWSTR
, *PCUZZWSTR
;
519 typedef PWSTR
*PZPWSTR
;
520 typedef PCWSTR
*PZPCWSTR
;
522 /* Neutral character and string types */
523 /* These are only defined for Winelib, i.e. _not_ defined for
524 * the emulator. The reason is they depend on the UNICODE
525 * macro which only exists in the user's code.
527 #ifndef WINE_NO_UNICODE_MACROS
529 # ifndef _TCHAR_DEFINED
530 typedef WCHAR TCHAR
, *PTCHAR
;
531 # define _TCHAR_DEFINED
533 typedef LPWCH PTCH
, LPTCH
;
534 typedef LPCWCH PCTCH
, LPCTCH
;
535 typedef LPWSTR PTSTR
, LPTSTR
;
536 typedef LPCWSTR PCTSTR
, LPCTSTR
;
537 typedef LPWSTR PUTSTR
, LPUTSTR
;
538 typedef LPCWSTR PCUTSTR
, LPCUTSTR
;
539 typedef PNZWCH PNZTCH
;
540 typedef PUNZWCH PUNZTCH
;
541 typedef PCNZWCH PCNZTCH
;
542 typedef PCUNZWCH PCUNZTCH
;
543 typedef PZZWSTR PZZTSTR
;
544 typedef PCZZWSTR PCZZTSTR
;
545 typedef PUZZWSTR PUZZTSTR
;
546 typedef PCUZZWSTR PCUZZTSTR
;
548 # ifndef _TCHAR_DEFINED
549 typedef CHAR TCHAR
, *PTCHAR
;
550 # define _TCHAR_DEFINED
552 typedef LPCH PTCH
, LPTCH
;
553 typedef LPCCH PCTCH
, LPCTCH
;
554 typedef LPSTR PTSTR
, LPTSTR
;
555 typedef LPCSTR PCTSTR
, LPCTSTR
;
556 typedef PNZCH PNZTCH
, PUNZTCH
;
557 typedef PCNZCH PCNZTCH
, PCUNZTCH
;
558 typedef PZZSTR PZZTSTR
, PUZZTSTR
;
559 typedef PCZZSTR PCZZTSTR
, PCUZZTSTR
;
560 # endif /* UNICODE */
561 #endif /* WINE_NO_UNICODE_MACROS */
563 /* UCS string types */
564 typedef UCSCHAR
*PUCSCHAR
, *PUUCSCHAR
;
565 typedef const UCSCHAR
*PCUCSCHAR
, *PCUUCSCHAR
;
566 typedef UCSCHAR
*PUCSSTR
, *PUUCSSTR
;
567 typedef const UCSCHAR
*PCUCSSTR
, *PCUUCSSTR
;
569 /* Misc common WIN32 types */
571 typedef DWORD LCID
, *PLCID
;
573 typedef DWORD EXECUTION_STATE
;
574 #ifndef _HRESULT_DEFINED
575 #define _HRESULT_DEFINED
576 typedef LONG HRESULT
;
581 typedef void *HANDLE
;
582 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
585 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
587 #define DECLARE_HANDLE(a) typedef HANDLE a
594 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
596 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
597 # define __MSABI_LONG(x) x ## l
599 # define __MSABI_LONG(x) x
605 #ifndef WIN32_NO_STATUS
607 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
608 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
609 #define STATUS_USER_APC ((DWORD) 0x000000C0)
610 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
611 #define STATUS_PENDING ((DWORD) 0x00000103)
612 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
613 #define STATUS_FATAL_APP_EXIT ((DWORD) 0x40000015)
614 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
615 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
616 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
617 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
618 #define STATUS_LONGJUMP ((DWORD) 0x80000026)
619 #define STATUS_UNWIND_CONSOLIDATE ((DWORD) 0x80000029)
620 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
621 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
622 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
623 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
624 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
625 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
626 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
627 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
628 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
629 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
630 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
631 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
632 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
633 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
634 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
635 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
636 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
637 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
638 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
639 #define STATUS_DLL_NOT_FOUND ((DWORD) 0xC0000135)
640 #define STATUS_ORDINAL_NOT_FOUND ((DWORD) 0xC0000138)
641 #define STATUS_ENTRYPOINT_NOT_FOUND ((DWORD) 0xC0000139)
642 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
643 #define STATUS_DLL_INIT_FAILED ((DWORD) 0xC0000142)
644 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
645 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
646 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
647 #define STATUS_HEAP_CORRUPTION ((DWORD) 0xC0000374)
648 #define STATUS_STACK_BUFFER_OVERRUN ((DWORD) 0xC0000409)
649 #define STATUS_INVALID_CRUNTIME_PARAMETER ((DWORD) 0xC0000417)
650 #define STATUS_ASSERTION_FAILURE ((DWORD) 0xC0000420)
651 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
652 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
654 /* status values for ContinueDebugEvent */
655 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
656 #define DBG_CONTINUE ((DWORD) 0x00010002)
657 #define DBG_REPLY_LATER ((DWORD) 0x40010001)
658 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
659 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
660 #define DBG_CONTROL_C ((DWORD) 0x40010005)
661 #define DBG_PRINTEXCEPTION_C ((DWORD) 0x40010006)
662 #define DBG_RIPEXCEPTION ((DWORD) 0x40010007)
663 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
664 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
665 #define DBG_PRINTEXCEPTION_WIDE_C ((DWORD) 0x4001000A)
666 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
668 #endif /* WIN32_NO_STATUS */
670 /* Argument 1 passed to the DllEntryProc. */
671 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
672 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
673 #define DLL_THREAD_ATTACH 2 /* attach new thread */
674 #define DLL_THREAD_DETACH 3 /* detach thread */
676 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
679 /* u.x.wProcessorArchitecture (NT) */
680 #define PROCESSOR_ARCHITECTURE_INTEL 0
681 #define PROCESSOR_ARCHITECTURE_MIPS 1
682 #define PROCESSOR_ARCHITECTURE_ALPHA 2
683 #define PROCESSOR_ARCHITECTURE_PPC 3
684 #define PROCESSOR_ARCHITECTURE_SHX 4
685 #define PROCESSOR_ARCHITECTURE_ARM 5
686 #define PROCESSOR_ARCHITECTURE_IA64 6
687 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
688 #define PROCESSOR_ARCHITECTURE_MSIL 8
689 #define PROCESSOR_ARCHITECTURE_AMD64 9
690 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
691 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
692 #define PROCESSOR_ARCHITECTURE_ARM64 12
693 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
694 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14
695 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
697 /* dwProcessorType */
698 #define PROCESSOR_INTEL_386 386
699 #define PROCESSOR_INTEL_486 486
700 #define PROCESSOR_INTEL_PENTIUM 586
701 #define PROCESSOR_INTEL_860 860
702 #define PROCESSOR_INTEL_IA64 2200
703 #define PROCESSOR_AMD_X8664 8664
704 #define PROCESSOR_MIPS_R2000 2000
705 #define PROCESSOR_MIPS_R3000 3000
706 #define PROCESSOR_MIPS_R4000 4000
707 #define PROCESSOR_ALPHA_21064 21064
708 #define PROCESSOR_PPC_601 601
709 #define PROCESSOR_PPC_603 603
710 #define PROCESSOR_PPC_604 604
711 #define PROCESSOR_PPC_620 620
712 #define PROCESSOR_HITACHI_SH3 10003
713 #define PROCESSOR_HITACHI_SH3E 10004
714 #define PROCESSOR_HITACHI_SH4 10005
715 #define PROCESSOR_MOTOROLA_821 821
716 #define PROCESSOR_SHx_SH3 103
717 #define PROCESSOR_SHx_SH4 104
718 #define PROCESSOR_STRONGARM 2577
719 #define PROCESSOR_ARM720 1824 /* 0x720 */
720 #define PROCESSOR_ARM820 2080 /* 0x820 */
721 #define PROCESSOR_ARM920 2336 /* 0x920 */
722 #define PROCESSOR_ARM_7TDMI 70001
723 #define PROCESSOR_OPTIL 18767
726 #define MAXIMUM_PROCESSORS 64
728 #define MAXIMUM_PROCESSORS 32
731 typedef struct _MEMORY_BASIC_INFORMATION
734 LPVOID AllocationBase
;
735 DWORD AllocationProtect
;
740 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
742 #define PAGE_NOACCESS 0x01
743 #define PAGE_READONLY 0x02
744 #define PAGE_READWRITE 0x04
745 #define PAGE_WRITECOPY 0x08
746 #define PAGE_EXECUTE 0x10
747 #define PAGE_EXECUTE_READ 0x20
748 #define PAGE_EXECUTE_READWRITE 0x40
749 #define PAGE_EXECUTE_WRITECOPY 0x80
750 #define PAGE_GUARD 0x100
751 #define PAGE_NOCACHE 0x200
752 #define PAGE_WRITECOMBINE 0x400
754 #define MEM_COMMIT 0x00001000
755 #define MEM_RESERVE 0x00002000
756 #define MEM_DECOMMIT 0x00004000
757 #define MEM_RELEASE 0x00008000
758 #define MEM_FREE 0x00010000
759 #define MEM_PRIVATE 0x00020000
760 #define MEM_MAPPED 0x00040000
761 #define MEM_RESET 0x00080000
762 #define MEM_TOP_DOWN 0x00100000
763 #define MEM_WRITE_WATCH 0x00200000
764 #define MEM_PHYSICAL 0x00400000
765 #define MEM_LARGE_PAGES 0x20000000
766 #define MEM_4MB_PAGES 0x80000000
768 #define SEC_FILE 0x00800000
769 #define SEC_IMAGE 0x01000000
770 #define SEC_PROTECTED_IMAGE 0x02000000
771 #define SEC_RESERVE 0x04000000
772 #define SEC_COMMIT 0x08000000
773 #define SEC_NOCACHE 0x10000000
774 #define SEC_WRITECOMBINE 0x40000000
775 #define SEC_LARGE_PAGES 0x80000000
776 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
777 #define MEM_IMAGE SEC_IMAGE
779 #define WRITE_WATCH_FLAG_RESET 0x00000001
781 #define AT_ROUND_TO_PAGE 0x40000000
785 #define MINSHORT 0x8000
786 #define MAXSHORT 0x7fff
787 #define MINLONG 0x80000000
788 #define MAXLONG 0x7fffffff
790 #define MAXWORD 0xffff
791 #define MAXDWORD 0xffffffff
792 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
794 #define UNICODE_STRING_MAX_CHARS 32767
796 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
797 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
798 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
800 #define CONTAINING_RECORD(address, type, field) \
801 ((type *)((PCHAR)(address) - offsetof(type, field)))
804 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
809 typedef struct _LIST_ENTRY
{
810 struct _LIST_ENTRY
*Flink
;
811 struct _LIST_ENTRY
*Blink
;
812 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
814 typedef struct _SINGLE_LIST_ENTRY
{
815 struct _SINGLE_LIST_ENTRY
*Next
;
816 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
820 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
821 struct _SLIST_ENTRY
*Next
;
822 } SLIST_ENTRY
, *PSLIST_ENTRY
;
824 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
831 ULONGLONG Sequence
:9;
832 ULONGLONG NextEntry
:39;
833 ULONGLONG HeaderType
:1;
835 ULONGLONG Reserved
:59;
840 ULONGLONG Sequence
:48;
841 ULONGLONG HeaderType
:1;
843 ULONGLONG Reserved
:2;
844 ULONGLONG NextEntry
:60;
846 } SLIST_HEADER
, *PSLIST_HEADER
;
850 #undef SLIST_ENTRY /* for Mac OS */
851 #define SLIST_ENTRY SINGLE_LIST_ENTRY
852 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
853 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
855 typedef union _SLIST_HEADER
{
862 } SLIST_HEADER
, *PSLIST_HEADER
;
866 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
867 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
868 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
869 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
870 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
871 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
876 #define HEAP_NO_SERIALIZE 0x00000001
877 #define HEAP_GROWABLE 0x00000002
878 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
879 #define HEAP_ZERO_MEMORY 0x00000008
880 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
881 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
882 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
883 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
884 #define HEAP_CREATE_ALIGN_16 0x00010000
885 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
886 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
888 /* This flag allows it to create heaps shared by all processes under win95,
889 FIXME: correct name */
890 #define HEAP_SHARED 0x04000000
892 typedef enum _HEAP_INFORMATION_CLASS
{
893 HeapCompatibilityInformation
,
894 } HEAP_INFORMATION_CLASS
;
896 /* Processor feature flags. */
897 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
898 #define PF_FLOATING_POINT_EMULATED 1
899 #define PF_COMPARE_EXCHANGE_DOUBLE 2
900 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
901 #define PF_PPC_MOVEMEM_64BIT_OK 4
902 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
903 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
904 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
905 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
906 #define PF_PAE_ENABLED 9
907 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
908 #define PF_SSE_DAZ_MODE_AVAILABLE 11
909 #define PF_NX_ENABLED 12
910 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
911 #define PF_COMPARE_EXCHANGE128 14
912 #define PF_COMPARE64_EXCHANGE128 15
913 #define PF_CHANNELS_ENABLED 16
914 #define PF_XSAVE_ENABLED 17
915 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
916 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
917 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
918 #define PF_VIRT_FIRMWARE_ENABLED 21
919 #define PF_RDWRFSGSBASE_AVAILABLE 22
920 #define PF_FASTFAIL_AVAILABLE 23
921 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
922 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
923 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
924 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
925 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
926 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
927 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
928 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
931 /* Execution state flags */
932 #define ES_SYSTEM_REQUIRED 0x00000001
933 #define ES_DISPLAY_REQUIRED 0x00000002
934 #define ES_USER_PRESENT 0x00000004
935 #define ES_CONTINUOUS 0x80000000
940 struct _EXCEPTION_POINTERS
;
941 struct _EXCEPTION_RECORD
;
943 typedef EXCEPTION_DISPOSITION WINAPI
EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD
*,PVOID
,
944 struct _CONTEXT
*,PVOID
);
945 typedef EXCEPTION_ROUTINE
*PEXCEPTION_ROUTINE
;
947 /* The Win32 register context */
949 /* i386 context definitions */
952 #define SIZE_OF_80387_REGISTERS 80
954 typedef struct _FLOATING_SAVE_AREA
963 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
965 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
967 #define MAXIMUM_SUPPORTED_EXTENSION 512
969 typedef struct _CONTEXT
971 DWORD ContextFlags
; /* 000 */
973 /* These are selected by CONTEXT_DEBUG_REGISTERS */
981 /* These are selected by CONTEXT_FLOATING_POINT */
982 FLOATING_SAVE_AREA FloatSave
; /* 01c */
984 /* These are selected by CONTEXT_SEGMENTS */
985 DWORD SegGs
; /* 08c */
986 DWORD SegFs
; /* 090 */
987 DWORD SegEs
; /* 094 */
988 DWORD SegDs
; /* 098 */
990 /* These are selected by CONTEXT_INTEGER */
998 /* These are selected by CONTEXT_CONTROL */
1000 DWORD Eip
; /* 0b8 */
1001 DWORD SegCs
; /* 0bc */
1002 DWORD EFlags
; /* 0c0 */
1003 DWORD Esp
; /* 0c4 */
1004 DWORD SegSs
; /* 0c8 */
1006 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
]; /* 0xcc */
1007 } CONTEXT
, *PCONTEXT
;
1009 #define CONTEXT_X86 0x00010000
1010 #define CONTEXT_i386 CONTEXT_X86
1011 #define CONTEXT_i486 CONTEXT_X86
1013 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
1014 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
1015 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1016 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1017 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1018 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1019 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040)
1020 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
1021 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
1022 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
1024 #define EXCEPTION_READ_FAULT 0
1025 #define EXCEPTION_WRITE_FAULT 1
1026 #define EXCEPTION_EXECUTE_FAULT 8
1028 #endif /* __i386__ */
1030 typedef struct _LDT_ENTRY
{
1041 unsigned BaseMid
: 8;
1045 unsigned LimitHi
: 4;
1047 unsigned Reserved_0
: 1;
1048 unsigned Default_Big
: 1;
1049 unsigned Granularity
: 1;
1050 unsigned BaseHi
: 8;
1053 } LDT_ENTRY
, *PLDT_ENTRY
, WOW64_LDT_ENTRY
, *PWOW64_LDT_ENTRY
;
1055 /* x86-64 context definitions */
1056 #if defined(__x86_64__)
1058 #define CONTEXT_AMD64 0x00100000
1060 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
1061 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
1062 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1063 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1064 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1065 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x0040)
1066 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1067 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1069 #define EXCEPTION_READ_FAULT 0
1070 #define EXCEPTION_WRITE_FAULT 1
1071 #define EXCEPTION_EXECUTE_FAULT 8
1073 typedef struct DECLSPEC_ALIGN(16) _M128A
{
1078 typedef struct _XMM_SAVE_AREA32
{
1079 WORD ControlWord
; /* 000 */
1080 WORD StatusWord
; /* 002 */
1081 BYTE TagWord
; /* 004 */
1082 BYTE Reserved1
; /* 005 */
1083 WORD ErrorOpcode
; /* 006 */
1084 DWORD ErrorOffset
; /* 008 */
1085 WORD ErrorSelector
; /* 00c */
1086 WORD Reserved2
; /* 00e */
1087 DWORD DataOffset
; /* 010 */
1088 WORD DataSelector
; /* 014 */
1089 WORD Reserved3
; /* 016 */
1090 DWORD MxCsr
; /* 018 */
1091 DWORD MxCsr_Mask
; /* 01c */
1092 M128A FloatRegisters
[8]; /* 020 */
1093 M128A XmmRegisters
[16]; /* 0a0 */
1094 BYTE Reserved4
[96]; /* 1a0 */
1095 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
1097 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
1098 DWORD64 P1Home
; /* 000 */
1099 DWORD64 P2Home
; /* 008 */
1100 DWORD64 P3Home
; /* 010 */
1101 DWORD64 P4Home
; /* 018 */
1102 DWORD64 P5Home
; /* 020 */
1103 DWORD64 P6Home
; /* 028 */
1106 DWORD ContextFlags
; /* 030 */
1107 DWORD MxCsr
; /* 034 */
1110 WORD SegCs
; /* 038 */
1111 WORD SegDs
; /* 03a */
1112 WORD SegEs
; /* 03c */
1113 WORD SegFs
; /* 03e */
1114 WORD SegGs
; /* 040 */
1115 WORD SegSs
; /* 042 */
1116 DWORD EFlags
; /* 044 */
1119 DWORD64 Dr0
; /* 048 */
1120 DWORD64 Dr1
; /* 050 */
1121 DWORD64 Dr2
; /* 058 */
1122 DWORD64 Dr3
; /* 060 */
1123 DWORD64 Dr6
; /* 068 */
1124 DWORD64 Dr7
; /* 070 */
1127 DWORD64 Rax
; /* 078 */
1128 DWORD64 Rcx
; /* 080 */
1129 DWORD64 Rdx
; /* 088 */
1130 DWORD64 Rbx
; /* 090 */
1131 DWORD64 Rsp
; /* 098 */
1132 DWORD64 Rbp
; /* 0a0 */
1133 DWORD64 Rsi
; /* 0a8 */
1134 DWORD64 Rdi
; /* 0b0 */
1135 DWORD64 R8
; /* 0b8 */
1136 DWORD64 R9
; /* 0c0 */
1137 DWORD64 R10
; /* 0c8 */
1138 DWORD64 R11
; /* 0d0 */
1139 DWORD64 R12
; /* 0d8 */
1140 DWORD64 R13
; /* 0e0 */
1141 DWORD64 R14
; /* 0e8 */
1142 DWORD64 R15
; /* 0f0 */
1145 DWORD64 Rip
; /* 0f8 */
1147 /* Floating point */
1149 XMM_SAVE_AREA32 FltSave
; /* 100 */
1151 M128A Header
[2]; /* 100 */
1152 M128A Legacy
[8]; /* 120 */
1153 M128A Xmm0
; /* 1a0 */
1154 M128A Xmm1
; /* 1b0 */
1155 M128A Xmm2
; /* 1c0 */
1156 M128A Xmm3
; /* 1d0 */
1157 M128A Xmm4
; /* 1e0 */
1158 M128A Xmm5
; /* 1f0 */
1159 M128A Xmm6
; /* 200 */
1160 M128A Xmm7
; /* 210 */
1161 M128A Xmm8
; /* 220 */
1162 M128A Xmm9
; /* 230 */
1163 M128A Xmm10
; /* 240 */
1164 M128A Xmm11
; /* 250 */
1165 M128A Xmm12
; /* 260 */
1166 M128A Xmm13
; /* 270 */
1167 M128A Xmm14
; /* 280 */
1168 M128A Xmm15
; /* 290 */
1173 M128A VectorRegister
[26]; /* 300 */
1174 DWORD64 VectorControl
; /* 4a0 */
1177 DWORD64 DebugControl
; /* 4a8 */
1178 DWORD64 LastBranchToRip
; /* 4b0 */
1179 DWORD64 LastBranchFromRip
; /* 4b8 */
1180 DWORD64 LastExceptionToRip
; /* 4c0 */
1181 DWORD64 LastExceptionFromRip
; /* 4c8 */
1182 } CONTEXT
, *PCONTEXT
;
1184 typedef struct _RUNTIME_FUNCTION
1189 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1191 #define UNWIND_HISTORY_TABLE_SIZE 12
1193 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1196 PRUNTIME_FUNCTION FunctionEntry
;
1197 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1199 #define UNWIND_HISTORY_TABLE_NONE 0
1200 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1201 #define UNWIND_HISTORY_TABLE_LOCAL 2
1203 typedef struct _UNWIND_HISTORY_TABLE
1208 ULONG64 HighAddress
;
1209 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1210 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1212 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1216 PM128A FloatingContext
[16];
1240 PULONG64 IntegerContext
[16];
1261 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1263 typedef struct _DISPATCHER_CONTEXT
1267 PRUNTIME_FUNCTION FunctionEntry
;
1268 ULONG64 EstablisherFrame
;
1270 PCONTEXT ContextRecord
;
1271 PEXCEPTION_ROUTINE LanguageHandler
;
1273 PUNWIND_HISTORY_TABLE HistoryTable
;
1276 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1278 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,PVOID
);
1279 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,PVOID
);
1281 NTSYSAPI PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1283 #define UNW_FLAG_NHANDLER 0
1284 #define UNW_FLAG_EHANDLER 1
1285 #define UNW_FLAG_UHANDLER 2
1286 #define UNW_FLAG_CHAININFO 4
1288 #endif /* __x86_64__ */
1290 /* IA64 context definitions */
1293 #define CONTEXT_IA64 0x00080000
1294 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1295 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1296 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1297 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1298 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1299 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1300 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1301 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1302 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1304 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1305 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1306 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1307 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1309 typedef struct _CONTEXT
1504 ULONGLONG RsBSPSTORE
;
1518 ULONGLONG UNUSEDPACK
;
1519 } CONTEXT
, *PCONTEXT
;
1521 typedef struct _RUNTIME_FUNCTION
1525 ULONG UnwindInfoAddress
;
1526 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1528 typedef struct _FRAME_POINTERS
{
1529 ULONGLONG MemoryStackFp
;
1530 ULONGLONG BackingStoreFp
;
1531 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1533 #define UNWIND_HISTORY_TABLE_SIZE 12
1535 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1538 PRUNTIME_FUNCTION FunctionEntry
;
1539 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1541 typedef struct _UNWIND_HISTORY_TABLE
{
1545 ULONG64 HighAddress
;
1546 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1547 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1549 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1555 PFLOAT128 HighFloatingContext
[10];
1577 PULONGLONG IntS0Nat
;
1578 PULONGLONG IntS1Nat
;
1579 PULONGLONG IntS2Nat
;
1580 PULONGLONG IntS3Nat
;
1581 PULONGLONG IntSpNat
;
1597 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1599 NTSYSAPI ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1601 #endif /* __ia64__ */
1603 /* Alpha context definitions */
1604 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1606 #define CONTEXT_ALPHA 0x00020000
1608 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1609 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1610 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1611 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1613 #define EXCEPTION_READ_FAULT 0
1614 #define EXCEPTION_WRITE_FAULT 1
1615 #define EXCEPTION_EXECUTE_FAULT 8
1617 typedef struct _CONTEXT
1619 /* selected by CONTEXT_FLOATING_POINT */
1653 /* selected by CONTEXT_INTEGER */
1687 /* selected by CONTEXT_FLOATING_POINT */
1691 /* selected by CONTEXT_CONTROL */
1696 } CONTEXT
, *PCONTEXT
;
1698 #define _QUAD_PSR_OFFSET HighSoftFpcr
1699 #define _QUAD_FLAGS_OFFSET HighFir
1701 #endif /* _ALPHA_ */
1705 /* The following flags control the contents of the CONTEXT structure. */
1707 #define CONTEXT_ARM 0x0200000
1708 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1709 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1710 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1711 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1713 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1714 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1716 #define EXCEPTION_READ_FAULT 0
1717 #define EXCEPTION_WRITE_FAULT 1
1718 #define EXCEPTION_EXECUTE_FAULT 8
1720 #define ARM_MAX_BREAKPOINTS 8
1721 #define ARM_MAX_WATCHPOINTS 1
1723 typedef struct _RUNTIME_FUNCTION
1730 DWORD FunctionLength
: 11;
1737 DWORD StackAdjust
: 10;
1740 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1742 #define UNWIND_HISTORY_TABLE_SIZE 12
1744 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1747 PRUNTIME_FUNCTION FunctionEntry
;
1748 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1750 typedef struct _UNWIND_HISTORY_TABLE
1759 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1760 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1762 typedef struct _NEON128
1766 } NEON128
, *PNEON128
;
1768 typedef struct _CONTEXT
1770 ULONG ContextFlags
; /* 000 */
1771 /* CONTEXT_INTEGER */
1782 ULONG R10
; /* 02c */
1783 ULONG R11
; /* 030 */
1784 ULONG R12
; /* 034 */
1785 /* CONTEXT_CONTROL */
1789 ULONG Cpsr
; /* 044 */
1790 /* CONTEXT_FLOATING_POINT */
1791 ULONG Fpscr
; /* 048 */
1792 ULONG Padding
; /* 04c */
1798 } DUMMYUNIONNAME
; /* 050 */
1799 /* CONTEXT_DEBUG_REGISTERS */
1800 ULONG Bvr
[ARM_MAX_BREAKPOINTS
]; /* 150 */
1801 ULONG Bcr
[ARM_MAX_BREAKPOINTS
]; /* 170 */
1802 ULONG Wvr
[ARM_MAX_WATCHPOINTS
]; /* 190 */
1803 ULONG Wcr
[ARM_MAX_WATCHPOINTS
]; /* 194 */
1804 ULONG Padding2
[2]; /* 198 */
1805 } CONTEXT
, *PCONTEXT
;
1807 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1826 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1828 typedef struct _DISPATCHER_CONTEXT
1832 PRUNTIME_FUNCTION FunctionEntry
;
1833 DWORD EstablisherFrame
;
1835 PCONTEXT ContextRecord
;
1836 PEXCEPTION_ROUTINE LanguageHandler
;
1838 PUNWIND_HISTORY_TABLE HistoryTable
;
1840 BOOLEAN ControlPcIsUnwound
;
1841 PBYTE NonVolatileRegisters
;
1843 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1845 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD
);
1846 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD
);
1848 NTSYSAPI PVOID WINAPI
RtlVirtualUnwind(DWORD
,DWORD
,DWORD
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,DWORD
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1850 #define UNW_FLAG_NHANDLER 0
1851 #define UNW_FLAG_EHANDLER 1
1852 #define UNW_FLAG_UHANDLER 2
1854 #endif /* __arm__ */
1858 #define CONTEXT_ARM64 0x400000
1859 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001)
1860 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002)
1861 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1862 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1864 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1865 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1867 #define EXCEPTION_READ_FAULT 0
1868 #define EXCEPTION_WRITE_FAULT 1
1869 #define EXCEPTION_EXECUTE_FAULT 8
1871 #define ARM64_MAX_BREAKPOINTS 8
1872 #define ARM64_MAX_WATCHPOINTS 2
1874 typedef struct _RUNTIME_FUNCTION
1883 DWORD FunctionLength
: 11;
1888 DWORD FrameSize
: 9;
1891 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1893 #define UNWIND_HISTORY_TABLE_SIZE 12
1895 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1898 PRUNTIME_FUNCTION FunctionEntry
;
1899 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1901 typedef struct _UNWIND_HISTORY_TABLE
1909 DWORD64 HighAddress
;
1910 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1911 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1913 typedef union _NEON128
1924 } NEON128
, *PNEON128
;
1926 typedef struct _CONTEXT
1928 ULONG ContextFlags
; /* 000 */
1929 /* CONTEXT_INTEGER */
1930 ULONG Cpsr
; /* 004 */
1935 DWORD64 X0
; /* 008 */
1936 DWORD64 X1
; /* 010 */
1937 DWORD64 X2
; /* 018 */
1938 DWORD64 X3
; /* 020 */
1939 DWORD64 X4
; /* 028 */
1940 DWORD64 X5
; /* 030 */
1941 DWORD64 X6
; /* 038 */
1942 DWORD64 X7
; /* 040 */
1943 DWORD64 X8
; /* 048 */
1944 DWORD64 X9
; /* 050 */
1945 DWORD64 X10
; /* 058 */
1946 DWORD64 X11
; /* 060 */
1947 DWORD64 X12
; /* 068 */
1948 DWORD64 X13
; /* 070 */
1949 DWORD64 X14
; /* 078 */
1950 DWORD64 X15
; /* 080 */
1951 DWORD64 X16
; /* 088 */
1952 DWORD64 X17
; /* 090 */
1953 DWORD64 X18
; /* 098 */
1954 DWORD64 X19
; /* 0a0 */
1955 DWORD64 X20
; /* 0a8 */
1956 DWORD64 X21
; /* 0b0 */
1957 DWORD64 X22
; /* 0b8 */
1958 DWORD64 X23
; /* 0c0 */
1959 DWORD64 X24
; /* 0c8 */
1960 DWORD64 X25
; /* 0d0 */
1961 DWORD64 X26
; /* 0d8 */
1962 DWORD64 X27
; /* 0e0 */
1963 DWORD64 X28
; /* 0e8 */
1964 DWORD64 Fp
; /* 0f0 */
1965 DWORD64 Lr
; /* 0f8 */
1967 DWORD64 X
[31]; /* 008 */
1969 /* CONTEXT_CONTROL */
1970 DWORD64 Sp
; /* 100 */
1971 DWORD64 Pc
; /* 108 */
1972 /* CONTEXT_FLOATING_POINT */
1973 NEON128 V
[32]; /* 110 */
1974 DWORD Fpcr
; /* 310 */
1975 DWORD Fpsr
; /* 314 */
1976 /* CONTEXT_DEBUG_REGISTERS */
1977 DWORD Bcr
[ARM64_MAX_BREAKPOINTS
]; /* 318 */
1978 DWORD64 Bvr
[ARM64_MAX_BREAKPOINTS
]; /* 338 */
1979 DWORD Wcr
[ARM64_MAX_WATCHPOINTS
]; /* 378 */
1980 DWORD64 Wvr
[ARM64_MAX_WATCHPOINTS
]; /* 380 */
1981 } CONTEXT
, *PCONTEXT
;
1983 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
2005 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
2007 typedef struct _DISPATCHER_CONTEXT
2009 ULONG_PTR ControlPc
;
2010 ULONG_PTR ImageBase
;
2011 PRUNTIME_FUNCTION FunctionEntry
;
2012 ULONG_PTR EstablisherFrame
;
2014 PCONTEXT ContextRecord
;
2015 PEXCEPTION_ROUTINE LanguageHandler
;
2017 PUNWIND_HISTORY_TABLE HistoryTable
;
2019 BOOLEAN ControlPcIsUnwound
;
2020 PBYTE NonVolatileRegisters
;
2021 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
2023 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD64
);
2024 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD64
);
2026 NTSYSAPI PVOID WINAPI
RtlVirtualUnwind(DWORD
,ULONG_PTR
,ULONG_PTR
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG_PTR
*,KNONVOLATILE_CONTEXT_POINTERS
*);
2028 #define UNW_FLAG_NHANDLER 0
2029 #define UNW_FLAG_EHANDLER 1
2030 #define UNW_FLAG_UHANDLER 2
2032 #endif /* __aarch64__ */
2035 /* Mips context definitions */
2036 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
2038 #define CONTEXT_R4000 0x00010000
2040 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
2041 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
2042 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
2044 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2046 #define EXCEPTION_READ_FAULT 0
2047 #define EXCEPTION_WRITE_FAULT 1
2048 #define EXCEPTION_EXECUTE_FAULT 8
2050 typedef struct _CONTEXT
2053 /* These are selected by CONTEXT_FLOATING_POINT */
2087 /* These are selected by CONTEXT_INTEGER */
2123 /* These are selected by CONTEXT_FLOATING_POINT */
2126 /* These are selected by CONTEXT_CONTROL */
2136 /* PowerPC context definitions */
2139 #define CONTEXT_CONTROL 0x0001
2140 #define CONTEXT_FLOATING_POINT 0x0002
2141 #define CONTEXT_INTEGER 0x0004
2142 #define CONTEXT_DEBUG_REGISTERS 0x0008
2143 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2145 #define EXCEPTION_READ_FAULT 0
2146 #define EXCEPTION_WRITE_FAULT 1
2147 #define EXCEPTION_EXECUTE_FAULT 8
2151 /* These are selected by CONTEXT_FLOATING_POINT */
2186 /* These are selected by CONTEXT_INTEGER */
2223 /* These are selected by CONTEXT_CONTROL */
2225 DWORD Iar
; /* Instruction Address Register , aka PC ... */
2231 DWORD Dar
; /* Fault registers for coredump */
2233 DWORD Trap
; /* number of powerpc exception taken */
2235 /* These are selected by CONTEXT_DEBUG_REGISTERS */
2246 typedef struct _STACK_FRAME_HEADER
2263 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
2265 #endif /* __powerpc__ */
2267 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
2268 #error You need to define a CONTEXT for your CPU
2271 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
2273 #define WOW64_CONTEXT_i386 0x00010000
2274 #define WOW64_CONTEXT_i486 0x00010000
2275 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
2276 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
2277 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
2278 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
2279 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
2280 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
2281 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2282 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
2283 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
2284 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
2285 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
2287 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2289 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
2290 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
2291 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
2292 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
2294 #define WOW64_SIZE_OF_80387_REGISTERS 80
2295 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
2297 typedef struct _WOW64_FLOATING_SAVE_AREA
2303 DWORD ErrorSelector
;
2306 BYTE RegisterArea
[WOW64_SIZE_OF_80387_REGISTERS
];
2308 } WOW64_FLOATING_SAVE_AREA
, *PWOW64_FLOATING_SAVE_AREA
;
2310 #include "pshpack4.h"
2311 typedef struct _WOW64_CONTEXT
2320 WOW64_FLOATING_SAVE_AREA FloatSave
;
2337 BYTE ExtendedRegisters
[WOW64_MAXIMUM_SUPPORTED_EXTENSION
];
2338 } WOW64_CONTEXT
, *PWOW64_CONTEXT
;
2339 #include "poppack.h"
2341 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
2343 typedef PRUNTIME_FUNCTION (CALLBACK
*PGET_RUNTIME_FUNCTION_CALLBACK
)(DWORD_PTR
,PVOID
);
2345 NTSYSAPI BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD_PTR
);
2346 NTSYSAPI DWORD WINAPI
RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION
,DWORD
,DWORD
,ULONG_PTR
,ULONG_PTR
);
2347 NTSYSAPI BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
2348 NTSYSAPI
void WINAPI
RtlDeleteGrowableFunctionTable(void*);
2349 NTSYSAPI
void WINAPI
RtlGrowFunctionTable(void*,DWORD
);
2350 NTSYSAPI BOOLEAN CDECL
RtlInstallFunctionTableCallback(DWORD_PTR
,DWORD_PTR
,DWORD
,PGET_RUNTIME_FUNCTION_CALLBACK
,PVOID
,PCWSTR
);
2351 NTSYSAPI PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD_PTR
,DWORD_PTR
*,UNWIND_HISTORY_TABLE
*);
2352 NTSYSAPI
void WINAPI
RtlUnwindEx(PVOID
,PVOID
,struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,UNWIND_HISTORY_TABLE
*);
2358 #define PRODUCT_UNDEFINED 0x00000000
2359 #define PRODUCT_ULTIMATE 0x00000001
2360 #define PRODUCT_HOME_BASIC 0x00000002
2361 #define PRODUCT_HOME_PREMIUM 0x00000003
2362 #define PRODUCT_ENTERPRISE 0x00000004
2363 #define PRODUCT_HOME_BASIC_N 0x00000005
2364 #define PRODUCT_BUSINESS 0x00000006
2365 #define PRODUCT_STANDARD_SERVER 0x00000007
2366 #define PRODUCT_DATACENTER_SERVER 0x00000008
2367 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
2368 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
2369 #define PRODUCT_STARTER 0x0000000B
2370 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
2371 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
2372 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
2373 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
2374 #define PRODUCT_BUSINESS_N 0x00000010
2375 #define PRODUCT_WEB_SERVER 0x00000011
2376 #define PRODUCT_CLUSTER_SERVER 0x00000012
2377 #define PRODUCT_HOME_SERVER 0x00000013
2378 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2379 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2380 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2381 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2382 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
2383 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
2384 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
2385 #define PRODUCT_ENTERPRISE_N 0x0000001B
2386 #define PRODUCT_ULTIMATE_N 0x0000001C
2387 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2388 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
2389 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
2390 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
2391 #define PRODUCT_SERVER_FOUNDATION 0x00000021
2392 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
2393 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
2394 #define PRODUCT_STANDARD_SERVER_V 0x00000024
2395 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
2396 #define PRODUCT_SERVER_V 0x00000025
2397 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
2398 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
2399 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
2400 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
2401 #define PRODUCT_HYPERV 0x0000002A
2402 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
2403 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
2404 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
2405 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
2406 #define PRODUCT_STARTER_N 0x0000002F
2407 #define PRODUCT_PROFESSIONAL 0x00000030
2408 #define PRODUCT_PROFESSIONAL_N 0x00000031
2409 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2410 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2411 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2412 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2413 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2414 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2415 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2416 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2417 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2418 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2419 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2420 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2421 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2422 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2423 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2424 #define PRODUCT_EMBEDDED 0x00000041
2425 #define PRODUCT_STARTER_E 0x00000042
2426 #define PRODUCT_HOME_BASIC_E 0x00000043
2427 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2428 #define PRODUCT_PROFESSIONAL_E 0x00000045
2429 #define PRODUCT_ENTERPRISE_E 0x00000046
2430 #define PRODUCT_ULTIMATE_E 0x00000047
2431 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2432 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2433 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2434 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2435 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2436 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2437 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2438 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2439 #define PRODUCT_THINPC 0x00000057
2440 #define PRODUCT_EMBEDDED_A 0x00000058
2441 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2442 #define PRODUCT_EMBEDDED_E 0x0000005A
2443 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2444 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2445 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2446 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2447 #define PRODUCT_CORE_ARM 0x00000061
2448 #define PRODUCT_CORE_N 0x00000062
2449 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2450 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2451 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2452 #define PRODUCT_CORE 0x00000065
2453 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2454 #define PRODUCT_MOBILE_CORE 0x00000068
2455 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2456 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2457 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2458 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2459 #define PRODUCT_NANO_SERVER 0x0000006D
2460 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2461 #define PRODUCT_CORE_CONNECTED 0x0000006F
2462 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2463 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2464 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2465 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2466 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2467 #define PRODUCT_CONNECTED_CAR 0x00000075
2468 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2469 #define PRODUCT_PPI_PRO 0x00000077
2470 #define PRODUCT_ARM64_SERVER 0x00000078
2471 #define PRODUCT_EDUCATION 0x00000079
2472 #define PRODUCT_EDUCATION_N 0x0000007A
2473 #define PRODUCT_IOTUAP 0x0000007B
2474 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2475 #define PRODUCT_ENTERPRISE_S 0x0000007D
2476 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2477 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2478 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2479 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2480 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2481 #define PRODUCT_UNLICENSED 0xABCDABCD
2488 #define MAKELCID(l, s) (MAKELONG(l, s))
2490 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2491 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2492 #define SUBLANGID(l) ((WORD)(l) >> 10)
2494 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2495 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2497 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2498 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2499 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2500 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2501 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2502 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2503 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2504 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2505 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2506 #define LOCALE_NAME_MAX_LENGTH 85
2509 #define UNREFERENCED_PARAMETER(u) (void)(u)
2510 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2511 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2517 * Definitions for IsTextUnicode()
2520 #define IS_TEXT_UNICODE_ASCII16 0x0001
2521 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2522 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2523 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2524 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2525 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2526 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2527 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2528 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2529 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2530 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2531 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2532 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2533 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2534 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2535 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2537 #define MAXIMUM_WAIT_OBJECTS 64
2538 #define MAXIMUM_SUSPEND_COUNT 127
2540 #define WT_EXECUTEDEFAULT 0x00
2541 #define WT_EXECUTEINIOTHREAD 0x01
2542 #define WT_EXECUTEINUITHREAD 0x02
2543 #define WT_EXECUTEINWAITTHREAD 0x04
2544 #define WT_EXECUTEONLYONCE 0x08
2545 #define WT_EXECUTELONGFUNCTION 0x10
2546 #define WT_EXECUTEINTIMERTHREAD 0x20
2547 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2548 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2549 #define WT_EXECUTEINLONGTHREAD 0x10
2550 #define WT_EXECUTEDELETEWAIT 0x08
2551 #define WT_TRANSFER_IMPERSONATION 0x0100
2554 #define EXCEPTION_CONTINUABLE 0
2555 #define EXCEPTION_NONCONTINUABLE 0x01
2558 * The exception record used by Win32 to give additional information
2559 * about exception to exception handlers.
2562 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2564 typedef struct _EXCEPTION_RECORD
2566 DWORD ExceptionCode
;
2567 DWORD ExceptionFlags
;
2568 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2570 PVOID ExceptionAddress
;
2571 DWORD NumberParameters
;
2572 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2573 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2575 typedef struct _EXCEPTION_RECORD32
2577 DWORD ExceptionCode
;
2578 DWORD ExceptionFlags
;
2579 DWORD ExceptionRecord
;
2580 DWORD ExceptionAddress
;
2581 DWORD NumberParameters
;
2582 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2583 } EXCEPTION_RECORD32
, *PEXCEPTION_RECORD32
;
2585 typedef struct _EXCEPTION_RECORD64
2587 DWORD ExceptionCode
;
2588 DWORD ExceptionFlags
;
2589 DWORD64 ExceptionRecord
;
2590 DWORD64 ExceptionAddress
;
2591 DWORD NumberParameters
;
2592 DWORD __unusedAlignment
;
2593 DWORD64 ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2594 } EXCEPTION_RECORD64
, *PEXCEPTION_RECORD64
;
2597 * The exception pointers structure passed to exception filters
2598 * in except() and the UnhandledExceptionFilter().
2601 typedef struct _EXCEPTION_POINTERS
2603 PEXCEPTION_RECORD ExceptionRecord
;
2604 PCONTEXT ContextRecord
;
2605 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2609 * The exception frame, used for registering exception handlers
2610 * Win32 cares only about this, but compilers generally emit
2611 * larger exception frames for their own use.
2614 struct _EXCEPTION_REGISTRATION_RECORD
;
2616 typedef DWORD (CDECL
*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2617 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2619 typedef struct _EXCEPTION_REGISTRATION_RECORD
2621 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2622 PEXCEPTION_HANDLER Handler
;
2623 } EXCEPTION_REGISTRATION_RECORD
;
2626 * function pointer to an exception filter
2629 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2631 typedef struct _NT_TIB
2633 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2641 PVOID ArbitraryUserPointer
;
2642 struct _NT_TIB
*Self
;
2647 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2648 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2651 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2654 #elif defined(__i386__) && defined(_MSC_VER)
2655 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2658 __asm mov eax
, fs
:[0x18];
2662 #elif defined(__x86_64__) && defined(__GNUC__)
2663 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2666 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2669 #elif defined(__x86_64__) && defined(_MSC_VER)
2670 #pragma intrinsic(__readgsqword)
2671 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2673 return (struct _TEB
*)__readgsqword(FIELD_OFFSET(NT_TIB
, Self
));
2676 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2679 #ifdef NONAMELESSUNION
2680 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2682 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2684 #define GetFiberData() (*(void **)GetCurrentFiber())
2686 #define TLS_MINIMUM_AVAILABLE 64
2688 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2690 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2691 #define IO_REPARSE_TAG_RESERVED_ONE 1
2692 #define IO_REPARSE_TAG_RESERVED_TWO 2
2694 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2696 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2697 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2698 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2699 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2700 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2701 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2702 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2703 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2704 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2705 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2706 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2707 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2708 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2709 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2710 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2711 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2712 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2713 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2714 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2715 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2716 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2717 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2718 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2719 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2720 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2721 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2722 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2723 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2724 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2725 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2726 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2727 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2728 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2729 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2730 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2731 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2732 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2733 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2734 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2735 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2736 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2737 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2738 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2741 * File formats definitions
2744 #include <pshpack2.h>
2745 typedef struct _IMAGE_DOS_HEADER
{
2746 WORD e_magic
; /* 00: MZ Header signature */
2747 WORD e_cblp
; /* 02: Bytes on last page of file */
2748 WORD e_cp
; /* 04: Pages in file */
2749 WORD e_crlc
; /* 06: Relocations */
2750 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2751 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2752 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2753 WORD e_ss
; /* 0e: Initial (relative) SS value */
2754 WORD e_sp
; /* 10: Initial SP value */
2755 WORD e_csum
; /* 12: Checksum */
2756 WORD e_ip
; /* 14: Initial IP value */
2757 WORD e_cs
; /* 16: Initial (relative) CS value */
2758 WORD e_lfarlc
; /* 18: File address of relocation table */
2759 WORD e_ovno
; /* 1a: Overlay number */
2760 WORD e_res
[4]; /* 1c: Reserved words */
2761 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2762 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2763 WORD e_res2
[10]; /* 28: Reserved words */
2764 DWORD e_lfanew
; /* 3c: Offset to extended header */
2765 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2766 #include <poppack.h>
2768 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2769 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2770 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2771 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2772 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2773 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2776 * This is the Windows executable (NE) header.
2777 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2779 #include <pshpack2.h>
2782 WORD ne_magic
; /* 00 NE signature 'NE' */
2783 BYTE ne_ver
; /* 02 Linker version number */
2784 BYTE ne_rev
; /* 03 Linker revision number */
2785 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2786 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2787 LONG ne_crc
; /* 08 Checksum */
2788 WORD ne_flags
; /* 0c Flags about segments in this file */
2789 WORD ne_autodata
; /* 0e Automatic data segment number */
2790 WORD ne_heap
; /* 10 Initial size of local heap */
2791 WORD ne_stack
; /* 12 Initial size of stack */
2792 DWORD ne_csip
; /* 14 Initial CS:IP */
2793 DWORD ne_sssp
; /* 18 Initial SS:SP */
2794 WORD ne_cseg
; /* 1c # of entries in segment table */
2795 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2796 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2797 WORD ne_segtab
; /* 22 Offset to segment table */
2798 WORD ne_rsrctab
; /* 24 Offset to resource table */
2799 WORD ne_restab
; /* 26 Offset to resident-name table */
2800 WORD ne_modtab
; /* 28 Offset to module reference table */
2801 WORD ne_imptab
; /* 2a Offset to imported name table */
2802 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2803 WORD ne_cmovent
; /* 30 # of movable entry points */
2804 WORD ne_align
; /* 32 Logical sector alignment shift count */
2805 WORD ne_cres
; /* 34 # of resource segments */
2806 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2807 BYTE ne_flagsothers
; /* 37 Additional information flags */
2808 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2809 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2810 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2811 WORD ne_expver
; /* 3e Expected Windows version number */
2812 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2813 #include <poppack.h>
2815 #include <pshpack2.h>
2816 typedef struct _IMAGE_VXD_HEADER
{
2831 DWORD e32_lastpagesize
;
2832 DWORD e32_fixupsize
;
2849 DWORD e32_impmodcnt
;
2855 DWORD e32_cbnrestab
;
2858 DWORD e32_debuginfo
;
2860 DWORD e32_instpreload
;
2861 DWORD e32_instdemand
;
2864 DWORD e32_winresoff
;
2865 DWORD e32_winreslen
;
2868 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2869 #include <poppack.h>
2871 /* These defines describe the meanings of the bits in the Characteristics
2874 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2875 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2876 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2877 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2878 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2879 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2880 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2881 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2882 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2883 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2884 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2885 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2886 #define IMAGE_FILE_SYSTEM 0x1000
2887 #define IMAGE_FILE_DLL 0x2000
2888 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2889 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2891 /* These are the settings of the Machine field. */
2892 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2893 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
2894 #define IMAGE_FILE_MACHINE_I860 0x014d
2895 #define IMAGE_FILE_MACHINE_I386 0x014c
2896 #define IMAGE_FILE_MACHINE_R3000 0x0162
2897 #define IMAGE_FILE_MACHINE_R4000 0x0166
2898 #define IMAGE_FILE_MACHINE_R10000 0x0168
2899 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2900 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2901 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2902 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2903 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2904 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2905 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2906 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2907 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2908 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
2909 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
2910 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2911 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2912 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2913 #define IMAGE_FILE_MACHINE_IA64 0x0200
2914 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2915 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2916 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2917 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2918 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2919 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2920 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2921 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2922 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2923 #define IMAGE_FILE_MACHINE_M32R 0x9041
2924 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2926 #define IMAGE_SIZEOF_FILE_HEADER 20
2927 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2928 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2929 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2930 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2931 #define IMAGE_SIZEOF_SHORT_NAME 8
2932 #define IMAGE_SIZEOF_SECTION_HEADER 40
2933 #define IMAGE_SIZEOF_SYMBOL 18
2934 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2935 #define IMAGE_SIZEOF_RELOCATION 10
2936 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2937 #define IMAGE_SIZEOF_LINENUMBER 6
2938 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2940 /* Possible Magic values */
2941 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2942 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2943 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2946 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2947 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2949 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2950 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2953 /* These are indexes into the DataDirectory array */
2954 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2955 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2956 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2957 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2958 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2959 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2960 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2961 #define IMAGE_FILE_DESCRIPTION_STRING 7
2962 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2963 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2964 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2966 /* Directory Entries, indices into the DataDirectory array */
2968 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2969 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2970 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2971 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2972 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2973 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2974 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2975 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2976 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2977 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2978 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2979 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2980 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2981 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2982 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2984 /* Subsystem Values */
2986 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2987 #define IMAGE_SUBSYSTEM_NATIVE 1
2988 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2989 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2990 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2991 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2992 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2993 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2994 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2995 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2996 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2997 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2998 #define IMAGE_SUBSYSTEM_XBOX 14
2999 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
3001 /* DLL Characteristics */
3002 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
3003 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
3004 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
3005 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
3006 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
3007 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
3008 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
3009 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
3011 typedef struct _IMAGE_FILE_HEADER
{
3013 WORD NumberOfSections
;
3014 DWORD TimeDateStamp
;
3015 DWORD PointerToSymbolTable
;
3016 DWORD NumberOfSymbols
;
3017 WORD SizeOfOptionalHeader
;
3018 WORD Characteristics
;
3019 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
3021 typedef struct _IMAGE_DATA_DIRECTORY
{
3022 DWORD VirtualAddress
;
3024 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
3026 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
3028 typedef struct _IMAGE_OPTIONAL_HEADER64
{
3029 WORD Magic
; /* 0x20b */
3030 BYTE MajorLinkerVersion
;
3031 BYTE MinorLinkerVersion
;
3033 DWORD SizeOfInitializedData
;
3034 DWORD SizeOfUninitializedData
;
3035 DWORD AddressOfEntryPoint
;
3037 ULONGLONG ImageBase
;
3038 DWORD SectionAlignment
;
3039 DWORD FileAlignment
;
3040 WORD MajorOperatingSystemVersion
;
3041 WORD MinorOperatingSystemVersion
;
3042 WORD MajorImageVersion
;
3043 WORD MinorImageVersion
;
3044 WORD MajorSubsystemVersion
;
3045 WORD MinorSubsystemVersion
;
3046 DWORD Win32VersionValue
;
3048 DWORD SizeOfHeaders
;
3051 WORD DllCharacteristics
;
3052 ULONGLONG SizeOfStackReserve
;
3053 ULONGLONG SizeOfStackCommit
;
3054 ULONGLONG SizeOfHeapReserve
;
3055 ULONGLONG SizeOfHeapCommit
;
3057 DWORD NumberOfRvaAndSizes
;
3058 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
3059 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
3061 typedef struct _IMAGE_NT_HEADERS64
{
3063 IMAGE_FILE_HEADER FileHeader
;
3064 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
3065 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
3067 typedef struct _IMAGE_OPTIONAL_HEADER
{
3069 /* Standard fields */
3071 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
3072 BYTE MajorLinkerVersion
;
3073 BYTE MinorLinkerVersion
;
3075 DWORD SizeOfInitializedData
;
3076 DWORD SizeOfUninitializedData
;
3077 DWORD AddressOfEntryPoint
; /* 0x10 */
3081 /* NT additional fields */
3084 DWORD SectionAlignment
; /* 0x20 */
3085 DWORD FileAlignment
;
3086 WORD MajorOperatingSystemVersion
;
3087 WORD MinorOperatingSystemVersion
;
3088 WORD MajorImageVersion
;
3089 WORD MinorImageVersion
;
3090 WORD MajorSubsystemVersion
; /* 0x30 */
3091 WORD MinorSubsystemVersion
;
3092 DWORD Win32VersionValue
;
3094 DWORD SizeOfHeaders
;
3095 DWORD CheckSum
; /* 0x40 */
3097 WORD DllCharacteristics
;
3098 DWORD SizeOfStackReserve
;
3099 DWORD SizeOfStackCommit
;
3100 DWORD SizeOfHeapReserve
; /* 0x50 */
3101 DWORD SizeOfHeapCommit
;
3103 DWORD NumberOfRvaAndSizes
;
3104 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
3106 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
3108 typedef struct _IMAGE_NT_HEADERS
{
3109 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
3110 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
3111 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
3112 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
3115 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
3116 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
3117 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
3118 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
3120 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
3121 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
3122 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
3123 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
3126 #define IMAGE_SIZEOF_SHORT_NAME 8
3128 typedef struct _IMAGE_SECTION_HEADER
{
3129 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
3131 DWORD PhysicalAddress
;
3134 DWORD VirtualAddress
;
3135 DWORD SizeOfRawData
;
3136 DWORD PointerToRawData
;
3137 DWORD PointerToRelocations
;
3138 DWORD PointerToLinenumbers
;
3139 WORD NumberOfRelocations
;
3140 WORD NumberOfLinenumbers
;
3141 DWORD Characteristics
;
3142 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
3144 #define IMAGE_SIZEOF_SECTION_HEADER 40
3146 #define IMAGE_FIRST_SECTION(ntheader) \
3147 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
3148 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
3150 /* These defines are for the Characteristics bitfield. */
3151 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
3152 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
3153 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
3154 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
3155 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
3156 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
3158 #define IMAGE_SCN_CNT_CODE 0x00000020
3159 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
3160 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
3162 #define IMAGE_SCN_LNK_OTHER 0x00000100
3163 #define IMAGE_SCN_LNK_INFO 0x00000200
3164 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
3165 #define IMAGE_SCN_LNK_REMOVE 0x00000800
3166 #define IMAGE_SCN_LNK_COMDAT 0x00001000
3168 /* 0x00002000 - Reserved */
3169 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
3170 #define IMAGE_SCN_MEM_FARDATA 0x00008000
3172 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
3173 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
3174 #define IMAGE_SCN_MEM_16BIT 0x00020000
3175 #define IMAGE_SCN_MEM_LOCKED 0x00040000
3176 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
3178 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
3179 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
3180 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
3181 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
3182 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
3183 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
3184 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
3185 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
3186 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
3187 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
3188 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
3189 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
3190 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
3191 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
3192 /* 0x00F00000 - Unused */
3193 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
3195 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3198 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3199 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3200 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3201 #define IMAGE_SCN_MEM_SHARED 0x10000000
3202 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3203 #define IMAGE_SCN_MEM_READ 0x40000000
3204 #define IMAGE_SCN_MEM_WRITE 0x80000000
3206 #include <pshpack2.h>
3208 typedef struct _IMAGE_SYMBOL
{
3218 SHORT SectionNumber
;
3221 BYTE NumberOfAuxSymbols
;
3223 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
3225 #define IMAGE_SIZEOF_SYMBOL 18
3227 typedef struct _IMAGE_LINENUMBER
{
3229 DWORD SymbolTableIndex
;
3230 DWORD VirtualAddress
;
3234 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
3236 #define IMAGE_SIZEOF_LINENUMBER 6
3238 typedef union _IMAGE_AUX_SYMBOL
{
3250 DWORD PointerToLinenumber
;
3251 DWORD PointerToNextFunction
;
3260 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
3264 WORD NumberOfRelocations
;
3265 WORD NumberOfLinenumbers
;
3271 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
3273 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3275 #include <poppack.h>
3277 #define IMAGE_SYM_UNDEFINED (SHORT)0
3278 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3279 #define IMAGE_SYM_DEBUG (SHORT)-2
3281 #define IMAGE_SYM_TYPE_NULL 0x0000
3282 #define IMAGE_SYM_TYPE_VOID 0x0001
3283 #define IMAGE_SYM_TYPE_CHAR 0x0002
3284 #define IMAGE_SYM_TYPE_SHORT 0x0003
3285 #define IMAGE_SYM_TYPE_INT 0x0004
3286 #define IMAGE_SYM_TYPE_LONG 0x0005
3287 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3288 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3289 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3290 #define IMAGE_SYM_TYPE_UNION 0x0009
3291 #define IMAGE_SYM_TYPE_ENUM 0x000A
3292 #define IMAGE_SYM_TYPE_MOE 0x000B
3293 #define IMAGE_SYM_TYPE_BYTE 0x000C
3294 #define IMAGE_SYM_TYPE_WORD 0x000D
3295 #define IMAGE_SYM_TYPE_UINT 0x000E
3296 #define IMAGE_SYM_TYPE_DWORD 0x000F
3297 #define IMAGE_SYM_TYPE_PCODE 0x8000
3299 #define IMAGE_SYM_DTYPE_NULL 0
3300 #define IMAGE_SYM_DTYPE_POINTER 1
3301 #define IMAGE_SYM_DTYPE_FUNCTION 2
3302 #define IMAGE_SYM_DTYPE_ARRAY 3
3304 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3305 #define IMAGE_SYM_CLASS_NULL 0x0000
3306 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3307 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3308 #define IMAGE_SYM_CLASS_STATIC 0x0003
3309 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3310 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3311 #define IMAGE_SYM_CLASS_LABEL 0x0006
3312 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3313 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3314 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3315 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3316 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3317 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3318 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3319 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3320 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3321 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3322 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3323 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3325 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3326 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3327 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3328 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3329 #define IMAGE_SYM_CLASS_FILE 0x0067
3330 #define IMAGE_SYM_CLASS_SECTION 0x0068
3331 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3333 #define N_BTMASK 0x000F
3334 #define N_TMASK 0x0030
3335 #define N_TMASK1 0x00C0
3336 #define N_TMASK2 0x00F0
3340 #define BTYPE(x) ((x) & N_BTMASK)
3343 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3347 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3351 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3355 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3359 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3362 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3365 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3366 #define IMAGE_COMDAT_SELECT_ANY 2
3367 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3368 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3369 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3370 #define IMAGE_COMDAT_SELECT_LARGEST 6
3371 #define IMAGE_COMDAT_SELECT_NEWEST 7
3373 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3374 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3375 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3377 /* Export module directory */
3379 typedef struct _IMAGE_EXPORT_DIRECTORY
{
3380 DWORD Characteristics
;
3381 DWORD TimeDateStamp
;
3386 DWORD NumberOfFunctions
;
3387 DWORD NumberOfNames
;
3388 DWORD AddressOfFunctions
;
3389 DWORD AddressOfNames
;
3390 DWORD AddressOfNameOrdinals
;
3391 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3393 /* Import name entry */
3394 typedef struct _IMAGE_IMPORT_BY_NAME
{
3397 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3399 #include <pshpack8.h>
3401 typedef struct _IMAGE_THUNK_DATA64
{
3403 ULONGLONG ForwarderString
;
3406 ULONGLONG AddressOfData
;
3408 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3409 #include <poppack.h>
3411 typedef struct _IMAGE_THUNK_DATA32
{
3413 DWORD ForwarderString
;
3416 DWORD AddressOfData
;
3418 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3420 /* Import module directory */
3422 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3424 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3425 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3427 DWORD TimeDateStamp
; /* 0 if not bound,
3428 * -1 if bound, and real date\time stamp
3429 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3431 * otherwise date/time stamp of DLL bound to
3434 DWORD ForwarderChain
; /* -1 if no forwarders */
3436 /* RVA to IAT (if bound this IAT has actual addresses) */
3438 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3440 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3441 #define IMAGE_ORDINAL_FLAG32 0x80000000
3442 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3443 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3444 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3445 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3448 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3449 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3450 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3451 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3452 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3454 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3455 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3456 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3457 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3458 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3461 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3463 DWORD TimeDateStamp
;
3464 WORD OffsetModuleName
;
3465 WORD NumberOfModuleForwarderRefs
;
3466 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3467 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3469 typedef struct _IMAGE_BOUND_FORWARDER_REF
3471 DWORD TimeDateStamp
;
3472 WORD OffsetModuleName
;
3474 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3476 typedef struct _IMAGE_BASE_RELOCATION
3478 DWORD VirtualAddress
;
3480 /* WORD TypeOffset[1]; */
3481 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3483 #include <pshpack2.h>
3485 typedef struct _IMAGE_RELOCATION
3488 DWORD VirtualAddress
;
3491 DWORD SymbolTableIndex
;
3493 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3495 #include <poppack.h>
3497 #define IMAGE_SIZEOF_RELOCATION 10
3499 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
3503 DWORD AllAttributes
;
3507 DWORD ReservedAttributes
:31;
3512 DWORD ModuleHandleRVA
;
3513 DWORD ImportAddressTableRVA
;
3514 DWORD ImportNameTableRVA
;
3515 DWORD BoundImportAddressTableRVA
;
3516 DWORD UnloadInformationTableRVA
;
3517 DWORD TimeDateStamp
;
3518 } IMAGE_DELAYLOAD_DESCRIPTOR
, *PIMAGE_DELAYLOAD_DESCRIPTOR
;
3519 typedef const IMAGE_DELAYLOAD_DESCRIPTOR
*PCIMAGE_DELAYLOAD_DESCRIPTOR
;
3521 /* generic relocation types */
3522 #define IMAGE_REL_BASED_ABSOLUTE 0
3523 #define IMAGE_REL_BASED_HIGH 1
3524 #define IMAGE_REL_BASED_LOW 2
3525 #define IMAGE_REL_BASED_HIGHLOW 3
3526 #define IMAGE_REL_BASED_HIGHADJ 4
3527 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3528 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3529 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3530 #define IMAGE_REL_BASED_SECTION 6
3531 #define IMAGE_REL_BASED_REL 7
3532 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3533 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3534 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3535 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3536 #define IMAGE_REL_BASED_DIR64 10
3537 #define IMAGE_REL_BASED_HIGH3ADJ 11
3539 /* I386 relocation types */
3540 #define IMAGE_REL_I386_ABSOLUTE 0
3541 #define IMAGE_REL_I386_DIR16 1
3542 #define IMAGE_REL_I386_REL16 2
3543 #define IMAGE_REL_I386_DIR32 6
3544 #define IMAGE_REL_I386_DIR32NB 7
3545 #define IMAGE_REL_I386_SEG12 9
3546 #define IMAGE_REL_I386_SECTION 10
3547 #define IMAGE_REL_I386_SECREL 11
3548 #define IMAGE_REL_I386_TOKEN 12
3549 #define IMAGE_REL_I386_SECREL7 13
3550 #define IMAGE_REL_I386_REL32 20
3552 /* MIPS relocation types */
3553 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3554 #define IMAGE_REL_MIPS_REFHALF 0x0001
3555 #define IMAGE_REL_MIPS_REFWORD 0x0002
3556 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3557 #define IMAGE_REL_MIPS_REFHI 0x0004
3558 #define IMAGE_REL_MIPS_REFLO 0x0005
3559 #define IMAGE_REL_MIPS_GPREL 0x0006
3560 #define IMAGE_REL_MIPS_LITERAL 0x0007
3561 #define IMAGE_REL_MIPS_SECTION 0x000A
3562 #define IMAGE_REL_MIPS_SECREL 0x000B
3563 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3564 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3565 #define IMAGE_REL_MIPS_TOKEN 0x000E
3566 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3567 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3568 #define IMAGE_REL_MIPS_PAIR 0x0025
3570 /* ALPHA relocation types */
3571 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3572 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3573 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3574 #define IMAGE_REL_ALPHA_GPREL 0x0003
3575 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3576 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3577 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3578 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3579 #define IMAGE_REL_ALPHA_HINT 0x0008
3580 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3581 #define IMAGE_REL_ALPHA_REFHI 0x000A
3582 #define IMAGE_REL_ALPHA_REFLO 0x000B
3583 #define IMAGE_REL_ALPHA_PAIR 0x000C
3584 #define IMAGE_REL_ALPHA_MATCH 0x000D
3585 #define IMAGE_REL_ALPHA_SECTION 0x000E
3586 #define IMAGE_REL_ALPHA_SECREL 0x000F
3587 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3588 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3589 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3590 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3591 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3592 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3593 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3594 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3596 /* PowerPC relocation types */
3597 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3598 #define IMAGE_REL_PPC_ADDR64 0x0001
3599 #define IMAGE_REL_PPC_ADDR 0x0002
3600 #define IMAGE_REL_PPC_ADDR24 0x0003
3601 #define IMAGE_REL_PPC_ADDR16 0x0004
3602 #define IMAGE_REL_PPC_ADDR14 0x0005
3603 #define IMAGE_REL_PPC_REL24 0x0006
3604 #define IMAGE_REL_PPC_REL14 0x0007
3605 #define IMAGE_REL_PPC_TOCREL16 0x0008
3606 #define IMAGE_REL_PPC_TOCREL14 0x0009
3607 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3608 #define IMAGE_REL_PPC_SECREL 0x000B
3609 #define IMAGE_REL_PPC_SECTION 0x000C
3610 #define IMAGE_REL_PPC_IFGLUE 0x000D
3611 #define IMAGE_REL_PPC_IMGLUE 0x000E
3612 #define IMAGE_REL_PPC_SECREL16 0x000F
3613 #define IMAGE_REL_PPC_REFHI 0x0010
3614 #define IMAGE_REL_PPC_REFLO 0x0011
3615 #define IMAGE_REL_PPC_PAIR 0x0012
3616 #define IMAGE_REL_PPC_SECRELLO 0x0013
3617 #define IMAGE_REL_PPC_SECRELHI 0x0014
3618 #define IMAGE_REL_PPC_GPREL 0x0015
3619 #define IMAGE_REL_PPC_TOKEN 0x0016
3620 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3622 #define IMAGE_REL_PPC_NEG 0x0100
3623 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3624 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3625 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3627 /* SH3 relocation types */
3628 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3629 #define IMAGE_REL_SH3_DIRECT16 0x0001
3630 #define IMAGE_REL_SH3_DIRECT 0x0002
3631 #define IMAGE_REL_SH3_DIRECT8 0x0003
3632 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3633 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3634 #define IMAGE_REL_SH3_DIRECT4 0x0006
3635 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3636 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3637 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3638 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3639 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3640 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3641 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3642 #define IMAGE_REL_SH3_SECTION 0x000E
3643 #define IMAGE_REL_SH3_SECREL 0x000F
3644 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3645 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3646 #define IMAGE_REL_SH3_TOKEN 0x0012
3648 /* ARM relocation types */
3649 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3650 #define IMAGE_REL_ARM_ADDR 0x0001
3651 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3652 #define IMAGE_REL_ARM_BRANCH24 0x0003
3653 #define IMAGE_REL_ARM_BRANCH11 0x0004
3654 #define IMAGE_REL_ARM_TOKEN 0x0005
3655 #define IMAGE_REL_ARM_GPREL12 0x0006
3656 #define IMAGE_REL_ARM_GPREL7 0x0007
3657 #define IMAGE_REL_ARM_BLX24 0x0008
3658 #define IMAGE_REL_ARM_BLX11 0x0009
3659 #define IMAGE_REL_ARM_SECTION 0x000E
3660 #define IMAGE_REL_ARM_SECREL 0x000F
3661 #define IMAGE_REL_ARM_MOV32A 0x0010
3662 #define IMAGE_REL_ARM_MOV32T 0x0011
3663 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3664 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3665 #define IMAGE_REL_ARM_BLX23T 0x0015
3667 /* ARM64 relocation types */
3668 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3669 #define IMAGE_REL_ARM64_ADDR32 0x0001
3670 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3671 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3672 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3673 #define IMAGE_REL_ARM64_REL21 0x0005
3674 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3675 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3676 #define IMAGE_REL_ARM64_SECREL 0x0008
3677 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3678 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3679 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3680 #define IMAGE_REL_ARM64_TOKEN 0x000C
3681 #define IMAGE_REL_ARM64_SECTION 0x000D
3682 #define IMAGE_REL_ARM64_ADDR64 0x000E
3683 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3685 /* IA64 relocation types */
3686 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3687 #define IMAGE_REL_IA64_IMM14 0x0001
3688 #define IMAGE_REL_IA64_IMM22 0x0002
3689 #define IMAGE_REL_IA64_IMM64 0x0003
3690 #define IMAGE_REL_IA64_DIR 0x0004
3691 #define IMAGE_REL_IA64_DIR64 0x0005
3692 #define IMAGE_REL_IA64_PCREL21B 0x0006
3693 #define IMAGE_REL_IA64_PCREL21M 0x0007
3694 #define IMAGE_REL_IA64_PCREL21F 0x0008
3695 #define IMAGE_REL_IA64_GPREL22 0x0009
3696 #define IMAGE_REL_IA64_LTOFF22 0x000A
3697 #define IMAGE_REL_IA64_SECTION 0x000B
3698 #define IMAGE_REL_IA64_SECREL22 0x000C
3699 #define IMAGE_REL_IA64_SECREL64I 0x000D
3700 #define IMAGE_REL_IA64_SECREL 0x000E
3701 #define IMAGE_REL_IA64_LTOFF64 0x000F
3702 #define IMAGE_REL_IA64_DIR32NB 0x0010
3703 #define IMAGE_REL_IA64_SREL14 0x0011
3704 #define IMAGE_REL_IA64_SREL22 0x0012
3705 #define IMAGE_REL_IA64_SREL32 0x0013
3706 #define IMAGE_REL_IA64_UREL32 0x0014
3707 #define IMAGE_REL_IA64_PCREL60X 0x0015
3708 #define IMAGE_REL_IA64_PCREL60B 0x0016
3709 #define IMAGE_REL_IA64_PCREL60F 0x0017
3710 #define IMAGE_REL_IA64_PCREL60I 0x0018
3711 #define IMAGE_REL_IA64_PCREL60M 0x0019
3712 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3713 #define IMAGE_REL_IA64_TOKEN 0x001B
3714 #define IMAGE_REL_IA64_GPREL32 0x001C
3715 #define IMAGE_REL_IA64_ADDEND 0x001F
3717 /* AMD64 relocation types */
3718 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3719 #define IMAGE_REL_AMD64_ADDR64 0x0001
3720 #define IMAGE_REL_AMD64_ADDR32 0x0002
3721 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3722 #define IMAGE_REL_AMD64_REL32 0x0004
3723 #define IMAGE_REL_AMD64_REL32_1 0x0005
3724 #define IMAGE_REL_AMD64_REL32_2 0x0006
3725 #define IMAGE_REL_AMD64_REL32_3 0x0007
3726 #define IMAGE_REL_AMD64_REL32_4 0x0008
3727 #define IMAGE_REL_AMD64_REL32_5 0x0009
3728 #define IMAGE_REL_AMD64_SECTION 0x000A
3729 #define IMAGE_REL_AMD64_SECREL 0x000B
3730 #define IMAGE_REL_AMD64_SECREL7 0x000C
3731 #define IMAGE_REL_AMD64_TOKEN 0x000D
3732 #define IMAGE_REL_AMD64_SREL32 0x000E
3733 #define IMAGE_REL_AMD64_PAIR 0x000F
3734 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3736 /* archive format */
3738 #define IMAGE_ARCHIVE_START_SIZE 8
3739 #define IMAGE_ARCHIVE_START "!<arch>\n"
3740 #define IMAGE_ARCHIVE_END "`\n"
3741 #define IMAGE_ARCHIVE_PAD "\n"
3742 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3743 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3745 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3754 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3756 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3758 typedef struct _IMPORT_OBJECT_HEADER
3764 DWORD TimeDateStamp
;
3774 } IMPORT_OBJECT_HEADER
;
3776 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3778 typedef enum IMPORT_OBJECT_TYPE
3780 IMPORT_OBJECT_CODE
= 0,
3781 IMPORT_OBJECT_DATA
= 1,
3782 IMPORT_OBJECT_CONST
= 2
3783 } IMPORT_OBJECT_TYPE
;
3785 typedef enum IMPORT_OBJECT_NAME_TYPE
3787 IMPORT_OBJECT_ORDINAL
= 0,
3788 IMPORT_OBJECT_NAME
= 1,
3789 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3790 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3791 } IMPORT_OBJECT_NAME_TYPE
;
3793 typedef struct _ANON_OBJECT_HEADER
3799 DWORD TimeDateStamp
;
3802 } ANON_OBJECT_HEADER
;
3805 * Resource directory stuff
3807 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3808 DWORD Characteristics
;
3809 DWORD TimeDateStamp
;
3812 WORD NumberOfNamedEntries
;
3813 WORD NumberOfIdEntries
;
3814 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3815 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3817 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3818 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3820 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3823 #ifdef BITFIELDS_BIGENDIAN
3824 unsigned NameIsString
:1;
3825 unsigned NameOffset
:31;
3827 unsigned NameOffset
:31;
3828 unsigned NameIsString
:1;
3832 #ifdef WORDS_BIGENDIAN
3843 #ifdef BITFIELDS_BIGENDIAN
3844 unsigned DataIsDirectory
:1;
3845 unsigned OffsetToDirectory
:31;
3847 unsigned OffsetToDirectory
:31;
3848 unsigned DataIsDirectory
:1;
3852 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3855 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3857 CHAR NameString
[ 1 ];
3858 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3860 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3862 WCHAR NameString
[ 1 ];
3863 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3865 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3870 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3873 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3874 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3877 typedef struct _IMAGE_TLS_DIRECTORY64
{
3878 ULONGLONG StartAddressOfRawData
;
3879 ULONGLONG EndAddressOfRawData
;
3880 ULONGLONG AddressOfIndex
;
3881 ULONGLONG AddressOfCallBacks
;
3882 DWORD SizeOfZeroFill
;
3883 DWORD Characteristics
;
3884 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3886 typedef struct _IMAGE_TLS_DIRECTORY32
{
3887 DWORD StartAddressOfRawData
;
3888 DWORD EndAddressOfRawData
;
3889 DWORD AddressOfIndex
;
3890 DWORD AddressOfCallBacks
;
3891 DWORD SizeOfZeroFill
;
3892 DWORD Characteristics
;
3893 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3896 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3897 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3899 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3900 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3903 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3904 DWORD Characteristics
;
3905 DWORD TimeDateStamp
;
3910 DWORD AddressOfRawData
;
3911 DWORD PointerToRawData
;
3912 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3914 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3915 #define IMAGE_DEBUG_TYPE_COFF 1
3916 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3917 #define IMAGE_DEBUG_TYPE_FPO 3
3918 #define IMAGE_DEBUG_TYPE_MISC 4
3919 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3920 #define IMAGE_DEBUG_TYPE_FIXUP 6
3921 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3922 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3923 #define IMAGE_DEBUG_TYPE_BORLAND 9
3924 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3925 #define IMAGE_DEBUG_TYPE_CLSID 11
3926 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
3927 #define IMAGE_DEBUG_TYPE_POGO 13
3928 #define IMAGE_DEBUG_TYPE_ILTCG 14
3929 #define IMAGE_DEBUG_TYPE_MPX 15
3930 #define IMAGE_DEBUG_TYPE_REPRO 16
3932 typedef enum ReplacesCorHdrNumericDefines
3934 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3935 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3936 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3937 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3938 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT
= 0x00000010,
3939 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3940 COMIMAGE_FLAGS_32BITPREFERRED
= 0x00020000,
3942 COR_VERSION_MAJOR_V2
= 2,
3943 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3944 COR_VERSION_MINOR
= 5,
3945 COR_DELETED_NAME_LENGTH
= 8,
3946 COR_VTABLEGAP_NAME_LENGTH
= 8,
3948 NATIVE_TYPE_MAX_CB
= 1,
3949 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3951 IMAGE_COR_MIH_METHODRVA
= 0x01,
3952 IMAGE_COR_MIH_EHRVA
= 0x02,
3953 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3955 COR_VTABLE_32BIT
= 0x01,
3956 COR_VTABLE_64BIT
= 0x02,
3957 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3958 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3960 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3962 MAX_CLASS_NAME
= 1024,
3963 MAX_PACKAGE_NAME
= 1024,
3964 } ReplacesCorHdrNumericDefines
;
3966 typedef struct IMAGE_COR20_HEADER
3969 WORD MajorRuntimeVersion
;
3970 WORD MinorRuntimeVersion
;
3972 IMAGE_DATA_DIRECTORY MetaData
;
3975 DWORD EntryPointToken
;
3976 DWORD EntryPointRVA
;
3979 IMAGE_DATA_DIRECTORY Resources
;
3980 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3981 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3982 IMAGE_DATA_DIRECTORY VTableFixups
;
3983 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3984 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3986 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3988 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3989 DWORD NumberOfSymbols
;
3990 DWORD LvaToFirstSymbol
;
3991 DWORD NumberOfLinenumbers
;
3992 DWORD LvaToFirstLinenumber
;
3993 DWORD RvaToFirstByteOfCode
;
3994 DWORD RvaToLastByteOfCode
;
3995 DWORD RvaToFirstByteOfData
;
3996 DWORD RvaToLastByteOfData
;
3997 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
4000 #define FRAME_TRAP 1
4002 #define FRAME_NONFPO 3
4004 typedef struct _FPO_DATA
{
4015 } FPO_DATA
, *PFPO_DATA
;
4017 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64
{
4019 DWORD TimeDateStamp
;
4022 DWORD GlobalFlagsClear
;
4023 DWORD GlobalFlagsSet
;
4024 DWORD CriticalSectionDefaultTimeout
;
4025 ULONGLONG DeCommitFreeBlockThreshold
;
4026 ULONGLONG DeCommitTotalFreeThreshold
;
4027 ULONGLONG LockPrefixTable
;
4028 ULONGLONG MaximumAllocationSize
;
4029 ULONGLONG VirtualMemoryThreshold
;
4030 ULONGLONG ProcessAffinityMask
;
4031 DWORD ProcessHeapFlags
;
4035 ULONGLONG SecurityCookie
;
4036 ULONGLONG SEHandlerTable
;
4037 ULONGLONG SEHandlerCount
;
4038 } IMAGE_LOAD_CONFIG_DIRECTORY64
, *PIMAGE_LOAD_CONFIG_DIRECTORY64
;
4040 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32
{
4042 DWORD TimeDateStamp
;
4045 DWORD GlobalFlagsClear
;
4046 DWORD GlobalFlagsSet
;
4047 DWORD CriticalSectionDefaultTimeout
;
4048 DWORD DeCommitFreeBlockThreshold
;
4049 DWORD DeCommitTotalFreeThreshold
;
4050 PVOID LockPrefixTable
;
4051 DWORD MaximumAllocationSize
;
4052 DWORD VirtualMemoryThreshold
;
4053 DWORD ProcessHeapFlags
;
4054 DWORD ProcessAffinityMask
;
4058 DWORD SecurityCookie
;
4059 DWORD SEHandlerTable
;
4060 DWORD SEHandlerCount
;
4061 } IMAGE_LOAD_CONFIG_DIRECTORY32
, *PIMAGE_LOAD_CONFIG_DIRECTORY32
;
4064 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY
;
4065 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY
;
4067 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY
;
4068 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY
;
4071 typedef struct _IMAGE_FUNCTION_ENTRY
{
4072 DWORD StartingAddress
;
4073 DWORD EndingAddress
;
4074 DWORD EndOfPrologue
;
4075 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
4077 #define IMAGE_DEBUG_MISC_EXENAME 1
4079 typedef struct _IMAGE_DEBUG_MISC
{
4085 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
4087 /* This is the structure that appears at the very start of a .DBG file. */
4089 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
4093 WORD Characteristics
;
4094 DWORD TimeDateStamp
;
4098 DWORD NumberOfSections
;
4099 DWORD ExportedNamesSize
;
4100 DWORD DebugDirectorySize
;
4101 DWORD SectionAlignment
;
4102 DWORD Reserved
[ 2 ];
4103 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
4105 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
4108 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
4112 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
4113 #define MESSAGE_RESOURCE_UNICODE 0x0001
4115 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
4118 DWORD OffsetToEntries
;
4119 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
4121 typedef struct tagMESSAGE_RESOURCE_DATA
{
4122 DWORD NumberOfBlocks
;
4123 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
4124 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
4127 * Here follows typedefs for security and tokens.
4131 * First a constant for the following typedefs.
4134 #define ANYSIZE_ARRAY 1
4136 /* FIXME: Orphan. What does it point to? */
4137 typedef PVOID PACCESS_TOKEN
;
4138 typedef PVOID PSECURITY_DESCRIPTOR
;
4141 typedef enum _TOKEN_ELEVATION_TYPE
{
4142 TokenElevationTypeDefault
= 1,
4143 TokenElevationTypeFull
,
4144 TokenElevationTypeLimited
4145 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
4148 * TOKEN_INFORMATION_CLASS
4151 typedef enum _TOKEN_INFORMATION_CLASS
{
4160 TokenImpersonationLevel
,
4162 TokenRestrictedSids
,
4164 TokenGroupsAndPrivileges
,
4165 TokenSessionReference
,
4172 TokenHasRestrictions
,
4173 TokenAccessInformation
,
4174 TokenVirtualizationAllowed
,
4175 TokenVirtualizationEnabled
,
4176 TokenIntegrityLevel
,
4178 TokenMandatoryPolicy
,
4180 TokenIsAppContainer
,
4182 TokenAppContainerSid
,
4183 TokenAppContainerNumber
,
4184 TokenUserClaimAttributes
,
4185 TokenDeviceClaimAttributes
,
4186 TokenRestrictedUserClaimAttributes
,
4187 TokenRestrictedDeviceClaimAttributes
,
4189 TokenRestrictedDeviceGroups
,
4190 TokenSecurityAttributes
,
4192 TokenProcessTrustLevel
,
4194 } TOKEN_INFORMATION_CLASS
;
4196 #define DISABLE_MAX_PRIVILEGE 0x1
4197 #define SANDBOX_INERT 0x2
4198 #define LUA_TOKEN 0x4
4199 #define WRITE_RESTRICTED 0x8
4201 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
4202 #define TOKEN_ADJUST_GROUPS 0x0040
4203 #define TOKEN_ADJUST_PRIVILEGES 0x0020
4204 #define TOKEN_ADJUST_SESSIONID 0x0100
4205 #define TOKEN_ASSIGN_PRIMARY 0x0001
4206 #define TOKEN_DUPLICATE 0x0002
4207 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
4208 #define TOKEN_IMPERSONATE 0x0004
4209 #define TOKEN_QUERY 0x0008
4210 #define TOKEN_QUERY_SOURCE 0x0010
4211 #define TOKEN_ADJUST_DEFAULT 0x0080
4212 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
4213 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
4214 TOKEN_ADJUST_PRIVILEGES | \
4215 TOKEN_ADJUST_GROUPS | \
4216 TOKEN_ADJUST_DEFAULT )
4217 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
4218 TOKEN_ASSIGN_PRIMARY | \
4220 TOKEN_IMPERSONATE | \
4222 TOKEN_QUERY_SOURCE | \
4223 TOKEN_ADJUST_PRIVILEGES | \
4224 TOKEN_ADJUST_GROUPS | \
4225 TOKEN_ADJUST_SESSIONID | \
4226 TOKEN_ADJUST_DEFAULT )
4228 #ifndef _SECURITY_DEFINED
4229 #define _SECURITY_DEFINED
4232 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
4234 typedef struct _GENERIC_MAPPING
{
4235 ACCESS_MASK GenericRead
;
4236 ACCESS_MASK GenericWrite
;
4237 ACCESS_MASK GenericExecute
;
4238 ACCESS_MASK GenericAll
;
4239 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
4241 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
4242 #define SID_IDENTIFIER_AUTHORITY_DEFINED
4245 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
4246 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
4250 typedef struct _SID
{
4252 BYTE SubAuthorityCount
;
4253 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
4254 DWORD SubAuthority
[1];
4256 #endif /* !defined(SID_DEFINED) */
4258 #define SID_REVISION (1) /* Current revision */
4259 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
4260 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
4262 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
4268 #define ACL_REVISION1 1
4269 #define ACL_REVISION2 2
4270 #define ACL_REVISION3 3
4271 #define ACL_REVISION4 4
4273 #define MIN_ACL_REVISION ACL_REVISION2
4274 #define MAX_ACL_REVISION ACL_REVISION4
4276 #define ACL_REVISION 2
4278 typedef struct _ACL
{
4286 typedef enum _ACL_INFORMATION_CLASS
4288 AclRevisionInformation
= 1,
4290 } ACL_INFORMATION_CLASS
;
4292 typedef struct _ACL_REVISION_INFORMATION
4295 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
4297 typedef struct _ACL_SIZE_INFORMATION
4300 DWORD AclBytesInUse
;
4302 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
4304 /* SECURITY_DESCRIPTOR */
4305 #define SECURITY_DESCRIPTOR_REVISION 1
4306 #define SECURITY_DESCRIPTOR_REVISION1 1
4313 #if defined(_MSC_VER) || defined(__MINGW32__)
4314 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4315 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4316 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4317 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4318 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4319 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4320 #define SE_TCB_NAME L"SeTcbPrivilege"
4321 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4322 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4323 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4324 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4325 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4326 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4327 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4328 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4329 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4330 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4331 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4332 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4333 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4334 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4335 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4336 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4337 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4338 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4339 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4340 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4341 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4342 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4343 #define SE_TRUSTED_CREDMAN_ACCESS_NAME L"SeTrustedCredManAccessPrivilege"
4344 #define SE_RELABEL_NAME L"SeRelabelPrivilege"
4345 #define SE_INC_WORKING_SET_NAME L"SeIncreaseWorkingSetPrivilege"
4346 #define SE_TIME_ZONE_NAME L"SeTimeZonePrivilege"
4347 #define SE_CREATE_SYMBOLIC_LINK_NAME L"SeCreateSymbolicLinkPrivilege"
4348 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME L"SeDelegateSessionUserImpersonatePrivilege"
4349 #else /* _MSC_VER/__MINGW32__ */
4350 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 };
4351 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 };
4352 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 };
4353 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 };
4354 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 };
4355 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 };
4356 static const WCHAR SE_TCB_NAME
[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4357 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 };
4358 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 };
4359 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 };
4360 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 };
4361 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 };
4362 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 };
4363 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 };
4364 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 };
4365 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 };
4366 static const WCHAR SE_BACKUP_NAME
[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4367 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 };
4368 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 };
4369 static const WCHAR SE_DEBUG_NAME
[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4370 static const WCHAR SE_AUDIT_NAME
[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4371 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 };
4372 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 };
4373 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 };
4374 static const WCHAR SE_UNDOCK_NAME
[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4375 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 };
4376 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 };
4377 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 };
4378 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 };
4379 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 };
4380 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 };
4381 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 };
4382 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 };
4383 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 };
4384 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 };
4387 #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
4388 #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
4389 #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
4390 #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
4391 #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
4392 #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
4393 #define SE_TCB_NAME "SeTcbPrivilege"
4394 #define SE_SECURITY_NAME "SeSecurityPrivilege"
4395 #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
4396 #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
4397 #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
4398 #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
4399 #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
4400 #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
4401 #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
4402 #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
4403 #define SE_BACKUP_NAME "SeBackupPrivilege"
4404 #define SE_RESTORE_NAME "SeRestorePrivilege"
4405 #define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
4406 #define SE_DEBUG_NAME "SeDebugPrivilege"
4407 #define SE_AUDIT_NAME "SeAuditPrivilege"
4408 #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
4409 #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
4410 #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
4411 #define SE_UNDOCK_NAME "SeUndockPrivilege"
4412 #define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
4413 #define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
4414 #define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
4415 #define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
4416 #define SE_TRUSTED_CREDMAN_ACCESS_NAME "SeTrustedCredManAccessPrivilege"
4417 #define SE_RELABEL_NAME "SeRelabelPrivilege"
4418 #define SE_INC_WORKING_SET_NAME "SeIncreaseWorkingSetPrivilege"
4419 #define SE_TIME_ZONE_NAME "SeTimeZonePrivilege"
4420 #define SE_CREATE_SYMBOLIC_LINK_NAME "SeCreateSymbolicLinkPrivilege"
4421 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME "SeDelegateSessionUserImpersonatePrivilege"
4424 #define SE_GROUP_MANDATORY 0x00000001
4425 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4426 #define SE_GROUP_ENABLED 0x00000004
4427 #define SE_GROUP_OWNER 0x00000008
4428 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4429 #define SE_GROUP_INTEGRITY 0x00000020
4430 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
4431 #define SE_GROUP_LOGON_ID 0xC0000000
4432 #define SE_GROUP_RESOURCE 0x20000000
4433 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
4435 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4436 #define SE_PRIVILEGE_ENABLED 0x00000002
4437 #define SE_PRIVILEGE_REMOVED 0x00000004
4438 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4439 #define SE_PRIVILEGE_VALID_ATTRIBUTES 0x80000007
4441 #define PRIVILEGE_SET_ALL_NECESSARY 1
4443 #define SE_OWNER_DEFAULTED 0x00000001
4444 #define SE_GROUP_DEFAULTED 0x00000002
4445 #define SE_DACL_PRESENT 0x00000004
4446 #define SE_DACL_DEFAULTED 0x00000008
4447 #define SE_SACL_PRESENT 0x00000010
4448 #define SE_SACL_DEFAULTED 0x00000020
4449 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4450 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4451 #define SE_DACL_AUTO_INHERITED 0x00000400
4452 #define SE_SACL_AUTO_INHERITED 0x00000800
4453 #define SE_DACL_PROTECTED 0x00001000
4454 #define SE_SACL_PROTECTED 0x00002000
4455 #define SE_RM_CONTROL_VALID 0x00004000
4456 #define SE_SELF_RELATIVE 0x00008000
4458 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4459 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4461 /* The security descriptor structure */
4465 SECURITY_DESCRIPTOR_CONTROL Control
;
4470 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4475 SECURITY_DESCRIPTOR_CONTROL Control
;
4480 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4482 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4484 #endif /* _SECURITY_DEFINED */
4487 * SID_AND_ATTRIBUTES
4490 typedef struct _SID_AND_ATTRIBUTES
{
4493 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4495 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY
[ANYSIZE_ARRAY
];
4496 typedef SID_AND_ATTRIBUTES_ARRAY
*PSID_AND_ATTRIBUTES_ARRAY
;
4498 #define SID_HASH_SIZE 32
4500 typedef ULONG_PTR SID_HASH_ENTRY
, *PSID_HASH_ENTRY
;
4502 typedef struct _SID_AND_ATTRIBUTES_HASH
{
4504 PSID_AND_ATTRIBUTES SidAttr
;
4505 SID_HASH_ENTRY Hash
[SID_HASH_SIZE
];
4506 } SID_AND_ATTRIBUTES_HASH
, *PSID_AND_ATTRIBUTES_HASH
;
4508 /* security entities */
4509 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
4510 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
4511 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
4513 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4516 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4519 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4520 #define SECURITY_LOCAL_LOGON_RID __MSABI_LONG(0X00000000)
4523 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4524 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
4525 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
4526 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
4527 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
4528 #define SECURITY_CREATOR_OWNER_RIGHTS_RID __MSABI_LONG(0x00000004)
4531 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4534 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4535 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
4536 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
4537 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
4538 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
4539 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
4540 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
4541 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
4542 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
4543 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
4544 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4545 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
4546 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
4547 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
4548 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
4549 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
4550 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
4551 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
4552 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
4553 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
4554 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
4555 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID __MSABI_LONG(0x00000016)
4556 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
4557 #define SECURITY_WRITE_RESTRICTED_CODE_RID __MSABI_LONG(0x00000021)
4559 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
4560 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
4561 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
4562 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
4563 #define SECURITY_CRED_TYPE_BASE_RID __MSABI_LONG(0x00000041)
4564 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID __MSABI_LONG(0x00000001)
4565 #define SECURITY_MIN_BASE_RID __MSABI_LONG(0x00000050)
4566 #define SECURITY_SERVICE_ID_BASE_RID __MSABI_LONG(0x00000050)
4567 #define SECURITY_RESERVED_ID_BASE_RID __MSABI_LONG(0x00000051)
4568 #define SECURITY_APPPOOL_ID_BASE_RID __MSABI_LONG(0x00000052)
4569 #define SECURITY_VIRTUALSERVER_ID_BASE_RID __MSABI_LONG(0x00000053)
4570 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID __MSABI_LONG(0x00000054)
4571 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID __MSABI_LONG(0x00000055)
4572 #define SECURITY_WMIHOST_ID_BASE_RID __MSABI_LONG(0x00000056)
4573 #define SECURITY_TASK_ID_BASE_RID __MSABI_LONG(0x00000057)
4574 #define SECURITY_NFS_ID_BASE_RID __MSABI_LONG(0x00000058)
4575 #define SECURITY_COM_ID_BASE_RID __MSABI_LONG(0x00000059)
4576 #define SECURITY_MAX_BASE_RID __MSABI_LONG(0x0000006F)
4577 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID __MSABI_LONG(0x00000070)
4578 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
4579 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
4580 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
4582 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS __MSABI_LONG(0x000001F2)
4584 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
4585 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
4586 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
4587 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
4588 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
4590 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
4591 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
4592 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
4593 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
4594 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
4595 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
4596 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
4597 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
4598 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
4599 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS __MSABI_LONG(0x00000209)
4601 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
4603 #define SECURITY_APP_PACKAGE_AUTHORITY {0,0,0,0,0,15}
4604 #define SECURITY_APP_PACKAGE_BASE_RID __MSABI_LONG(0x000000002)
4605 #define SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000002)
4606 #define SECURITY_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000008)
4607 #define SECURITY_CAPABILITY_BASE_RID __MSABI_LONG(0x000000003)
4608 #define SECURITY_CAPABILITY_APP_RID __MSABI_LONG(0x000000400)
4609 #define SECURITY_BUILTIN_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000002)
4610 #define SECURITY_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000005)
4611 #define SECURITY_PARENT_PACKAGE_RID_COUNT SECURITY_APP_PACKAGE_RID_COUNT
4612 #define SECURITY_CHILD_PACKAGE_RID_COUNT __MSABI_LONG(0x00000000c)
4613 #define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE __MSABI_LONG(0x000000001)
4615 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4616 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
4617 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
4618 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
4619 #define SECURITY_MANDATORY_MEDIUM_PLUS_RID __MSABI_LONG(0x00002100)
4620 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
4621 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
4622 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
4623 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
4625 #define MANDATORY_LEVEL_TO_MANDATORY_RID(ML) (ML * 0x1000)
4627 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
4628 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
4629 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
4630 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
4632 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
4633 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
4634 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
4635 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
4637 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
4638 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
4639 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
4640 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
4641 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
4642 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
4644 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
4645 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
4646 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
4647 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
4648 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
4649 #define DOMAIN_ALIAS_RID_IUSERS __MSABI_LONG(0x00000238)
4650 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS __MSABI_LONG(0x00000239)
4651 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023B)
4652 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023C)
4653 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP __MSABI_LONG(0x0000023D)
4654 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP __MSABI_LONG(0x0000023E)
4656 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4658 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
4659 #define SECURITY_CRED_TYPE_RID_COUNT __MSABI_LONG(2)
4660 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
4661 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT __MSABI_LONG(3)
4662 #define SECURITY_SERVICE_ID_RID_COUNT __MSABI_LONG(6)
4663 #define SECURITY_APPPOOL_ID_RID_COUNT __MSABI_LONG(6)
4664 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT __MSABI_LONG(6)
4665 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT __MSABI_LONG(6)
4666 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT __MSABI_LONG(6)
4667 #define SECURITY_WMIHOST_ID_RID_COUNT __MSABI_LONG(6)
4668 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT __MSABI_LONG(6)
4670 #define SYSTEM_LUID { 0x3e7, 0x0 }
4671 #define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 }
4672 #define LOCALSERVICE_LUID { 0x3e5, 0x0 }
4673 #define NETWORKSERVICE_LUID { 0x3e4, 0x0 }
4674 #define IUSER_LUID { 0x3e3, 0x0 }
4680 WinCreatorOwnerSid
= 3,
4681 WinCreatorGroupSid
= 4,
4682 WinCreatorOwnerServerSid
= 5,
4683 WinCreatorGroupServerSid
= 6,
4684 WinNtAuthoritySid
= 7,
4688 WinInteractiveSid
= 11,
4690 WinAnonymousSid
= 13,
4692 WinEnterpriseControllersSid
= 15,
4694 WinAuthenticatedUserSid
= 17,
4695 WinRestrictedCodeSid
= 18,
4696 WinTerminalServerSid
= 19,
4697 WinRemoteLogonIdSid
= 20,
4698 WinLogonIdsSid
= 21,
4699 WinLocalSystemSid
= 22,
4700 WinLocalServiceSid
= 23,
4701 WinNetworkServiceSid
= 24,
4702 WinBuiltinDomainSid
= 25,
4703 WinBuiltinAdministratorsSid
= 26,
4704 WinBuiltinUsersSid
= 27,
4705 WinBuiltinGuestsSid
= 28,
4706 WinBuiltinPowerUsersSid
= 29,
4707 WinBuiltinAccountOperatorsSid
= 30,
4708 WinBuiltinSystemOperatorsSid
= 31,
4709 WinBuiltinPrintOperatorsSid
= 32,
4710 WinBuiltinBackupOperatorsSid
= 33,
4711 WinBuiltinReplicatorSid
= 34,
4712 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4713 WinBuiltinRemoteDesktopUsersSid
= 36,
4714 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4715 WinAccountAdministratorSid
= 38,
4716 WinAccountGuestSid
= 39,
4717 WinAccountKrbtgtSid
= 40,
4718 WinAccountDomainAdminsSid
= 41,
4719 WinAccountDomainUsersSid
= 42,
4720 WinAccountDomainGuestsSid
= 43,
4721 WinAccountComputersSid
= 44,
4722 WinAccountControllersSid
= 45,
4723 WinAccountCertAdminsSid
= 46,
4724 WinAccountSchemaAdminsSid
= 47,
4725 WinAccountEnterpriseAdminsSid
= 48,
4726 WinAccountPolicyAdminsSid
= 49,
4727 WinAccountRasAndIasServersSid
= 50,
4728 WinNTLMAuthenticationSid
= 51,
4729 WinDigestAuthenticationSid
= 52,
4730 WinSChannelAuthenticationSid
= 53,
4731 WinThisOrganizationSid
= 54,
4732 WinOtherOrganizationSid
= 55,
4733 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4734 WinBuiltinPerfMonitoringUsersSid
= 57,
4735 WinBuiltinPerfLoggingUsersSid
= 58,
4736 WinBuiltinAuthorizationAccessSid
= 59,
4737 WinBuiltinTerminalServerLicenseServersSid
= 60,
4738 WinBuiltinDCOMUsersSid
= 61,
4739 WinBuiltinIUsersSid
= 62,
4741 WinBuiltinCryptoOperatorsSid
= 64,
4742 WinUntrustedLabelSid
= 65,
4743 WinLowLabelSid
= 66,
4744 WinMediumLabelSid
= 67,
4745 WinHighLabelSid
= 68,
4746 WinSystemLabelSid
= 69,
4747 WinWriteRestrictedCodeSid
= 70,
4748 WinCreatorOwnerRightsSid
= 71,
4749 WinCacheablePrincipalsGroupSid
= 72,
4750 WinNonCacheablePrincipalsGroupSid
= 73,
4751 WinEnterpriseReadonlyControllersSid
= 74,
4752 WinAccountReadonlyControllersSid
= 75,
4753 WinBuiltinEventLogReadersGroup
= 76,
4754 WinNewEnterpriseReadonlyControllersSid
= 77,
4755 WinBuiltinCertSvcDComAccessGroup
= 78,
4756 WinMediumPlusLabelSid
= 79,
4757 WinLocalLogonSid
= 80,
4758 WinConsoleLogonSid
= 81,
4759 WinThisOrganizationCertificateSid
= 82,
4760 WinApplicationPackageAuthoritySid
= 83,
4761 WinBuiltinAnyPackageSid
= 84,
4762 WinCapabilityInternetClientSid
= 85,
4763 WinCapabilityInternetClientServerSid
= 86,
4764 WinCapabilityPrivateNetworkClientServerSid
= 87,
4765 WinCapabilityPicturesLibrarySid
= 88,
4766 WinCapabilityVideosLibrarySid
= 89,
4767 WinCapabilityMusicLibrarySid
= 90,
4768 WinCapabilityDocumentsLibrarySid
= 91,
4769 WinCapabilitySharedUserCertificatesSid
= 92,
4770 WinCapabilityEnterpriseAuthenticationSid
= 93,
4771 WinCapabilityRemovableStorageSid
= 94,
4772 WinBuiltinRDSRemoteAccessServersSid
= 95,
4773 WinBuiltinRDSEndpointServersSid
= 96,
4774 WinBuiltinRDSManagementServersSid
= 97,
4775 WinUserModeDriversSid
= 98,
4776 WinBuiltinHyperVAdminsSid
= 99,
4777 WinAccountCloneableControllersSid
= 100,
4778 WinBuiltinAccessControlAssistanceOperatorsSid
= 101,
4779 WinBuiltinRemoteManagementUsersSid
= 102,
4780 WinAuthenticationAuthorityAssertedSid
= 103,
4781 WinAuthenticationServiceAssertedSid
= 104,
4782 WinLocalAccountSid
= 105,
4783 WinLocalAccountAndAdministratorSid
= 106,
4784 WinAccountProtectedUsersSid
= 107,
4785 } WELL_KNOWN_SID_TYPE
;
4791 typedef struct _TOKEN_USER
{
4792 SID_AND_ATTRIBUTES User
;
4793 } TOKEN_USER
, *PTOKEN_USER
;
4799 typedef struct _TOKEN_GROUPS
{
4801 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4802 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4805 * LUID_AND_ATTRIBUTES
4808 typedef union _LARGE_INTEGER
{
4810 #ifdef WORDS_BIGENDIAN
4818 #ifndef NONAMELESSSTRUCT
4820 #ifdef WORDS_BIGENDIAN
4830 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4832 typedef union _ULARGE_INTEGER
{
4834 #ifdef WORDS_BIGENDIAN
4842 #ifndef NONAMELESSSTRUCT
4844 #ifdef WORDS_BIGENDIAN
4854 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4857 * Locally Unique Identifier
4860 typedef struct _LUID
{
4865 #include <pshpack4.h>
4866 typedef struct _LUID_AND_ATTRIBUTES
{
4869 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4870 #include <poppack.h>
4876 typedef struct _PRIVILEGE_SET
{
4877 DWORD PrivilegeCount
;
4879 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4880 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4886 typedef struct _TOKEN_PRIVILEGES
{
4887 DWORD PrivilegeCount
;
4888 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4889 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4895 typedef struct _TOKEN_OWNER
{
4897 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4900 * TOKEN_PRIMARY_GROUP
4903 typedef struct _TOKEN_PRIMARY_GROUP
{
4905 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4909 * TOKEN_DEFAULT_DACL
4912 typedef struct _TOKEN_DEFAULT_DACL
{
4914 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4920 #define TOKEN_SOURCE_LENGTH 8
4922 typedef struct _TOKEN_SOURCE
{
4923 char SourceName
[TOKEN_SOURCE_LENGTH
];
4924 LUID SourceIdentifier
;
4925 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4931 typedef enum tagTOKEN_TYPE
{
4937 * SECURITY_IMPERSONATION_LEVEL
4940 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4942 SecurityIdentification
,
4943 SecurityImpersonation
,
4945 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4947 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4948 #define SECURITY_STATIC_TRACKING (FALSE)
4950 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4951 * PSECURITY_CONTEXT_TRACKING_MODE
;
4953 * Quality of Service
4956 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4958 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4959 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4960 BOOLEAN EffectiveOnly
;
4961 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4967 #include <pshpack4.h>
4968 typedef struct _TOKEN_STATISTICS
{
4970 LUID AuthenticationId
;
4971 LARGE_INTEGER ExpirationTime
;
4972 TOKEN_TYPE TokenType
;
4973 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4974 DWORD DynamicCharged
;
4975 DWORD DynamicAvailable
;
4977 DWORD PrivilegeCount
;
4980 #include <poppack.h>
4982 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4985 PSID_AND_ATTRIBUTES Sids
;
4986 DWORD RestrictedSidCount
;
4987 DWORD RestrictedSidLength
;
4988 PSID_AND_ATTRIBUTES RestrictedSids
;
4989 DWORD PrivilegeCount
;
4990 DWORD PrivilegeLength
;
4991 PLUID_AND_ATTRIBUTES Privileges
;
4992 LUID AuthenticationId
;
4993 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4995 typedef struct _TOKEN_ORIGIN
{
4996 LUID OriginatingLogonSession
;
4997 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4999 typedef struct _TOKEN_LINKED_TOKEN
{
5001 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
5003 typedef struct _TOKEN_ELEVATION
{
5004 DWORD TokenIsElevated
;
5005 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
5007 typedef struct _TOKEN_MANDATORY_LABEL
{
5008 SID_AND_ATTRIBUTES Label
;
5009 } TOKEN_MANDATORY_LABEL
, * PTOKEN_MANDATORY_LABEL
;
5011 #define TOKEN_MANDATORY_POLICY_OFF 0x0
5012 #define TOKEN_MANDATORY_POLICY_NO_WRITEUP 0x1
5013 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
5014 #define TOKEN_MANDATORY_POLICY_VALID_MASK 0x3
5016 typedef struct _TOKEN_MANDATORY_POLICY
{
5018 } TOKEN_MANDATORY_POLICY
, *PTOKEN_MANDATORY_POLICY
;
5020 typedef struct _TOKEN_APPCONTAINER_INFORMATION
{
5021 PSID TokenAppContainer
;
5022 } TOKEN_APPCONTAINER_INFORMATION
, * PTOKEN_APPCONTAINER_INFORMATION
;
5024 #define POLICY_AUDIT_SUBCATEGORY_COUNT 53
5026 typedef struct _TOKEN_AUDIT_POLICY
{
5027 BYTE PerUserPolicy
[((POLICY_AUDIT_SUBCATEGORY_COUNT
) >> 1) + 1];
5028 } TOKEN_AUDIT_POLICY
, *PTOKEN_AUDIT_POLICY
;
5030 typedef struct _TOKEN_ACCESS_INFORMATION
{
5031 PSID_AND_ATTRIBUTES_HASH SidHash
;
5032 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash
;
5033 PTOKEN_PRIVILEGES Privileges
;
5034 LUID AuthenticationId
;
5035 TOKEN_TYPE TokenType
;
5036 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
5037 TOKEN_MANDATORY_POLICY MandatoryPolicy
;
5039 } TOKEN_ACCESS_INFORMATION
, *PTOKEN_ACCESS_INFORMATION
;
5041 typedef struct _TOKEN_CONTROL
{
5043 LUID AuthenticationId
;
5045 TOKEN_SOURCE TokenSource
;
5046 } TOKEN_CONTROL
, *PTOKEN_CONTROL
;
5052 /* ACEs, directly starting after an ACL */
5053 typedef struct _ACE_HEADER
{
5057 } ACE_HEADER
,*PACE_HEADER
;
5060 #define ACCESS_MIN_MS_ACE_TYPE 0x0
5061 #define ACCESS_ALLOWED_ACE_TYPE 0x0
5062 #define ACCESS_DENIED_ACE_TYPE 0x1
5063 #define SYSTEM_AUDIT_ACE_TYPE 0x2
5064 #define SYSTEM_ALARM_ACE_TYPE 0x3
5065 #define ACCESS_MAX_MS_V2_ACE_TYPE 0x3
5066 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4
5067 #define ACCESS_MAX_MS_V3_ACE_TYPE 0x4
5068 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE 0x5
5069 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5
5070 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6
5071 #define ACCESS_AUDIT_OBJECT_ACE_TYPE 0x7
5072 #define ACCESS_ALARM_OBJECT_ACE_TYPE 0x8
5073 #define ACCESS_MAX_MS_V4_ACE_TYPE 0x8
5074 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9
5075 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xa
5076 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xb
5077 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xc
5078 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xd
5079 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xe
5080 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xf
5081 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
5082 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
5083 #define ACCESS_MAX_MS_V5_ACE_TYPE 0x11
5085 /* inherit AceFlags */
5086 #define OBJECT_INHERIT_ACE 0x01
5087 #define CONTAINER_INHERIT_ACE 0x02
5088 #define NO_PROPAGATE_INHERIT_ACE 0x04
5089 #define INHERIT_ONLY_ACE 0x08
5090 #define INHERITED_ACE 0x10
5091 #define VALID_INHERIT_FLAGS 0x1F
5093 /* AceFlags mask for what events we (should) audit */
5094 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
5095 #define FAILED_ACCESS_ACE_FLAG 0x80
5097 /* different ACEs depending on AceType
5098 * SidStart marks the begin of a SID
5099 * so the thing finally looks like this:
5104 typedef struct _ACCESS_ALLOWED_ACE
{
5108 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
5110 typedef struct _ACCESS_DENIED_ACE
{
5114 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
5116 typedef struct _SYSTEM_AUDIT_ACE
{
5120 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
5122 typedef struct _SYSTEM_ALARM_ACE
{
5126 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
5128 typedef struct _SYSTEM_MANDATORY_LABEL_ACE
{
5132 } SYSTEM_MANDATORY_LABEL_ACE
,*PSYSTEM_MANDATORY_LABEL_ACE
;
5134 typedef struct _ACCESS_ALLOWED_OBJECT_ACE
{
5139 GUID InheritedObjectType
;
5141 } ACCESS_ALLOWED_OBJECT_ACE
, *PACCESS_ALLOWED_OBJECT_ACE
;
5143 typedef struct _ACCESS_DENIED_OBJECT_ACE
{
5148 GUID InheritedObjectType
;
5150 } ACCESS_DENIED_OBJECT_ACE
, *PACCESS_DENIED_OBJECT_ACE
;
5152 typedef struct _SYSTEM_AUDIT_OBJECT_ACE
{
5157 GUID InheritedObjectType
;
5159 } SYSTEM_AUDIT_OBJECT_ACE
, *PSYSTEM_AUDIT_OBJECT_ACE
;
5161 typedef struct _SYSTEM_ALARM_OBJECT_ACE
{
5166 GUID InheritedObjectType
;
5168 } SYSTEM_ALARM_OBJECT_ACE
, *PSYSTEM_ALARM_OBJECT_aCE
;
5170 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE
{
5174 } ACCESS_ALLOWED_CALLBACK_ACE
,*PACCESS_ALLOWED_CALLBACK_ACE
;
5176 typedef struct _ACCESS_DENIED_CALLBACK_ACE
{
5180 } ACCESS_DENIED_CALLBACK_ACE
,*PACCESS_DENIED_CALLBACK_ACE
;
5182 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE
{
5186 } SYSTEM_AUDIT_CALLBACK_ACE
,*PSYSTEM_AUDIT_CALLBACK_ACE
;
5188 typedef struct _SYSTEM_ALARM_CALLBACK_ACE
{
5192 } SYSTEM_ALARM_CALLBACK_ACE
,*PSYSTEM_ALARM_CALLBACK_ACE
;
5194 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
{
5199 GUID InheritedObjectType
;
5201 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE
;
5203 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE
{
5208 GUID InheritedObjectType
;
5210 } ACCESS_DENIED_CALLBACK_OBJECT_ACE
, *PACCESS_DENIED_CALLBACK_OBJECT_ACE
;
5212 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
{
5217 GUID InheritedObjectType
;
5219 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE
;
5221 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
{
5226 GUID InheritedObjectType
;
5228 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE
, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE
;
5230 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
5231 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
5232 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
5233 #define SYSTEM_MANDATORY_LABEL_VALID_MASK 0x7
5235 typedef enum tagSID_NAME_USE
{
5240 SidTypeWellKnownGroup
,
5241 SidTypeDeletedAccount
,
5244 } SID_NAME_USE
,*PSID_NAME_USE
;
5246 #define ACE_OBJECT_TYPE_PRESENT 0x1
5247 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
5251 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
5253 #define DELETE 0x00010000
5254 #define READ_CONTROL 0x00020000
5255 #define WRITE_DAC 0x00040000
5256 #define WRITE_OWNER 0x00080000
5257 #define SYNCHRONIZE 0x00100000
5258 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
5260 #define STANDARD_RIGHTS_READ READ_CONTROL
5261 #define STANDARD_RIGHTS_WRITE READ_CONTROL
5262 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
5264 #define STANDARD_RIGHTS_ALL 0x001f0000
5266 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
5268 #define GENERIC_READ 0x80000000
5269 #define GENERIC_WRITE 0x40000000
5270 #define GENERIC_EXECUTE 0x20000000
5271 #define GENERIC_ALL 0x10000000
5273 #define MAXIMUM_ALLOWED 0x02000000
5274 #define ACCESS_SYSTEM_SECURITY 0x01000000
5276 #define EVENT_QUERY_STATE 0x0001
5277 #define EVENT_MODIFY_STATE 0x0002
5278 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5280 #define SEMAPHORE_QUERY_STATE 0x0001
5281 #define SEMAPHORE_MODIFY_STATE 0x0002
5282 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5284 #define MUTANT_QUERY_STATE 0x0001
5285 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
5287 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
5288 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
5289 #define JOB_OBJECT_QUERY 0x0004
5290 #define JOB_OBJECT_TERMINATE 0x0008
5291 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
5292 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
5294 #define TIMER_QUERY_STATE 0x0001
5295 #define TIMER_MODIFY_STATE 0x0002
5296 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5298 #define PROCESS_TERMINATE 0x0001
5299 #define PROCESS_CREATE_THREAD 0x0002
5300 #define PROCESS_VM_OPERATION 0x0008
5301 #define PROCESS_VM_READ 0x0010
5302 #define PROCESS_VM_WRITE 0x0020
5303 #define PROCESS_DUP_HANDLE 0x0040
5304 #define PROCESS_CREATE_PROCESS 0x0080
5305 #define PROCESS_SET_QUOTA 0x0100
5306 #define PROCESS_SET_INFORMATION 0x0200
5307 #define PROCESS_QUERY_INFORMATION 0x0400
5308 #define PROCESS_SUSPEND_RESUME 0x0800
5309 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
5310 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
5311 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5313 #define THREAD_TERMINATE 0x0001
5314 #define THREAD_SUSPEND_RESUME 0x0002
5315 #define THREAD_GET_CONTEXT 0x0008
5316 #define THREAD_SET_CONTEXT 0x0010
5317 #define THREAD_SET_INFORMATION 0x0020
5318 #define THREAD_QUERY_INFORMATION 0x0040
5319 #define THREAD_SET_THREAD_TOKEN 0x0080
5320 #define THREAD_IMPERSONATE 0x0100
5321 #define THREAD_DIRECT_IMPERSONATION 0x0200
5322 #define THREAD_SET_LIMITED_INFORMATION 0x0400
5323 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
5324 #define THREAD_RESUME 0x1000
5325 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5327 #define THREAD_BASE_PRIORITY_LOWRT 15
5328 #define THREAD_BASE_PRIORITY_MAX 2
5329 #define THREAD_BASE_PRIORITY_MIN -2
5330 #define THREAD_BASE_PRIORITY_IDLE -15
5332 typedef struct _QUOTA_LIMITS
{
5333 SIZE_T PagedPoolLimit
;
5334 SIZE_T NonPagedPoolLimit
;
5335 SIZE_T MinimumWorkingSetSize
;
5336 SIZE_T MaximumWorkingSetSize
;
5337 SIZE_T PagefileLimit
;
5338 LARGE_INTEGER TimeLimit
;
5339 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
5341 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
5342 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
5343 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
5344 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
5345 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
5347 typedef union _RATE_QUOTA_LIMIT
{
5350 DWORD RatePercent
:7;
5353 } RATE_QUOTA_LIMIT
, *PRATE_QUOTA_LIMIT
;
5355 typedef struct _QUOTA_LIMITS_EX
{
5356 SIZE_T PagedPoolLimit
;
5357 SIZE_T NonPagedPoolLimit
;
5358 SIZE_T MinimumWorkingSetSize
;
5359 SIZE_T MaximumWorkingSetSize
;
5360 SIZE_T PagefileLimit
;
5361 LARGE_INTEGER TimeLimit
;
5362 SIZE_T WorkingSetLimit
;
5367 RATE_QUOTA_LIMIT CpuRateLimit
;
5368 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
5370 #define SECTION_QUERY 0x0001
5371 #define SECTION_MAP_WRITE 0x0002
5372 #define SECTION_MAP_READ 0x0004
5373 #define SECTION_MAP_EXECUTE 0x0008
5374 #define SECTION_EXTEND_SIZE 0x0010
5375 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
5376 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
5378 #define FILE_READ_DATA 0x0001 /* file & pipe */
5379 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
5380 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
5381 #define FILE_ADD_FILE 0x0002 /* directory */
5382 #define FILE_APPEND_DATA 0x0004 /* file */
5383 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
5384 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
5385 #define FILE_READ_EA 0x0008 /* file & directory */
5386 #define FILE_READ_PROPERTIES FILE_READ_EA
5387 #define FILE_WRITE_EA 0x0010 /* file & directory */
5388 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
5389 #define FILE_EXECUTE 0x0020 /* file */
5390 #define FILE_TRAVERSE 0x0020 /* directory */
5391 #define FILE_DELETE_CHILD 0x0040 /* directory */
5392 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
5393 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
5394 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
5396 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
5397 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
5399 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
5400 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
5401 FILE_APPEND_DATA | SYNCHRONIZE)
5402 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
5403 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
5405 #define DUPLICATE_CLOSE_SOURCE 0x00000001
5406 #define DUPLICATE_SAME_ACCESS 0x00000002
5408 /* File attribute flags */
5409 #define FILE_SHARE_READ 0x00000001
5410 #define FILE_SHARE_WRITE 0x00000002
5411 #define FILE_SHARE_DELETE 0x00000004
5413 #define FILE_ATTRIBUTE_READONLY 0x00000001
5414 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
5415 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
5416 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
5417 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
5418 #define FILE_ATTRIBUTE_DEVICE 0x00000040
5419 #define FILE_ATTRIBUTE_NORMAL 0x00000080
5420 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
5421 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
5422 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
5423 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
5424 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
5425 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
5426 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
5427 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
5428 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
5429 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
5430 #define FILE_ATTRIBUTE_EA 0x00040000
5432 /* File notification flags */
5433 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
5434 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
5435 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
5436 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
5437 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
5438 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
5439 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
5440 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
5441 #define FILE_NOTIFY_CHANGE_EA 0x00000080
5442 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
5443 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
5444 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
5445 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
5447 #define FILE_ACTION_ADDED 0x00000001
5448 #define FILE_ACTION_REMOVED 0x00000002
5449 #define FILE_ACTION_MODIFIED 0x00000003
5450 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
5451 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
5452 #define FILE_ACTION_ADDED_STREAM 0x00000006
5453 #define FILE_ACTION_REMOVED_STREAM 0x00000007
5454 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
5455 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
5456 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000a
5457 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000b
5459 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
5460 #define FILE_CASE_PRESERVED_NAMES 0x00000002
5461 #define FILE_UNICODE_ON_DISK 0x00000004
5462 #define FILE_PERSISTENT_ACLS 0x00000008
5463 #define FILE_FILE_COMPRESSION 0x00000010
5464 #define FILE_VOLUME_QUOTAS 0x00000020
5465 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
5466 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
5467 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
5468 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
5469 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
5470 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
5471 #define FILE_NAMED_STREAMS 0x00040000
5472 #define FILE_READ_ONLY_VOLUME 0x00080000
5473 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
5474 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
5475 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
5476 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
5477 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
5478 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
5479 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000
5480 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
5481 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000
5482 #define FILE_DAX_VOLUME 0x20000000
5483 #define FILE_SUPPORTS_GHOSTING 0x40000000
5485 /* File alignments (NT) */
5486 #define FILE_BYTE_ALIGNMENT 0x00000000
5487 #define FILE_WORD_ALIGNMENT 0x00000001
5488 #define FILE_LONG_ALIGNMENT 0x00000003
5489 #define FILE_QUAD_ALIGNMENT 0x00000007
5490 #define FILE_OCTA_ALIGNMENT 0x0000000f
5491 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
5492 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
5493 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
5494 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
5495 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
5497 #define COMPRESSION_FORMAT_NONE 0
5498 #define COMPRESSION_FORMAT_DEFAULT 1
5499 #define COMPRESSION_FORMAT_LZNT1 2
5500 #define COMPRESSION_ENGINE_STANDARD 0
5501 #define COMPRESSION_ENGINE_MAXIMUM 256
5503 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
5504 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
5506 #define REG_NONE 0 /* no type */
5507 #define REG_SZ 1 /* string type (ASCII) */
5508 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
5509 #define REG_BINARY 3 /* binary format, callerspecific */
5510 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
5511 #define REG_DWORD 4 /* DWORD in little endian format */
5512 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
5513 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
5514 #define REG_LINK 6 /* symbolic link (UNICODE) */
5515 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
5516 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
5517 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
5518 #define REG_RESOURCE_REQUIREMENTS_LIST 10
5519 #define REG_QWORD 11 /* QWORD in little endian format */
5520 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
5522 /* ----------------------------- begin power management --------------------- */
5524 typedef enum _LATENCY_TIME
{
5527 } LATENCY_TIME
, *PLATENCY_TIME
;
5529 #define DISCHARGE_POLICY_CRITICAL 0
5530 #define DISCHARGE_POLICY_LOW 1
5531 #define NUM_DISCHARGE_POLICIES 4
5533 #define PO_THROTTLE_NONE 0
5534 #define PO_THROTTLE_CONSTANT 1
5535 #define PO_THROTTLE_DEGRADE 2
5536 #define PO_THROTTLE_ADAPTIVE 3
5538 typedef enum _POWER_ACTION
{
5539 PowerActionNone
= 0,
5540 PowerActionReserved
,
5542 PowerActionHibernate
,
5543 PowerActionShutdown
,
5544 PowerActionShutdownReset
,
5545 PowerActionShutdownOff
,
5546 PowerActionWarmEject
5550 typedef enum _POWER_PLATFORM_ROLE
{
5551 PlatformRoleUnspecified
,
5552 PlatformRoleDesktop
,
5554 PlatformRoleWorkstation
,
5555 PlatformRoleEnterpriseServer
,
5556 PlatformRoleSOHOServer
,
5557 PlatformRoleAppliancePC
,
5558 PlatformRolePerformanceServer
,
5561 } POWER_PLATFORM_ROLE
, *PPOWER_PLATFORM_ROLE
;
5563 typedef enum _SYSTEM_POWER_STATE
{
5564 PowerSystemUnspecified
= 0,
5565 PowerSystemWorking
= 1,
5566 PowerSystemSleeping1
= 2,
5567 PowerSystemSleeping2
= 3,
5568 PowerSystemSleeping3
= 4,
5569 PowerSystemHibernate
= 5,
5570 PowerSystemShutdown
= 6,
5571 PowerSystemMaximum
= 7
5572 } SYSTEM_POWER_STATE
,
5573 *PSYSTEM_POWER_STATE
;
5575 typedef enum _DEVICE_POWER_STATE
{
5576 PowerDeviceUnspecified
,
5582 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
5584 typedef enum _POWER_INFORMATION_LEVEL
{
5585 SystemPowerPolicyAc
,
5586 SystemPowerPolicyDc
,
5587 VerifySystemPolicyAc
,
5588 VerifySystemPolicyDc
,
5589 SystemPowerCapabilities
,
5591 SystemPowerStateHandler
,
5592 ProcessorStateHandler
,
5593 SystemPowerPolicyCurrent
,
5594 AdministratorPowerPolicy
,
5595 SystemReserveHiberFile
,
5596 ProcessorInformation
,
5597 SystemPowerInformation
,
5598 ProcessorStateHandler2
,
5601 SystemExecutionState
,
5602 SystemPowerStateNotifyHandler
,
5603 ProcessorPowerPolicyAc
,
5604 ProcessorPowerPolicyDc
,
5605 VerifyProcessorPowerPolicyAc
,
5606 VerifyProcessorPowerPolicyDc
,
5607 ProcessorPowerPolicyCurrent
5608 } POWER_INFORMATION_LEVEL
;
5610 typedef struct _ADMINISTRATOR_POWER_POLICY
{
5611 SYSTEM_POWER_STATE MinSleep
;
5612 SYSTEM_POWER_STATE MaxSleep
;
5613 ULONG MinVideoTimeout
;
5614 ULONG MaxVideoTimeout
;
5615 ULONG MinSpindownTimeout
;
5616 ULONG MaxSpindownTimeout
;
5617 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
5622 } BATTERY_REPORTING_SCALE
,
5623 *PBATTERY_REPORTING_SCALE
;
5626 POWER_ACTION Action
;
5629 } POWER_ACTION_POLICY
,
5630 *PPOWER_ACTION_POLICY
;
5632 typedef struct _PROCESSOR_POWER_INFORMATION
{
5638 ULONG CurrentIdleState
;
5639 } PROCESSOR_POWER_INFORMATION
,
5640 *PPROCESSOR_POWER_INFORMATION
;
5642 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
5646 UCHAR DemotePercent
;
5647 UCHAR PromotePercent
;
5649 ULONG AllowDemotion
:1;
5650 ULONG AllowPromotion
:1;
5652 } PROCESSOR_POWER_POLICY_INFO
,
5653 *PPROCESSOR_POWER_POLICY_INFO
;
5655 typedef struct _PROCESSOR_POWER_POLICY
{
5657 BYTE DynamicThrottle
;
5659 DWORD DisableCStates
:1;
5662 PROCESSOR_POWER_POLICY_INFO Policy
[3];
5663 } PROCESSOR_POWER_POLICY
,
5664 *PPROCESSOR_POWER_POLICY
;
5668 BOOLEAN BatteryPresent
;
5670 BOOLEAN Discharging
;
5674 ULONG RemainingCapacity
;
5676 ULONG EstimatedTime
;
5677 ULONG DefaultAlert1
;
5678 ULONG DefaultAlert2
;
5679 } SYSTEM_BATTERY_STATE
,
5680 *PSYSTEM_BATTERY_STATE
;
5683 BOOLEAN PowerButtonPresent
;
5684 BOOLEAN SleepButtonPresent
;
5691 BOOLEAN HiberFilePresent
;
5693 BOOLEAN VideoDimPresent
;
5696 BOOLEAN ThermalControl
;
5697 BOOLEAN ProcessorThrottle
;
5698 UCHAR ProcessorMinThrottle
;
5699 UCHAR ProcessorMaxThrottle
;
5701 BOOLEAN DiskSpinDown
;
5703 BOOLEAN SystemBatteriesPresent
;
5704 BOOLEAN BatteriesAreShortTerm
;
5705 BATTERY_REPORTING_SCALE BatteryScale
[3];
5706 SYSTEM_POWER_STATE AcOnLineWake
;
5707 SYSTEM_POWER_STATE SoftLidWake
;
5708 SYSTEM_POWER_STATE RtcWake
;
5709 SYSTEM_POWER_STATE MinDeviceWakeState
;
5710 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
5711 } SYSTEM_POWER_CAPABILITIES
,
5712 *PSYSTEM_POWER_CAPABILITIES
;
5714 typedef struct _SYSTEM_POWER_INFORMATION
{
5715 ULONG MaxIdlenessAllowed
;
5717 ULONG TimeRemaining
;
5719 } SYSTEM_POWER_INFORMATION
,
5720 *PSYSTEM_POWER_INFORMATION
;
5722 typedef struct _SYSTEM_POWER_LEVEL
{
5726 POWER_ACTION_POLICY PowerPolicy
;
5727 SYSTEM_POWER_STATE MinSystemState
;
5728 } SYSTEM_POWER_LEVEL
,
5729 *PSYSTEM_POWER_LEVEL
;
5731 typedef struct _SYSTEM_POWER_POLICY
{
5733 POWER_ACTION_POLICY PowerButton
;
5734 POWER_ACTION_POLICY SleepButton
;
5735 POWER_ACTION_POLICY LidClose
;
5736 SYSTEM_POWER_STATE LidOpenWake
;
5738 POWER_ACTION_POLICY Idle
;
5740 UCHAR IdleSensitivity
;
5741 UCHAR DynamicThrottle
;
5743 SYSTEM_POWER_STATE MinSleep
;
5744 SYSTEM_POWER_STATE MaxSleep
;
5745 SYSTEM_POWER_STATE ReducedLatencySleep
;
5746 ULONG WinLogonFlags
;
5748 ULONG DozeS4Timeout
;
5749 ULONG BroadcastCapacityResolution
;
5750 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
5752 BOOLEAN VideoDimDisplay
;
5753 ULONG VideoReserved
[3];
5754 ULONG SpindownTimeout
;
5755 BOOLEAN OptimizeForPower
;
5756 UCHAR FanThrottleTolerance
;
5757 UCHAR ForcedThrottle
;
5759 POWER_ACTION_POLICY OverThrottled
;
5760 } SYSTEM_POWER_POLICY
,
5761 *PSYSTEM_POWER_POLICY
;
5763 typedef enum _POWER_REQUEST_TYPE
5765 PowerRequestDisplayRequired
,
5766 PowerRequestSystemRequired
,
5767 PowerRequestAwayModeRequired
5768 } POWER_REQUEST_TYPE
, *PPOWER_REQUEST_TYPE
;
5770 #define POWER_REQUEST_CONTEXT_VERSION 0
5772 #define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
5773 #define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
5775 typedef union _FILE_SEGMENT_ELEMENT
{
5777 ULONGLONG Alignment
;
5778 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
5780 typedef struct _FILE_NOTIFY_INFORMATION
{
5781 DWORD NextEntryOffset
;
5783 DWORD FileNameLength
;
5785 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
5787 /* ----------------------------- begin tape storage --------------------- */
5789 #define TAPE_FIXED_PARTITIONS 0
5790 #define TAPE_SELECT_PARTITIONS 1
5791 #define TAPE_INITIATOR_PARTITIONS 2
5792 #define TAPE_ERASE_SHORT 0
5793 #define TAPE_ERASE_LONG 1
5795 #define TAPE_UNLOAD 1
5796 #define TAPE_TENSION 2
5798 #define TAPE_UNLOCK 4
5799 #define TAPE_FORMAT 5
5800 #define TAPE_SETMARKS 0
5801 #define TAPE_FILEMARKS 1
5802 #define TAPE_SHORT_FILEMARKS 2
5803 #define TAPE_LONG_FILEMARKS 3
5804 #define TAPE_REWIND 0
5805 #define TAPE_ABSOLUTE_BLOCK 1
5806 #define TAPE_LOGICAL_BLOCK 2
5807 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5808 #define TAPE_SPACE_END_OF_DATA 4
5809 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5810 #define TAPE_SPACE_FILEMARKS 6
5811 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5812 #define TAPE_SPACE_SETMARKS 8
5813 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5815 typedef struct _TAPE_CREATE_PARTITION
{
5819 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5821 typedef struct _TAPE_ERASE
{
5824 } TAPE_ERASE
, *PTAPE_ERASE
;
5826 typedef struct _TAPE_PREPARE
{
5829 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5831 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5833 BOOLEAN Compression
;
5834 BOOLEAN DataPadding
;
5835 BOOLEAN ReportSetmarks
;
5836 ULONG EOTWarningZoneSize
;
5837 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5839 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5841 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5843 typedef struct _TAPE_WRITE_MARKS
{
5847 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5849 typedef struct _TAPE_GET_POSITION
{
5854 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5856 typedef struct _TAPE_SET_POSITION
{
5859 LARGE_INTEGER Offset
;
5861 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5863 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5865 BOOLEAN Compression
;
5866 BOOLEAN DataPadding
;
5867 BOOLEAN ReportSetmarks
;
5868 DWORD DefaultBlockSize
;
5869 DWORD MaximumBlockSize
;
5870 DWORD MinimumBlockSize
;
5871 DWORD MaximumPartitionCount
;
5874 DWORD EOTWarningZoneSize
;
5875 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5877 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5878 LARGE_INTEGER Capacity
;
5879 LARGE_INTEGER Remaining
;
5881 DWORD PartitionCount
;
5882 BOOLEAN WriteProtected
;
5883 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5885 /* ----------------------------- begin registry ----------------------------- */
5887 /* Registry security values */
5888 #define OWNER_SECURITY_INFORMATION 0x00000001
5889 #define GROUP_SECURITY_INFORMATION 0x00000002
5890 #define DACL_SECURITY_INFORMATION 0x00000004
5891 #define SACL_SECURITY_INFORMATION 0x00000008
5892 #define LABEL_SECURITY_INFORMATION 0x00000010
5894 #define REG_OPTION_RESERVED 0x00000000
5895 #define REG_OPTION_NON_VOLATILE 0x00000000
5896 #define REG_OPTION_VOLATILE 0x00000001
5897 #define REG_OPTION_CREATE_LINK 0x00000002
5898 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5899 #define REG_OPTION_OPEN_LINK 0x00000008
5900 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | \
5901 REG_OPTION_NON_VOLATILE | \
5902 REG_OPTION_VOLATILE | \
5903 REG_OPTION_CREATE_LINK | \
5904 REG_OPTION_BACKUP_RESTORE | \
5905 REG_OPTION_OPEN_LINK)
5908 #define REG_CREATED_NEW_KEY 0x00000001
5909 #define REG_OPENED_EXISTING_KEY 0x00000002
5911 /* For RegNotifyChangeKeyValue */
5912 #define REG_NOTIFY_CHANGE_NAME 0x01
5913 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5914 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5915 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5916 #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
5918 #define KEY_QUERY_VALUE 0x00000001
5919 #define KEY_SET_VALUE 0x00000002
5920 #define KEY_CREATE_SUB_KEY 0x00000004
5921 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5922 #define KEY_NOTIFY 0x00000010
5923 #define KEY_CREATE_LINK 0x00000020
5924 #define KEY_WOW64_64KEY 0x00000100
5925 #define KEY_WOW64_32KEY 0x00000200
5926 #define KEY_WOW64_RES 0x00000300
5928 /* for RegKeyRestore flags */
5929 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5930 #define REG_REFRESH_HIVE 0x00000002
5931 #define REG_NO_LAZY_FLUSH 0x00000004
5932 #define REG_FORCE_RESTORE 0x00000008
5934 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5936 KEY_ENUMERATE_SUB_KEYS| \
5940 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5942 KEY_CREATE_SUB_KEY) \
5945 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5946 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5949 KEY_CREATE_SUB_KEY| \
5950 KEY_ENUMERATE_SUB_KEYS| \
5955 /* ------------------------------ end registry ------------------------------ */
5958 #define EVENTLOG_SUCCESS 0x0000
5959 #define EVENTLOG_ERROR_TYPE 0x0001
5960 #define EVENTLOG_WARNING_TYPE 0x0002
5961 #define EVENTLOG_INFORMATION_TYPE 0x0004
5962 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5963 #define EVENTLOG_AUDIT_FAILURE 0x0010
5965 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5966 #define EVENTLOG_SEEK_READ 0x0002
5967 #define EVENTLOG_FORWARDS_READ 0x0004
5968 #define EVENTLOG_BACKWARDS_READ 0x0008
5970 typedef struct _EVENTLOGRECORD
{
5974 DWORD TimeGenerated
;
5981 DWORD ClosingRecordNumber
;
5983 DWORD UserSidLength
;
5984 DWORD UserSidOffset
;
5987 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5989 #define SERVICE_BOOT_START 0x00000000
5990 #define SERVICE_SYSTEM_START 0x00000001
5991 #define SERVICE_AUTO_START 0x00000002
5992 #define SERVICE_DEMAND_START 0x00000003
5993 #define SERVICE_DISABLED 0x00000004
5995 #define SERVICE_ERROR_IGNORE 0x00000000
5996 #define SERVICE_ERROR_NORMAL 0x00000001
5997 #define SERVICE_ERROR_SEVERE 0x00000002
5998 #define SERVICE_ERROR_CRITICAL 0x00000003
6001 #define SERVICE_KERNEL_DRIVER 0x00000001
6002 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
6003 #define SERVICE_ADAPTER 0x00000004
6004 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
6006 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
6007 SERVICE_RECOGNIZER_DRIVER )
6009 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
6010 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
6011 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
6013 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
6015 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
6016 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
6019 typedef enum _CM_SERVICE_NODE_TYPE
6021 DriverType
= SERVICE_KERNEL_DRIVER
,
6022 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
6023 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
6024 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
6025 AdapterType
= SERVICE_ADAPTER
,
6026 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
6027 } SERVICE_NODE_TYPE
;
6029 typedef enum _CM_SERVICE_LOAD_TYPE
6031 BootLoad
= SERVICE_BOOT_START
,
6032 SystemLoad
= SERVICE_SYSTEM_START
,
6033 AutoLoad
= SERVICE_AUTO_START
,
6034 DemandLoad
= SERVICE_DEMAND_START
,
6035 DisableLoad
= SERVICE_DISABLED
6036 } SERVICE_LOAD_TYPE
;
6038 typedef enum _CM_ERROR_CONTROL_TYPE
6040 IgnoreError
= SERVICE_ERROR_IGNORE
,
6041 NormalError
= SERVICE_ERROR_NORMAL
,
6042 SevereError
= SERVICE_ERROR_SEVERE
,
6043 CriticalError
= SERVICE_ERROR_CRITICAL
6044 } SERVICE_ERROR_TYPE
;
6046 NTSYSAPI SIZE_T WINAPI
RtlCompareMemory(const VOID
*, const VOID
*, SIZE_T
);
6048 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
6049 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
6050 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
6051 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
6052 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
6054 static FORCEINLINE
void *RtlSecureZeroMemory(void *buffer
, SIZE_T length
)
6056 volatile char *ptr
= (volatile char *)buffer
;
6058 while (length
--) *ptr
++ = 0;
6062 #include <guiddef.h>
6064 typedef struct _OBJECT_TYPE_LIST
{
6068 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
6070 typedef struct _RTL_CRITICAL_SECTION_DEBUG
6073 WORD CreatorBackTraceIndex
;
6074 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
6075 LIST_ENTRY ProcessLocksList
;
6077 DWORD ContentionCount
;
6078 #ifdef __WINESRC__ /* in Wine we store the name here */
6079 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
6083 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
6085 typedef struct _RTL_CRITICAL_SECTION
{
6086 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
6088 LONG RecursionCount
;
6089 HANDLE OwningThread
;
6090 HANDLE LockSemaphore
;
6091 ULONG_PTR SpinCount
;
6092 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
6094 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
6095 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
6096 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
6097 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
6098 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
6100 typedef struct _RTL_SRWLOCK
{
6102 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
6104 #define RTL_SRWLOCK_INIT {0}
6106 typedef struct _RTL_CONDITION_VARIABLE
{
6108 } RTL_CONDITION_VARIABLE
, *PRTL_CONDITION_VARIABLE
;
6109 #define RTL_CONDITION_VARIABLE_INIT {0}
6110 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
6112 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
6113 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
6115 #define RTL_RUN_ONCE_INIT {0}
6116 typedef union _RTL_RUN_ONCE
{
6118 } RTL_RUN_ONCE
, *PRTL_RUN_ONCE
;
6120 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
6121 #define RTL_RUN_ONCE_ASYNC 0x00000002
6122 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004
6124 typedef DWORD WINAPI
RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE
, PVOID
, PVOID
*);
6125 typedef RTL_RUN_ONCE_INIT_FN
*PRTL_RUN_ONCE_INIT_FN
;
6126 NTSYSAPI VOID WINAPI
RtlRunOnceInitialize(PRTL_RUN_ONCE
);
6127 NTSYSAPI DWORD WINAPI
RtlRunOnceExecuteOnce(PRTL_RUN_ONCE
,PRTL_RUN_ONCE_INIT_FN
,PVOID
,PVOID
*);
6128 NTSYSAPI DWORD WINAPI
RtlRunOnceBeginInitialize(PRTL_RUN_ONCE
, DWORD
, PVOID
*);
6129 NTSYSAPI DWORD WINAPI
RtlRunOnceComplete(PRTL_RUN_ONCE
, DWORD
, PVOID
);
6131 #include <pshpack8.h>
6132 typedef struct _IO_COUNTERS
{
6133 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
6134 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
6135 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
6136 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
6137 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
6138 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
6139 } IO_COUNTERS
, *PIO_COUNTERS
;
6140 #include <poppack.h>
6143 DWORD dwOSVersionInfoSize
;
6144 DWORD dwMajorVersion
;
6145 DWORD dwMinorVersion
;
6146 DWORD dwBuildNumber
;
6148 CHAR szCSDVersion
[128];
6149 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
6152 DWORD dwOSVersionInfoSize
;
6153 DWORD dwMajorVersion
;
6154 DWORD dwMinorVersion
;
6155 DWORD dwBuildNumber
;
6157 WCHAR szCSDVersion
[128];
6158 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
6160 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
6161 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
6162 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
6165 DWORD dwOSVersionInfoSize
;
6166 DWORD dwMajorVersion
;
6167 DWORD dwMinorVersion
;
6168 DWORD dwBuildNumber
;
6170 CHAR szCSDVersion
[128];
6171 WORD wServicePackMajor
;
6172 WORD wServicePackMinor
;
6176 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
6179 DWORD dwOSVersionInfoSize
;
6180 DWORD dwMajorVersion
;
6181 DWORD dwMinorVersion
;
6182 DWORD dwBuildNumber
;
6184 WCHAR szCSDVersion
[128];
6185 WORD wServicePackMajor
;
6186 WORD wServicePackMinor
;
6190 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
6192 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
6193 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
6194 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
6196 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
6198 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
6200 #define VER_PLATFORM_WIN32s 0
6201 #define VER_PLATFORM_WIN32_WINDOWS 1
6202 #define VER_PLATFORM_WIN32_NT 2
6204 #define VER_MINORVERSION 0x00000001
6205 #define VER_MAJORVERSION 0x00000002
6206 #define VER_BUILDNUMBER 0x00000004
6207 #define VER_PLATFORMID 0x00000008
6208 #define VER_SERVICEPACKMINOR 0x00000010
6209 #define VER_SERVICEPACKMAJOR 0x00000020
6210 #define VER_SUITENAME 0x00000040
6211 #define VER_PRODUCT_TYPE 0x00000080
6213 #define VER_NT_WORKSTATION 1
6214 #define VER_NT_DOMAIN_CONTROLLER 2
6215 #define VER_NT_SERVER 3
6217 #define VER_SUITE_SMALLBUSINESS 0x00000001
6218 #define VER_SUITE_ENTERPRISE 0x00000002
6219 #define VER_SUITE_BACKOFFICE 0x00000004
6220 #define VER_SUITE_COMMUNICATIONS 0x00000008
6221 #define VER_SUITE_TERMINAL 0x00000010
6222 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
6223 #define VER_SUITE_EMBEDDEDNT 0x00000040
6224 #define VER_SUITE_DATACENTER 0x00000080
6225 #define VER_SUITE_SINGLEUSERTS 0x00000100
6226 #define VER_SUITE_PERSONAL 0x00000200
6227 #define VER_SUITE_BLADE 0x00000400
6228 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
6229 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
6230 #define VER_SUITE_STORAGE_SERVER 0x00002000
6231 #define VER_SUITE_COMPUTE_SERVER 0x00004000
6232 #define VER_SUITE_WH_SERVER 0x00008000
6235 #define VER_GREATER 2
6236 #define VER_GREATER_EQUAL 3
6238 #define VER_LESS_EQUAL 5
6242 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
6244 DWORD ulFormatVersion
;
6245 DWORD ulAssemblyCount
;
6246 DWORD ulRootManifestPathType
;
6247 DWORD ulRootManifestPathChars
;
6248 DWORD ulRootConfigurationPathType
;
6249 DWORD ulRootConfigurationPathChars
;
6250 DWORD ulAppDirPathType
;
6251 DWORD ulAppDirPathChars
;
6252 PCWSTR lpRootManifestPath
;
6253 PCWSTR lpRootConfigurationPath
;
6254 PCWSTR lpAppDirPath
;
6255 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
6257 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
6259 DWORD ulEncodedAssemblyIdentityLength
;
6260 DWORD ulManifestPathType
;
6261 DWORD ulManifestPathLength
;
6262 LARGE_INTEGER liManifestLastWriteTime
;
6263 DWORD ulPolicyPathType
;
6264 DWORD ulPolicyPathLength
;
6265 LARGE_INTEGER liPolicyLastWriteTime
;
6266 DWORD ulMetadataSatelliteRosterIndex
;
6267 DWORD ulManifestVersionMajor
;
6268 DWORD ulManifestVersionMinor
;
6269 DWORD ulPolicyVersionMajor
;
6270 DWORD ulPolicyVersionMinor
;
6271 DWORD ulAssemblyDirectoryNameLength
;
6272 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
6273 PCWSTR lpAssemblyManifestPath
;
6274 PCWSTR lpAssemblyPolicyPath
;
6275 PCWSTR lpAssemblyDirectoryName
;
6277 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
6279 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
6280 DWORD ulAssemblyIndex
;
6281 DWORD ulFileIndexInAssembly
;
6282 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
6284 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
6286 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
6288 DWORD ulFilenameLength
;
6292 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
6294 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
6297 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN
= 0,
6298 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS
,
6299 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION
,
6300 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED
6301 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE
;
6303 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT
{
6305 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type
;
6306 } COMPATIBILITY_CONTEXT_ELEMENT
, *PCOMPATIBILITY_CONTEXT_ELEMENT
;
6308 #if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3)))
6309 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
6311 COMPATIBILITY_CONTEXT_ELEMENT Elements
[];
6312 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
;
6316 ACTCTX_RUN_LEVEL_UNSPECIFIED
= 0,
6317 ACTCTX_RUN_LEVEL_AS_INVOKER
,
6318 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
,
6319 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
,
6320 ACTCTX_RUN_LEVEL_NUMBERS
6321 } ACTCTX_REQUESTED_RUN_LEVEL
;
6323 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
{
6325 ACTCTX_REQUESTED_RUN_LEVEL RunLevel
;
6327 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6329 typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
*PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6331 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
6332 ActivationContextBasicInformation
= 1,
6333 ActivationContextDetailedInformation
= 2,
6334 AssemblyDetailedInformationInActivationContext
= 3,
6335 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
6336 RunlevelInformationInActivationContext
= 5,
6337 CompatibilityInformationInActivationContext
= 6,
6338 ActivationContextManifestResourceName
= 7,
6339 MaxActivationContextInfoClass
,
6340 AssemblyDetailedInformationInActivationContxt
= AssemblyDetailedInformationInActivationContext
,
6341 FileInformationInAssemblyOfAssemblyInActivationContxt
= FileInformationInAssemblyOfAssemblyInActivationContext
6342 } ACTIVATION_CONTEXT_INFO_CLASS
;
6344 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
6345 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
6346 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
6347 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
6349 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
6350 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
6351 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
6352 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
6353 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
6354 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
6355 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
6356 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
6357 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
6358 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10
6359 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11
6361 typedef enum _JOBOBJECTINFOCLASS
6363 JobObjectBasicAccountingInformation
= 1,
6364 JobObjectBasicLimitInformation
,
6365 JobObjectBasicProcessIdList
,
6366 JobObjectBasicUIRestrictions
,
6367 JobObjectSecurityLimitInformation
,
6368 JobObjectEndOfJobTimeInformation
,
6369 JobObjectAssociateCompletionPortInformation
,
6370 JobObjectBasicAndIoAccountingInformation
,
6371 JobObjectExtendedLimitInformation
,
6372 JobObjectJobSetInformation
,
6373 MaxJobObjectInfoClass
6374 } JOBOBJECTINFOCLASS
;
6376 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
{
6377 LARGE_INTEGER TotalUserTime
;
6378 LARGE_INTEGER TotalKernelTime
;
6379 LARGE_INTEGER ThisPeriodTotalUserTime
;
6380 LARGE_INTEGER ThisPeriodTotalKernelTime
;
6381 DWORD TotalPageFaultCount
;
6382 DWORD TotalProcesses
;
6383 DWORD ActiveProcesses
;
6384 DWORD TotalTerminatedProcesses
;
6385 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION
;
6387 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION
{
6388 LARGE_INTEGER PerProcessUserTimeLimit
;
6389 LARGE_INTEGER PerJobUserTimeLimit
;
6391 SIZE_T MinimumWorkingSetSize
;
6392 SIZE_T MaximumWorkingSetSize
;
6393 DWORD ActiveProcessLimit
;
6395 DWORD PriorityClass
;
6396 DWORD SchedulingClass
;
6397 } JOBOBJECT_BASIC_LIMIT_INFORMATION
, *PJOBOBJECT_BASIC_LIMIT_INFORMATION
;
6399 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST
{
6400 DWORD NumberOfAssignedProcesses
;
6401 DWORD NumberOfProcessIdsInList
;
6402 ULONG_PTR ProcessIdList
[1];
6403 } JOBOBJECT_BASIC_PROCESS_ID_LIST
, *PJOBOBJECT_BASIC_PROCESS_ID_LIST
;
6405 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS
{
6406 DWORD UIRestrictionsClass
;
6407 } JOBOBJECT_BASIC_UI_RESTRICTIONS
, *PJOBOBJECT_BASIC_UI_RESTRICTIONS
;
6409 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
6410 DWORD SecurityLimitFlags
;
6412 PTOKEN_GROUPS SidsToDisable
;
6413 PTOKEN_PRIVILEGES PrivilegesToDelete
;
6414 PTOKEN_GROUPS RestrictedSids
;
6415 } JOBOBJECT_SECURITY_LIMIT_INFORMATION
, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION
;
6417 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
{
6418 DWORD EndOfJobTimeAction
;
6419 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION
, PJOBOBJECT_END_OF_JOB_TIME_INFORMATION
;
6421 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
{
6422 PVOID CompletionKey
;
6423 HANDLE CompletionPort
;
6424 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT
, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT
;
6426 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
6427 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
6428 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
6429 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
6430 #define JOB_OBJECT_MSG_NEW_PROCESS 6
6431 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
6432 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
6433 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
6434 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
6436 typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
{
6437 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo
;
6439 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
;
6441 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
6442 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation
;
6444 SIZE_T ProcessMemoryLimit
;
6445 SIZE_T JobMemoryLimit
;
6446 SIZE_T PeakProcessMemoryUsed
;
6447 SIZE_T PeakJobMemoryUsed
;
6448 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION
, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION
;
6450 #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
6451 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
6452 #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
6453 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
6454 #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
6455 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
6456 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
6457 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
6458 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
6459 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
6460 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
6461 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
6462 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
6463 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
6464 #define JOB_OBJECT_LIMIT_SUBSET_AFFINITY 0x00004000
6466 #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
6467 #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
6468 #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00007fff
6470 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
6472 RelationProcessorCore
= 0,
6473 RelationNumaNode
= 1,
6475 RelationProcessorPackage
= 3,
6477 RelationAll
= 0xffff
6478 } LOGICAL_PROCESSOR_RELATIONSHIP
;
6480 #define LTP_PC_SMT 0x1
6482 typedef enum _PROCESSOR_CACHE_TYPE
6488 } PROCESSOR_CACHE_TYPE
;
6490 typedef struct _PROCESSOR_GROUP_INFO
6492 BYTE MaximumProcessorCount
;
6493 BYTE ActiveProcessorCount
;
6495 KAFFINITY ActiveProcessorMask
;
6496 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
6498 typedef struct _CACHE_DESCRIPTOR
6504 PROCESSOR_CACHE_TYPE Type
;
6505 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
6507 typedef struct _GROUP_AFFINITY
6512 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
6514 typedef struct _PROCESSOR_NUMBER
6519 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
6521 typedef struct _PROCESSOR_RELATIONSHIP
6524 BYTE EfficiencyClass
;
6527 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
6528 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
6530 typedef struct _NUMA_NODE_RELATIONSHIP
6534 GROUP_AFFINITY GroupMask
;
6535 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
6537 typedef struct _CACHE_RELATIONSHIP
6543 PROCESSOR_CACHE_TYPE Type
;
6545 GROUP_AFFINITY GroupMask
;
6546 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
6548 typedef struct _GROUP_RELATIONSHIP
6550 WORD MaximumGroupCount
;
6551 WORD ActiveGroupCount
;
6553 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
6554 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
6556 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
6558 ULONG_PTR ProcessorMask
;
6559 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6570 CACHE_DESCRIPTOR Cache
;
6571 ULONGLONG Reserved
[2];
6573 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
6575 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
6577 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6581 PROCESSOR_RELATIONSHIP Processor
;
6582 NUMA_NODE_RELATIONSHIP NumaNode
;
6583 CACHE_RELATIONSHIP Cache
;
6584 GROUP_RELATIONSHIP Group
;
6586 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
6588 /* Threadpool things */
6589 typedef DWORD TP_VERSION
,*PTP_VERSION
;
6591 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
,*PTP_CALLBACK_INSTANCE
;
6593 typedef VOID (CALLBACK
*PTP_SIMPLE_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
);
6595 typedef struct _TP_POOL TP_POOL
,*PTP_POOL
;
6597 typedef enum _TP_CALLBACK_PRIORITY
6599 TP_CALLBACK_PRIORITY_HIGH
,
6600 TP_CALLBACK_PRIORITY_NORMAL
,
6601 TP_CALLBACK_PRIORITY_LOW
,
6602 TP_CALLBACK_PRIORITY_INVALID
,
6603 TP_CALLBACK_PRIORITY_COUNT
= TP_CALLBACK_PRIORITY_INVALID
6604 } TP_CALLBACK_PRIORITY
;
6606 typedef struct _TP_POOL_STACK_INFORMATION
6608 SIZE_T StackReserve
;
6610 } TP_POOL_STACK_INFORMATION
,*PTP_POOL_STACK_INFORMATION
;
6612 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
,*PTP_CLEANUP_GROUP
;
6614 typedef VOID (CALLBACK
*PTP_CLEANUP_GROUP_CANCEL_CALLBACK
)(PVOID
,PVOID
);
6616 typedef struct _TP_CALLBACK_ENVIRON_V1
6620 PTP_CLEANUP_GROUP CleanupGroup
;
6621 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6623 struct _ACTIVATION_CONTEXT
* ActivationContext
;
6624 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6630 DWORD LongFunction
:1;
6635 } TP_CALLBACK_ENVIRON_V1
;
6637 typedef struct _TP_CALLBACK_ENVIRON_V3
6641 PTP_CLEANUP_GROUP CleanupGroup
;
6642 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6644 struct _ACTIVATION_CONTEXT
*ActivationContext
;
6645 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6651 DWORD LongFunction
:1;
6656 TP_CALLBACK_PRIORITY CallbackPriority
;
6658 } TP_CALLBACK_ENVIRON_V3
;
6660 typedef struct _TP_WORK TP_WORK
, *PTP_WORK
;
6661 typedef struct _TP_TIMER TP_TIMER
, *PTP_TIMER
;
6663 typedef DWORD TP_WAIT_RESULT
;
6664 typedef struct _TP_WAIT TP_WAIT
, *PTP_WAIT
;
6666 typedef struct _TP_IO TP_IO
, *PTP_IO
;
6668 typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON
, *PTP_CALLBACK_ENVIRON
;
6670 typedef VOID (CALLBACK
*PTP_WORK_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WORK
);
6671 typedef VOID (CALLBACK
*PTP_TIMER_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_TIMER
);
6672 typedef VOID (CALLBACK
*PTP_WAIT_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WAIT
,TP_WAIT_RESULT
);
6675 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
6677 typedef enum _RTL_UMS_THREAD_INFO_CLASS
6679 UmsThreadInvalidInfoClass
,
6680 UmsThreadUserContext
,
6684 UmsThreadIsSuspended
,
6685 UmsThreadIsTerminated
,
6686 UmsThreadMaxInfoClass
6687 } RTL_UMS_THREAD_INFO_CLASS
, *PRTL_UMS_THREAD_INFO_CLASS
;
6689 typedef enum _RTL_UMS_SCHEDULER_REASON
6691 UmsSchedulerStartup
,
6692 UmsSchedulerThreadBlocked
,
6693 UmsSchedulerThreadYield
,
6694 } RTL_UMS_SCHEDULER_REASON
, *PRTL_UMS_SCHEDULER_REASON
;
6696 typedef void (CALLBACK
*PRTL_UMS_SCHEDULER_ENTRY_POINT
)(RTL_UMS_SCHEDULER_REASON
,ULONG_PTR
,PVOID
);
6698 typedef enum _PROCESS_MITIGATION_POLICY
6702 ProcessDynamicCodePolicy
,
6703 ProcessStrictHandleCheckPolicy
,
6704 ProcessSystemCallDisablePolicy
,
6705 ProcessMitigationOptionsMask
,
6706 ProcessExtensionPointDisablePolicy
,
6707 ProcessControlFlowGuardPolicy
,
6708 ProcessSignaturePolicy
,
6709 ProcessFontDisablePolicy
,
6710 ProcessImageLoadPolicy
,
6711 ProcessSystemCallFilterPolicy
,
6712 ProcessPayloadRestrictionPolicy
,
6713 ProcessChildProcessPolicy
,
6714 ProcessSideChannelIsolationPolicy
,
6715 MaxProcessMitigationPolicy
6716 } PROCESS_MITIGATION_POLICY
, *PPROCESS_MITIGATION_POLICY
;
6722 #endif /* _WINNT_ */