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 #ifdef WINE_UNICODE_NATIVE
467 typedef wchar_t WCHAR
, *PWCHAR
;
469 typedef unsigned short WCHAR
, *PWCHAR
;
472 typedef ULONG UCSCHAR
;
473 #define MIN_UCSCHAR (0)
474 #define MAX_UCSCHAR (0x0010ffff)
475 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
477 /* 'Extended/Wide' numerical types */
481 typedef signed __int64 LONGLONG
, *PLONGLONG
;
482 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
484 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
485 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
492 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
494 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
498 /* ANSI string types */
499 typedef CHAR
*PCH
, *LPCH
, *PNZCH
;
500 typedef const CHAR
*PCCH
, *LPCCH
, *PCNZCH
;
501 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
502 typedef const CHAR
*PCSTR
, *LPCSTR
;
503 typedef CHAR
*PZZSTR
;
504 typedef const CHAR
*PCZZSTR
;
506 /* Unicode string types */
507 typedef const WCHAR
*PCWCHAR
, *LPCUWCHAR
, *PCUWCHAR
;
508 typedef WCHAR
*PWCH
, *LPWCH
;
509 typedef const WCHAR
*PCWCH
, *LPCWCH
;
510 typedef WCHAR
*PNZWCH
, *PUNZWCH
;
511 typedef const WCHAR
*PCNZWCH
, *PCUNZWCH
;
512 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
513 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
514 typedef WCHAR
*PZZWSTR
, *PUZZWSTR
;
515 typedef const WCHAR
*PCZZWSTR
, *PCUZZWSTR
;
516 typedef PWSTR
*PZPWSTR
;
517 typedef PCWSTR
*PZPCWSTR
;
519 /* Neutral character and string types */
520 /* These are only defined for Winelib, i.e. _not_ defined for
521 * the emulator. The reason is they depend on the UNICODE
522 * macro which only exists in the user's code.
524 #ifndef WINE_NO_UNICODE_MACROS
526 # ifndef _TCHAR_DEFINED
527 typedef WCHAR TCHAR
, *PTCHAR
;
528 # define _TCHAR_DEFINED
530 typedef LPWCH PTCH
, LPTCH
;
531 typedef LPCWCH PCTCH
, LPCTCH
;
532 typedef LPWSTR PTSTR
, LPTSTR
;
533 typedef LPCWSTR PCTSTR
, LPCTSTR
;
534 typedef LPWSTR PUTSTR
, LPUTSTR
;
535 typedef LPCWSTR PCUTSTR
, LPCUTSTR
;
536 typedef PNZWCH PNZTCH
;
537 typedef PUNZWCH PUNZTCH
;
538 typedef PCNZWCH PCNZTCH
;
539 typedef PCUNZWCH PCUNZTCH
;
540 typedef PZZWSTR PZZTSTR
;
541 typedef PCZZWSTR PCZZTSTR
;
542 typedef PUZZWSTR PUZZTSTR
;
543 typedef PCUZZWSTR PCUZZTSTR
;
545 # ifndef _TCHAR_DEFINED
546 typedef CHAR TCHAR
, *PTCHAR
;
547 # define _TCHAR_DEFINED
549 typedef LPCH PTCH
, LPTCH
;
550 typedef LPCCH PCTCH
, LPCTCH
;
551 typedef LPSTR PTSTR
, LPTSTR
;
552 typedef LPCSTR PCTSTR
, LPCTSTR
;
553 typedef PNZCH PNZTCH
, PUNZTCH
;
554 typedef PCNZCH PCNZTCH
, PCUNZTCH
;
555 typedef PZZSTR PZZTSTR
, PUZZTSTR
;
556 typedef PCZZSTR PCZZTSTR
, PCUZZTSTR
;
557 # endif /* UNICODE */
558 #endif /* WINE_NO_UNICODE_MACROS */
560 /* UCS string types */
561 typedef UCSCHAR
*PUCSCHAR
, *PUUCSCHAR
;
562 typedef const UCSCHAR
*PCUCSCHAR
, *PCUUCSCHAR
;
563 typedef UCSCHAR
*PUCSSTR
, *PUUCSSTR
;
564 typedef const UCSCHAR
*PCUCSSTR
, *PCUUCSSTR
;
566 /* Misc common WIN32 types */
568 typedef DWORD LCID
, *PLCID
;
570 typedef DWORD EXECUTION_STATE
;
571 #ifndef _HRESULT_DEFINED
572 #define _HRESULT_DEFINED
573 typedef LONG HRESULT
;
578 typedef void *HANDLE
;
579 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
582 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
584 #define DECLARE_HANDLE(a) typedef HANDLE a
591 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
593 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
594 # define __MSABI_LONG(x) x ## l
596 # define __MSABI_LONG(x) x
602 #ifndef WIN32_NO_STATUS
604 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
605 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
606 #define STATUS_USER_APC ((DWORD) 0x000000C0)
607 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
608 #define STATUS_PENDING ((DWORD) 0x00000103)
609 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
610 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
611 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
612 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
613 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
614 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
615 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
616 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
617 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
618 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
619 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
620 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
621 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
622 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
623 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
624 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
625 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
626 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
627 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
628 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
629 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
630 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
631 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
632 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
633 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
634 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
635 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
636 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
637 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
638 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
640 /* status values for ContinueDebugEvent */
641 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
642 #define DBG_CONTINUE ((DWORD) 0x00010002)
643 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
644 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
645 #define DBG_CONTROL_C ((DWORD) 0x40010005)
646 #define DBG_PRINTEXCEPTION_C ((DWORD) 0x40010006)
647 #define DBG_RIPEXCEPTION ((DWORD) 0x40010007)
648 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
649 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
650 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
652 #endif /* WIN32_NO_STATUS */
654 /* Argument 1 passed to the DllEntryProc. */
655 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
656 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
657 #define DLL_THREAD_ATTACH 2 /* attach new thread */
658 #define DLL_THREAD_DETACH 3 /* detach thread */
660 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
663 /* u.x.wProcessorArchitecture (NT) */
664 #define PROCESSOR_ARCHITECTURE_INTEL 0
665 #define PROCESSOR_ARCHITECTURE_MIPS 1
666 #define PROCESSOR_ARCHITECTURE_ALPHA 2
667 #define PROCESSOR_ARCHITECTURE_PPC 3
668 #define PROCESSOR_ARCHITECTURE_SHX 4
669 #define PROCESSOR_ARCHITECTURE_ARM 5
670 #define PROCESSOR_ARCHITECTURE_IA64 6
671 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
672 #define PROCESSOR_ARCHITECTURE_MSIL 8
673 #define PROCESSOR_ARCHITECTURE_AMD64 9
674 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
675 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
676 #define PROCESSOR_ARCHITECTURE_ARM64 12
677 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
678 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14
679 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
681 /* dwProcessorType */
682 #define PROCESSOR_INTEL_386 386
683 #define PROCESSOR_INTEL_486 486
684 #define PROCESSOR_INTEL_PENTIUM 586
685 #define PROCESSOR_INTEL_860 860
686 #define PROCESSOR_INTEL_IA64 2200
687 #define PROCESSOR_AMD_X8664 8664
688 #define PROCESSOR_MIPS_R2000 2000
689 #define PROCESSOR_MIPS_R3000 3000
690 #define PROCESSOR_MIPS_R4000 4000
691 #define PROCESSOR_ALPHA_21064 21064
692 #define PROCESSOR_PPC_601 601
693 #define PROCESSOR_PPC_603 603
694 #define PROCESSOR_PPC_604 604
695 #define PROCESSOR_PPC_620 620
696 #define PROCESSOR_HITACHI_SH3 10003
697 #define PROCESSOR_HITACHI_SH3E 10004
698 #define PROCESSOR_HITACHI_SH4 10005
699 #define PROCESSOR_MOTOROLA_821 821
700 #define PROCESSOR_SHx_SH3 103
701 #define PROCESSOR_SHx_SH4 104
702 #define PROCESSOR_STRONGARM 2577
703 #define PROCESSOR_ARM720 1824 /* 0x720 */
704 #define PROCESSOR_ARM820 2080 /* 0x820 */
705 #define PROCESSOR_ARM920 2336 /* 0x920 */
706 #define PROCESSOR_ARM_7TDMI 70001
707 #define PROCESSOR_OPTIL 18767
710 #define MAXIMUM_PROCESSORS 64
712 #define MAXIMUM_PROCESSORS 32
715 typedef struct _MEMORY_BASIC_INFORMATION
718 LPVOID AllocationBase
;
719 DWORD AllocationProtect
;
724 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
726 #define PAGE_NOACCESS 0x01
727 #define PAGE_READONLY 0x02
728 #define PAGE_READWRITE 0x04
729 #define PAGE_WRITECOPY 0x08
730 #define PAGE_EXECUTE 0x10
731 #define PAGE_EXECUTE_READ 0x20
732 #define PAGE_EXECUTE_READWRITE 0x40
733 #define PAGE_EXECUTE_WRITECOPY 0x80
734 #define PAGE_GUARD 0x100
735 #define PAGE_NOCACHE 0x200
736 #define PAGE_WRITECOMBINE 0x400
738 #define MEM_COMMIT 0x00001000
739 #define MEM_RESERVE 0x00002000
740 #define MEM_DECOMMIT 0x00004000
741 #define MEM_RELEASE 0x00008000
742 #define MEM_FREE 0x00010000
743 #define MEM_PRIVATE 0x00020000
744 #define MEM_MAPPED 0x00040000
745 #define MEM_RESET 0x00080000
746 #define MEM_TOP_DOWN 0x00100000
747 #define MEM_WRITE_WATCH 0x00200000
748 #define MEM_PHYSICAL 0x00400000
749 #define MEM_LARGE_PAGES 0x20000000
750 #define MEM_4MB_PAGES 0x80000000
752 #define SEC_FILE 0x00800000
753 #define SEC_IMAGE 0x01000000
754 #define SEC_PROTECTED_IMAGE 0x02000000
755 #define SEC_RESERVE 0x04000000
756 #define SEC_COMMIT 0x08000000
757 #define SEC_NOCACHE 0x10000000
758 #define SEC_WRITECOMBINE 0x40000000
759 #define SEC_LARGE_PAGES 0x80000000
760 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
761 #define MEM_IMAGE SEC_IMAGE
763 #define WRITE_WATCH_FLAG_RESET 0x00000001
765 #define AT_ROUND_TO_PAGE 0x40000000
769 #define MINSHORT 0x8000
770 #define MAXSHORT 0x7fff
771 #define MINLONG 0x80000000
772 #define MAXLONG 0x7fffffff
774 #define MAXWORD 0xffff
775 #define MAXDWORD 0xffffffff
776 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
778 #define UNICODE_STRING_MAX_CHARS 32767
780 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
781 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
782 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
784 #define CONTAINING_RECORD(address, type, field) \
785 ((type *)((PCHAR)(address) - offsetof(type, field)))
788 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
793 typedef struct _LIST_ENTRY
{
794 struct _LIST_ENTRY
*Flink
;
795 struct _LIST_ENTRY
*Blink
;
796 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
798 typedef struct _SINGLE_LIST_ENTRY
{
799 struct _SINGLE_LIST_ENTRY
*Next
;
800 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
804 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
805 struct _SLIST_ENTRY
*Next
;
806 } SLIST_ENTRY
, *PSLIST_ENTRY
;
808 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
815 ULONGLONG Sequence
:9;
816 ULONGLONG NextEntry
:39;
817 ULONGLONG HeaderType
:1;
819 ULONGLONG Reserved
:59;
824 ULONGLONG Sequence
:48;
825 ULONGLONG HeaderType
:1;
827 ULONGLONG Reserved
:2;
828 ULONGLONG NextEntry
:60;
830 } SLIST_HEADER
, *PSLIST_HEADER
;
834 #undef SLIST_ENTRY /* for Mac OS */
835 #define SLIST_ENTRY SINGLE_LIST_ENTRY
836 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
837 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
839 typedef union _SLIST_HEADER
{
846 } SLIST_HEADER
, *PSLIST_HEADER
;
850 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
851 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
852 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
853 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
854 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
855 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
860 #define HEAP_NO_SERIALIZE 0x00000001
861 #define HEAP_GROWABLE 0x00000002
862 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
863 #define HEAP_ZERO_MEMORY 0x00000008
864 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
865 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
866 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
867 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
868 #define HEAP_CREATE_ALIGN_16 0x00010000
869 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
870 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
872 /* This flag allows it to create heaps shared by all processes under win95,
873 FIXME: correct name */
874 #define HEAP_SHARED 0x04000000
876 typedef enum _HEAP_INFORMATION_CLASS
{
877 HeapCompatibilityInformation
,
878 } HEAP_INFORMATION_CLASS
;
880 /* Processor feature flags. */
881 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
882 #define PF_FLOATING_POINT_EMULATED 1
883 #define PF_COMPARE_EXCHANGE_DOUBLE 2
884 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
885 #define PF_PPC_MOVEMEM_64BIT_OK 4
886 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
887 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
888 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
889 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
890 #define PF_PAE_ENABLED 9
891 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
892 #define PF_SSE_DAZ_MODE_AVAILABLE 11
893 #define PF_NX_ENABLED 12
894 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
895 #define PF_COMPARE_EXCHANGE128 14
896 #define PF_COMPARE64_EXCHANGE128 15
897 #define PF_CHANNELS_ENABLED 16
898 #define PF_XSAVE_ENABLED 17
899 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
900 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
901 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
902 #define PF_VIRT_FIRMWARE_ENABLED 21
903 #define PF_RDWRFSGSBASE_AVAILABLE 22
904 #define PF_FASTFAIL_AVAILABLE 23
905 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
906 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
907 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
908 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
909 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
910 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
911 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
912 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
915 /* Execution state flags */
916 #define ES_SYSTEM_REQUIRED 0x00000001
917 #define ES_DISPLAY_REQUIRED 0x00000002
918 #define ES_USER_PRESENT 0x00000004
919 #define ES_CONTINUOUS 0x80000000
924 struct _EXCEPTION_POINTERS
;
925 struct _EXCEPTION_RECORD
;
927 typedef EXCEPTION_DISPOSITION WINAPI
EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD
*,PVOID
,
928 struct _CONTEXT
*,PVOID
);
929 typedef EXCEPTION_ROUTINE
*PEXCEPTION_ROUTINE
;
931 /* The Win32 register context */
933 /* i386 context definitions */
936 #define SIZE_OF_80387_REGISTERS 80
938 typedef struct _FLOATING_SAVE_AREA
947 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
949 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
951 #define MAXIMUM_SUPPORTED_EXTENSION 512
953 typedef struct _CONTEXT
955 DWORD ContextFlags
; /* 000 */
957 /* These are selected by CONTEXT_DEBUG_REGISTERS */
965 /* These are selected by CONTEXT_FLOATING_POINT */
966 FLOATING_SAVE_AREA FloatSave
; /* 01c */
968 /* These are selected by CONTEXT_SEGMENTS */
969 DWORD SegGs
; /* 08c */
970 DWORD SegFs
; /* 090 */
971 DWORD SegEs
; /* 094 */
972 DWORD SegDs
; /* 098 */
974 /* These are selected by CONTEXT_INTEGER */
982 /* These are selected by CONTEXT_CONTROL */
985 DWORD SegCs
; /* 0bc */
986 DWORD EFlags
; /* 0c0 */
988 DWORD SegSs
; /* 0c8 */
990 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
]; /* 0xcc */
991 } CONTEXT
, *PCONTEXT
;
993 #define CONTEXT_X86 0x00010000
994 #define CONTEXT_i386 CONTEXT_X86
995 #define CONTEXT_i486 CONTEXT_X86
997 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
998 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
999 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1000 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1001 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1002 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1003 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040)
1004 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
1005 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
1006 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
1008 #define EXCEPTION_READ_FAULT 0
1009 #define EXCEPTION_WRITE_FAULT 1
1010 #define EXCEPTION_EXECUTE_FAULT 8
1012 #endif /* __i386__ */
1014 typedef struct _LDT_ENTRY
{
1025 unsigned BaseMid
: 8;
1029 unsigned LimitHi
: 4;
1031 unsigned Reserved_0
: 1;
1032 unsigned Default_Big
: 1;
1033 unsigned Granularity
: 1;
1034 unsigned BaseHi
: 8;
1037 } LDT_ENTRY
, *PLDT_ENTRY
, WOW64_LDT_ENTRY
, *PWOW64_LDT_ENTRY
;
1039 /* x86-64 context definitions */
1040 #if defined(__x86_64__)
1042 #define CONTEXT_AMD64 0x00100000
1044 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
1045 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
1046 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1047 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1048 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1049 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x0040)
1050 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1051 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1053 #define EXCEPTION_READ_FAULT 0
1054 #define EXCEPTION_WRITE_FAULT 1
1055 #define EXCEPTION_EXECUTE_FAULT 8
1057 typedef struct DECLSPEC_ALIGN(16) _M128A
{
1062 typedef struct _XMM_SAVE_AREA32
{
1063 WORD ControlWord
; /* 000 */
1064 WORD StatusWord
; /* 002 */
1065 BYTE TagWord
; /* 004 */
1066 BYTE Reserved1
; /* 005 */
1067 WORD ErrorOpcode
; /* 006 */
1068 DWORD ErrorOffset
; /* 008 */
1069 WORD ErrorSelector
; /* 00c */
1070 WORD Reserved2
; /* 00e */
1071 DWORD DataOffset
; /* 010 */
1072 WORD DataSelector
; /* 014 */
1073 WORD Reserved3
; /* 016 */
1074 DWORD MxCsr
; /* 018 */
1075 DWORD MxCsr_Mask
; /* 01c */
1076 M128A FloatRegisters
[8]; /* 020 */
1077 M128A XmmRegisters
[16]; /* 0a0 */
1078 BYTE Reserved4
[96]; /* 1a0 */
1079 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
1081 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
1082 DWORD64 P1Home
; /* 000 */
1083 DWORD64 P2Home
; /* 008 */
1084 DWORD64 P3Home
; /* 010 */
1085 DWORD64 P4Home
; /* 018 */
1086 DWORD64 P5Home
; /* 020 */
1087 DWORD64 P6Home
; /* 028 */
1090 DWORD ContextFlags
; /* 030 */
1091 DWORD MxCsr
; /* 034 */
1094 WORD SegCs
; /* 038 */
1095 WORD SegDs
; /* 03a */
1096 WORD SegEs
; /* 03c */
1097 WORD SegFs
; /* 03e */
1098 WORD SegGs
; /* 040 */
1099 WORD SegSs
; /* 042 */
1100 DWORD EFlags
; /* 044 */
1103 DWORD64 Dr0
; /* 048 */
1104 DWORD64 Dr1
; /* 050 */
1105 DWORD64 Dr2
; /* 058 */
1106 DWORD64 Dr3
; /* 060 */
1107 DWORD64 Dr6
; /* 068 */
1108 DWORD64 Dr7
; /* 070 */
1111 DWORD64 Rax
; /* 078 */
1112 DWORD64 Rcx
; /* 080 */
1113 DWORD64 Rdx
; /* 088 */
1114 DWORD64 Rbx
; /* 090 */
1115 DWORD64 Rsp
; /* 098 */
1116 DWORD64 Rbp
; /* 0a0 */
1117 DWORD64 Rsi
; /* 0a8 */
1118 DWORD64 Rdi
; /* 0b0 */
1119 DWORD64 R8
; /* 0b8 */
1120 DWORD64 R9
; /* 0c0 */
1121 DWORD64 R10
; /* 0c8 */
1122 DWORD64 R11
; /* 0d0 */
1123 DWORD64 R12
; /* 0d8 */
1124 DWORD64 R13
; /* 0e0 */
1125 DWORD64 R14
; /* 0e8 */
1126 DWORD64 R15
; /* 0f0 */
1129 DWORD64 Rip
; /* 0f8 */
1131 /* Floating point */
1133 XMM_SAVE_AREA32 FltSave
; /* 100 */
1135 M128A Header
[2]; /* 100 */
1136 M128A Legacy
[8]; /* 120 */
1137 M128A Xmm0
; /* 1a0 */
1138 M128A Xmm1
; /* 1b0 */
1139 M128A Xmm2
; /* 1c0 */
1140 M128A Xmm3
; /* 1d0 */
1141 M128A Xmm4
; /* 1e0 */
1142 M128A Xmm5
; /* 1f0 */
1143 M128A Xmm6
; /* 200 */
1144 M128A Xmm7
; /* 210 */
1145 M128A Xmm8
; /* 220 */
1146 M128A Xmm9
; /* 230 */
1147 M128A Xmm10
; /* 240 */
1148 M128A Xmm11
; /* 250 */
1149 M128A Xmm12
; /* 260 */
1150 M128A Xmm13
; /* 270 */
1151 M128A Xmm14
; /* 280 */
1152 M128A Xmm15
; /* 290 */
1157 M128A VectorRegister
[26]; /* 300 */
1158 DWORD64 VectorControl
; /* 4a0 */
1161 DWORD64 DebugControl
; /* 4a8 */
1162 DWORD64 LastBranchToRip
; /* 4b0 */
1163 DWORD64 LastBranchFromRip
; /* 4b8 */
1164 DWORD64 LastExceptionToRip
; /* 4c0 */
1165 DWORD64 LastExceptionFromRip
; /* 4c8 */
1166 } CONTEXT
, *PCONTEXT
;
1168 typedef struct _RUNTIME_FUNCTION
1173 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1175 #define UNWIND_HISTORY_TABLE_SIZE 12
1177 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1180 PRUNTIME_FUNCTION FunctionEntry
;
1181 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1183 #define UNWIND_HISTORY_TABLE_NONE 0
1184 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1185 #define UNWIND_HISTORY_TABLE_LOCAL 2
1187 typedef struct _UNWIND_HISTORY_TABLE
1192 ULONG64 HighAddress
;
1193 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1194 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1196 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1200 PM128A FloatingContext
[16];
1224 PULONG64 IntegerContext
[16];
1245 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1247 typedef struct _DISPATCHER_CONTEXT
1251 PRUNTIME_FUNCTION FunctionEntry
;
1252 ULONG64 EstablisherFrame
;
1254 PCONTEXT ContextRecord
;
1255 PEXCEPTION_ROUTINE LanguageHandler
;
1257 PUNWIND_HISTORY_TABLE HistoryTable
;
1260 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1262 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,PVOID
);
1263 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,PVOID
);
1265 PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1267 #define UNW_FLAG_NHANDLER 0
1268 #define UNW_FLAG_EHANDLER 1
1269 #define UNW_FLAG_UHANDLER 2
1270 #define UNW_FLAG_CHAININFO 4
1272 #endif /* __x86_64__ */
1274 /* IA64 context definitions */
1277 #define CONTEXT_IA64 0x00080000
1278 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1279 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1280 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1281 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1282 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1283 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1284 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1285 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1286 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1288 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1289 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1290 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1291 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1293 typedef struct _CONTEXT
1488 ULONGLONG RsBSPSTORE
;
1502 ULONGLONG UNUSEDPACK
;
1503 } CONTEXT
, *PCONTEXT
;
1505 typedef struct _RUNTIME_FUNCTION
1509 ULONG UnwindInfoAddress
;
1510 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1512 typedef struct _FRAME_POINTERS
{
1513 ULONGLONG MemoryStackFp
;
1514 ULONGLONG BackingStoreFp
;
1515 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1517 #define UNWIND_HISTORY_TABLE_SIZE 12
1519 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1522 PRUNTIME_FUNCTION FunctionEntry
;
1523 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1525 typedef struct _UNWIND_HISTORY_TABLE
{
1529 ULONG64 HighAddress
;
1530 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1531 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1533 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1539 PFLOAT128 HighFloatingContext
[10];
1561 PULONGLONG IntS0Nat
;
1562 PULONGLONG IntS1Nat
;
1563 PULONGLONG IntS2Nat
;
1564 PULONGLONG IntS3Nat
;
1565 PULONGLONG IntSpNat
;
1581 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1583 ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1585 #endif /* __ia64__ */
1587 /* Alpha context definitions */
1588 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1590 #define CONTEXT_ALPHA 0x00020000
1592 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1593 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1594 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1595 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1597 #define EXCEPTION_READ_FAULT 0
1598 #define EXCEPTION_WRITE_FAULT 1
1599 #define EXCEPTION_EXECUTE_FAULT 8
1601 typedef struct _CONTEXT
1603 /* selected by CONTEXT_FLOATING_POINT */
1637 /* selected by CONTEXT_INTEGER */
1671 /* selected by CONTEXT_FLOATING_POINT */
1675 /* selected by CONTEXT_CONTROL */
1680 } CONTEXT
, *PCONTEXT
;
1682 #define _QUAD_PSR_OFFSET HighSoftFpcr
1683 #define _QUAD_FLAGS_OFFSET HighFir
1685 #endif /* _ALPHA_ */
1689 /* The following flags control the contents of the CONTEXT structure. */
1691 #define CONTEXT_ARM 0x0200000
1692 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1693 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1694 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1695 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1697 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1698 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1700 #define EXCEPTION_READ_FAULT 0
1701 #define EXCEPTION_WRITE_FAULT 1
1702 #define EXCEPTION_EXECUTE_FAULT 8
1704 #define ARM_MAX_BREAKPOINTS 8
1705 #define ARM_MAX_WATCHPOINTS 1
1707 typedef struct _RUNTIME_FUNCTION
1714 DWORD FunctionLength
: 11;
1721 DWORD StackAdjust
: 10;
1724 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1726 #define UNWIND_HISTORY_TABLE_SIZE 12
1728 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1731 PRUNTIME_FUNCTION FunctionEntry
;
1732 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1734 typedef struct _UNWIND_HISTORY_TABLE
1743 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1744 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1746 typedef struct _NEON128
1750 } NEON128
, *PNEON128
;
1752 typedef struct _CONTEXT
1754 ULONG ContextFlags
; /* 000 */
1755 /* CONTEXT_INTEGER */
1766 ULONG R10
; /* 02c */
1767 ULONG R11
; /* 030 */
1768 ULONG R12
; /* 034 */
1769 /* CONTEXT_CONTROL */
1773 ULONG Cpsr
; /* 044 */
1774 /* CONTEXT_FLOATING_POINT */
1775 ULONG Fpscr
; /* 048 */
1776 ULONG Padding
; /* 04c */
1782 } DUMMYUNIONNAME
; /* 050 */
1783 /* CONTEXT_DEBUG_REGISTERS */
1784 ULONG Bvr
[ARM_MAX_BREAKPOINTS
]; /* 150 */
1785 ULONG Bcr
[ARM_MAX_BREAKPOINTS
]; /* 170 */
1786 ULONG Wvr
[ARM_MAX_WATCHPOINTS
]; /* 190 */
1787 ULONG Wcr
[ARM_MAX_WATCHPOINTS
]; /* 194 */
1788 ULONG Padding2
[2]; /* 198 */
1789 } CONTEXT
, *PCONTEXT
;
1791 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1810 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1812 typedef struct _DISPATCHER_CONTEXT
1816 PRUNTIME_FUNCTION FunctionEntry
;
1817 DWORD EstablisherFrame
;
1819 PCONTEXT ContextRecord
;
1820 PEXCEPTION_ROUTINE LanguageHandler
;
1822 PUNWIND_HISTORY_TABLE HistoryTable
;
1824 BOOLEAN ControlPcIsUnwound
;
1825 PBYTE NonVolatileRegisters
;
1827 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
1829 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD
);
1830 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD
);
1832 PVOID WINAPI
RtlVirtualUnwind(DWORD
,DWORD
,DWORD
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,DWORD
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1834 #define UNW_FLAG_NHANDLER 0
1835 #define UNW_FLAG_EHANDLER 1
1836 #define UNW_FLAG_UHANDLER 2
1838 #endif /* __arm__ */
1842 #define CONTEXT_ARM64 0x400000
1843 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001)
1844 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002)
1845 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1846 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1848 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1849 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1851 #define EXCEPTION_READ_FAULT 0
1852 #define EXCEPTION_WRITE_FAULT 1
1853 #define EXCEPTION_EXECUTE_FAULT 8
1855 #define ARM64_MAX_BREAKPOINTS 8
1856 #define ARM64_MAX_WATCHPOINTS 2
1858 typedef struct _RUNTIME_FUNCTION
1867 DWORD FunctionLength
: 11;
1872 DWORD FrameSize
: 9;
1875 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1877 #define UNWIND_HISTORY_TABLE_SIZE 12
1879 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1882 PRUNTIME_FUNCTION FunctionEntry
;
1883 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1885 typedef struct _UNWIND_HISTORY_TABLE
1893 DWORD64 HighAddress
;
1894 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1895 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1897 typedef union _NEON128
1908 } NEON128
, *PNEON128
;
1910 typedef struct _CONTEXT
1912 ULONG ContextFlags
; /* 000 */
1913 /* CONTEXT_INTEGER */
1914 ULONG Cpsr
; /* 004 */
1919 DWORD64 X0
; /* 008 */
1920 DWORD64 X1
; /* 010 */
1921 DWORD64 X2
; /* 018 */
1922 DWORD64 X3
; /* 020 */
1923 DWORD64 X4
; /* 028 */
1924 DWORD64 X5
; /* 030 */
1925 DWORD64 X6
; /* 038 */
1926 DWORD64 X7
; /* 040 */
1927 DWORD64 X8
; /* 048 */
1928 DWORD64 X9
; /* 050 */
1929 DWORD64 X10
; /* 058 */
1930 DWORD64 X11
; /* 060 */
1931 DWORD64 X12
; /* 068 */
1932 DWORD64 X13
; /* 070 */
1933 DWORD64 X14
; /* 078 */
1934 DWORD64 X15
; /* 080 */
1935 DWORD64 X16
; /* 088 */
1936 DWORD64 X17
; /* 090 */
1937 DWORD64 X18
; /* 098 */
1938 DWORD64 X19
; /* 0a0 */
1939 DWORD64 X20
; /* 0a8 */
1940 DWORD64 X21
; /* 0b0 */
1941 DWORD64 X22
; /* 0b8 */
1942 DWORD64 X23
; /* 0c0 */
1943 DWORD64 X24
; /* 0c8 */
1944 DWORD64 X25
; /* 0d0 */
1945 DWORD64 X26
; /* 0d8 */
1946 DWORD64 X27
; /* 0e0 */
1947 DWORD64 X28
; /* 0e8 */
1948 DWORD64 Fp
; /* 0f0 */
1949 DWORD64 Lr
; /* 0f8 */
1951 DWORD64 X
[31]; /* 008 */
1953 /* CONTEXT_CONTROL */
1954 DWORD64 Sp
; /* 100 */
1955 DWORD64 Pc
; /* 108 */
1956 /* CONTEXT_FLOATING_POINT */
1957 NEON128 V
[32]; /* 110 */
1958 DWORD Fpcr
; /* 310 */
1959 DWORD Fpsr
; /* 314 */
1960 /* CONTEXT_DEBUG_REGISTERS */
1961 DWORD Bcr
[ARM64_MAX_BREAKPOINTS
]; /* 318 */
1962 DWORD64 Bvr
[ARM64_MAX_BREAKPOINTS
]; /* 338 */
1963 DWORD Wcr
[ARM64_MAX_WATCHPOINTS
]; /* 378 */
1964 DWORD64 Wvr
[ARM64_MAX_WATCHPOINTS
]; /* 380 */
1965 } CONTEXT
, *PCONTEXT
;
1967 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1989 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1991 typedef struct _DISPATCHER_CONTEXT
1993 ULONG_PTR ControlPc
;
1994 ULONG_PTR ImageBase
;
1995 PRUNTIME_FUNCTION FunctionEntry
;
1996 ULONG_PTR EstablisherFrame
;
1998 PCONTEXT ContextRecord
;
1999 PEXCEPTION_ROUTINE LanguageHandler
;
2001 PUNWIND_HISTORY_TABLE HistoryTable
;
2003 BOOLEAN ControlPcIsUnwound
;
2004 PBYTE NonVolatileRegisters
;
2005 } DISPATCHER_CONTEXT
, *PDISPATCHER_CONTEXT
;
2007 typedef LONG (CALLBACK
*PEXCEPTION_FILTER
)(struct _EXCEPTION_POINTERS
*,DWORD64
);
2008 typedef void (CALLBACK
*PTERMINATION_HANDLER
)(BOOLEAN
,DWORD64
);
2010 PVOID WINAPI
RtlVirtualUnwind(DWORD
,ULONG_PTR
,ULONG_PTR
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG_PTR
*,KNONVOLATILE_CONTEXT_POINTERS
*);
2012 #define UNW_FLAG_NHANDLER 0
2013 #define UNW_FLAG_EHANDLER 1
2014 #define UNW_FLAG_UHANDLER 2
2016 #endif /* __aarch64__ */
2019 /* Mips context definitions */
2020 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
2022 #define CONTEXT_R4000 0x00010000
2024 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
2025 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
2026 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
2028 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2030 #define EXCEPTION_READ_FAULT 0
2031 #define EXCEPTION_WRITE_FAULT 1
2032 #define EXCEPTION_EXECUTE_FAULT 8
2034 typedef struct _CONTEXT
2037 /* These are selected by CONTEXT_FLOATING_POINT */
2071 /* These are selected by CONTEXT_INTEGER */
2107 /* These are selected by CONTEXT_FLOATING_POINT */
2110 /* These are selected by CONTEXT_CONTROL */
2120 /* PowerPC context definitions */
2123 #define CONTEXT_CONTROL 0x0001
2124 #define CONTEXT_FLOATING_POINT 0x0002
2125 #define CONTEXT_INTEGER 0x0004
2126 #define CONTEXT_DEBUG_REGISTERS 0x0008
2127 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2129 #define EXCEPTION_READ_FAULT 0
2130 #define EXCEPTION_WRITE_FAULT 1
2131 #define EXCEPTION_EXECUTE_FAULT 8
2135 /* These are selected by CONTEXT_FLOATING_POINT */
2170 /* These are selected by CONTEXT_INTEGER */
2207 /* These are selected by CONTEXT_CONTROL */
2209 DWORD Iar
; /* Instruction Address Register , aka PC ... */
2215 DWORD Dar
; /* Fault registers for coredump */
2217 DWORD Trap
; /* number of powerpc exception taken */
2219 /* These are selected by CONTEXT_DEBUG_REGISTERS */
2230 typedef struct _STACK_FRAME_HEADER
2247 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
2249 #endif /* __powerpc__ */
2251 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
2252 #error You need to define a CONTEXT for your CPU
2255 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
2257 #define WOW64_CONTEXT_i386 0x00010000
2258 #define WOW64_CONTEXT_i486 0x00010000
2259 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
2260 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
2261 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
2262 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
2263 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
2264 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
2265 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2266 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
2267 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
2268 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
2269 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
2271 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2273 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
2274 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
2275 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
2276 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
2278 #define WOW64_SIZE_OF_80387_REGISTERS 80
2279 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
2281 typedef struct _WOW64_FLOATING_SAVE_AREA
2287 DWORD ErrorSelector
;
2290 BYTE RegisterArea
[WOW64_SIZE_OF_80387_REGISTERS
];
2292 } WOW64_FLOATING_SAVE_AREA
, *PWOW64_FLOATING_SAVE_AREA
;
2294 #include "pshpack4.h"
2295 typedef struct _WOW64_CONTEXT
2304 WOW64_FLOATING_SAVE_AREA FloatSave
;
2321 BYTE ExtendedRegisters
[WOW64_MAXIMUM_SUPPORTED_EXTENSION
];
2322 } WOW64_CONTEXT
, *PWOW64_CONTEXT
;
2323 #include "poppack.h"
2325 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
2327 typedef PRUNTIME_FUNCTION (CALLBACK
*PGET_RUNTIME_FUNCTION_CALLBACK
)(DWORD_PTR
,PVOID
);
2329 BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD_PTR
);
2330 DWORD WINAPI
RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION
,DWORD
,DWORD
,ULONG_PTR
,ULONG_PTR
);
2331 BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
2332 void WINAPI
RtlDeleteGrowableFunctionTable(void*);
2333 void WINAPI
RtlGrowFunctionTable(void*,DWORD
);
2334 BOOLEAN CDECL
RtlInstallFunctionTableCallback(DWORD_PTR
,DWORD_PTR
,DWORD
,PGET_RUNTIME_FUNCTION_CALLBACK
,PVOID
,PCWSTR
);
2335 PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD_PTR
,DWORD_PTR
*,UNWIND_HISTORY_TABLE
*);
2336 void WINAPI
RtlUnwindEx(PVOID
,PVOID
,struct _EXCEPTION_RECORD
*,PVOID
,CONTEXT
*,UNWIND_HISTORY_TABLE
*);
2342 #define PRODUCT_UNDEFINED 0x00000000
2343 #define PRODUCT_ULTIMATE 0x00000001
2344 #define PRODUCT_HOME_BASIC 0x00000002
2345 #define PRODUCT_HOME_PREMIUM 0x00000003
2346 #define PRODUCT_ENTERPRISE 0x00000004
2347 #define PRODUCT_HOME_BASIC_N 0x00000005
2348 #define PRODUCT_BUSINESS 0x00000006
2349 #define PRODUCT_STANDARD_SERVER 0x00000007
2350 #define PRODUCT_DATACENTER_SERVER 0x00000008
2351 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
2352 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
2353 #define PRODUCT_STARTER 0x0000000B
2354 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
2355 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
2356 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
2357 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
2358 #define PRODUCT_BUSINESS_N 0x00000010
2359 #define PRODUCT_WEB_SERVER 0x00000011
2360 #define PRODUCT_CLUSTER_SERVER 0x00000012
2361 #define PRODUCT_HOME_SERVER 0x00000013
2362 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2363 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2364 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2365 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2366 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
2367 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
2368 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
2369 #define PRODUCT_ENTERPRISE_N 0x0000001B
2370 #define PRODUCT_ULTIMATE_N 0x0000001C
2371 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2372 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
2373 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
2374 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
2375 #define PRODUCT_SERVER_FOUNDATION 0x00000021
2376 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
2377 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
2378 #define PRODUCT_STANDARD_SERVER_V 0x00000024
2379 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
2380 #define PRODUCT_SERVER_V 0x00000025
2381 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
2382 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
2383 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
2384 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
2385 #define PRODUCT_HYPERV 0x0000002A
2386 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
2387 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
2388 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
2389 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
2390 #define PRODUCT_STARTER_N 0x0000002F
2391 #define PRODUCT_PROFESSIONAL 0x00000030
2392 #define PRODUCT_PROFESSIONAL_N 0x00000031
2393 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2394 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2395 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2396 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2397 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2398 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2399 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2400 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2401 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2402 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2403 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2404 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2405 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2406 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2407 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2408 #define PRODUCT_EMBEDDED 0x00000041
2409 #define PRODUCT_STARTER_E 0x00000042
2410 #define PRODUCT_HOME_BASIC_E 0x00000043
2411 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2412 #define PRODUCT_PROFESSIONAL_E 0x00000045
2413 #define PRODUCT_ENTERPRISE_E 0x00000046
2414 #define PRODUCT_ULTIMATE_E 0x00000047
2415 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2416 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2417 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2418 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2419 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2420 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2421 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2422 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2423 #define PRODUCT_THINPC 0x00000057
2424 #define PRODUCT_EMBEDDED_A 0x00000058
2425 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2426 #define PRODUCT_EMBEDDED_E 0x0000005A
2427 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2428 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2429 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2430 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2431 #define PRODUCT_CORE_ARM 0x00000061
2432 #define PRODUCT_CORE_N 0x00000062
2433 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2434 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2435 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2436 #define PRODUCT_CORE 0x00000065
2437 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2438 #define PRODUCT_MOBILE_CORE 0x00000068
2439 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2440 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2441 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2442 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2443 #define PRODUCT_NANO_SERVER 0x0000006D
2444 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2445 #define PRODUCT_CORE_CONNECTED 0x0000006F
2446 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2447 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2448 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2449 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2450 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2451 #define PRODUCT_CONNECTED_CAR 0x00000075
2452 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2453 #define PRODUCT_PPI_PRO 0x00000077
2454 #define PRODUCT_ARM64_SERVER 0x00000078
2455 #define PRODUCT_EDUCATION 0x00000079
2456 #define PRODUCT_EDUCATION_N 0x0000007A
2457 #define PRODUCT_IOTUAP 0x0000007B
2458 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2459 #define PRODUCT_ENTERPRISE_S 0x0000007D
2460 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2461 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2462 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2463 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2464 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2465 #define PRODUCT_UNLICENSED 0xABCDABCD
2472 #define MAKELCID(l, s) (MAKELONG(l, s))
2474 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2475 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2476 #define SUBLANGID(l) ((WORD)(l) >> 10)
2478 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2479 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2481 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2482 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2483 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2484 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2485 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2486 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2487 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2488 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2489 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2490 #define LOCALE_NAME_MAX_LENGTH 85
2493 #define UNREFERENCED_PARAMETER(u) (void)(u)
2494 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2495 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2501 * Definitions for IsTextUnicode()
2504 #define IS_TEXT_UNICODE_ASCII16 0x0001
2505 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2506 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2507 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2508 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2509 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2510 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2511 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2512 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2513 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2514 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2515 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2516 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2517 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2518 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2519 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2521 #define MAXIMUM_WAIT_OBJECTS 64
2522 #define MAXIMUM_SUSPEND_COUNT 127
2524 #define WT_EXECUTEDEFAULT 0x00
2525 #define WT_EXECUTEINIOTHREAD 0x01
2526 #define WT_EXECUTEINUITHREAD 0x02
2527 #define WT_EXECUTEINWAITTHREAD 0x04
2528 #define WT_EXECUTEONLYONCE 0x08
2529 #define WT_EXECUTELONGFUNCTION 0x10
2530 #define WT_EXECUTEINTIMERTHREAD 0x20
2531 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2532 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2533 #define WT_EXECUTEINLONGTHREAD 0x10
2534 #define WT_EXECUTEDELETEWAIT 0x08
2535 #define WT_TRANSFER_IMPERSONATION 0x0100
2538 #define EXCEPTION_CONTINUABLE 0
2539 #define EXCEPTION_NONCONTINUABLE 0x01
2542 * The exception record used by Win32 to give additional information
2543 * about exception to exception handlers.
2546 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2548 typedef struct _EXCEPTION_RECORD
2550 DWORD ExceptionCode
;
2551 DWORD ExceptionFlags
;
2552 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2554 PVOID ExceptionAddress
;
2555 DWORD NumberParameters
;
2556 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2557 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2559 typedef struct _EXCEPTION_RECORD32
2561 DWORD ExceptionCode
;
2562 DWORD ExceptionFlags
;
2563 DWORD ExceptionRecord
;
2564 DWORD ExceptionAddress
;
2565 DWORD NumberParameters
;
2566 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2567 } EXCEPTION_RECORD32
, *PEXCEPTION_RECORD32
;
2569 typedef struct _EXCEPTION_RECORD64
2571 DWORD ExceptionCode
;
2572 DWORD ExceptionFlags
;
2573 DWORD64 ExceptionRecord
;
2574 DWORD64 ExceptionAddress
;
2575 DWORD NumberParameters
;
2576 DWORD __unusedAlignment
;
2577 DWORD64 ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2578 } EXCEPTION_RECORD64
, *PEXCEPTION_RECORD64
;
2581 * The exception pointers structure passed to exception filters
2582 * in except() and the UnhandledExceptionFilter().
2585 typedef struct _EXCEPTION_POINTERS
2587 PEXCEPTION_RECORD ExceptionRecord
;
2588 PCONTEXT ContextRecord
;
2589 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2593 * The exception frame, used for registering exception handlers
2594 * Win32 cares only about this, but compilers generally emit
2595 * larger exception frames for their own use.
2598 struct _EXCEPTION_REGISTRATION_RECORD
;
2600 typedef DWORD (CDECL
*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2601 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2603 typedef struct _EXCEPTION_REGISTRATION_RECORD
2605 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2606 PEXCEPTION_HANDLER Handler
;
2607 } EXCEPTION_REGISTRATION_RECORD
;
2610 * function pointer to an exception filter
2613 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2615 typedef struct _NT_TIB
2617 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2625 PVOID ArbitraryUserPointer
;
2626 struct _NT_TIB
*Self
;
2631 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2632 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2635 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2638 #elif defined(__i386__) && defined(_MSC_VER)
2639 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2642 __asm mov eax
, fs
:[0x18];
2646 #elif defined(__x86_64__) && defined(__GNUC__)
2647 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2650 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2653 #elif defined(__x86_64__) && defined(_MSC_VER)
2654 #pragma intrinsic(__readgsqword)
2655 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2657 return (struct _TEB
*)__readgsqword(FIELD_OFFSET(NT_TIB
, Self
));
2660 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2663 #ifdef NONAMELESSUNION
2664 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2666 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2668 #define GetFiberData() (*(void **)GetCurrentFiber())
2670 #define TLS_MINIMUM_AVAILABLE 64
2672 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2674 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2675 #define IO_REPARSE_TAG_RESERVED_ONE 1
2676 #define IO_REPARSE_TAG_RESERVED_TWO 2
2678 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2680 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2681 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2682 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2683 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2684 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2685 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2686 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2687 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2688 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2689 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2690 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2691 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2692 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2693 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2694 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2695 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2696 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2697 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2698 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2699 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2700 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2701 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2702 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2703 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2704 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2705 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2706 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2707 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2708 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2709 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2710 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2711 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2712 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2713 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2714 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2715 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2716 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2717 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2718 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2719 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2720 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2721 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2722 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2725 * File formats definitions
2728 #include <pshpack2.h>
2729 typedef struct _IMAGE_DOS_HEADER
{
2730 WORD e_magic
; /* 00: MZ Header signature */
2731 WORD e_cblp
; /* 02: Bytes on last page of file */
2732 WORD e_cp
; /* 04: Pages in file */
2733 WORD e_crlc
; /* 06: Relocations */
2734 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2735 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2736 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2737 WORD e_ss
; /* 0e: Initial (relative) SS value */
2738 WORD e_sp
; /* 10: Initial SP value */
2739 WORD e_csum
; /* 12: Checksum */
2740 WORD e_ip
; /* 14: Initial IP value */
2741 WORD e_cs
; /* 16: Initial (relative) CS value */
2742 WORD e_lfarlc
; /* 18: File address of relocation table */
2743 WORD e_ovno
; /* 1a: Overlay number */
2744 WORD e_res
[4]; /* 1c: Reserved words */
2745 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2746 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2747 WORD e_res2
[10]; /* 28: Reserved words */
2748 DWORD e_lfanew
; /* 3c: Offset to extended header */
2749 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2750 #include <poppack.h>
2752 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2753 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2754 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2755 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2756 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2757 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2760 * This is the Windows executable (NE) header.
2761 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2763 #include <pshpack2.h>
2766 WORD ne_magic
; /* 00 NE signature 'NE' */
2767 BYTE ne_ver
; /* 02 Linker version number */
2768 BYTE ne_rev
; /* 03 Linker revision number */
2769 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2770 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2771 LONG ne_crc
; /* 08 Checksum */
2772 WORD ne_flags
; /* 0c Flags about segments in this file */
2773 WORD ne_autodata
; /* 0e Automatic data segment number */
2774 WORD ne_heap
; /* 10 Initial size of local heap */
2775 WORD ne_stack
; /* 12 Initial size of stack */
2776 DWORD ne_csip
; /* 14 Initial CS:IP */
2777 DWORD ne_sssp
; /* 18 Initial SS:SP */
2778 WORD ne_cseg
; /* 1c # of entries in segment table */
2779 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2780 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2781 WORD ne_segtab
; /* 22 Offset to segment table */
2782 WORD ne_rsrctab
; /* 24 Offset to resource table */
2783 WORD ne_restab
; /* 26 Offset to resident-name table */
2784 WORD ne_modtab
; /* 28 Offset to module reference table */
2785 WORD ne_imptab
; /* 2a Offset to imported name table */
2786 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2787 WORD ne_cmovent
; /* 30 # of movable entry points */
2788 WORD ne_align
; /* 32 Logical sector alignment shift count */
2789 WORD ne_cres
; /* 34 # of resource segments */
2790 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2791 BYTE ne_flagsothers
; /* 37 Additional information flags */
2792 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2793 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2794 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2795 WORD ne_expver
; /* 3e Expected Windows version number */
2796 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2797 #include <poppack.h>
2799 #include <pshpack2.h>
2800 typedef struct _IMAGE_VXD_HEADER
{
2815 DWORD e32_lastpagesize
;
2816 DWORD e32_fixupsize
;
2833 DWORD e32_impmodcnt
;
2839 DWORD e32_cbnrestab
;
2842 DWORD e32_debuginfo
;
2844 DWORD e32_instpreload
;
2845 DWORD e32_instdemand
;
2848 DWORD e32_winresoff
;
2849 DWORD e32_winreslen
;
2852 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2853 #include <poppack.h>
2855 /* These defines describe the meanings of the bits in the Characteristics
2858 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2859 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2860 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2861 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2862 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2863 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2864 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2865 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2866 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2867 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2868 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2869 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2870 #define IMAGE_FILE_SYSTEM 0x1000
2871 #define IMAGE_FILE_DLL 0x2000
2872 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2873 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2875 /* These are the settings of the Machine field. */
2876 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2877 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
2878 #define IMAGE_FILE_MACHINE_I860 0x014d
2879 #define IMAGE_FILE_MACHINE_I386 0x014c
2880 #define IMAGE_FILE_MACHINE_R3000 0x0162
2881 #define IMAGE_FILE_MACHINE_R4000 0x0166
2882 #define IMAGE_FILE_MACHINE_R10000 0x0168
2883 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2884 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2885 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2886 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2887 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2888 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2889 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2890 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2891 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2892 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
2893 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
2894 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2895 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2896 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2897 #define IMAGE_FILE_MACHINE_IA64 0x0200
2898 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2899 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2900 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2901 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2902 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2903 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2904 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2905 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2906 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2907 #define IMAGE_FILE_MACHINE_M32R 0x9041
2908 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2910 #define IMAGE_SIZEOF_FILE_HEADER 20
2911 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2912 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2913 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2914 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2915 #define IMAGE_SIZEOF_SHORT_NAME 8
2916 #define IMAGE_SIZEOF_SECTION_HEADER 40
2917 #define IMAGE_SIZEOF_SYMBOL 18
2918 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2919 #define IMAGE_SIZEOF_RELOCATION 10
2920 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2921 #define IMAGE_SIZEOF_LINENUMBER 6
2922 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2924 /* Possible Magic values */
2925 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2926 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2927 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2930 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2931 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2933 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2934 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2937 /* These are indexes into the DataDirectory array */
2938 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2939 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2940 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2941 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2942 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2943 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2944 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2945 #define IMAGE_FILE_DESCRIPTION_STRING 7
2946 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2947 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2948 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2950 /* Directory Entries, indices into the DataDirectory array */
2952 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2953 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2954 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2955 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2956 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2957 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2958 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2959 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2960 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2961 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2962 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2963 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2964 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2965 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2966 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2968 /* Subsystem Values */
2970 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2971 #define IMAGE_SUBSYSTEM_NATIVE 1
2972 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2973 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2974 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2975 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2976 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2977 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2978 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2979 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2980 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2981 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2982 #define IMAGE_SUBSYSTEM_XBOX 14
2983 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2985 /* DLL Characteristics */
2986 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2987 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2988 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2989 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2990 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2991 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2992 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2993 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2995 typedef struct _IMAGE_FILE_HEADER
{
2997 WORD NumberOfSections
;
2998 DWORD TimeDateStamp
;
2999 DWORD PointerToSymbolTable
;
3000 DWORD NumberOfSymbols
;
3001 WORD SizeOfOptionalHeader
;
3002 WORD Characteristics
;
3003 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
3005 typedef struct _IMAGE_DATA_DIRECTORY
{
3006 DWORD VirtualAddress
;
3008 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
3010 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
3012 typedef struct _IMAGE_OPTIONAL_HEADER64
{
3013 WORD Magic
; /* 0x20b */
3014 BYTE MajorLinkerVersion
;
3015 BYTE MinorLinkerVersion
;
3017 DWORD SizeOfInitializedData
;
3018 DWORD SizeOfUninitializedData
;
3019 DWORD AddressOfEntryPoint
;
3021 ULONGLONG ImageBase
;
3022 DWORD SectionAlignment
;
3023 DWORD FileAlignment
;
3024 WORD MajorOperatingSystemVersion
;
3025 WORD MinorOperatingSystemVersion
;
3026 WORD MajorImageVersion
;
3027 WORD MinorImageVersion
;
3028 WORD MajorSubsystemVersion
;
3029 WORD MinorSubsystemVersion
;
3030 DWORD Win32VersionValue
;
3032 DWORD SizeOfHeaders
;
3035 WORD DllCharacteristics
;
3036 ULONGLONG SizeOfStackReserve
;
3037 ULONGLONG SizeOfStackCommit
;
3038 ULONGLONG SizeOfHeapReserve
;
3039 ULONGLONG SizeOfHeapCommit
;
3041 DWORD NumberOfRvaAndSizes
;
3042 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
3043 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
3045 typedef struct _IMAGE_NT_HEADERS64
{
3047 IMAGE_FILE_HEADER FileHeader
;
3048 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
3049 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
3051 typedef struct _IMAGE_OPTIONAL_HEADER
{
3053 /* Standard fields */
3055 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
3056 BYTE MajorLinkerVersion
;
3057 BYTE MinorLinkerVersion
;
3059 DWORD SizeOfInitializedData
;
3060 DWORD SizeOfUninitializedData
;
3061 DWORD AddressOfEntryPoint
; /* 0x10 */
3065 /* NT additional fields */
3068 DWORD SectionAlignment
; /* 0x20 */
3069 DWORD FileAlignment
;
3070 WORD MajorOperatingSystemVersion
;
3071 WORD MinorOperatingSystemVersion
;
3072 WORD MajorImageVersion
;
3073 WORD MinorImageVersion
;
3074 WORD MajorSubsystemVersion
; /* 0x30 */
3075 WORD MinorSubsystemVersion
;
3076 DWORD Win32VersionValue
;
3078 DWORD SizeOfHeaders
;
3079 DWORD CheckSum
; /* 0x40 */
3081 WORD DllCharacteristics
;
3082 DWORD SizeOfStackReserve
;
3083 DWORD SizeOfStackCommit
;
3084 DWORD SizeOfHeapReserve
; /* 0x50 */
3085 DWORD SizeOfHeapCommit
;
3087 DWORD NumberOfRvaAndSizes
;
3088 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
3090 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
3092 typedef struct _IMAGE_NT_HEADERS
{
3093 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
3094 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
3095 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
3096 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
3099 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
3100 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
3101 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
3102 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
3104 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
3105 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
3106 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
3107 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
3110 #define IMAGE_SIZEOF_SHORT_NAME 8
3112 typedef struct _IMAGE_SECTION_HEADER
{
3113 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
3115 DWORD PhysicalAddress
;
3118 DWORD VirtualAddress
;
3119 DWORD SizeOfRawData
;
3120 DWORD PointerToRawData
;
3121 DWORD PointerToRelocations
;
3122 DWORD PointerToLinenumbers
;
3123 WORD NumberOfRelocations
;
3124 WORD NumberOfLinenumbers
;
3125 DWORD Characteristics
;
3126 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
3128 #define IMAGE_SIZEOF_SECTION_HEADER 40
3130 #define IMAGE_FIRST_SECTION(ntheader) \
3131 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
3132 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
3134 /* These defines are for the Characteristics bitfield. */
3135 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
3136 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
3137 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
3138 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
3139 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
3140 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
3142 #define IMAGE_SCN_CNT_CODE 0x00000020
3143 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
3144 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
3146 #define IMAGE_SCN_LNK_OTHER 0x00000100
3147 #define IMAGE_SCN_LNK_INFO 0x00000200
3148 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
3149 #define IMAGE_SCN_LNK_REMOVE 0x00000800
3150 #define IMAGE_SCN_LNK_COMDAT 0x00001000
3152 /* 0x00002000 - Reserved */
3153 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
3154 #define IMAGE_SCN_MEM_FARDATA 0x00008000
3156 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
3157 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
3158 #define IMAGE_SCN_MEM_16BIT 0x00020000
3159 #define IMAGE_SCN_MEM_LOCKED 0x00040000
3160 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
3162 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
3163 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
3164 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
3165 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
3166 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
3167 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
3168 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
3169 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
3170 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
3171 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
3172 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
3173 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
3174 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
3175 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
3176 /* 0x00F00000 - Unused */
3177 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
3179 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3182 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3183 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3184 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3185 #define IMAGE_SCN_MEM_SHARED 0x10000000
3186 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3187 #define IMAGE_SCN_MEM_READ 0x40000000
3188 #define IMAGE_SCN_MEM_WRITE 0x80000000
3190 #include <pshpack2.h>
3192 typedef struct _IMAGE_SYMBOL
{
3202 SHORT SectionNumber
;
3205 BYTE NumberOfAuxSymbols
;
3207 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
3209 #define IMAGE_SIZEOF_SYMBOL 18
3211 typedef struct _IMAGE_LINENUMBER
{
3213 DWORD SymbolTableIndex
;
3214 DWORD VirtualAddress
;
3218 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
3220 #define IMAGE_SIZEOF_LINENUMBER 6
3222 typedef union _IMAGE_AUX_SYMBOL
{
3234 DWORD PointerToLinenumber
;
3235 DWORD PointerToNextFunction
;
3244 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
3248 WORD NumberOfRelocations
;
3249 WORD NumberOfLinenumbers
;
3255 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
3257 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3259 #include <poppack.h>
3261 #define IMAGE_SYM_UNDEFINED (SHORT)0
3262 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3263 #define IMAGE_SYM_DEBUG (SHORT)-2
3265 #define IMAGE_SYM_TYPE_NULL 0x0000
3266 #define IMAGE_SYM_TYPE_VOID 0x0001
3267 #define IMAGE_SYM_TYPE_CHAR 0x0002
3268 #define IMAGE_SYM_TYPE_SHORT 0x0003
3269 #define IMAGE_SYM_TYPE_INT 0x0004
3270 #define IMAGE_SYM_TYPE_LONG 0x0005
3271 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3272 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3273 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3274 #define IMAGE_SYM_TYPE_UNION 0x0009
3275 #define IMAGE_SYM_TYPE_ENUM 0x000A
3276 #define IMAGE_SYM_TYPE_MOE 0x000B
3277 #define IMAGE_SYM_TYPE_BYTE 0x000C
3278 #define IMAGE_SYM_TYPE_WORD 0x000D
3279 #define IMAGE_SYM_TYPE_UINT 0x000E
3280 #define IMAGE_SYM_TYPE_DWORD 0x000F
3281 #define IMAGE_SYM_TYPE_PCODE 0x8000
3283 #define IMAGE_SYM_DTYPE_NULL 0
3284 #define IMAGE_SYM_DTYPE_POINTER 1
3285 #define IMAGE_SYM_DTYPE_FUNCTION 2
3286 #define IMAGE_SYM_DTYPE_ARRAY 3
3288 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3289 #define IMAGE_SYM_CLASS_NULL 0x0000
3290 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3291 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3292 #define IMAGE_SYM_CLASS_STATIC 0x0003
3293 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3294 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3295 #define IMAGE_SYM_CLASS_LABEL 0x0006
3296 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3297 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3298 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3299 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3300 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3301 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3302 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3303 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3304 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3305 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3306 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3307 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3309 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3310 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3311 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3312 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3313 #define IMAGE_SYM_CLASS_FILE 0x0067
3314 #define IMAGE_SYM_CLASS_SECTION 0x0068
3315 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3317 #define N_BTMASK 0x000F
3318 #define N_TMASK 0x0030
3319 #define N_TMASK1 0x00C0
3320 #define N_TMASK2 0x00F0
3324 #define BTYPE(x) ((x) & N_BTMASK)
3327 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3331 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3335 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3339 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3343 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3346 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3349 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3350 #define IMAGE_COMDAT_SELECT_ANY 2
3351 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3352 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3353 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3354 #define IMAGE_COMDAT_SELECT_LARGEST 6
3355 #define IMAGE_COMDAT_SELECT_NEWEST 7
3357 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3358 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3359 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3361 /* Export module directory */
3363 typedef struct _IMAGE_EXPORT_DIRECTORY
{
3364 DWORD Characteristics
;
3365 DWORD TimeDateStamp
;
3370 DWORD NumberOfFunctions
;
3371 DWORD NumberOfNames
;
3372 DWORD AddressOfFunctions
;
3373 DWORD AddressOfNames
;
3374 DWORD AddressOfNameOrdinals
;
3375 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3377 /* Import name entry */
3378 typedef struct _IMAGE_IMPORT_BY_NAME
{
3381 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3383 #include <pshpack8.h>
3385 typedef struct _IMAGE_THUNK_DATA64
{
3387 ULONGLONG ForwarderString
;
3390 ULONGLONG AddressOfData
;
3392 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3393 #include <poppack.h>
3395 typedef struct _IMAGE_THUNK_DATA32
{
3397 DWORD ForwarderString
;
3400 DWORD AddressOfData
;
3402 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3404 /* Import module directory */
3406 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3408 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3409 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3411 DWORD TimeDateStamp
; /* 0 if not bound,
3412 * -1 if bound, and real date\time stamp
3413 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3415 * otherwise date/time stamp of DLL bound to
3418 DWORD ForwarderChain
; /* -1 if no forwarders */
3420 /* RVA to IAT (if bound this IAT has actual addresses) */
3422 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3424 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3425 #define IMAGE_ORDINAL_FLAG32 0x80000000
3426 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3427 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3428 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3429 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3432 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3433 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3434 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3435 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3436 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3438 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3439 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3440 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3441 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3442 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3445 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3447 DWORD TimeDateStamp
;
3448 WORD OffsetModuleName
;
3449 WORD NumberOfModuleForwarderRefs
;
3450 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3451 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3453 typedef struct _IMAGE_BOUND_FORWARDER_REF
3455 DWORD TimeDateStamp
;
3456 WORD OffsetModuleName
;
3458 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3460 typedef struct _IMAGE_BASE_RELOCATION
3462 DWORD VirtualAddress
;
3464 /* WORD TypeOffset[1]; */
3465 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3467 #include <pshpack2.h>
3469 typedef struct _IMAGE_RELOCATION
3472 DWORD VirtualAddress
;
3475 DWORD SymbolTableIndex
;
3477 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3479 #include <poppack.h>
3481 #define IMAGE_SIZEOF_RELOCATION 10
3483 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
3487 DWORD AllAttributes
;
3491 DWORD ReservedAttributes
:31;
3496 DWORD ModuleHandleRVA
;
3497 DWORD ImportAddressTableRVA
;
3498 DWORD ImportNameTableRVA
;
3499 DWORD BoundImportAddressTableRVA
;
3500 DWORD UnloadInformationTableRVA
;
3501 DWORD TimeDateStamp
;
3502 } IMAGE_DELAYLOAD_DESCRIPTOR
, *PIMAGE_DELAYLOAD_DESCRIPTOR
;
3503 typedef const IMAGE_DELAYLOAD_DESCRIPTOR
*PCIMAGE_DELAYLOAD_DESCRIPTOR
;
3505 /* generic relocation types */
3506 #define IMAGE_REL_BASED_ABSOLUTE 0
3507 #define IMAGE_REL_BASED_HIGH 1
3508 #define IMAGE_REL_BASED_LOW 2
3509 #define IMAGE_REL_BASED_HIGHLOW 3
3510 #define IMAGE_REL_BASED_HIGHADJ 4
3511 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3512 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3513 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3514 #define IMAGE_REL_BASED_SECTION 6
3515 #define IMAGE_REL_BASED_REL 7
3516 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3517 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3518 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3519 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3520 #define IMAGE_REL_BASED_DIR64 10
3521 #define IMAGE_REL_BASED_HIGH3ADJ 11
3523 /* I386 relocation types */
3524 #define IMAGE_REL_I386_ABSOLUTE 0
3525 #define IMAGE_REL_I386_DIR16 1
3526 #define IMAGE_REL_I386_REL16 2
3527 #define IMAGE_REL_I386_DIR32 6
3528 #define IMAGE_REL_I386_DIR32NB 7
3529 #define IMAGE_REL_I386_SEG12 9
3530 #define IMAGE_REL_I386_SECTION 10
3531 #define IMAGE_REL_I386_SECREL 11
3532 #define IMAGE_REL_I386_TOKEN 12
3533 #define IMAGE_REL_I386_SECREL7 13
3534 #define IMAGE_REL_I386_REL32 20
3536 /* MIPS relocation types */
3537 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3538 #define IMAGE_REL_MIPS_REFHALF 0x0001
3539 #define IMAGE_REL_MIPS_REFWORD 0x0002
3540 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3541 #define IMAGE_REL_MIPS_REFHI 0x0004
3542 #define IMAGE_REL_MIPS_REFLO 0x0005
3543 #define IMAGE_REL_MIPS_GPREL 0x0006
3544 #define IMAGE_REL_MIPS_LITERAL 0x0007
3545 #define IMAGE_REL_MIPS_SECTION 0x000A
3546 #define IMAGE_REL_MIPS_SECREL 0x000B
3547 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3548 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3549 #define IMAGE_REL_MIPS_TOKEN 0x000E
3550 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3551 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3552 #define IMAGE_REL_MIPS_PAIR 0x0025
3554 /* ALPHA relocation types */
3555 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3556 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3557 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3558 #define IMAGE_REL_ALPHA_GPREL 0x0003
3559 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3560 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3561 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3562 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3563 #define IMAGE_REL_ALPHA_HINT 0x0008
3564 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3565 #define IMAGE_REL_ALPHA_REFHI 0x000A
3566 #define IMAGE_REL_ALPHA_REFLO 0x000B
3567 #define IMAGE_REL_ALPHA_PAIR 0x000C
3568 #define IMAGE_REL_ALPHA_MATCH 0x000D
3569 #define IMAGE_REL_ALPHA_SECTION 0x000E
3570 #define IMAGE_REL_ALPHA_SECREL 0x000F
3571 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3572 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3573 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3574 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3575 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3576 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3577 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3578 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3580 /* PowerPC relocation types */
3581 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3582 #define IMAGE_REL_PPC_ADDR64 0x0001
3583 #define IMAGE_REL_PPC_ADDR 0x0002
3584 #define IMAGE_REL_PPC_ADDR24 0x0003
3585 #define IMAGE_REL_PPC_ADDR16 0x0004
3586 #define IMAGE_REL_PPC_ADDR14 0x0005
3587 #define IMAGE_REL_PPC_REL24 0x0006
3588 #define IMAGE_REL_PPC_REL14 0x0007
3589 #define IMAGE_REL_PPC_TOCREL16 0x0008
3590 #define IMAGE_REL_PPC_TOCREL14 0x0009
3591 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3592 #define IMAGE_REL_PPC_SECREL 0x000B
3593 #define IMAGE_REL_PPC_SECTION 0x000C
3594 #define IMAGE_REL_PPC_IFGLUE 0x000D
3595 #define IMAGE_REL_PPC_IMGLUE 0x000E
3596 #define IMAGE_REL_PPC_SECREL16 0x000F
3597 #define IMAGE_REL_PPC_REFHI 0x0010
3598 #define IMAGE_REL_PPC_REFLO 0x0011
3599 #define IMAGE_REL_PPC_PAIR 0x0012
3600 #define IMAGE_REL_PPC_SECRELLO 0x0013
3601 #define IMAGE_REL_PPC_SECRELHI 0x0014
3602 #define IMAGE_REL_PPC_GPREL 0x0015
3603 #define IMAGE_REL_PPC_TOKEN 0x0016
3604 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3606 #define IMAGE_REL_PPC_NEG 0x0100
3607 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3608 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3609 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3611 /* SH3 relocation types */
3612 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3613 #define IMAGE_REL_SH3_DIRECT16 0x0001
3614 #define IMAGE_REL_SH3_DIRECT 0x0002
3615 #define IMAGE_REL_SH3_DIRECT8 0x0003
3616 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3617 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3618 #define IMAGE_REL_SH3_DIRECT4 0x0006
3619 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3620 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3621 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3622 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3623 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3624 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3625 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3626 #define IMAGE_REL_SH3_SECTION 0x000E
3627 #define IMAGE_REL_SH3_SECREL 0x000F
3628 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3629 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3630 #define IMAGE_REL_SH3_TOKEN 0x0012
3632 /* ARM relocation types */
3633 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3634 #define IMAGE_REL_ARM_ADDR 0x0001
3635 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3636 #define IMAGE_REL_ARM_BRANCH24 0x0003
3637 #define IMAGE_REL_ARM_BRANCH11 0x0004
3638 #define IMAGE_REL_ARM_TOKEN 0x0005
3639 #define IMAGE_REL_ARM_GPREL12 0x0006
3640 #define IMAGE_REL_ARM_GPREL7 0x0007
3641 #define IMAGE_REL_ARM_BLX24 0x0008
3642 #define IMAGE_REL_ARM_BLX11 0x0009
3643 #define IMAGE_REL_ARM_SECTION 0x000E
3644 #define IMAGE_REL_ARM_SECREL 0x000F
3645 #define IMAGE_REL_ARM_MOV32A 0x0010
3646 #define IMAGE_REL_ARM_MOV32T 0x0011
3647 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3648 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3649 #define IMAGE_REL_ARM_BLX23T 0x0015
3651 /* ARM64 relocation types */
3652 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3653 #define IMAGE_REL_ARM64_ADDR32 0x0001
3654 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3655 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3656 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3657 #define IMAGE_REL_ARM64_REL21 0x0005
3658 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3659 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3660 #define IMAGE_REL_ARM64_SECREL 0x0008
3661 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3662 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3663 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3664 #define IMAGE_REL_ARM64_TOKEN 0x000C
3665 #define IMAGE_REL_ARM64_SECTION 0x000D
3666 #define IMAGE_REL_ARM64_ADDR64 0x000E
3667 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3669 /* IA64 relocation types */
3670 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3671 #define IMAGE_REL_IA64_IMM14 0x0001
3672 #define IMAGE_REL_IA64_IMM22 0x0002
3673 #define IMAGE_REL_IA64_IMM64 0x0003
3674 #define IMAGE_REL_IA64_DIR 0x0004
3675 #define IMAGE_REL_IA64_DIR64 0x0005
3676 #define IMAGE_REL_IA64_PCREL21B 0x0006
3677 #define IMAGE_REL_IA64_PCREL21M 0x0007
3678 #define IMAGE_REL_IA64_PCREL21F 0x0008
3679 #define IMAGE_REL_IA64_GPREL22 0x0009
3680 #define IMAGE_REL_IA64_LTOFF22 0x000A
3681 #define IMAGE_REL_IA64_SECTION 0x000B
3682 #define IMAGE_REL_IA64_SECREL22 0x000C
3683 #define IMAGE_REL_IA64_SECREL64I 0x000D
3684 #define IMAGE_REL_IA64_SECREL 0x000E
3685 #define IMAGE_REL_IA64_LTOFF64 0x000F
3686 #define IMAGE_REL_IA64_DIR32NB 0x0010
3687 #define IMAGE_REL_IA64_SREL14 0x0011
3688 #define IMAGE_REL_IA64_SREL22 0x0012
3689 #define IMAGE_REL_IA64_SREL32 0x0013
3690 #define IMAGE_REL_IA64_UREL32 0x0014
3691 #define IMAGE_REL_IA64_PCREL60X 0x0015
3692 #define IMAGE_REL_IA64_PCREL60B 0x0016
3693 #define IMAGE_REL_IA64_PCREL60F 0x0017
3694 #define IMAGE_REL_IA64_PCREL60I 0x0018
3695 #define IMAGE_REL_IA64_PCREL60M 0x0019
3696 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3697 #define IMAGE_REL_IA64_TOKEN 0x001B
3698 #define IMAGE_REL_IA64_GPREL32 0x001C
3699 #define IMAGE_REL_IA64_ADDEND 0x001F
3701 /* AMD64 relocation types */
3702 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3703 #define IMAGE_REL_AMD64_ADDR64 0x0001
3704 #define IMAGE_REL_AMD64_ADDR32 0x0002
3705 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3706 #define IMAGE_REL_AMD64_REL32 0x0004
3707 #define IMAGE_REL_AMD64_REL32_1 0x0005
3708 #define IMAGE_REL_AMD64_REL32_2 0x0006
3709 #define IMAGE_REL_AMD64_REL32_3 0x0007
3710 #define IMAGE_REL_AMD64_REL32_4 0x0008
3711 #define IMAGE_REL_AMD64_REL32_5 0x0009
3712 #define IMAGE_REL_AMD64_SECTION 0x000A
3713 #define IMAGE_REL_AMD64_SECREL 0x000B
3714 #define IMAGE_REL_AMD64_SECREL7 0x000C
3715 #define IMAGE_REL_AMD64_TOKEN 0x000D
3716 #define IMAGE_REL_AMD64_SREL32 0x000E
3717 #define IMAGE_REL_AMD64_PAIR 0x000F
3718 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3720 /* archive format */
3722 #define IMAGE_ARCHIVE_START_SIZE 8
3723 #define IMAGE_ARCHIVE_START "!<arch>\n"
3724 #define IMAGE_ARCHIVE_END "`\n"
3725 #define IMAGE_ARCHIVE_PAD "\n"
3726 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3727 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3729 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3738 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3740 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3742 typedef struct _IMPORT_OBJECT_HEADER
3748 DWORD TimeDateStamp
;
3758 } IMPORT_OBJECT_HEADER
;
3760 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3762 typedef enum IMPORT_OBJECT_TYPE
3764 IMPORT_OBJECT_CODE
= 0,
3765 IMPORT_OBJECT_DATA
= 1,
3766 IMPORT_OBJECT_CONST
= 2
3767 } IMPORT_OBJECT_TYPE
;
3769 typedef enum IMPORT_OBJECT_NAME_TYPE
3771 IMPORT_OBJECT_ORDINAL
= 0,
3772 IMPORT_OBJECT_NAME
= 1,
3773 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3774 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3775 } IMPORT_OBJECT_NAME_TYPE
;
3777 typedef struct _ANON_OBJECT_HEADER
3783 DWORD TimeDateStamp
;
3786 } ANON_OBJECT_HEADER
;
3789 * Resource directory stuff
3791 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3792 DWORD Characteristics
;
3793 DWORD TimeDateStamp
;
3796 WORD NumberOfNamedEntries
;
3797 WORD NumberOfIdEntries
;
3798 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3799 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3801 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3802 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3804 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3807 #ifdef BITFIELDS_BIGENDIAN
3808 unsigned NameIsString
:1;
3809 unsigned NameOffset
:31;
3811 unsigned NameOffset
:31;
3812 unsigned NameIsString
:1;
3816 #ifdef WORDS_BIGENDIAN
3827 #ifdef BITFIELDS_BIGENDIAN
3828 unsigned DataIsDirectory
:1;
3829 unsigned OffsetToDirectory
:31;
3831 unsigned OffsetToDirectory
:31;
3832 unsigned DataIsDirectory
:1;
3836 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3839 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3841 CHAR NameString
[ 1 ];
3842 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3844 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3846 WCHAR NameString
[ 1 ];
3847 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3849 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3854 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3857 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3858 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3861 typedef struct _IMAGE_TLS_DIRECTORY64
{
3862 ULONGLONG StartAddressOfRawData
;
3863 ULONGLONG EndAddressOfRawData
;
3864 ULONGLONG AddressOfIndex
;
3865 ULONGLONG AddressOfCallBacks
;
3866 DWORD SizeOfZeroFill
;
3867 DWORD Characteristics
;
3868 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3870 typedef struct _IMAGE_TLS_DIRECTORY32
{
3871 DWORD StartAddressOfRawData
;
3872 DWORD EndAddressOfRawData
;
3873 DWORD AddressOfIndex
;
3874 DWORD AddressOfCallBacks
;
3875 DWORD SizeOfZeroFill
;
3876 DWORD Characteristics
;
3877 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3880 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3881 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3883 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3884 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3887 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3888 DWORD Characteristics
;
3889 DWORD TimeDateStamp
;
3894 DWORD AddressOfRawData
;
3895 DWORD PointerToRawData
;
3896 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3898 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3899 #define IMAGE_DEBUG_TYPE_COFF 1
3900 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3901 #define IMAGE_DEBUG_TYPE_FPO 3
3902 #define IMAGE_DEBUG_TYPE_MISC 4
3903 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3904 #define IMAGE_DEBUG_TYPE_FIXUP 6
3905 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3906 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3907 #define IMAGE_DEBUG_TYPE_BORLAND 9
3908 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3909 #define IMAGE_DEBUG_TYPE_CLSID 11
3910 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
3911 #define IMAGE_DEBUG_TYPE_POGO 13
3912 #define IMAGE_DEBUG_TYPE_ILTCG 14
3913 #define IMAGE_DEBUG_TYPE_MPX 15
3914 #define IMAGE_DEBUG_TYPE_REPRO 16
3916 typedef enum ReplacesCorHdrNumericDefines
3918 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3919 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3920 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3921 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3922 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT
= 0x00000010,
3923 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3924 COMIMAGE_FLAGS_32BITPREFERRED
= 0x00020000,
3926 COR_VERSION_MAJOR_V2
= 2,
3927 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3928 COR_VERSION_MINOR
= 5,
3929 COR_DELETED_NAME_LENGTH
= 8,
3930 COR_VTABLEGAP_NAME_LENGTH
= 8,
3932 NATIVE_TYPE_MAX_CB
= 1,
3933 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3935 IMAGE_COR_MIH_METHODRVA
= 0x01,
3936 IMAGE_COR_MIH_EHRVA
= 0x02,
3937 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3939 COR_VTABLE_32BIT
= 0x01,
3940 COR_VTABLE_64BIT
= 0x02,
3941 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3942 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3944 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3946 MAX_CLASS_NAME
= 1024,
3947 MAX_PACKAGE_NAME
= 1024,
3948 } ReplacesCorHdrNumericDefines
;
3950 typedef struct IMAGE_COR20_HEADER
3953 WORD MajorRuntimeVersion
;
3954 WORD MinorRuntimeVersion
;
3956 IMAGE_DATA_DIRECTORY MetaData
;
3959 DWORD EntryPointToken
;
3960 DWORD EntryPointRVA
;
3963 IMAGE_DATA_DIRECTORY Resources
;
3964 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3965 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3966 IMAGE_DATA_DIRECTORY VTableFixups
;
3967 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3968 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3970 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3972 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3973 DWORD NumberOfSymbols
;
3974 DWORD LvaToFirstSymbol
;
3975 DWORD NumberOfLinenumbers
;
3976 DWORD LvaToFirstLinenumber
;
3977 DWORD RvaToFirstByteOfCode
;
3978 DWORD RvaToLastByteOfCode
;
3979 DWORD RvaToFirstByteOfData
;
3980 DWORD RvaToLastByteOfData
;
3981 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3984 #define FRAME_TRAP 1
3986 #define FRAME_NONFPO 3
3988 typedef struct _FPO_DATA
{
3999 } FPO_DATA
, *PFPO_DATA
;
4001 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64
{
4003 DWORD TimeDateStamp
;
4006 DWORD GlobalFlagsClear
;
4007 DWORD GlobalFlagsSet
;
4008 DWORD CriticalSectionDefaultTimeout
;
4009 ULONGLONG DeCommitFreeBlockThreshold
;
4010 ULONGLONG DeCommitTotalFreeThreshold
;
4011 ULONGLONG LockPrefixTable
;
4012 ULONGLONG MaximumAllocationSize
;
4013 ULONGLONG VirtualMemoryThreshold
;
4014 ULONGLONG ProcessAffinityMask
;
4015 DWORD ProcessHeapFlags
;
4019 ULONGLONG SecurityCookie
;
4020 ULONGLONG SEHandlerTable
;
4021 ULONGLONG SEHandlerCount
;
4022 } IMAGE_LOAD_CONFIG_DIRECTORY64
, *PIMAGE_LOAD_CONFIG_DIRECTORY64
;
4024 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32
{
4026 DWORD TimeDateStamp
;
4029 DWORD GlobalFlagsClear
;
4030 DWORD GlobalFlagsSet
;
4031 DWORD CriticalSectionDefaultTimeout
;
4032 DWORD DeCommitFreeBlockThreshold
;
4033 DWORD DeCommitTotalFreeThreshold
;
4034 PVOID LockPrefixTable
;
4035 DWORD MaximumAllocationSize
;
4036 DWORD VirtualMemoryThreshold
;
4037 DWORD ProcessHeapFlags
;
4038 DWORD ProcessAffinityMask
;
4042 DWORD SecurityCookie
;
4043 DWORD SEHandlerTable
;
4044 DWORD SEHandlerCount
;
4045 } IMAGE_LOAD_CONFIG_DIRECTORY32
, *PIMAGE_LOAD_CONFIG_DIRECTORY32
;
4048 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY
;
4049 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY
;
4051 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY
;
4052 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY
;
4055 typedef struct _IMAGE_FUNCTION_ENTRY
{
4056 DWORD StartingAddress
;
4057 DWORD EndingAddress
;
4058 DWORD EndOfPrologue
;
4059 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
4061 #define IMAGE_DEBUG_MISC_EXENAME 1
4063 typedef struct _IMAGE_DEBUG_MISC
{
4069 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
4071 /* This is the structure that appears at the very start of a .DBG file. */
4073 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
4077 WORD Characteristics
;
4078 DWORD TimeDateStamp
;
4082 DWORD NumberOfSections
;
4083 DWORD ExportedNamesSize
;
4084 DWORD DebugDirectorySize
;
4085 DWORD SectionAlignment
;
4086 DWORD Reserved
[ 2 ];
4087 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
4089 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
4092 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
4096 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
4097 #define MESSAGE_RESOURCE_UNICODE 0x0001
4099 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
4102 DWORD OffsetToEntries
;
4103 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
4105 typedef struct tagMESSAGE_RESOURCE_DATA
{
4106 DWORD NumberOfBlocks
;
4107 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
4108 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
4111 * Here follows typedefs for security and tokens.
4115 * First a constant for the following typedefs.
4118 #define ANYSIZE_ARRAY 1
4120 /* FIXME: Orphan. What does it point to? */
4121 typedef PVOID PACCESS_TOKEN
;
4122 typedef PVOID PSECURITY_DESCRIPTOR
;
4125 typedef enum _TOKEN_ELEVATION_TYPE
{
4126 TokenElevationTypeDefault
= 1,
4127 TokenElevationTypeFull
,
4128 TokenElevationTypeLimited
4129 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
4132 * TOKEN_INFORMATION_CLASS
4135 typedef enum _TOKEN_INFORMATION_CLASS
{
4144 TokenImpersonationLevel
,
4146 TokenRestrictedSids
,
4148 TokenGroupsAndPrivileges
,
4149 TokenSessionReference
,
4156 TokenHasRestrictions
,
4157 TokenAccessInformation
,
4158 TokenVirtualizationAllowed
,
4159 TokenVirtualizationEnabled
,
4160 TokenIntegrityLevel
,
4162 TokenMandatoryPolicy
,
4164 TokenIsAppContainer
,
4166 TokenAppContainerSid
,
4167 TokenAppContainerNumber
,
4168 TokenUserClaimAttributes
,
4169 TokenDeviceClaimAttributes
,
4170 TokenRestrictedUserClaimAttributes
,
4171 TokenRestrictedDeviceClaimAttributes
,
4173 TokenRestrictedDeviceGroups
,
4174 TokenSecurityAttributes
,
4176 TokenProcessTrustLevel
,
4178 } TOKEN_INFORMATION_CLASS
;
4180 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
4181 #define TOKEN_ADJUST_GROUPS 0x0040
4182 #define TOKEN_ADJUST_PRIVILEGES 0x0020
4183 #define TOKEN_ADJUST_SESSIONID 0x0100
4184 #define TOKEN_ASSIGN_PRIMARY 0x0001
4185 #define TOKEN_DUPLICATE 0x0002
4186 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
4187 #define TOKEN_IMPERSONATE 0x0004
4188 #define TOKEN_QUERY 0x0008
4189 #define TOKEN_QUERY_SOURCE 0x0010
4190 #define TOKEN_ADJUST_DEFAULT 0x0080
4191 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
4192 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
4193 TOKEN_ADJUST_PRIVILEGES | \
4194 TOKEN_ADJUST_GROUPS | \
4195 TOKEN_ADJUST_DEFAULT )
4196 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
4197 TOKEN_ASSIGN_PRIMARY | \
4199 TOKEN_IMPERSONATE | \
4201 TOKEN_QUERY_SOURCE | \
4202 TOKEN_ADJUST_PRIVILEGES | \
4203 TOKEN_ADJUST_GROUPS | \
4204 TOKEN_ADJUST_SESSIONID | \
4205 TOKEN_ADJUST_DEFAULT )
4207 #ifndef _SECURITY_DEFINED
4208 #define _SECURITY_DEFINED
4211 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
4213 typedef struct _GENERIC_MAPPING
{
4214 ACCESS_MASK GenericRead
;
4215 ACCESS_MASK GenericWrite
;
4216 ACCESS_MASK GenericExecute
;
4217 ACCESS_MASK GenericAll
;
4218 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
4220 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
4221 #define SID_IDENTIFIER_AUTHORITY_DEFINED
4224 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
4225 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
4229 typedef struct _SID
{
4231 BYTE SubAuthorityCount
;
4232 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
4233 DWORD SubAuthority
[1];
4235 #endif /* !defined(SID_DEFINED) */
4237 #define SID_REVISION (1) /* Current revision */
4238 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
4239 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
4241 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
4247 #define ACL_REVISION1 1
4248 #define ACL_REVISION2 2
4249 #define ACL_REVISION3 3
4250 #define ACL_REVISION4 4
4252 #define MIN_ACL_REVISION ACL_REVISION2
4253 #define MAX_ACL_REVISION ACL_REVISION4
4255 #define ACL_REVISION 2
4257 typedef struct _ACL
{
4265 typedef enum _ACL_INFORMATION_CLASS
4267 AclRevisionInformation
= 1,
4269 } ACL_INFORMATION_CLASS
;
4271 typedef struct _ACL_REVISION_INFORMATION
4274 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
4276 typedef struct _ACL_SIZE_INFORMATION
4279 DWORD AclBytesInUse
;
4281 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
4283 /* SECURITY_DESCRIPTOR */
4284 #define SECURITY_DESCRIPTOR_REVISION 1
4285 #define SECURITY_DESCRIPTOR_REVISION1 1
4292 #if defined(_MSC_VER) || defined(__MINGW32__)
4293 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4294 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4295 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4296 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4297 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4298 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4299 #define SE_TCB_NAME L"SeTcbPrivilege"
4300 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4301 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4302 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4303 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4304 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4305 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4306 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4307 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4308 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4309 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4310 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4311 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4312 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4313 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4314 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4315 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4316 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4317 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4318 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4319 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4320 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4321 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4322 #else /* _MSC_VER/__MINGW32__ */
4323 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 };
4324 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 };
4325 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 };
4326 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 };
4327 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 };
4328 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 };
4329 static const WCHAR SE_TCB_NAME
[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4330 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 };
4331 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 };
4332 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 };
4333 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 };
4334 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 };
4335 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 };
4336 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 };
4337 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 };
4338 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 };
4339 static const WCHAR SE_BACKUP_NAME
[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4340 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 };
4341 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 };
4342 static const WCHAR SE_DEBUG_NAME
[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4343 static const WCHAR SE_AUDIT_NAME
[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4344 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 };
4345 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 };
4346 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 };
4347 static const WCHAR SE_UNDOCK_NAME
[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4348 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 };
4349 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 };
4350 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 };
4351 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 };
4354 #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
4355 #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
4356 #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
4357 #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
4358 #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
4359 #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
4360 #define SE_TCB_NAME "SeTcbPrivilege"
4361 #define SE_SECURITY_NAME "SeSecurityPrivilege"
4362 #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
4363 #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
4364 #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
4365 #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
4366 #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
4367 #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
4368 #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
4369 #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
4370 #define SE_BACKUP_NAME "SeBackupPrivilege"
4371 #define SE_RESTORE_NAME "SeRestorePrivilege"
4372 #define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
4373 #define SE_DEBUG_NAME "SeDebugPrivilege"
4374 #define SE_AUDIT_NAME "SeAuditPrivilege"
4375 #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
4376 #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
4377 #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
4378 #define SE_UNDOCK_NAME "SeUndockPrivilege"
4379 #define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
4380 #define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
4381 #define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
4382 #define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
4385 #define SE_GROUP_MANDATORY 0x00000001
4386 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4387 #define SE_GROUP_ENABLED 0x00000004
4388 #define SE_GROUP_OWNER 0x00000008
4389 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4390 #define SE_GROUP_INTEGRITY 0x00000020
4391 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
4392 #define SE_GROUP_LOGON_ID 0xC0000000
4393 #define SE_GROUP_RESOURCE 0x20000000
4394 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
4396 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4397 #define SE_PRIVILEGE_ENABLED 0x00000002
4398 #define SE_PRIVILEGE_REMOVED 0x00000004
4399 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4400 #define SE_PRIVILEGE_VALID_ATTRIBUTES 0x80000007
4402 #define PRIVILEGE_SET_ALL_NECESSARY 1
4404 #define SE_OWNER_DEFAULTED 0x00000001
4405 #define SE_GROUP_DEFAULTED 0x00000002
4406 #define SE_DACL_PRESENT 0x00000004
4407 #define SE_DACL_DEFAULTED 0x00000008
4408 #define SE_SACL_PRESENT 0x00000010
4409 #define SE_SACL_DEFAULTED 0x00000020
4410 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4411 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4412 #define SE_DACL_AUTO_INHERITED 0x00000400
4413 #define SE_SACL_AUTO_INHERITED 0x00000800
4414 #define SE_DACL_PROTECTED 0x00001000
4415 #define SE_SACL_PROTECTED 0x00002000
4416 #define SE_RM_CONTROL_VALID 0x00004000
4417 #define SE_SELF_RELATIVE 0x00008000
4419 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4420 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4422 /* The security descriptor structure */
4426 SECURITY_DESCRIPTOR_CONTROL Control
;
4431 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4436 SECURITY_DESCRIPTOR_CONTROL Control
;
4441 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4443 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4445 #endif /* _SECURITY_DEFINED */
4448 * SID_AND_ATTRIBUTES
4451 typedef struct _SID_AND_ATTRIBUTES
{
4454 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4456 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY
[ANYSIZE_ARRAY
];
4457 typedef SID_AND_ATTRIBUTES_ARRAY
*PSID_AND_ATTRIBUTES_ARRAY
;
4459 #define SID_HASH_SIZE 32
4461 typedef ULONG_PTR SID_HASH_ENTRY
, *PSID_HASH_ENTRY
;
4463 typedef struct _SID_AND_ATTRIBUTES_HASH
{
4465 PSID_AND_ATTRIBUTES SidAttr
;
4466 SID_HASH_ENTRY Hash
[SID_HASH_SIZE
];
4467 } SID_AND_ATTRIBUTES_HASH
, *PSID_AND_ATTRIBUTES_HASH
;
4469 /* security entities */
4470 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
4471 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
4472 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
4474 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4477 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4480 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4481 #define SECURITY_LOCAL_LOGON_RID __MSABI_LONG(0X00000000)
4484 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4485 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
4486 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
4487 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
4488 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
4489 #define SECURITY_CREATOR_OWNER_RIGHTS_RID __MSABI_LONG(0x00000004)
4492 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4495 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4496 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
4497 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
4498 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
4499 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
4500 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
4501 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
4502 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
4503 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
4504 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
4505 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4506 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
4507 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
4508 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
4509 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
4510 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
4511 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
4512 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
4513 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
4514 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
4515 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
4516 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID __MSABI_LONG(0x00000016)
4517 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
4518 #define SECURITY_WRITE_RESTRICTED_CODE_RID __MSABI_LONG(0x00000021)
4520 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
4521 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
4522 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
4523 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
4524 #define SECURITY_CRED_TYPE_BASE_RID __MSABI_LONG(0x00000041)
4525 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID __MSABI_LONG(0x00000001)
4526 #define SECURITY_MIN_BASE_RID __MSABI_LONG(0x00000050)
4527 #define SECURITY_SERVICE_ID_BASE_RID __MSABI_LONG(0x00000050)
4528 #define SECURITY_RESERVED_ID_BASE_RID __MSABI_LONG(0x00000051)
4529 #define SECURITY_APPPOOL_ID_BASE_RID __MSABI_LONG(0x00000052)
4530 #define SECURITY_VIRTUALSERVER_ID_BASE_RID __MSABI_LONG(0x00000053)
4531 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID __MSABI_LONG(0x00000054)
4532 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID __MSABI_LONG(0x00000055)
4533 #define SECURITY_WMIHOST_ID_BASE_RID __MSABI_LONG(0x00000056)
4534 #define SECURITY_TASK_ID_BASE_RID __MSABI_LONG(0x00000057)
4535 #define SECURITY_NFS_ID_BASE_RID __MSABI_LONG(0x00000058)
4536 #define SECURITY_COM_ID_BASE_RID __MSABI_LONG(0x00000059)
4537 #define SECURITY_MAX_BASE_RID __MSABI_LONG(0x0000006F)
4538 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID __MSABI_LONG(0x00000070)
4539 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
4540 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
4541 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
4543 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS __MSABI_LONG(0x000001F2)
4545 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
4546 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
4547 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
4548 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
4549 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
4551 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
4552 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
4553 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
4554 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
4555 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
4556 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
4557 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
4558 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
4559 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
4560 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS __MSABI_LONG(0x00000209)
4562 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
4564 #define SECURITY_APP_PACKAGE_AUTHORITY {0,0,0,0,0,15}
4565 #define SECURITY_APP_PACKAGE_BASE_RID __MSABI_LONG(0x000000002)
4566 #define SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000002)
4567 #define SECURITY_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000008)
4568 #define SECURITY_CAPABILITY_BASE_RID __MSABI_LONG(0x000000003)
4569 #define SECURITY_CAPABILITY_APP_RID __MSABI_LONG(0x000000400)
4570 #define SECURITY_BUILTIN_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000002)
4571 #define SECURITY_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000005)
4572 #define SECURITY_PARENT_PACKAGE_RID_COUNT SECURITY_APP_PACKAGE_RID_COUNT
4573 #define SECURITY_CHILD_PACKAGE_RID_COUNT __MSABI_LONG(0x00000000c)
4574 #define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE __MSABI_LONG(0x000000001)
4576 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4577 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
4578 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
4579 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
4580 #define SECURITY_MANDATORY_MEDIUM_PLUS_RID __MSABI_LONG(0x00002100)
4581 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
4582 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
4583 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
4584 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
4586 #define MANDATORY_LEVEL_TO_MANDATORY_RID(ML) (ML * 0x1000)
4588 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
4589 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
4590 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
4591 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
4593 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
4594 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
4595 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
4596 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
4598 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
4599 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
4600 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
4601 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
4602 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
4603 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
4605 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
4606 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
4607 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
4608 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
4609 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
4610 #define DOMAIN_ALIAS_RID_IUSERS __MSABI_LONG(0x00000238)
4611 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS __MSABI_LONG(0x00000239)
4612 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023B)
4613 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023C)
4614 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP __MSABI_LONG(0x0000023D)
4615 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP __MSABI_LONG(0x0000023E)
4617 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4619 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
4620 #define SECURITY_CRED_TYPE_RID_COUNT __MSABI_LONG(2)
4621 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
4622 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT __MSABI_LONG(3)
4623 #define SECURITY_SERVICE_ID_RID_COUNT __MSABI_LONG(6)
4624 #define SECURITY_APPPOOL_ID_RID_COUNT __MSABI_LONG(6)
4625 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT __MSABI_LONG(6)
4626 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT __MSABI_LONG(6)
4627 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT __MSABI_LONG(6)
4628 #define SECURITY_WMIHOST_ID_RID_COUNT __MSABI_LONG(6)
4629 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT __MSABI_LONG(6)
4631 #define SYSTEM_LUID { 0x3e7, 0x0 }
4632 #define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 }
4633 #define LOCALSERVICE_LUID { 0x3e5, 0x0 }
4634 #define NETWORKSERVICE_LUID { 0x3e4, 0x0 }
4635 #define IUSER_LUID { 0x3e3, 0x0 }
4641 WinCreatorOwnerSid
= 3,
4642 WinCreatorGroupSid
= 4,
4643 WinCreatorOwnerServerSid
= 5,
4644 WinCreatorGroupServerSid
= 6,
4645 WinNtAuthoritySid
= 7,
4649 WinInteractiveSid
= 11,
4651 WinAnonymousSid
= 13,
4653 WinEnterpriseControllersSid
= 15,
4655 WinAuthenticatedUserSid
= 17,
4656 WinRestrictedCodeSid
= 18,
4657 WinTerminalServerSid
= 19,
4658 WinRemoteLogonIdSid
= 20,
4659 WinLogonIdsSid
= 21,
4660 WinLocalSystemSid
= 22,
4661 WinLocalServiceSid
= 23,
4662 WinNetworkServiceSid
= 24,
4663 WinBuiltinDomainSid
= 25,
4664 WinBuiltinAdministratorsSid
= 26,
4665 WinBuiltinUsersSid
= 27,
4666 WinBuiltinGuestsSid
= 28,
4667 WinBuiltinPowerUsersSid
= 29,
4668 WinBuiltinAccountOperatorsSid
= 30,
4669 WinBuiltinSystemOperatorsSid
= 31,
4670 WinBuiltinPrintOperatorsSid
= 32,
4671 WinBuiltinBackupOperatorsSid
= 33,
4672 WinBuiltinReplicatorSid
= 34,
4673 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4674 WinBuiltinRemoteDesktopUsersSid
= 36,
4675 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4676 WinAccountAdministratorSid
= 38,
4677 WinAccountGuestSid
= 39,
4678 WinAccountKrbtgtSid
= 40,
4679 WinAccountDomainAdminsSid
= 41,
4680 WinAccountDomainUsersSid
= 42,
4681 WinAccountDomainGuestsSid
= 43,
4682 WinAccountComputersSid
= 44,
4683 WinAccountControllersSid
= 45,
4684 WinAccountCertAdminsSid
= 46,
4685 WinAccountSchemaAdminsSid
= 47,
4686 WinAccountEnterpriseAdminsSid
= 48,
4687 WinAccountPolicyAdminsSid
= 49,
4688 WinAccountRasAndIasServersSid
= 50,
4689 WinNTLMAuthenticationSid
= 51,
4690 WinDigestAuthenticationSid
= 52,
4691 WinSChannelAuthenticationSid
= 53,
4692 WinThisOrganizationSid
= 54,
4693 WinOtherOrganizationSid
= 55,
4694 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4695 WinBuiltinPerfMonitoringUsersSid
= 57,
4696 WinBuiltinPerfLoggingUsersSid
= 58,
4697 WinBuiltinAuthorizationAccessSid
= 59,
4698 WinBuiltinTerminalServerLicenseServersSid
= 60,
4699 WinBuiltinDCOMUsersSid
= 61,
4700 WinBuiltinIUsersSid
= 62,
4702 WinBuiltinCryptoOperatorsSid
= 64,
4703 WinUntrustedLabelSid
= 65,
4704 WinLowLabelSid
= 66,
4705 WinMediumLabelSid
= 67,
4706 WinHighLabelSid
= 68,
4707 WinSystemLabelSid
= 69,
4708 WinWriteRestrictedCodeSid
= 70,
4709 WinCreatorOwnerRightsSid
= 71,
4710 WinCacheablePrincipalsGroupSid
= 72,
4711 WinNonCacheablePrincipalsGroupSid
= 73,
4712 WinEnterpriseReadonlyControllersSid
= 74,
4713 WinAccountReadonlyControllersSid
= 75,
4714 WinBuiltinEventLogReadersGroup
= 76,
4715 WinNewEnterpriseReadonlyControllersSid
= 77,
4716 WinBuiltinCertSvcDComAccessGroup
= 78,
4717 WinMediumPlusLabelSid
= 79,
4718 WinLocalLogonSid
= 80,
4719 WinConsoleLogonSid
= 81,
4720 WinThisOrganizationCertificateSid
= 82,
4721 WinApplicationPackageAuthoritySid
= 83,
4722 WinBuiltinAnyPackageSid
= 84,
4723 WinCapabilityInternetClientSid
= 85,
4724 WinCapabilityInternetClientServerSid
= 86,
4725 WinCapabilityPrivateNetworkClientServerSid
= 87,
4726 WinCapabilityPicturesLibrarySid
= 88,
4727 WinCapabilityVideosLibrarySid
= 89,
4728 WinCapabilityMusicLibrarySid
= 90,
4729 WinCapabilityDocumentsLibrarySid
= 91,
4730 WinCapabilitySharedUserCertificatesSid
= 92,
4731 WinCapabilityEnterpriseAuthenticationSid
= 93,
4732 WinCapabilityRemovableStorageSid
= 94,
4733 WinBuiltinRDSRemoteAccessServersSid
= 95,
4734 WinBuiltinRDSEndpointServersSid
= 96,
4735 WinBuiltinRDSManagementServersSid
= 97,
4736 WinUserModeDriversSid
= 98,
4737 WinBuiltinHyperVAdminsSid
= 99,
4738 WinAccountCloneableControllersSid
= 100,
4739 WinBuiltinAccessControlAssistanceOperatorsSid
= 101,
4740 WinBuiltinRemoteManagementUsersSid
= 102,
4741 WinAuthenticationAuthorityAssertedSid
= 103,
4742 WinAuthenticationServiceAssertedSid
= 104,
4743 WinLocalAccountSid
= 105,
4744 WinLocalAccountAndAdministratorSid
= 106,
4745 WinAccountProtectedUsersSid
= 107,
4746 } WELL_KNOWN_SID_TYPE
;
4752 typedef struct _TOKEN_USER
{
4753 SID_AND_ATTRIBUTES User
;
4754 } TOKEN_USER
, *PTOKEN_USER
;
4760 typedef struct _TOKEN_GROUPS
{
4762 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4763 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4766 * LUID_AND_ATTRIBUTES
4769 typedef union _LARGE_INTEGER
{
4771 #ifdef WORDS_BIGENDIAN
4779 #ifndef NONAMELESSSTRUCT
4781 #ifdef WORDS_BIGENDIAN
4791 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4793 typedef union _ULARGE_INTEGER
{
4795 #ifdef WORDS_BIGENDIAN
4803 #ifndef NONAMELESSSTRUCT
4805 #ifdef WORDS_BIGENDIAN
4815 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4818 * Locally Unique Identifier
4821 typedef struct _LUID
{
4826 #include <pshpack4.h>
4827 typedef struct _LUID_AND_ATTRIBUTES
{
4830 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4831 #include <poppack.h>
4837 typedef struct _PRIVILEGE_SET
{
4838 DWORD PrivilegeCount
;
4840 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4841 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4847 typedef struct _TOKEN_PRIVILEGES
{
4848 DWORD PrivilegeCount
;
4849 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4850 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4856 typedef struct _TOKEN_OWNER
{
4858 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4861 * TOKEN_PRIMARY_GROUP
4864 typedef struct _TOKEN_PRIMARY_GROUP
{
4866 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4870 * TOKEN_DEFAULT_DACL
4873 typedef struct _TOKEN_DEFAULT_DACL
{
4875 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4881 #define TOKEN_SOURCE_LENGTH 8
4883 typedef struct _TOKEN_SOURCE
{
4884 char SourceName
[TOKEN_SOURCE_LENGTH
];
4885 LUID SourceIdentifier
;
4886 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4892 typedef enum tagTOKEN_TYPE
{
4898 * SECURITY_IMPERSONATION_LEVEL
4901 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4903 SecurityIdentification
,
4904 SecurityImpersonation
,
4906 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4908 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4909 #define SECURITY_STATIC_TRACKING (FALSE)
4911 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4912 * PSECURITY_CONTEXT_TRACKING_MODE
;
4914 * Quality of Service
4917 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4919 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4920 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4921 BOOLEAN EffectiveOnly
;
4922 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4928 #include <pshpack4.h>
4929 typedef struct _TOKEN_STATISTICS
{
4931 LUID AuthenticationId
;
4932 LARGE_INTEGER ExpirationTime
;
4933 TOKEN_TYPE TokenType
;
4934 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4935 DWORD DynamicCharged
;
4936 DWORD DynamicAvailable
;
4938 DWORD PrivilegeCount
;
4941 #include <poppack.h>
4943 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4946 PSID_AND_ATTRIBUTES Sids
;
4947 DWORD RestrictedSidCount
;
4948 DWORD RestrictedSidLength
;
4949 PSID_AND_ATTRIBUTES RestrictedSids
;
4950 DWORD PrivilegeCount
;
4951 DWORD PrivilegeLength
;
4952 PLUID_AND_ATTRIBUTES Privileges
;
4953 LUID AuthenticationId
;
4954 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4956 typedef struct _TOKEN_ORIGIN
{
4957 LUID OriginatingLogonSession
;
4958 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4960 typedef struct _TOKEN_LINKED_TOKEN
{
4962 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4964 typedef struct _TOKEN_ELEVATION
{
4965 DWORD TokenIsElevated
;
4966 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4968 typedef struct _TOKEN_MANDATORY_LABEL
{
4969 SID_AND_ATTRIBUTES Label
;
4970 } TOKEN_MANDATORY_LABEL
, * PTOKEN_MANDATORY_LABEL
;
4972 #define TOKEN_MANDATORY_POLICY_OFF 0x0
4973 #define TOKEN_MANDATORY_POLICY_NO_WRITEUP 0x1
4974 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
4975 #define TOKEN_MANDATORY_POLICY_VALID_MASK 0x3
4977 typedef struct _TOKEN_MANDATORY_POLICY
{
4979 } TOKEN_MANDATORY_POLICY
, *PTOKEN_MANDATORY_POLICY
;
4981 typedef struct _TOKEN_APPCONTAINER_INFORMATION
{
4982 PSID TokenAppContainer
;
4983 } TOKEN_APPCONTAINER_INFORMATION
, * PTOKEN_APPCONTAINER_INFORMATION
;
4985 #define POLICY_AUDIT_SUBCATEGORY_COUNT 53
4987 typedef struct _TOKEN_AUDIT_POLICY
{
4988 BYTE PerUserPolicy
[((POLICY_AUDIT_SUBCATEGORY_COUNT
) >> 1) + 1];
4989 } TOKEN_AUDIT_POLICY
, *PTOKEN_AUDIT_POLICY
;
4991 typedef struct _TOKEN_ACCESS_INFORMATION
{
4992 PSID_AND_ATTRIBUTES_HASH SidHash
;
4993 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash
;
4994 PTOKEN_PRIVILEGES Privileges
;
4995 LUID AuthenticationId
;
4996 TOKEN_TYPE TokenType
;
4997 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4998 TOKEN_MANDATORY_POLICY MandatoryPolicy
;
5000 } TOKEN_ACCESS_INFORMATION
, *PTOKEN_ACCESS_INFORMATION
;
5002 typedef struct _TOKEN_CONTROL
{
5004 LUID AuthenticationId
;
5006 TOKEN_SOURCE TokenSource
;
5007 } TOKEN_CONTROL
, *PTOKEN_CONTROL
;
5013 /* ACEs, directly starting after an ACL */
5014 typedef struct _ACE_HEADER
{
5018 } ACE_HEADER
,*PACE_HEADER
;
5021 #define ACCESS_MIN_MS_ACE_TYPE 0x0
5022 #define ACCESS_ALLOWED_ACE_TYPE 0x0
5023 #define ACCESS_DENIED_ACE_TYPE 0x1
5024 #define SYSTEM_AUDIT_ACE_TYPE 0x2
5025 #define SYSTEM_ALARM_ACE_TYPE 0x3
5026 #define ACCESS_MAX_MS_V2_ACE_TYPE 0x3
5027 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4
5028 #define ACCESS_MAX_MS_V3_ACE_TYPE 0x4
5029 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE 0x5
5030 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5
5031 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6
5032 #define ACCESS_AUDIT_OBJECT_ACE_TYPE 0x7
5033 #define ACCESS_ALARM_OBJECT_ACE_TYPE 0x8
5034 #define ACCESS_MAX_MS_V4_ACE_TYPE 0x8
5035 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9
5036 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xa
5037 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xb
5038 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xc
5039 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xd
5040 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xe
5041 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xf
5042 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
5043 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
5044 #define ACCESS_MAX_MS_V5_ACE_TYPE 0x11
5046 /* inherit AceFlags */
5047 #define OBJECT_INHERIT_ACE 0x01
5048 #define CONTAINER_INHERIT_ACE 0x02
5049 #define NO_PROPAGATE_INHERIT_ACE 0x04
5050 #define INHERIT_ONLY_ACE 0x08
5051 #define INHERITED_ACE 0x10
5052 #define VALID_INHERIT_FLAGS 0x1F
5054 /* AceFlags mask for what events we (should) audit */
5055 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
5056 #define FAILED_ACCESS_ACE_FLAG 0x80
5058 /* different ACEs depending on AceType
5059 * SidStart marks the begin of a SID
5060 * so the thing finally looks like this:
5065 typedef struct _ACCESS_ALLOWED_ACE
{
5069 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
5071 typedef struct _ACCESS_DENIED_ACE
{
5075 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
5077 typedef struct _SYSTEM_AUDIT_ACE
{
5081 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
5083 typedef struct _SYSTEM_ALARM_ACE
{
5087 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
5089 typedef struct _SYSTEM_MANDATORY_LABEL_ACE
{
5093 } SYSTEM_MANDATORY_LABEL_ACE
,*PSYSTEM_MANDATORY_LABEL_ACE
;
5095 typedef struct _ACCESS_ALLOWED_OBJECT_ACE
{
5100 GUID InheritedObjectType
;
5102 } ACCESS_ALLOWED_OBJECT_ACE
, *PACCESS_ALLOWED_OBJECT_ACE
;
5104 typedef struct _ACCESS_DENIED_OBJECT_ACE
{
5109 GUID InheritedObjectType
;
5111 } ACCESS_DENIED_OBJECT_ACE
, *PACCESS_DENIED_OBJECT_ACE
;
5113 typedef struct _SYSTEM_AUDIT_OBJECT_ACE
{
5118 GUID InheritedObjectType
;
5120 } SYSTEM_AUDIT_OBJECT_ACE
, *PSYSTEM_AUDIT_OBJECT_ACE
;
5122 typedef struct _SYSTEM_ALARM_OBJECT_ACE
{
5127 GUID InheritedObjectType
;
5129 } SYSTEM_ALARM_OBJECT_ACE
, *PSYSTEM_ALARM_OBJECT_aCE
;
5131 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE
{
5135 } ACCESS_ALLOWED_CALLBACK_ACE
,*PACCESS_ALLOWED_CALLBACK_ACE
;
5137 typedef struct _ACCESS_DENIED_CALLBACK_ACE
{
5141 } ACCESS_DENIED_CALLBACK_ACE
,*PACCESS_DENIED_CALLBACK_ACE
;
5143 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE
{
5147 } SYSTEM_AUDIT_CALLBACK_ACE
,*PSYSTEM_AUDIT_CALLBACK_ACE
;
5149 typedef struct _SYSTEM_ALARM_CALLBACK_ACE
{
5153 } SYSTEM_ALARM_CALLBACK_ACE
,*PSYSTEM_ALARM_CALLBACK_ACE
;
5155 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
{
5160 GUID InheritedObjectType
;
5162 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE
;
5164 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE
{
5169 GUID InheritedObjectType
;
5171 } ACCESS_DENIED_CALLBACK_OBJECT_ACE
, *PACCESS_DENIED_CALLBACK_OBJECT_ACE
;
5173 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
{
5178 GUID InheritedObjectType
;
5180 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE
;
5182 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
{
5187 GUID InheritedObjectType
;
5189 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE
, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE
;
5191 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
5192 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
5193 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
5194 #define SYSTEM_MANDATORY_LABEL_VALID_MASK 0x7
5196 typedef enum tagSID_NAME_USE
{
5201 SidTypeWellKnownGroup
,
5202 SidTypeDeletedAccount
,
5205 } SID_NAME_USE
,*PSID_NAME_USE
;
5207 #define ACE_OBJECT_TYPE_PRESENT 0x1
5208 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
5212 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
5214 #define DELETE 0x00010000
5215 #define READ_CONTROL 0x00020000
5216 #define WRITE_DAC 0x00040000
5217 #define WRITE_OWNER 0x00080000
5218 #define SYNCHRONIZE 0x00100000
5219 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
5221 #define STANDARD_RIGHTS_READ READ_CONTROL
5222 #define STANDARD_RIGHTS_WRITE READ_CONTROL
5223 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
5225 #define STANDARD_RIGHTS_ALL 0x001f0000
5227 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
5229 #define GENERIC_READ 0x80000000
5230 #define GENERIC_WRITE 0x40000000
5231 #define GENERIC_EXECUTE 0x20000000
5232 #define GENERIC_ALL 0x10000000
5234 #define MAXIMUM_ALLOWED 0x02000000
5235 #define ACCESS_SYSTEM_SECURITY 0x01000000
5237 #define EVENT_QUERY_STATE 0x0001
5238 #define EVENT_MODIFY_STATE 0x0002
5239 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5241 #define SEMAPHORE_QUERY_STATE 0x0001
5242 #define SEMAPHORE_MODIFY_STATE 0x0002
5243 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5245 #define MUTANT_QUERY_STATE 0x0001
5246 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
5248 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
5249 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
5250 #define JOB_OBJECT_QUERY 0x0004
5251 #define JOB_OBJECT_TERMINATE 0x0008
5252 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
5253 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
5255 #define TIMER_QUERY_STATE 0x0001
5256 #define TIMER_MODIFY_STATE 0x0002
5257 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5259 #define PROCESS_TERMINATE 0x0001
5260 #define PROCESS_CREATE_THREAD 0x0002
5261 #define PROCESS_VM_OPERATION 0x0008
5262 #define PROCESS_VM_READ 0x0010
5263 #define PROCESS_VM_WRITE 0x0020
5264 #define PROCESS_DUP_HANDLE 0x0040
5265 #define PROCESS_CREATE_PROCESS 0x0080
5266 #define PROCESS_SET_QUOTA 0x0100
5267 #define PROCESS_SET_INFORMATION 0x0200
5268 #define PROCESS_QUERY_INFORMATION 0x0400
5269 #define PROCESS_SUSPEND_RESUME 0x0800
5270 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
5271 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
5272 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5274 #define THREAD_TERMINATE 0x0001
5275 #define THREAD_SUSPEND_RESUME 0x0002
5276 #define THREAD_GET_CONTEXT 0x0008
5277 #define THREAD_SET_CONTEXT 0x0010
5278 #define THREAD_SET_INFORMATION 0x0020
5279 #define THREAD_QUERY_INFORMATION 0x0040
5280 #define THREAD_SET_THREAD_TOKEN 0x0080
5281 #define THREAD_IMPERSONATE 0x0100
5282 #define THREAD_DIRECT_IMPERSONATION 0x0200
5283 #define THREAD_SET_LIMITED_INFORMATION 0x0400
5284 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
5285 #define THREAD_RESUME 0x1000
5286 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5288 #define THREAD_BASE_PRIORITY_LOWRT 15
5289 #define THREAD_BASE_PRIORITY_MAX 2
5290 #define THREAD_BASE_PRIORITY_MIN -2
5291 #define THREAD_BASE_PRIORITY_IDLE -15
5293 typedef struct _QUOTA_LIMITS
{
5294 SIZE_T PagedPoolLimit
;
5295 SIZE_T NonPagedPoolLimit
;
5296 SIZE_T MinimumWorkingSetSize
;
5297 SIZE_T MaximumWorkingSetSize
;
5298 SIZE_T PagefileLimit
;
5299 LARGE_INTEGER TimeLimit
;
5300 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
5302 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
5303 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
5304 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
5305 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
5307 typedef struct _QUOTA_LIMITS_EX
{
5308 SIZE_T PagedPoolLimit
;
5309 SIZE_T NonPagedPoolLimit
;
5310 SIZE_T MinimumWorkingSetSize
;
5311 SIZE_T MaximumWorkingSetSize
;
5312 SIZE_T PagefileLimit
;
5313 LARGE_INTEGER TimeLimit
;
5320 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
5322 #define SECTION_QUERY 0x0001
5323 #define SECTION_MAP_WRITE 0x0002
5324 #define SECTION_MAP_READ 0x0004
5325 #define SECTION_MAP_EXECUTE 0x0008
5326 #define SECTION_EXTEND_SIZE 0x0010
5327 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
5328 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
5330 #define FILE_READ_DATA 0x0001 /* file & pipe */
5331 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
5332 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
5333 #define FILE_ADD_FILE 0x0002 /* directory */
5334 #define FILE_APPEND_DATA 0x0004 /* file */
5335 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
5336 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
5337 #define FILE_READ_EA 0x0008 /* file & directory */
5338 #define FILE_READ_PROPERTIES FILE_READ_EA
5339 #define FILE_WRITE_EA 0x0010 /* file & directory */
5340 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
5341 #define FILE_EXECUTE 0x0020 /* file */
5342 #define FILE_TRAVERSE 0x0020 /* directory */
5343 #define FILE_DELETE_CHILD 0x0040 /* directory */
5344 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
5345 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
5346 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
5348 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
5349 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
5351 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
5352 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
5353 FILE_APPEND_DATA | SYNCHRONIZE)
5354 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
5355 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
5357 #define DUPLICATE_CLOSE_SOURCE 0x00000001
5358 #define DUPLICATE_SAME_ACCESS 0x00000002
5360 /* File attribute flags */
5361 #define FILE_SHARE_READ 0x00000001
5362 #define FILE_SHARE_WRITE 0x00000002
5363 #define FILE_SHARE_DELETE 0x00000004
5365 #define FILE_ATTRIBUTE_READONLY 0x00000001
5366 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
5367 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
5368 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
5369 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
5370 #define FILE_ATTRIBUTE_DEVICE 0x00000040
5371 #define FILE_ATTRIBUTE_NORMAL 0x00000080
5372 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
5373 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
5374 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
5375 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
5376 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
5377 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
5378 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
5379 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
5380 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
5381 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
5382 #define FILE_ATTRIBUTE_EA 0x00040000
5384 /* File notification flags */
5385 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
5386 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
5387 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
5388 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
5389 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
5390 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
5391 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
5392 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
5393 #define FILE_NOTIFY_CHANGE_EA 0x00000080
5394 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
5395 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
5396 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
5397 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
5399 #define FILE_ACTION_ADDED 0x00000001
5400 #define FILE_ACTION_REMOVED 0x00000002
5401 #define FILE_ACTION_MODIFIED 0x00000003
5402 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
5403 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
5404 #define FILE_ACTION_ADDED_STREAM 0x00000006
5405 #define FILE_ACTION_REMOVED_STREAM 0x00000007
5406 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
5407 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
5408 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000a
5409 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000b
5411 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
5412 #define FILE_CASE_PRESERVED_NAMES 0x00000002
5413 #define FILE_UNICODE_ON_DISK 0x00000004
5414 #define FILE_PERSISTENT_ACLS 0x00000008
5415 #define FILE_FILE_COMPRESSION 0x00000010
5416 #define FILE_VOLUME_QUOTAS 0x00000020
5417 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
5418 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
5419 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
5420 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
5421 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
5422 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
5423 #define FILE_NAMED_STREAMS 0x00040000
5424 #define FILE_READ_ONLY_VOLUME 0x00080000
5425 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
5426 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
5427 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
5428 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
5429 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
5430 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
5431 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000
5432 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
5433 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000
5435 /* File alignments (NT) */
5436 #define FILE_BYTE_ALIGNMENT 0x00000000
5437 #define FILE_WORD_ALIGNMENT 0x00000001
5438 #define FILE_LONG_ALIGNMENT 0x00000003
5439 #define FILE_QUAD_ALIGNMENT 0x00000007
5440 #define FILE_OCTA_ALIGNMENT 0x0000000f
5441 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
5442 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
5443 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
5444 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
5445 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
5447 #define COMPRESSION_FORMAT_NONE 0
5448 #define COMPRESSION_FORMAT_DEFAULT 1
5449 #define COMPRESSION_FORMAT_LZNT1 2
5450 #define COMPRESSION_ENGINE_STANDARD 0
5451 #define COMPRESSION_ENGINE_MAXIMUM 256
5453 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
5454 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
5456 #define REG_NONE 0 /* no type */
5457 #define REG_SZ 1 /* string type (ASCII) */
5458 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
5459 #define REG_BINARY 3 /* binary format, callerspecific */
5460 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
5461 #define REG_DWORD 4 /* DWORD in little endian format */
5462 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
5463 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
5464 #define REG_LINK 6 /* symbolic link (UNICODE) */
5465 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
5466 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
5467 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
5468 #define REG_RESOURCE_REQUIREMENTS_LIST 10
5469 #define REG_QWORD 11 /* QWORD in little endian format */
5470 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
5472 /* ----------------------------- begin power management --------------------- */
5474 typedef enum _LATENCY_TIME
{
5477 } LATENCY_TIME
, *PLATENCY_TIME
;
5479 #define DISCHARGE_POLICY_CRITICAL 0
5480 #define DISCHARGE_POLICY_LOW 1
5481 #define NUM_DISCHARGE_POLICIES 4
5483 #define PO_THROTTLE_NONE 0
5484 #define PO_THROTTLE_CONSTANT 1
5485 #define PO_THROTTLE_DEGRADE 2
5486 #define PO_THROTTLE_ADAPTIVE 3
5488 typedef enum _POWER_ACTION
{
5489 PowerActionNone
= 0,
5490 PowerActionReserved
,
5492 PowerActionHibernate
,
5493 PowerActionShutdown
,
5494 PowerActionShutdownReset
,
5495 PowerActionShutdownOff
,
5496 PowerActionWarmEject
5500 typedef enum _POWER_PLATFORM_ROLE
{
5501 PlatformRoleUnspecified
,
5502 PlatformRoleDesktop
,
5504 PlatformRoleWorkstation
,
5505 PlatformRoleEnterpriseServer
,
5506 PlatformRoleSOHOServer
,
5507 PlatformRoleAppliancePC
,
5508 PlatformRolePerformanceServer
,
5511 } POWER_PLATFORM_ROLE
, *PPOWER_PLATFORM_ROLE
;
5513 typedef enum _SYSTEM_POWER_STATE
{
5514 PowerSystemUnspecified
= 0,
5515 PowerSystemWorking
= 1,
5516 PowerSystemSleeping1
= 2,
5517 PowerSystemSleeping2
= 3,
5518 PowerSystemSleeping3
= 4,
5519 PowerSystemHibernate
= 5,
5520 PowerSystemShutdown
= 6,
5521 PowerSystemMaximum
= 7
5522 } SYSTEM_POWER_STATE
,
5523 *PSYSTEM_POWER_STATE
;
5525 typedef enum _DEVICE_POWER_STATE
{
5526 PowerDeviceUnspecified
,
5532 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
5534 typedef enum _POWER_INFORMATION_LEVEL
{
5535 SystemPowerPolicyAc
,
5536 SystemPowerPolicyDc
,
5537 VerifySystemPolicyAc
,
5538 VerifySystemPolicyDc
,
5539 SystemPowerCapabilities
,
5541 SystemPowerStateHandler
,
5542 ProcessorStateHandler
,
5543 SystemPowerPolicyCurrent
,
5544 AdministratorPowerPolicy
,
5545 SystemReserveHiberFile
,
5546 ProcessorInformation
,
5547 SystemPowerInformation
,
5548 ProcessorStateHandler2
,
5551 SystemExecutionState
,
5552 SystemPowerStateNotifyHandler
,
5553 ProcessorPowerPolicyAc
,
5554 ProcessorPowerPolicyDc
,
5555 VerifyProcessorPowerPolicyAc
,
5556 VerifyProcessorPowerPolicyDc
,
5557 ProcessorPowerPolicyCurrent
5558 } POWER_INFORMATION_LEVEL
;
5560 typedef struct _ADMINISTRATOR_POWER_POLICY
{
5561 SYSTEM_POWER_STATE MinSleep
;
5562 SYSTEM_POWER_STATE MaxSleep
;
5563 ULONG MinVideoTimeout
;
5564 ULONG MaxVideoTimeout
;
5565 ULONG MinSpindownTimeout
;
5566 ULONG MaxSpindownTimeout
;
5567 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
5572 } BATTERY_REPORTING_SCALE
,
5573 *PBATTERY_REPORTING_SCALE
;
5576 POWER_ACTION Action
;
5579 } POWER_ACTION_POLICY
,
5580 *PPOWER_ACTION_POLICY
;
5582 typedef struct _PROCESSOR_POWER_INFORMATION
{
5588 ULONG CurrentIdleState
;
5589 } PROCESSOR_POWER_INFORMATION
,
5590 *PPROCESSOR_POWER_INFORMATION
;
5592 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
5596 UCHAR DemotePercent
;
5597 UCHAR PromotePercent
;
5599 ULONG AllowDemotion
:1;
5600 ULONG AllowPromotion
:1;
5602 } PROCESSOR_POWER_POLICY_INFO
,
5603 *PPROCESSOR_POWER_POLICY_INFO
;
5605 typedef struct _PROCESSOR_POWER_POLICY
{
5607 BYTE DynamicThrottle
;
5609 DWORD DisableCStates
:1;
5612 PROCESSOR_POWER_POLICY_INFO Policy
[3];
5613 } PROCESSOR_POWER_POLICY
,
5614 *PPROCESSOR_POWER_POLICY
;
5618 BOOLEAN BatteryPresent
;
5620 BOOLEAN Discharging
;
5624 ULONG RemainingCapacity
;
5626 ULONG EstimatedTime
;
5627 ULONG DefaultAlert1
;
5628 ULONG DefaultAlert2
;
5629 } SYSTEM_BATTERY_STATE
,
5630 *PSYSTEM_BATTERY_STATE
;
5633 BOOLEAN PowerButtonPresent
;
5634 BOOLEAN SleepButtonPresent
;
5641 BOOLEAN HiberFilePresent
;
5643 BOOLEAN VideoDimPresent
;
5646 BOOLEAN ThermalControl
;
5647 BOOLEAN ProcessorThrottle
;
5648 UCHAR ProcessorMinThrottle
;
5649 UCHAR ProcessorMaxThrottle
;
5651 BOOLEAN DiskSpinDown
;
5653 BOOLEAN SystemBatteriesPresent
;
5654 BOOLEAN BatteriesAreShortTerm
;
5655 BATTERY_REPORTING_SCALE BatteryScale
[3];
5656 SYSTEM_POWER_STATE AcOnLineWake
;
5657 SYSTEM_POWER_STATE SoftLidWake
;
5658 SYSTEM_POWER_STATE RtcWake
;
5659 SYSTEM_POWER_STATE MinDeviceWakeState
;
5660 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
5661 } SYSTEM_POWER_CAPABILITIES
,
5662 *PSYSTEM_POWER_CAPABILITIES
;
5664 typedef struct _SYSTEM_POWER_INFORMATION
{
5665 ULONG MaxIdlenessAllowed
;
5667 ULONG TimeRemaining
;
5669 } SYSTEM_POWER_INFORMATION
,
5670 *PSYSTEM_POWER_INFORMATION
;
5672 typedef struct _SYSTEM_POWER_LEVEL
{
5676 POWER_ACTION_POLICY PowerPolicy
;
5677 SYSTEM_POWER_STATE MinSystemState
;
5678 } SYSTEM_POWER_LEVEL
,
5679 *PSYSTEM_POWER_LEVEL
;
5681 typedef struct _SYSTEM_POWER_POLICY
{
5683 POWER_ACTION_POLICY PowerButton
;
5684 POWER_ACTION_POLICY SleepButton
;
5685 POWER_ACTION_POLICY LidClose
;
5686 SYSTEM_POWER_STATE LidOpenWake
;
5688 POWER_ACTION_POLICY Idle
;
5690 UCHAR IdleSensitivity
;
5691 UCHAR DynamicThrottle
;
5693 SYSTEM_POWER_STATE MinSleep
;
5694 SYSTEM_POWER_STATE MaxSleep
;
5695 SYSTEM_POWER_STATE ReducedLatencySleep
;
5696 ULONG WinLogonFlags
;
5698 ULONG DozeS4Timeout
;
5699 ULONG BroadcastCapacityResolution
;
5700 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
5702 BOOLEAN VideoDimDisplay
;
5703 ULONG VideoReserved
[3];
5704 ULONG SpindownTimeout
;
5705 BOOLEAN OptimizeForPower
;
5706 UCHAR FanThrottleTolerance
;
5707 UCHAR ForcedThrottle
;
5709 POWER_ACTION_POLICY OverThrottled
;
5710 } SYSTEM_POWER_POLICY
,
5711 *PSYSTEM_POWER_POLICY
;
5713 typedef enum _POWER_REQUEST_TYPE
5715 PowerRequestDisplayRequired
,
5716 PowerRequestSystemRequired
,
5717 PowerRequestAwayModeRequired
5718 } POWER_REQUEST_TYPE
, *PPOWER_REQUEST_TYPE
;
5720 #define POWER_REQUEST_CONTEXT_VERSION 0
5722 #define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
5723 #define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
5725 typedef union _FILE_SEGMENT_ELEMENT
{
5727 ULONGLONG Alignment
;
5728 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
5730 typedef struct _FILE_NOTIFY_INFORMATION
{
5731 DWORD NextEntryOffset
;
5733 DWORD FileNameLength
;
5735 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
5737 /* ----------------------------- begin tape storage --------------------- */
5739 #define TAPE_FIXED_PARTITIONS 0
5740 #define TAPE_SELECT_PARTITIONS 1
5741 #define TAPE_INITIATOR_PARTITIONS 2
5742 #define TAPE_ERASE_SHORT 0
5743 #define TAPE_ERASE_LONG 1
5745 #define TAPE_UNLOAD 1
5746 #define TAPE_TENSION 2
5748 #define TAPE_UNLOCK 4
5749 #define TAPE_FORMAT 5
5750 #define TAPE_SETMARKS 0
5751 #define TAPE_FILEMARKS 1
5752 #define TAPE_SHORT_FILEMARKS 2
5753 #define TAPE_LONG_FILEMARKS 3
5754 #define TAPE_REWIND 0
5755 #define TAPE_ABSOLUTE_BLOCK 1
5756 #define TAPE_LOGICAL_BLOCK 2
5757 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5758 #define TAPE_SPACE_END_OF_DATA 4
5759 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5760 #define TAPE_SPACE_FILEMARKS 6
5761 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5762 #define TAPE_SPACE_SETMARKS 8
5763 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5765 typedef struct _TAPE_CREATE_PARTITION
{
5769 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5771 typedef struct _TAPE_ERASE
{
5774 } TAPE_ERASE
, *PTAPE_ERASE
;
5776 typedef struct _TAPE_PREPARE
{
5779 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5781 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5783 BOOLEAN Compression
;
5784 BOOLEAN DataPadding
;
5785 BOOLEAN ReportSetmarks
;
5786 ULONG EOTWarningZoneSize
;
5787 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5789 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5791 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5793 typedef struct _TAPE_WRITE_MARKS
{
5797 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5799 typedef struct _TAPE_GET_POSITION
{
5804 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5806 typedef struct _TAPE_SET_POSITION
{
5809 LARGE_INTEGER Offset
;
5811 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5813 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5815 BOOLEAN Compression
;
5816 BOOLEAN DataPadding
;
5817 BOOLEAN ReportSetmarks
;
5818 DWORD DefaultBlockSize
;
5819 DWORD MaximumBlockSize
;
5820 DWORD MinimumBlockSize
;
5821 DWORD MaximumPartitionCount
;
5824 DWORD EOTWarningZoneSize
;
5825 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5827 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5828 LARGE_INTEGER Capacity
;
5829 LARGE_INTEGER Remaining
;
5831 DWORD PartitionCount
;
5832 BOOLEAN WriteProtected
;
5833 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5835 /* ----------------------------- begin registry ----------------------------- */
5837 /* Registry security values */
5838 #define OWNER_SECURITY_INFORMATION 0x00000001
5839 #define GROUP_SECURITY_INFORMATION 0x00000002
5840 #define DACL_SECURITY_INFORMATION 0x00000004
5841 #define SACL_SECURITY_INFORMATION 0x00000008
5842 #define LABEL_SECURITY_INFORMATION 0x00000010
5844 #define REG_OPTION_RESERVED 0x00000000
5845 #define REG_OPTION_NON_VOLATILE 0x00000000
5846 #define REG_OPTION_VOLATILE 0x00000001
5847 #define REG_OPTION_CREATE_LINK 0x00000002
5848 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5849 #define REG_OPTION_OPEN_LINK 0x00000008
5850 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | \
5851 REG_OPTION_NON_VOLATILE | \
5852 REG_OPTION_VOLATILE | \
5853 REG_OPTION_CREATE_LINK | \
5854 REG_OPTION_BACKUP_RESTORE | \
5855 REG_OPTION_OPEN_LINK)
5858 #define REG_CREATED_NEW_KEY 0x00000001
5859 #define REG_OPENED_EXISTING_KEY 0x00000002
5861 /* For RegNotifyChangeKeyValue */
5862 #define REG_NOTIFY_CHANGE_NAME 0x01
5863 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5864 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5865 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5866 #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
5868 #define KEY_QUERY_VALUE 0x00000001
5869 #define KEY_SET_VALUE 0x00000002
5870 #define KEY_CREATE_SUB_KEY 0x00000004
5871 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5872 #define KEY_NOTIFY 0x00000010
5873 #define KEY_CREATE_LINK 0x00000020
5874 #define KEY_WOW64_64KEY 0x00000100
5875 #define KEY_WOW64_32KEY 0x00000200
5876 #define KEY_WOW64_RES 0x00000300
5878 /* for RegKeyRestore flags */
5879 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5880 #define REG_REFRESH_HIVE 0x00000002
5881 #define REG_NO_LAZY_FLUSH 0x00000004
5882 #define REG_FORCE_RESTORE 0x00000008
5884 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5886 KEY_ENUMERATE_SUB_KEYS| \
5890 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5892 KEY_CREATE_SUB_KEY) \
5895 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5896 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5899 KEY_CREATE_SUB_KEY| \
5900 KEY_ENUMERATE_SUB_KEYS| \
5905 /* ------------------------------ end registry ------------------------------ */
5908 #define EVENTLOG_SUCCESS 0x0000
5909 #define EVENTLOG_ERROR_TYPE 0x0001
5910 #define EVENTLOG_WARNING_TYPE 0x0002
5911 #define EVENTLOG_INFORMATION_TYPE 0x0004
5912 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5913 #define EVENTLOG_AUDIT_FAILURE 0x0010
5915 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5916 #define EVENTLOG_SEEK_READ 0x0002
5917 #define EVENTLOG_FORWARDS_READ 0x0004
5918 #define EVENTLOG_BACKWARDS_READ 0x0008
5920 typedef struct _EVENTLOGRECORD
{
5924 DWORD TimeGenerated
;
5931 DWORD ClosingRecordNumber
;
5933 DWORD UserSidLength
;
5934 DWORD UserSidOffset
;
5937 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5939 #define SERVICE_BOOT_START 0x00000000
5940 #define SERVICE_SYSTEM_START 0x00000001
5941 #define SERVICE_AUTO_START 0x00000002
5942 #define SERVICE_DEMAND_START 0x00000003
5943 #define SERVICE_DISABLED 0x00000004
5945 #define SERVICE_ERROR_IGNORE 0x00000000
5946 #define SERVICE_ERROR_NORMAL 0x00000001
5947 #define SERVICE_ERROR_SEVERE 0x00000002
5948 #define SERVICE_ERROR_CRITICAL 0x00000003
5951 #define SERVICE_KERNEL_DRIVER 0x00000001
5952 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5953 #define SERVICE_ADAPTER 0x00000004
5954 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5956 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5957 SERVICE_RECOGNIZER_DRIVER )
5959 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5960 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5961 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5963 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5965 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5966 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5969 typedef enum _CM_SERVICE_NODE_TYPE
5971 DriverType
= SERVICE_KERNEL_DRIVER
,
5972 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5973 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5974 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5975 AdapterType
= SERVICE_ADAPTER
,
5976 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5977 } SERVICE_NODE_TYPE
;
5979 typedef enum _CM_SERVICE_LOAD_TYPE
5981 BootLoad
= SERVICE_BOOT_START
,
5982 SystemLoad
= SERVICE_SYSTEM_START
,
5983 AutoLoad
= SERVICE_AUTO_START
,
5984 DemandLoad
= SERVICE_DEMAND_START
,
5985 DisableLoad
= SERVICE_DISABLED
5986 } SERVICE_LOAD_TYPE
;
5988 typedef enum _CM_ERROR_CONTROL_TYPE
5990 IgnoreError
= SERVICE_ERROR_IGNORE
,
5991 NormalError
= SERVICE_ERROR_NORMAL
,
5992 SevereError
= SERVICE_ERROR_SEVERE
,
5993 CriticalError
= SERVICE_ERROR_CRITICAL
5994 } SERVICE_ERROR_TYPE
;
5996 NTSYSAPI SIZE_T WINAPI
RtlCompareMemory(const VOID
*, const VOID
*, SIZE_T
);
5998 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5999 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
6000 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
6001 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
6002 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
6004 static FORCEINLINE
void *RtlSecureZeroMemory(void *buffer
, SIZE_T length
)
6006 volatile char *ptr
= (volatile char *)buffer
;
6008 while (length
--) *ptr
++ = 0;
6012 #include <guiddef.h>
6014 typedef struct _OBJECT_TYPE_LIST
{
6018 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
6020 typedef struct _RTL_CRITICAL_SECTION_DEBUG
6023 WORD CreatorBackTraceIndex
;
6024 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
6025 LIST_ENTRY ProcessLocksList
;
6027 DWORD ContentionCount
;
6028 #ifdef __WINESRC__ /* in Wine we store the name here */
6029 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
6033 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
6035 typedef struct _RTL_CRITICAL_SECTION
{
6036 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
6038 LONG RecursionCount
;
6039 HANDLE OwningThread
;
6040 HANDLE LockSemaphore
;
6041 ULONG_PTR SpinCount
;
6042 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
6044 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
6045 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
6046 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
6047 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
6048 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
6050 typedef struct _RTL_SRWLOCK
{
6052 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
6054 #define RTL_SRWLOCK_INIT {0}
6056 typedef struct _RTL_CONDITION_VARIABLE
{
6058 } RTL_CONDITION_VARIABLE
, *PRTL_CONDITION_VARIABLE
;
6059 #define RTL_CONDITION_VARIABLE_INIT {0}
6060 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
6062 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
6063 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
6065 #define RTL_RUN_ONCE_INIT {0}
6066 typedef union _RTL_RUN_ONCE
{
6068 } RTL_RUN_ONCE
, *PRTL_RUN_ONCE
;
6070 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
6071 #define RTL_RUN_ONCE_ASYNC 0x00000002
6072 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004
6074 typedef DWORD WINAPI
RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE
, PVOID
, PVOID
*);
6075 typedef RTL_RUN_ONCE_INIT_FN
*PRTL_RUN_ONCE_INIT_FN
;
6076 NTSYSAPI VOID WINAPI
RtlRunOnceInitialize(PRTL_RUN_ONCE
);
6077 NTSYSAPI DWORD WINAPI
RtlRunOnceExecuteOnce(PRTL_RUN_ONCE
,PRTL_RUN_ONCE_INIT_FN
,PVOID
,PVOID
*);
6078 NTSYSAPI DWORD WINAPI
RtlRunOnceBeginInitialize(PRTL_RUN_ONCE
, DWORD
, PVOID
*);
6079 NTSYSAPI DWORD WINAPI
RtlRunOnceComplete(PRTL_RUN_ONCE
, DWORD
, PVOID
);
6081 #include <pshpack8.h>
6082 typedef struct _IO_COUNTERS
{
6083 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
6084 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
6085 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
6086 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
6087 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
6088 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
6089 } IO_COUNTERS
, *PIO_COUNTERS
;
6090 #include <poppack.h>
6093 DWORD dwOSVersionInfoSize
;
6094 DWORD dwMajorVersion
;
6095 DWORD dwMinorVersion
;
6096 DWORD dwBuildNumber
;
6098 CHAR szCSDVersion
[128];
6099 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
6102 DWORD dwOSVersionInfoSize
;
6103 DWORD dwMajorVersion
;
6104 DWORD dwMinorVersion
;
6105 DWORD dwBuildNumber
;
6107 WCHAR szCSDVersion
[128];
6108 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
6110 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
6111 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
6112 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
6115 DWORD dwOSVersionInfoSize
;
6116 DWORD dwMajorVersion
;
6117 DWORD dwMinorVersion
;
6118 DWORD dwBuildNumber
;
6120 CHAR szCSDVersion
[128];
6121 WORD wServicePackMajor
;
6122 WORD wServicePackMinor
;
6126 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
6129 DWORD dwOSVersionInfoSize
;
6130 DWORD dwMajorVersion
;
6131 DWORD dwMinorVersion
;
6132 DWORD dwBuildNumber
;
6134 WCHAR szCSDVersion
[128];
6135 WORD wServicePackMajor
;
6136 WORD wServicePackMinor
;
6140 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
6142 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
6143 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
6144 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
6146 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
6148 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
6150 #define VER_PLATFORM_WIN32s 0
6151 #define VER_PLATFORM_WIN32_WINDOWS 1
6152 #define VER_PLATFORM_WIN32_NT 2
6154 #define VER_MINORVERSION 0x00000001
6155 #define VER_MAJORVERSION 0x00000002
6156 #define VER_BUILDNUMBER 0x00000004
6157 #define VER_PLATFORMID 0x00000008
6158 #define VER_SERVICEPACKMINOR 0x00000010
6159 #define VER_SERVICEPACKMAJOR 0x00000020
6160 #define VER_SUITENAME 0x00000040
6161 #define VER_PRODUCT_TYPE 0x00000080
6163 #define VER_NT_WORKSTATION 1
6164 #define VER_NT_DOMAIN_CONTROLLER 2
6165 #define VER_NT_SERVER 3
6167 #define VER_SUITE_SMALLBUSINESS 0x00000001
6168 #define VER_SUITE_ENTERPRISE 0x00000002
6169 #define VER_SUITE_BACKOFFICE 0x00000004
6170 #define VER_SUITE_COMMUNICATIONS 0x00000008
6171 #define VER_SUITE_TERMINAL 0x00000010
6172 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
6173 #define VER_SUITE_EMBEDDEDNT 0x00000040
6174 #define VER_SUITE_DATACENTER 0x00000080
6175 #define VER_SUITE_SINGLEUSERTS 0x00000100
6176 #define VER_SUITE_PERSONAL 0x00000200
6177 #define VER_SUITE_BLADE 0x00000400
6178 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
6179 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
6180 #define VER_SUITE_STORAGE_SERVER 0x00002000
6181 #define VER_SUITE_COMPUTE_SERVER 0x00004000
6182 #define VER_SUITE_WH_SERVER 0x00008000
6185 #define VER_GREATER 2
6186 #define VER_GREATER_EQUAL 3
6188 #define VER_LESS_EQUAL 5
6192 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
6194 DWORD ulFormatVersion
;
6195 DWORD ulAssemblyCount
;
6196 DWORD ulRootManifestPathType
;
6197 DWORD ulRootManifestPathChars
;
6198 DWORD ulRootConfigurationPathType
;
6199 DWORD ulRootConfigurationPathChars
;
6200 DWORD ulAppDirPathType
;
6201 DWORD ulAppDirPathChars
;
6202 PCWSTR lpRootManifestPath
;
6203 PCWSTR lpRootConfigurationPath
;
6204 PCWSTR lpAppDirPath
;
6205 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
6207 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
6209 DWORD ulEncodedAssemblyIdentityLength
;
6210 DWORD ulManifestPathType
;
6211 DWORD ulManifestPathLength
;
6212 LARGE_INTEGER liManifestLastWriteTime
;
6213 DWORD ulPolicyPathType
;
6214 DWORD ulPolicyPathLength
;
6215 LARGE_INTEGER liPolicyLastWriteTime
;
6216 DWORD ulMetadataSatelliteRosterIndex
;
6217 DWORD ulManifestVersionMajor
;
6218 DWORD ulManifestVersionMinor
;
6219 DWORD ulPolicyVersionMajor
;
6220 DWORD ulPolicyVersionMinor
;
6221 DWORD ulAssemblyDirectoryNameLength
;
6222 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
6223 PCWSTR lpAssemblyManifestPath
;
6224 PCWSTR lpAssemblyPolicyPath
;
6225 PCWSTR lpAssemblyDirectoryName
;
6227 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
6229 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
6230 DWORD ulAssemblyIndex
;
6231 DWORD ulFileIndexInAssembly
;
6232 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
6234 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
6236 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
6238 DWORD ulFilenameLength
;
6242 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
6244 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
6247 ACTCX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN
= 0,
6248 ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS
6249 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE
;
6251 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT
{
6253 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type
;
6254 } COMPATIBILITY_CONTEXT_ELEMENT
, *PCOMPATIBILITY_CONTEXT_ELEMENT
;
6256 #if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3)))
6257 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
{
6259 COMPATIBILITY_CONTEXT_ELEMENT Elements
[];
6260 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
;
6264 ACTCTX_RUN_LEVEL_UNSPECIFIED
= 0,
6265 ACTCTX_RUN_LEVEL_AS_INVOKER
,
6266 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
,
6267 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
,
6268 ACTCTX_RUN_LEVEL_NUMBERS
6269 } ACTCTX_REQUESTED_RUN_LEVEL
;
6271 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
{
6273 ACTCTX_REQUESTED_RUN_LEVEL RunLevel
;
6275 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6277 typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
*PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
;
6279 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
6280 ActivationContextBasicInformation
= 1,
6281 ActivationContextDetailedInformation
= 2,
6282 AssemblyDetailedInformationInActivationContext
= 3,
6283 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
6284 RunlevelInformationInActivationContext
= 5,
6285 CompatibilityInformationInActivationContext
= 6,
6286 ActivationContextManifestResourceName
= 7,
6287 MaxActivationContextInfoClass
,
6288 AssemblyDetailedInformationInActivationContxt
= AssemblyDetailedInformationInActivationContext
,
6289 FileInformationInAssemblyOfAssemblyInActivationContxt
= FileInformationInAssemblyOfAssemblyInActivationContext
6290 } ACTIVATION_CONTEXT_INFO_CLASS
;
6292 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
6293 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
6294 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
6295 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
6297 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
6298 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
6299 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
6300 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
6301 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
6302 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
6303 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
6304 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
6305 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
6306 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10
6307 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11
6309 typedef enum _JOBOBJECTINFOCLASS
6311 JobObjectBasicAccountingInformation
= 1,
6312 JobObjectBasicLimitInformation
,
6313 JobObjectBasicProcessIdList
,
6314 JobObjectBasicUIRestrictions
,
6315 JobObjectSecurityLimitInformation
,
6316 JobObjectEndOfJobTimeInformation
,
6317 JobObjectAssociateCompletionPortInformation
,
6318 JobObjectBasicAndIoAccountingInformation
,
6319 JobObjectExtendedLimitInformation
,
6320 JobObjectJobSetInformation
,
6321 MaxJobObjectInfoClass
6322 } JOBOBJECTINFOCLASS
;
6324 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
{
6325 LARGE_INTEGER TotalUserTime
;
6326 LARGE_INTEGER TotalKernelTime
;
6327 LARGE_INTEGER ThisPeriodTotalUserTime
;
6328 LARGE_INTEGER ThisPeriodTotalKernelTime
;
6329 DWORD TotalPageFaultCount
;
6330 DWORD TotalProcesses
;
6331 DWORD ActiveProcesses
;
6332 DWORD TotalTerminatedProcesses
;
6333 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION
;
6335 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION
{
6336 LARGE_INTEGER PerProcessUserTimeLimit
;
6337 LARGE_INTEGER PerJobUserTimeLimit
;
6339 SIZE_T MinimumWorkingSetSize
;
6340 SIZE_T MaximumWorkingSetSize
;
6341 DWORD ActiveProcessLimit
;
6343 DWORD PriorityClass
;
6344 DWORD SchedulingClass
;
6345 } JOBOBJECT_BASIC_LIMIT_INFORMATION
, *PJOBOBJECT_BASIC_LIMIT_INFORMATION
;
6347 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST
{
6348 DWORD NumberOfAssignedProcesses
;
6349 DWORD NumberOfProcessIdsInList
;
6350 ULONG_PTR ProcessIdList
[1];
6351 } JOBOBJECT_BASIC_PROCESS_ID_LIST
, *PJOBOBJECT_BASIC_PROCESS_ID_LIST
;
6353 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS
{
6354 DWORD UIRestrictionsClass
;
6355 } JOBOBJECT_BASIC_UI_RESTRICTIONS
, *PJOBOBJECT_BASIC_UI_RESTRICTIONS
;
6357 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
6358 DWORD SecurityLimitFlags
;
6360 PTOKEN_GROUPS SidsToDisable
;
6361 PTOKEN_PRIVILEGES PrivilegesToDelete
;
6362 PTOKEN_GROUPS RestrictedSids
;
6363 } JOBOBJECT_SECURITY_LIMIT_INFORMATION
, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION
;
6365 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
{
6366 DWORD EndOfJobTimeAction
;
6367 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION
, PJOBOBJECT_END_OF_JOB_TIME_INFORMATION
;
6369 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
{
6370 PVOID CompletionKey
;
6371 HANDLE CompletionPort
;
6372 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT
, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT
;
6374 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
6375 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
6376 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
6377 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
6378 #define JOB_OBJECT_MSG_NEW_PROCESS 6
6379 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
6380 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
6381 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
6382 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
6384 typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
{
6385 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo
;
6387 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
;
6389 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
6390 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation
;
6392 SIZE_T ProcessMemoryLimit
;
6393 SIZE_T JobMemoryLimit
;
6394 SIZE_T PeakProcessMemoryUsed
;
6395 SIZE_T PeakJobMemoryUsed
;
6396 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION
, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION
;
6398 #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
6399 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
6400 #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
6401 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
6402 #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
6403 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
6404 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
6405 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
6406 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
6407 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
6408 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
6409 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
6410 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
6411 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
6412 #define JOB_OBJECT_LIMIT_SUBSET_AFFINITY 0x00004000
6414 #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
6415 #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
6416 #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00007fff
6418 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
6420 RelationProcessorCore
= 0,
6421 RelationNumaNode
= 1,
6423 RelationProcessorPackage
= 3,
6425 RelationAll
= 0xffff
6426 } LOGICAL_PROCESSOR_RELATIONSHIP
;
6428 #define LTP_PC_SMT 0x1
6430 typedef enum _PROCESSOR_CACHE_TYPE
6436 } PROCESSOR_CACHE_TYPE
;
6438 typedef struct _PROCESSOR_GROUP_INFO
6440 BYTE MaximumProcessorCount
;
6441 BYTE ActiveProcessorCount
;
6443 KAFFINITY ActiveProcessorMask
;
6444 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
6446 typedef struct _CACHE_DESCRIPTOR
6452 PROCESSOR_CACHE_TYPE Type
;
6453 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
6455 typedef struct _GROUP_AFFINITY
6460 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
6462 typedef struct _PROCESSOR_NUMBER
6467 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
6469 typedef struct _PROCESSOR_RELATIONSHIP
6472 BYTE EfficiencyClass
;
6475 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
6476 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
6478 typedef struct _NUMA_NODE_RELATIONSHIP
6482 GROUP_AFFINITY GroupMask
;
6483 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
6485 typedef struct _CACHE_RELATIONSHIP
6491 PROCESSOR_CACHE_TYPE Type
;
6493 GROUP_AFFINITY GroupMask
;
6494 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
6496 typedef struct _GROUP_RELATIONSHIP
6498 WORD MaximumGroupCount
;
6499 WORD ActiveGroupCount
;
6501 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
6502 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
6504 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
6506 ULONG_PTR ProcessorMask
;
6507 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6518 CACHE_DESCRIPTOR Cache
;
6519 ULONGLONG Reserved
[2];
6521 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
6523 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
6525 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
6529 PROCESSOR_RELATIONSHIP Processor
;
6530 NUMA_NODE_RELATIONSHIP NumaNode
;
6531 CACHE_RELATIONSHIP Cache
;
6532 GROUP_RELATIONSHIP Group
;
6534 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
6536 /* Threadpool things */
6537 typedef DWORD TP_VERSION
,*PTP_VERSION
;
6539 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
,*PTP_CALLBACK_INSTANCE
;
6541 typedef VOID (CALLBACK
*PTP_SIMPLE_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
);
6543 typedef struct _TP_POOL TP_POOL
,*PTP_POOL
;
6545 typedef enum _TP_CALLBACK_PRIORITY
6547 TP_CALLBACK_PRIORITY_HIGH
,
6548 TP_CALLBACK_PRIORITY_NORMAL
,
6549 TP_CALLBACK_PRIORITY_LOW
,
6550 TP_CALLBACK_PRIORITY_INVALID
,
6551 TP_CALLBACK_PRIORITY_COUNT
= TP_CALLBACK_PRIORITY_INVALID
6552 } TP_CALLBACK_PRIORITY
;
6554 typedef struct _TP_POOL_STACK_INFORMATION
6556 SIZE_T StackReserve
;
6558 } TP_POOL_STACK_INFORMATION
,*PTP_POOL_STACK_INFORMATION
;
6560 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP
,*PTP_CLEANUP_GROUP
;
6562 typedef VOID (CALLBACK
*PTP_CLEANUP_GROUP_CANCEL_CALLBACK
)(PVOID
,PVOID
);
6564 typedef struct _TP_CALLBACK_ENVIRON_V1
6568 PTP_CLEANUP_GROUP CleanupGroup
;
6569 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6571 struct _ACTIVATION_CONTEXT
* ActivationContext
;
6572 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6578 DWORD LongFunction
:1;
6583 } TP_CALLBACK_ENVIRON_V1
;
6585 typedef struct _TP_CALLBACK_ENVIRON_V3
6589 PTP_CLEANUP_GROUP CleanupGroup
;
6590 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback
;
6592 struct _ACTIVATION_CONTEXT
*ActivationContext
;
6593 PTP_SIMPLE_CALLBACK FinalizationCallback
;
6599 DWORD LongFunction
:1;
6604 TP_CALLBACK_PRIORITY CallbackPriority
;
6606 } TP_CALLBACK_ENVIRON_V3
;
6608 typedef struct _TP_WORK TP_WORK
, *PTP_WORK
;
6609 typedef struct _TP_TIMER TP_TIMER
, *PTP_TIMER
;
6611 typedef DWORD TP_WAIT_RESULT
;
6612 typedef struct _TP_WAIT TP_WAIT
, *PTP_WAIT
;
6614 typedef struct _TP_IO TP_IO
, *PTP_IO
;
6616 typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON
, *PTP_CALLBACK_ENVIRON
;
6618 typedef VOID (CALLBACK
*PTP_WORK_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WORK
);
6619 typedef VOID (CALLBACK
*PTP_TIMER_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_TIMER
);
6620 typedef VOID (CALLBACK
*PTP_WAIT_CALLBACK
)(PTP_CALLBACK_INSTANCE
,PVOID
,PTP_WAIT
,TP_WAIT_RESULT
);
6623 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
6625 typedef enum _RTL_UMS_THREAD_INFO_CLASS
6627 UmsThreadInvalidInfoClass
,
6628 UmsThreadUserContext
,
6632 UmsThreadIsSuspended
,
6633 UmsThreadIsTerminated
,
6634 UmsThreadMaxInfoClass
6635 } RTL_UMS_THREAD_INFO_CLASS
, *PRTL_UMS_THREAD_INFO_CLASS
;
6637 typedef enum _RTL_UMS_SCHEDULER_REASON
6639 UmsSchedulerStartup
,
6640 UmsSchedulerThreadBlocked
,
6641 UmsSchedulerThreadYield
,
6642 } RTL_UMS_SCHEDULER_REASON
, *PRTL_UMS_SCHEDULER_REASON
;
6644 typedef void (CALLBACK
*PRTL_UMS_SCHEDULER_ENTRY_POINT
)(RTL_UMS_SCHEDULER_REASON
,ULONG_PTR
,PVOID
);
6646 typedef enum _PROCESS_MITIGATION_POLICY
6650 ProcessDynamicCodePolicy
,
6651 ProcessStrictHandleCheckPolicy
,
6652 ProcessSystemCallDisablePolicy
,
6653 ProcessMitigationOptionsMask
,
6654 ProcessExtensionPointDisablePolicy
,
6655 ProcessControlFlowGuardPolicy
,
6656 ProcessSignaturePolicy
,
6657 ProcessFontDisablePolicy
,
6658 ProcessImageLoadPolicy
,
6659 ProcessSystemCallFilterPolicy
,
6660 ProcessPayloadRestrictionPolicy
,
6661 ProcessChildProcessPolicy
,
6662 ProcessSideChannelIsolationPolicy
,
6663 MaxProcessMitigationPolicy
6664 } PROCESS_MITIGATION_POLICY
, *PPROCESS_MITIGATION_POLICY
;
6670 #endif /* _WINNT_ */