dbghelp: Use local declaration for 64-bit macho nlist.
[wine.git] / include / winnt.h
blob7a5b8aafc194b7fcb5f67c70f50fd079392e73cb
1 /*
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
21 #ifndef _WINNT_
22 #define _WINNT_
24 #include <basetsd.h>
25 #include <guiddef.h>
27 #ifndef RC_INVOKED
28 #include <ctype.h>
29 #include <stddef.h>
30 #include <string.h>
31 #endif
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #ifdef _NTSYSTEM_
39 #define NTSYSAPI
40 #else
41 #define NTSYSAPI DECLSPEC_IMPORT
42 #endif
44 #define NTAPI __stdcall
45 #define FASTCALL __fastcall
47 #ifndef MIDL_PASS
48 # if defined(_MSC_VER)
49 # define DECLSPEC_IMPORT __declspec(dllimport)
50 # elif defined(__MINGW32__) || defined(__CYGWIN__)
51 # define DECLSPEC_IMPORT __attribute__((dllimport))
52 # else
53 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
54 # endif
55 #else
56 # define DECLSPEC_IMPORT
57 #endif
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))
64 # else
65 # define DECLSPEC_NORETURN
66 # endif
67 #endif
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)))
74 # else
75 # define DECLSPEC_ALIGN(x)
76 # endif
77 #endif
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))
84 # else
85 # define DECLSPEC_NOTHROW
86 # endif
87 #endif
89 #ifndef DECLSPEC_CACHEALIGN
90 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
91 #endif
93 #ifndef DECLSPEC_UUID
94 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
95 # define DECLSPEC_UUID(x) __declspec(uuid(x))
96 # else
97 # define DECLSPEC_UUID(x)
98 # endif
99 #endif
101 #ifndef DECLSPEC_NOVTABLE
102 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
103 # define DECLSPEC_NOVTABLE __declspec(novtable)
104 # else
105 # define DECLSPEC_NOVTABLE
106 # endif
107 #endif
109 #ifndef DECLSPEC_SELECTANY
110 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
111 #define DECLSPEC_SELECTANY __declspec(selectany)
112 #else
113 #define DECLSPEC_SELECTANY
114 #endif
115 #endif
117 #ifndef NOP_FUNCTION
118 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
119 # define NOP_FUNCTION __noop
120 # else
121 # define NOP_FUNCTION (void)0
122 # endif
123 #endif
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)
128 # else
129 # define DECLSPEC_ADDRSAFE
130 # endif
131 #endif
133 #ifndef FORCEINLINE
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))
138 # else
139 # define FORCEINLINE inline
140 # endif
141 #endif
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
150 # else
151 # define DECLSPEC_DEPRECATED
152 # undef DEPRECATE_SUPPORTED
153 # endif
154 #endif
156 /* a couple of useful Wine extensions */
158 #ifdef _MSC_VER
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")))
164 #else
165 # define DECLSPEC_EXPORT
166 #endif
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")))
172 #else
173 # define DECLSPEC_HIDDEN
174 #endif
176 #ifndef __has_attribute
177 # define __has_attribute(x) 0
178 #endif
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__))
182 #else
183 #define DECLSPEC_HOTPATCH
184 #endif
186 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
187 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
188 #else
189 #define __WINE_ALLOC_SIZE(x)
190 #endif
192 /* Anonymous union/struct handling */
194 #ifndef NONAMELESSSTRUCT
195 # ifdef __GNUC__
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
199 # endif
200 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
201 # define NONAMELESSSTRUCT
202 # endif
203 #endif /* NONAMELESSSTRUCT */
205 #ifndef NONAMELESSUNION
206 # ifdef __GNUC__
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
210 # endif
211 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
212 # define NONAMELESSUNION
213 # endif
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)
287 # ifdef __GNUC__
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__
291 # endif
292 # elif defined(_MSC_VER)
293 # define __C89_NAMELESS
294 # endif
295 #endif
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
313 #else
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
330 #endif
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
339 # else
340 # define RESTRICTED_POINTER
341 # endif
342 #else
343 # define RESTRICTED_POINTER
344 #endif
346 /* C99 unaligned support */
348 #ifndef UNALIGNED
349 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
350 # define UNALIGNED __unaligned
351 # ifdef _WIN64
352 # define UNALIGNED64 __unaligned
353 # else
354 # define UNALIGNED64
355 # endif
356 #else
357 # define UNALIGNED
358 # define UNALIGNED64
359 #endif
360 #endif
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
367 #else
368 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
369 #define MEMORY_ALLOCATION_ALIGNMENT 8
370 #endif
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)
376 #else
377 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
378 #endif
380 #ifdef _WIN64
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)
385 #else
386 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
387 #endif
389 /* Compile time assertion */
391 #if defined(_MSC_VER)
392 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
393 #else
394 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
395 #endif
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()
402 #else
403 # define DEFAULT_UNREACHABLE default:
404 #endif
406 /* Error Masks */
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
413 #ifdef __cplusplus
414 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
415 extern "C++" { \
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)); } \
424 #else
425 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
426 #endif
428 /* Microsoft's macros for declaring functions */
430 #ifdef __cplusplus
431 # define EXTERN_C extern "C"
432 #else
433 # define EXTERN_C extern
434 #endif
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 */
451 #ifndef VOID
452 #define VOID void
453 #endif
454 typedef VOID *PVOID;
455 typedef VOID *PVOID64;
456 typedef BYTE BOOLEAN, *PBOOLEAN;
457 typedef char CHAR, *PCHAR;
458 typedef short SHORT, *PSHORT;
459 #ifdef _MSC_VER
460 typedef long LONG, *PLONG;
461 #else
462 typedef int LONG, *PLONG;
463 #endif
465 /* Some systems might have wchar_t, but we really need 16 bit characters */
466 #if defined(WINE_UNICODE_NATIVE)
467 typedef wchar_t WCHAR;
468 #elif defined(WINE_UNICODE_CHAR16)
469 typedef char16_t WCHAR;
470 #else
471 typedef unsigned short WCHAR;
472 #endif
473 typedef WCHAR *PWCHAR;
475 typedef ULONG UCSCHAR;
476 #define MIN_UCSCHAR (0)
477 #define MAX_UCSCHAR (0x0010ffff)
478 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
480 /* 'Extended/Wide' numerical types */
481 #ifndef _ULONGLONG_
482 # define _ULONGLONG_
483 # ifdef _MSC_VER
484 typedef signed __int64 LONGLONG, *PLONGLONG;
485 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
486 # else
487 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
488 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
489 # endif
490 #endif
492 #ifndef _DWORDLONG_
493 # define _DWORDLONG_
494 # ifdef _MSC_VER
495 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
496 # else
497 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
498 # endif
499 #endif
501 /* ANSI string types */
502 typedef CHAR *PCH, *LPCH, *PNZCH;
503 typedef const CHAR *PCCH, *LPCCH, *PCNZCH;
504 typedef CHAR *PSTR, *LPSTR, *NPSTR;
505 typedef const CHAR *PCSTR, *LPCSTR;
506 typedef CHAR *PZZSTR;
507 typedef const CHAR *PCZZSTR;
509 /* Unicode string types */
510 typedef const WCHAR *PCWCHAR, *LPCUWCHAR, *PCUWCHAR;
511 typedef WCHAR *PWCH, *LPWCH;
512 typedef const WCHAR *PCWCH, *LPCWCH;
513 typedef WCHAR *PNZWCH, *PUNZWCH;
514 typedef const WCHAR *PCNZWCH, *PCUNZWCH;
515 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
516 typedef const WCHAR *PCWSTR, *LPCWSTR;
517 typedef WCHAR *PZZWSTR, *PUZZWSTR;
518 typedef const WCHAR *PCZZWSTR, *PCUZZWSTR;
519 typedef PWSTR *PZPWSTR;
520 typedef PCWSTR *PZPCWSTR;
522 /* Neutral character and string types */
523 /* These are only defined for Winelib, i.e. _not_ defined for
524 * the emulator. The reason is they depend on the UNICODE
525 * macro which only exists in the user's code.
527 #ifndef WINE_NO_UNICODE_MACROS
528 # ifdef UNICODE
529 # ifndef _TCHAR_DEFINED
530 typedef WCHAR TCHAR, *PTCHAR;
531 # define _TCHAR_DEFINED
532 #endif
533 typedef LPWCH PTCH, LPTCH;
534 typedef LPCWCH PCTCH, LPCTCH;
535 typedef LPWSTR PTSTR, LPTSTR;
536 typedef LPCWSTR PCTSTR, LPCTSTR;
537 typedef LPWSTR PUTSTR, LPUTSTR;
538 typedef LPCWSTR PCUTSTR, LPCUTSTR;
539 typedef PNZWCH PNZTCH;
540 typedef PUNZWCH PUNZTCH;
541 typedef PCNZWCH PCNZTCH;
542 typedef PCUNZWCH PCUNZTCH;
543 typedef PZZWSTR PZZTSTR;
544 typedef PCZZWSTR PCZZTSTR;
545 typedef PUZZWSTR PUZZTSTR;
546 typedef PCUZZWSTR PCUZZTSTR;
547 # else /* UNICODE */
548 # ifndef _TCHAR_DEFINED
549 typedef CHAR TCHAR, *PTCHAR;
550 # define _TCHAR_DEFINED
551 # endif
552 typedef LPCH PTCH, LPTCH;
553 typedef LPCCH PCTCH, LPCTCH;
554 typedef LPSTR PTSTR, LPTSTR;
555 typedef LPCSTR PCTSTR, LPCTSTR;
556 typedef PNZCH PNZTCH, PUNZTCH;
557 typedef PCNZCH PCNZTCH, PCUNZTCH;
558 typedef PZZSTR PZZTSTR, PUZZTSTR;
559 typedef PCZZSTR PCZZTSTR, PCUZZTSTR;
560 # endif /* UNICODE */
561 #endif /* WINE_NO_UNICODE_MACROS */
563 /* UCS string types */
564 typedef UCSCHAR *PUCSCHAR, *PUUCSCHAR;
565 typedef const UCSCHAR *PCUCSCHAR, *PCUUCSCHAR;
566 typedef UCSCHAR *PUCSSTR, *PUUCSSTR;
567 typedef const UCSCHAR *PCUCSSTR, *PCUUCSSTR;
569 /* Misc common WIN32 types */
570 typedef char CCHAR;
571 typedef DWORD LCID, *PLCID;
572 typedef WORD LANGID;
573 typedef DWORD EXECUTION_STATE;
574 #ifndef _HRESULT_DEFINED
575 #define _HRESULT_DEFINED
576 typedef LONG HRESULT;
577 #endif
579 /* Handle type */
581 typedef void *HANDLE;
582 typedef HANDLE *PHANDLE, *LPHANDLE;
584 #ifdef STRICT
585 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
586 #else /*STRICT*/
587 #define DECLARE_HANDLE(a) typedef HANDLE a
588 #endif /*STRICT*/
590 typedef BYTE FCHAR;
591 typedef WORD FSHORT;
592 typedef DWORD FLONG;
594 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
595 #ifndef __MSABI_LONG
596 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
597 # define __MSABI_LONG(x) x ## l
598 # else
599 # define __MSABI_LONG(x) x
600 # endif
601 #endif
603 /* Defines */
605 #ifndef WIN32_NO_STATUS
607 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
608 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
609 #define STATUS_USER_APC ((DWORD) 0x000000C0)
610 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
611 #define STATUS_PENDING ((DWORD) 0x00000103)
612 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
613 #define STATUS_FATAL_APP_EXIT ((DWORD) 0x40000015)
614 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
615 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
616 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
617 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
618 #define STATUS_LONGJUMP ((DWORD) 0x80000026)
619 #define STATUS_UNWIND_CONSOLIDATE ((DWORD) 0x80000029)
620 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
621 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
622 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
623 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
624 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
625 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
626 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
627 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
628 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
629 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
630 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
631 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
632 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
633 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
634 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
635 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
636 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
637 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
638 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
639 #define STATUS_DLL_NOT_FOUND ((DWORD) 0xC0000135)
640 #define STATUS_ORDINAL_NOT_FOUND ((DWORD) 0xC0000138)
641 #define STATUS_ENTRYPOINT_NOT_FOUND ((DWORD) 0xC0000139)
642 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
643 #define STATUS_DLL_INIT_FAILED ((DWORD) 0xC0000142)
644 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
645 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
646 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
647 #define STATUS_HEAP_CORRUPTION ((DWORD) 0xC0000374)
648 #define STATUS_STACK_BUFFER_OVERRUN ((DWORD) 0xC0000409)
649 #define STATUS_INVALID_CRUNTIME_PARAMETER ((DWORD) 0xC0000417)
650 #define STATUS_ASSERTION_FAILURE ((DWORD) 0xC0000420)
651 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
652 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
654 /* status values for ContinueDebugEvent */
655 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
656 #define DBG_CONTINUE ((DWORD) 0x00010002)
657 #define DBG_REPLY_LATER ((DWORD) 0x40010001)
658 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
659 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
660 #define DBG_CONTROL_C ((DWORD) 0x40010005)
661 #define DBG_PRINTEXCEPTION_C ((DWORD) 0x40010006)
662 #define DBG_RIPEXCEPTION ((DWORD) 0x40010007)
663 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
664 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
665 #define DBG_PRINTEXCEPTION_WIDE_C ((DWORD) 0x4001000A)
666 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
668 #endif /* WIN32_NO_STATUS */
670 /* Argument 1 passed to the DllEntryProc. */
671 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
672 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
673 #define DLL_THREAD_ATTACH 2 /* attach new thread */
674 #define DLL_THREAD_DETACH 3 /* detach thread */
675 #ifdef __WINESRC__
676 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
677 #endif
679 /* u.x.wProcessorArchitecture (NT) */
680 #define PROCESSOR_ARCHITECTURE_INTEL 0
681 #define PROCESSOR_ARCHITECTURE_MIPS 1
682 #define PROCESSOR_ARCHITECTURE_ALPHA 2
683 #define PROCESSOR_ARCHITECTURE_PPC 3
684 #define PROCESSOR_ARCHITECTURE_SHX 4
685 #define PROCESSOR_ARCHITECTURE_ARM 5
686 #define PROCESSOR_ARCHITECTURE_IA64 6
687 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
688 #define PROCESSOR_ARCHITECTURE_MSIL 8
689 #define PROCESSOR_ARCHITECTURE_AMD64 9
690 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
691 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
692 #define PROCESSOR_ARCHITECTURE_ARM64 12
693 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
694 #define PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 14
695 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
697 /* dwProcessorType */
698 #define PROCESSOR_INTEL_386 386
699 #define PROCESSOR_INTEL_486 486
700 #define PROCESSOR_INTEL_PENTIUM 586
701 #define PROCESSOR_INTEL_860 860
702 #define PROCESSOR_INTEL_IA64 2200
703 #define PROCESSOR_AMD_X8664 8664
704 #define PROCESSOR_MIPS_R2000 2000
705 #define PROCESSOR_MIPS_R3000 3000
706 #define PROCESSOR_MIPS_R4000 4000
707 #define PROCESSOR_ALPHA_21064 21064
708 #define PROCESSOR_PPC_601 601
709 #define PROCESSOR_PPC_603 603
710 #define PROCESSOR_PPC_604 604
711 #define PROCESSOR_PPC_620 620
712 #define PROCESSOR_HITACHI_SH3 10003
713 #define PROCESSOR_HITACHI_SH3E 10004
714 #define PROCESSOR_HITACHI_SH4 10005
715 #define PROCESSOR_MOTOROLA_821 821
716 #define PROCESSOR_SHx_SH3 103
717 #define PROCESSOR_SHx_SH4 104
718 #define PROCESSOR_STRONGARM 2577
719 #define PROCESSOR_ARM720 1824 /* 0x720 */
720 #define PROCESSOR_ARM820 2080 /* 0x820 */
721 #define PROCESSOR_ARM920 2336 /* 0x920 */
722 #define PROCESSOR_ARM_7TDMI 70001
723 #define PROCESSOR_OPTIL 18767
725 #ifdef _WIN64
726 #define MAXIMUM_PROCESSORS 64
727 #else
728 #define MAXIMUM_PROCESSORS 32
729 #endif
731 typedef struct _MEMORY_BASIC_INFORMATION
733 LPVOID BaseAddress;
734 LPVOID AllocationBase;
735 DWORD AllocationProtect;
736 SIZE_T RegionSize;
737 DWORD State;
738 DWORD Protect;
739 DWORD Type;
740 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
742 #define PAGE_NOACCESS 0x01
743 #define PAGE_READONLY 0x02
744 #define PAGE_READWRITE 0x04
745 #define PAGE_WRITECOPY 0x08
746 #define PAGE_EXECUTE 0x10
747 #define PAGE_EXECUTE_READ 0x20
748 #define PAGE_EXECUTE_READWRITE 0x40
749 #define PAGE_EXECUTE_WRITECOPY 0x80
750 #define PAGE_GUARD 0x100
751 #define PAGE_NOCACHE 0x200
752 #define PAGE_WRITECOMBINE 0x400
754 #define MEM_COMMIT 0x00001000
755 #define MEM_RESERVE 0x00002000
756 #define MEM_DECOMMIT 0x00004000
757 #define MEM_RELEASE 0x00008000
758 #define MEM_FREE 0x00010000
759 #define MEM_PRIVATE 0x00020000
760 #define MEM_MAPPED 0x00040000
761 #define MEM_RESET 0x00080000
762 #define MEM_TOP_DOWN 0x00100000
763 #define MEM_WRITE_WATCH 0x00200000
764 #define MEM_PHYSICAL 0x00400000
765 #define MEM_LARGE_PAGES 0x20000000
766 #define MEM_4MB_PAGES 0x80000000
768 #define SEC_FILE 0x00800000
769 #define SEC_IMAGE 0x01000000
770 #define SEC_PROTECTED_IMAGE 0x02000000
771 #define SEC_RESERVE 0x04000000
772 #define SEC_COMMIT 0x08000000
773 #define SEC_NOCACHE 0x10000000
774 #define SEC_WRITECOMBINE 0x40000000
775 #define SEC_LARGE_PAGES 0x80000000
776 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE)
777 #define MEM_IMAGE SEC_IMAGE
779 #define WRITE_WATCH_FLAG_RESET 0x00000001
781 #define AT_ROUND_TO_PAGE 0x40000000
783 #define MINCHAR 0x80
784 #define MAXCHAR 0x7f
785 #define MINSHORT 0x8000
786 #define MAXSHORT 0x7fff
787 #define MINLONG 0x80000000
788 #define MAXLONG 0x7fffffff
789 #define MAXBYTE 0xff
790 #define MAXWORD 0xffff
791 #define MAXDWORD 0xffffffff
792 #define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
794 #define UNICODE_STRING_MAX_CHARS 32767
796 #define FIELD_OFFSET(type, field) ((LONG)offsetof(type, field))
797 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
798 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
800 #define CONTAINING_RECORD(address, type, field) \
801 ((type *)((PCHAR)(address) - offsetof(type, field)))
803 #ifdef __WINESRC__
804 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
805 #endif
807 /* Types */
809 typedef struct _LIST_ENTRY {
810 struct _LIST_ENTRY *Flink;
811 struct _LIST_ENTRY *Blink;
812 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
814 typedef struct _SINGLE_LIST_ENTRY {
815 struct _SINGLE_LIST_ENTRY *Next;
816 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
818 #ifdef _WIN64
820 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
821 struct _SLIST_ENTRY *Next;
822 } SLIST_ENTRY, *PSLIST_ENTRY;
824 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
825 struct {
826 ULONGLONG Alignment;
827 ULONGLONG Region;
828 } DUMMYSTRUCTNAME;
829 struct {
830 ULONGLONG Depth:16;
831 ULONGLONG Sequence:9;
832 ULONGLONG NextEntry:39;
833 ULONGLONG HeaderType:1;
834 ULONGLONG Init:1;
835 ULONGLONG Reserved:59;
836 ULONGLONG Region:3;
837 } Header8;
838 struct {
839 ULONGLONG Depth:16;
840 ULONGLONG Sequence:48;
841 ULONGLONG HeaderType:1;
842 ULONGLONG Init:1;
843 ULONGLONG Reserved:2;
844 ULONGLONG NextEntry:60;
845 } Header16;
846 } SLIST_HEADER, *PSLIST_HEADER;
848 #else
850 #undef SLIST_ENTRY /* for Mac OS */
851 #define SLIST_ENTRY SINGLE_LIST_ENTRY
852 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
853 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
855 typedef union _SLIST_HEADER {
856 ULONGLONG Alignment;
857 struct {
858 SLIST_ENTRY Next;
859 WORD Depth;
860 WORD Sequence;
861 } DUMMYSTRUCTNAME;
862 } SLIST_HEADER, *PSLIST_HEADER;
864 #endif
866 NTSYSAPI PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER*);
867 NTSYSAPI VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER);
868 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER);
869 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER);
870 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
871 NTSYSAPI WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
874 /* Heap flags */
876 #define HEAP_NO_SERIALIZE 0x00000001
877 #define HEAP_GROWABLE 0x00000002
878 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
879 #define HEAP_ZERO_MEMORY 0x00000008
880 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
881 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
882 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
883 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
884 #define HEAP_CREATE_ALIGN_16 0x00010000
885 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
886 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
888 /* This flag allows it to create heaps shared by all processes under win95,
889 FIXME: correct name */
890 #define HEAP_SHARED 0x04000000
892 typedef enum _HEAP_INFORMATION_CLASS {
893 HeapCompatibilityInformation,
894 } HEAP_INFORMATION_CLASS;
896 /* Processor feature flags. */
897 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
898 #define PF_FLOATING_POINT_EMULATED 1
899 #define PF_COMPARE_EXCHANGE_DOUBLE 2
900 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
901 #define PF_PPC_MOVEMEM_64BIT_OK 4
902 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
903 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
904 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
905 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
906 #define PF_PAE_ENABLED 9
907 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
908 #define PF_SSE_DAZ_MODE_AVAILABLE 11
909 #define PF_NX_ENABLED 12
910 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
911 #define PF_COMPARE_EXCHANGE128 14
912 #define PF_COMPARE64_EXCHANGE128 15
913 #define PF_CHANNELS_ENABLED 16
914 #define PF_XSAVE_ENABLED 17
915 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
916 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
917 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
918 #define PF_VIRT_FIRMWARE_ENABLED 21
919 #define PF_RDWRFSGSBASE_AVAILABLE 22
920 #define PF_FASTFAIL_AVAILABLE 23
921 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
922 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
923 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
924 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
925 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
926 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
927 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
928 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
931 /* Execution state flags */
932 #define ES_SYSTEM_REQUIRED 0x00000001
933 #define ES_DISPLAY_REQUIRED 0x00000002
934 #define ES_USER_PRESENT 0x00000004
935 #define ES_CONTINUOUS 0x80000000
937 #include <excpt.h>
939 struct _CONTEXT;
940 struct _EXCEPTION_POINTERS;
941 struct _EXCEPTION_RECORD;
943 typedef EXCEPTION_DISPOSITION WINAPI EXCEPTION_ROUTINE(struct _EXCEPTION_RECORD*,PVOID,
944 struct _CONTEXT*,PVOID);
945 typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
947 /* The Win32 register context */
949 /* i386 context definitions */
950 #ifdef __i386__
952 #define SIZE_OF_80387_REGISTERS 80
954 typedef struct _FLOATING_SAVE_AREA
956 DWORD ControlWord;
957 DWORD StatusWord;
958 DWORD TagWord;
959 DWORD ErrorOffset;
960 DWORD ErrorSelector;
961 DWORD DataOffset;
962 DWORD DataSelector;
963 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
964 DWORD Cr0NpxState;
965 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
967 #define MAXIMUM_SUPPORTED_EXTENSION 512
969 typedef struct _CONTEXT
971 DWORD ContextFlags; /* 000 */
973 /* These are selected by CONTEXT_DEBUG_REGISTERS */
974 DWORD Dr0; /* 004 */
975 DWORD Dr1; /* 008 */
976 DWORD Dr2; /* 00c */
977 DWORD Dr3; /* 010 */
978 DWORD Dr6; /* 014 */
979 DWORD Dr7; /* 018 */
981 /* These are selected by CONTEXT_FLOATING_POINT */
982 FLOATING_SAVE_AREA FloatSave; /* 01c */
984 /* These are selected by CONTEXT_SEGMENTS */
985 DWORD SegGs; /* 08c */
986 DWORD SegFs; /* 090 */
987 DWORD SegEs; /* 094 */
988 DWORD SegDs; /* 098 */
990 /* These are selected by CONTEXT_INTEGER */
991 DWORD Edi; /* 09c */
992 DWORD Esi; /* 0a0 */
993 DWORD Ebx; /* 0a4 */
994 DWORD Edx; /* 0a8 */
995 DWORD Ecx; /* 0ac */
996 DWORD Eax; /* 0b0 */
998 /* These are selected by CONTEXT_CONTROL */
999 DWORD Ebp; /* 0b4 */
1000 DWORD Eip; /* 0b8 */
1001 DWORD SegCs; /* 0bc */
1002 DWORD EFlags; /* 0c0 */
1003 DWORD Esp; /* 0c4 */
1004 DWORD SegSs; /* 0c8 */
1006 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; /* 0xcc */
1007 } CONTEXT, *PCONTEXT;
1009 #define CONTEXT_X86 0x00010000
1010 #define CONTEXT_i386 CONTEXT_X86
1011 #define CONTEXT_i486 CONTEXT_X86
1013 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
1014 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
1015 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
1016 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
1017 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
1018 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
1019 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x0040)
1020 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
1021 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
1022 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
1024 #define EXCEPTION_READ_FAULT 0
1025 #define EXCEPTION_WRITE_FAULT 1
1026 #define EXCEPTION_EXECUTE_FAULT 8
1028 #endif /* __i386__ */
1030 typedef struct _LDT_ENTRY {
1031 WORD LimitLow;
1032 WORD BaseLow;
1033 union {
1034 struct {
1035 BYTE BaseMid;
1036 BYTE Flags1;
1037 BYTE Flags2;
1038 BYTE BaseHi;
1039 } Bytes;
1040 struct {
1041 unsigned BaseMid: 8;
1042 unsigned Type : 5;
1043 unsigned Dpl : 2;
1044 unsigned Pres : 1;
1045 unsigned LimitHi : 4;
1046 unsigned Sys : 1;
1047 unsigned Reserved_0 : 1;
1048 unsigned Default_Big : 1;
1049 unsigned Granularity : 1;
1050 unsigned BaseHi : 8;
1051 } Bits;
1052 } HighWord;
1053 } LDT_ENTRY, *PLDT_ENTRY, WOW64_LDT_ENTRY, *PWOW64_LDT_ENTRY;
1055 /* x86-64 context definitions */
1056 #if defined(__x86_64__)
1058 #define CONTEXT_AMD64 0x00100000
1060 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
1061 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
1062 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
1063 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
1064 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
1065 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x0040)
1066 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1067 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1069 #define EXCEPTION_READ_FAULT 0
1070 #define EXCEPTION_WRITE_FAULT 1
1071 #define EXCEPTION_EXECUTE_FAULT 8
1073 typedef struct DECLSPEC_ALIGN(16) _M128A {
1074 ULONGLONG Low;
1075 LONGLONG High;
1076 } M128A, *PM128A;
1078 typedef struct _XMM_SAVE_AREA32 {
1079 WORD ControlWord; /* 000 */
1080 WORD StatusWord; /* 002 */
1081 BYTE TagWord; /* 004 */
1082 BYTE Reserved1; /* 005 */
1083 WORD ErrorOpcode; /* 006 */
1084 DWORD ErrorOffset; /* 008 */
1085 WORD ErrorSelector; /* 00c */
1086 WORD Reserved2; /* 00e */
1087 DWORD DataOffset; /* 010 */
1088 WORD DataSelector; /* 014 */
1089 WORD Reserved3; /* 016 */
1090 DWORD MxCsr; /* 018 */
1091 DWORD MxCsr_Mask; /* 01c */
1092 M128A FloatRegisters[8]; /* 020 */
1093 M128A XmmRegisters[16]; /* 0a0 */
1094 BYTE Reserved4[96]; /* 1a0 */
1095 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
1097 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
1098 DWORD64 P1Home; /* 000 */
1099 DWORD64 P2Home; /* 008 */
1100 DWORD64 P3Home; /* 010 */
1101 DWORD64 P4Home; /* 018 */
1102 DWORD64 P5Home; /* 020 */
1103 DWORD64 P6Home; /* 028 */
1105 /* Control flags */
1106 DWORD ContextFlags; /* 030 */
1107 DWORD MxCsr; /* 034 */
1109 /* Segment */
1110 WORD SegCs; /* 038 */
1111 WORD SegDs; /* 03a */
1112 WORD SegEs; /* 03c */
1113 WORD SegFs; /* 03e */
1114 WORD SegGs; /* 040 */
1115 WORD SegSs; /* 042 */
1116 DWORD EFlags; /* 044 */
1118 /* Debug */
1119 DWORD64 Dr0; /* 048 */
1120 DWORD64 Dr1; /* 050 */
1121 DWORD64 Dr2; /* 058 */
1122 DWORD64 Dr3; /* 060 */
1123 DWORD64 Dr6; /* 068 */
1124 DWORD64 Dr7; /* 070 */
1126 /* Integer */
1127 DWORD64 Rax; /* 078 */
1128 DWORD64 Rcx; /* 080 */
1129 DWORD64 Rdx; /* 088 */
1130 DWORD64 Rbx; /* 090 */
1131 DWORD64 Rsp; /* 098 */
1132 DWORD64 Rbp; /* 0a0 */
1133 DWORD64 Rsi; /* 0a8 */
1134 DWORD64 Rdi; /* 0b0 */
1135 DWORD64 R8; /* 0b8 */
1136 DWORD64 R9; /* 0c0 */
1137 DWORD64 R10; /* 0c8 */
1138 DWORD64 R11; /* 0d0 */
1139 DWORD64 R12; /* 0d8 */
1140 DWORD64 R13; /* 0e0 */
1141 DWORD64 R14; /* 0e8 */
1142 DWORD64 R15; /* 0f0 */
1144 /* Counter */
1145 DWORD64 Rip; /* 0f8 */
1147 /* Floating point */
1148 union {
1149 XMM_SAVE_AREA32 FltSave; /* 100 */
1150 struct {
1151 M128A Header[2]; /* 100 */
1152 M128A Legacy[8]; /* 120 */
1153 M128A Xmm0; /* 1a0 */
1154 M128A Xmm1; /* 1b0 */
1155 M128A Xmm2; /* 1c0 */
1156 M128A Xmm3; /* 1d0 */
1157 M128A Xmm4; /* 1e0 */
1158 M128A Xmm5; /* 1f0 */
1159 M128A Xmm6; /* 200 */
1160 M128A Xmm7; /* 210 */
1161 M128A Xmm8; /* 220 */
1162 M128A Xmm9; /* 230 */
1163 M128A Xmm10; /* 240 */
1164 M128A Xmm11; /* 250 */
1165 M128A Xmm12; /* 260 */
1166 M128A Xmm13; /* 270 */
1167 M128A Xmm14; /* 280 */
1168 M128A Xmm15; /* 290 */
1169 } DUMMYSTRUCTNAME;
1170 } DUMMYUNIONNAME;
1172 /* Vector */
1173 M128A VectorRegister[26]; /* 300 */
1174 DWORD64 VectorControl; /* 4a0 */
1176 /* Debug control */
1177 DWORD64 DebugControl; /* 4a8 */
1178 DWORD64 LastBranchToRip; /* 4b0 */
1179 DWORD64 LastBranchFromRip; /* 4b8 */
1180 DWORD64 LastExceptionToRip; /* 4c0 */
1181 DWORD64 LastExceptionFromRip; /* 4c8 */
1182 } CONTEXT, *PCONTEXT;
1184 typedef struct _RUNTIME_FUNCTION
1186 DWORD BeginAddress;
1187 DWORD EndAddress;
1188 DWORD UnwindData;
1189 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1191 #define UNWIND_HISTORY_TABLE_SIZE 12
1193 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1195 ULONG64 ImageBase;
1196 PRUNTIME_FUNCTION FunctionEntry;
1197 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1199 #define UNWIND_HISTORY_TABLE_NONE 0
1200 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1201 #define UNWIND_HISTORY_TABLE_LOCAL 2
1203 typedef struct _UNWIND_HISTORY_TABLE
1205 ULONG Count;
1206 UCHAR Search;
1207 ULONG64 LowAddress;
1208 ULONG64 HighAddress;
1209 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1210 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1212 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1214 union
1216 PM128A FloatingContext[16];
1217 struct
1219 PM128A Xmm0;
1220 PM128A Xmm1;
1221 PM128A Xmm2;
1222 PM128A Xmm3;
1223 PM128A Xmm4;
1224 PM128A Xmm5;
1225 PM128A Xmm6;
1226 PM128A Xmm7;
1227 PM128A Xmm8;
1228 PM128A Xmm9;
1229 PM128A Xmm10;
1230 PM128A Xmm11;
1231 PM128A Xmm12;
1232 PM128A Xmm13;
1233 PM128A Xmm14;
1234 PM128A Xmm15;
1235 } DUMMYSTRUCTNAME;
1236 } DUMMYUNIONNAME;
1238 union
1240 PULONG64 IntegerContext[16];
1241 struct
1243 PULONG64 Rax;
1244 PULONG64 Rcx;
1245 PULONG64 Rdx;
1246 PULONG64 Rbx;
1247 PULONG64 Rsp;
1248 PULONG64 Rbp;
1249 PULONG64 Rsi;
1250 PULONG64 Rdi;
1251 PULONG64 R8;
1252 PULONG64 R9;
1253 PULONG64 R10;
1254 PULONG64 R11;
1255 PULONG64 R12;
1256 PULONG64 R13;
1257 PULONG64 R14;
1258 PULONG64 R15;
1259 } DUMMYSTRUCTNAME;
1260 } DUMMYUNIONNAME2;
1261 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1263 typedef struct _DISPATCHER_CONTEXT
1265 ULONG64 ControlPc;
1266 ULONG64 ImageBase;
1267 PRUNTIME_FUNCTION FunctionEntry;
1268 ULONG64 EstablisherFrame;
1269 ULONG64 TargetIp;
1270 PCONTEXT ContextRecord;
1271 PEXCEPTION_ROUTINE LanguageHandler;
1272 PVOID HandlerData;
1273 PUNWIND_HISTORY_TABLE HistoryTable;
1274 DWORD ScopeIndex;
1275 DWORD Fill0;
1276 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
1278 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,PVOID);
1279 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,PVOID);
1281 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
1283 #define UNW_FLAG_NHANDLER 0
1284 #define UNW_FLAG_EHANDLER 1
1285 #define UNW_FLAG_UHANDLER 2
1286 #define UNW_FLAG_CHAININFO 4
1288 #endif /* __x86_64__ */
1290 /* IA64 context definitions */
1291 #ifdef __ia64__
1293 #define CONTEXT_IA64 0x00080000
1294 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1295 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1296 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1297 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1298 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1299 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1300 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1301 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1302 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1304 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1305 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1306 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1307 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1309 typedef struct _CONTEXT
1311 DWORD ContextFlags;
1312 DWORD Fill1[3];
1313 ULONGLONG DbI0;
1314 ULONGLONG DbI1;
1315 ULONGLONG DbI2;
1316 ULONGLONG DbI3;
1317 ULONGLONG DbI4;
1318 ULONGLONG DbI5;
1319 ULONGLONG DbI6;
1320 ULONGLONG DbI7;
1321 ULONGLONG DbD0;
1322 ULONGLONG DbD1;
1323 ULONGLONG DbD2;
1324 ULONGLONG DbD3;
1325 ULONGLONG DbD4;
1326 ULONGLONG DbD5;
1327 ULONGLONG DbD6;
1328 ULONGLONG DbD7;
1329 FLOAT128 FltS0;
1330 FLOAT128 FltS1;
1331 FLOAT128 FltS2;
1332 FLOAT128 FltS3;
1333 FLOAT128 FltT0;
1334 FLOAT128 FltT1;
1335 FLOAT128 FltT2;
1336 FLOAT128 FltT3;
1337 FLOAT128 FltT4;
1338 FLOAT128 FltT5;
1339 FLOAT128 FltT6;
1340 FLOAT128 FltT7;
1341 FLOAT128 FltT8;
1342 FLOAT128 FltT9;
1343 FLOAT128 FltS4;
1344 FLOAT128 FltS5;
1345 FLOAT128 FltS6;
1346 FLOAT128 FltS7;
1347 FLOAT128 FltS8;
1348 FLOAT128 FltS9;
1349 FLOAT128 FltS10;
1350 FLOAT128 FltS11;
1351 FLOAT128 FltS12;
1352 FLOAT128 FltS13;
1353 FLOAT128 FltS14;
1354 FLOAT128 FltS15;
1355 FLOAT128 FltS16;
1356 FLOAT128 FltS17;
1357 FLOAT128 FltS18;
1358 FLOAT128 FltS19;
1359 FLOAT128 FltF32;
1360 FLOAT128 FltF33;
1361 FLOAT128 FltF34;
1362 FLOAT128 FltF35;
1363 FLOAT128 FltF36;
1364 FLOAT128 FltF37;
1365 FLOAT128 FltF38;
1366 FLOAT128 FltF39;
1367 FLOAT128 FltF40;
1368 FLOAT128 FltF41;
1369 FLOAT128 FltF42;
1370 FLOAT128 FltF43;
1371 FLOAT128 FltF44;
1372 FLOAT128 FltF45;
1373 FLOAT128 FltF46;
1374 FLOAT128 FltF47;
1375 FLOAT128 FltF48;
1376 FLOAT128 FltF49;
1377 FLOAT128 FltF50;
1378 FLOAT128 FltF51;
1379 FLOAT128 FltF52;
1380 FLOAT128 FltF53;
1381 FLOAT128 FltF54;
1382 FLOAT128 FltF55;
1383 FLOAT128 FltF56;
1384 FLOAT128 FltF57;
1385 FLOAT128 FltF58;
1386 FLOAT128 FltF59;
1387 FLOAT128 FltF60;
1388 FLOAT128 FltF61;
1389 FLOAT128 FltF62;
1390 FLOAT128 FltF63;
1391 FLOAT128 FltF64;
1392 FLOAT128 FltF65;
1393 FLOAT128 FltF66;
1394 FLOAT128 FltF67;
1395 FLOAT128 FltF68;
1396 FLOAT128 FltF69;
1397 FLOAT128 FltF70;
1398 FLOAT128 FltF71;
1399 FLOAT128 FltF72;
1400 FLOAT128 FltF73;
1401 FLOAT128 FltF74;
1402 FLOAT128 FltF75;
1403 FLOAT128 FltF76;
1404 FLOAT128 FltF77;
1405 FLOAT128 FltF78;
1406 FLOAT128 FltF79;
1407 FLOAT128 FltF80;
1408 FLOAT128 FltF81;
1409 FLOAT128 FltF82;
1410 FLOAT128 FltF83;
1411 FLOAT128 FltF84;
1412 FLOAT128 FltF85;
1413 FLOAT128 FltF86;
1414 FLOAT128 FltF87;
1415 FLOAT128 FltF88;
1416 FLOAT128 FltF89;
1417 FLOAT128 FltF90;
1418 FLOAT128 FltF91;
1419 FLOAT128 FltF92;
1420 FLOAT128 FltF93;
1421 FLOAT128 FltF94;
1422 FLOAT128 FltF95;
1423 FLOAT128 FltF96;
1424 FLOAT128 FltF97;
1425 FLOAT128 FltF98;
1426 FLOAT128 FltF99;
1427 FLOAT128 FltF100;
1428 FLOAT128 FltF101;
1429 FLOAT128 FltF102;
1430 FLOAT128 FltF103;
1431 FLOAT128 FltF104;
1432 FLOAT128 FltF105;
1433 FLOAT128 FltF106;
1434 FLOAT128 FltF107;
1435 FLOAT128 FltF108;
1436 FLOAT128 FltF109;
1437 FLOAT128 FltF110;
1438 FLOAT128 FltF111;
1439 FLOAT128 FltF112;
1440 FLOAT128 FltF113;
1441 FLOAT128 FltF114;
1442 FLOAT128 FltF115;
1443 FLOAT128 FltF116;
1444 FLOAT128 FltF117;
1445 FLOAT128 FltF118;
1446 FLOAT128 FltF119;
1447 FLOAT128 FltF120;
1448 FLOAT128 FltF121;
1449 FLOAT128 FltF122;
1450 FLOAT128 FltF123;
1451 FLOAT128 FltF124;
1452 FLOAT128 FltF125;
1453 FLOAT128 FltF126;
1454 FLOAT128 FltF127;
1455 ULONGLONG StFPSR;
1456 ULONGLONG IntGp;
1457 ULONGLONG IntT0;
1458 ULONGLONG IntT1;
1459 ULONGLONG IntS0;
1460 ULONGLONG IntS1;
1461 ULONGLONG IntS2;
1462 ULONGLONG IntS3;
1463 ULONGLONG IntV0;
1464 ULONGLONG IntT2;
1465 ULONGLONG IntT3;
1466 ULONGLONG IntT4;
1467 ULONGLONG IntSp;
1468 ULONGLONG IntTeb;
1469 ULONGLONG IntT5;
1470 ULONGLONG IntT6;
1471 ULONGLONG IntT7;
1472 ULONGLONG IntT8;
1473 ULONGLONG IntT9;
1474 ULONGLONG IntT10;
1475 ULONGLONG IntT11;
1476 ULONGLONG IntT12;
1477 ULONGLONG IntT13;
1478 ULONGLONG IntT14;
1479 ULONGLONG IntT15;
1480 ULONGLONG IntT16;
1481 ULONGLONG IntT17;
1482 ULONGLONG IntT18;
1483 ULONGLONG IntT19;
1484 ULONGLONG IntT20;
1485 ULONGLONG IntT21;
1486 ULONGLONG IntT22;
1487 ULONGLONG IntNats;
1488 ULONGLONG Preds;
1489 ULONGLONG BrRp;
1490 ULONGLONG BrS0;
1491 ULONGLONG BrS1;
1492 ULONGLONG BrS2;
1493 ULONGLONG BrS3;
1494 ULONGLONG BrS4;
1495 ULONGLONG BrT0;
1496 ULONGLONG BrT1;
1497 ULONGLONG ApUNAT;
1498 ULONGLONG ApLC;
1499 ULONGLONG ApEC;
1500 ULONGLONG ApCCV;
1501 ULONGLONG ApDCR;
1502 ULONGLONG RsPFS;
1503 ULONGLONG RsBSP;
1504 ULONGLONG RsBSPSTORE;
1505 ULONGLONG RsRSC;
1506 ULONGLONG RsRNAT;
1507 ULONGLONG StIPSR;
1508 ULONGLONG StIIP;
1509 ULONGLONG StIFS;
1510 ULONGLONG StFCR;
1511 ULONGLONG Eflag;
1512 ULONGLONG SegCSD;
1513 ULONGLONG SegSSD;
1514 ULONGLONG Cflag;
1515 ULONGLONG StFSR;
1516 ULONGLONG StFIR;
1517 ULONGLONG StFDR;
1518 ULONGLONG UNUSEDPACK;
1519 } CONTEXT, *PCONTEXT;
1521 typedef struct _RUNTIME_FUNCTION
1523 ULONG BeginAddress;
1524 ULONG EndAddress;
1525 ULONG UnwindInfoAddress;
1526 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1528 typedef struct _FRAME_POINTERS {
1529 ULONGLONG MemoryStackFp;
1530 ULONGLONG BackingStoreFp;
1531 } FRAME_POINTERS, *PFRAME_POINTERS;
1533 #define UNWIND_HISTORY_TABLE_SIZE 12
1535 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
1536 ULONG64 ImageBase;
1537 ULONG64 Gp;
1538 PRUNTIME_FUNCTION FunctionEntry;
1539 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1541 typedef struct _UNWIND_HISTORY_TABLE {
1542 ULONG Count;
1543 UCHAR Search;
1544 ULONG64 LowAddress;
1545 ULONG64 HighAddress;
1546 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1547 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1549 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1551 PFLOAT128 FltS0;
1552 PFLOAT128 FltS1;
1553 PFLOAT128 FltS2;
1554 PFLOAT128 FltS3;
1555 PFLOAT128 HighFloatingContext[10];
1556 PFLOAT128 FltS4;
1557 PFLOAT128 FltS5;
1558 PFLOAT128 FltS6;
1559 PFLOAT128 FltS7;
1560 PFLOAT128 FltS8;
1561 PFLOAT128 FltS9;
1562 PFLOAT128 FltS10;
1563 PFLOAT128 FltS11;
1564 PFLOAT128 FltS12;
1565 PFLOAT128 FltS13;
1566 PFLOAT128 FltS14;
1567 PFLOAT128 FltS15;
1568 PFLOAT128 FltS16;
1569 PFLOAT128 FltS17;
1570 PFLOAT128 FltS18;
1571 PFLOAT128 FltS19;
1572 PULONGLONG IntS0;
1573 PULONGLONG IntS1;
1574 PULONGLONG IntS2;
1575 PULONGLONG IntS3;
1576 PULONGLONG IntSp;
1577 PULONGLONG IntS0Nat;
1578 PULONGLONG IntS1Nat;
1579 PULONGLONG IntS2Nat;
1580 PULONGLONG IntS3Nat;
1581 PULONGLONG IntSpNat;
1582 PULONGLONG Preds;
1583 PULONGLONG BrRp;
1584 PULONGLONG BrS0;
1585 PULONGLONG BrS1;
1586 PULONGLONG BrS2;
1587 PULONGLONG BrS3;
1588 PULONGLONG BrS4;
1589 PULONGLONG ApUNAT;
1590 PULONGLONG ApLC;
1591 PULONGLONG ApEC;
1592 PULONGLONG RsPFS;
1593 PULONGLONG StFSR;
1594 PULONGLONG StFIR;
1595 PULONGLONG StFDR;
1596 PULONGLONG Cflag;
1597 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1599 NTSYSAPI ULONGLONG WINAPI RtlVirtualUnwind(ULONGLONG,ULONGLONG,RUNTIME_FUNCTION*,CONTEXT*,BOOLEAN*,FRAME_POINTERS*,KNONVOLATILE_CONTEXT_POINTERS*);
1601 #endif /* __ia64__ */
1603 /* Alpha context definitions */
1604 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1606 #define CONTEXT_ALPHA 0x00020000
1608 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1609 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1610 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1611 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1613 #define EXCEPTION_READ_FAULT 0
1614 #define EXCEPTION_WRITE_FAULT 1
1615 #define EXCEPTION_EXECUTE_FAULT 8
1617 typedef struct _CONTEXT
1619 /* selected by CONTEXT_FLOATING_POINT */
1620 ULONGLONG FltF0;
1621 ULONGLONG FltF1;
1622 ULONGLONG FltF2;
1623 ULONGLONG FltF3;
1624 ULONGLONG FltF4;
1625 ULONGLONG FltF5;
1626 ULONGLONG FltF6;
1627 ULONGLONG FltF7;
1628 ULONGLONG FltF8;
1629 ULONGLONG FltF9;
1630 ULONGLONG FltF10;
1631 ULONGLONG FltF11;
1632 ULONGLONG FltF12;
1633 ULONGLONG FltF13;
1634 ULONGLONG FltF14;
1635 ULONGLONG FltF15;
1636 ULONGLONG FltF16;
1637 ULONGLONG FltF17;
1638 ULONGLONG FltF18;
1639 ULONGLONG FltF19;
1640 ULONGLONG FltF20;
1641 ULONGLONG FltF21;
1642 ULONGLONG FltF22;
1643 ULONGLONG FltF23;
1644 ULONGLONG FltF24;
1645 ULONGLONG FltF25;
1646 ULONGLONG FltF26;
1647 ULONGLONG FltF27;
1648 ULONGLONG FltF28;
1649 ULONGLONG FltF29;
1650 ULONGLONG FltF30;
1651 ULONGLONG FltF31;
1653 /* selected by CONTEXT_INTEGER */
1654 ULONGLONG IntV0;
1655 ULONGLONG IntT0;
1656 ULONGLONG IntT1;
1657 ULONGLONG IntT2;
1658 ULONGLONG IntT3;
1659 ULONGLONG IntT4;
1660 ULONGLONG IntT5;
1661 ULONGLONG IntT6;
1662 ULONGLONG IntT7;
1663 ULONGLONG IntS0;
1664 ULONGLONG IntS1;
1665 ULONGLONG IntS2;
1666 ULONGLONG IntS3;
1667 ULONGLONG IntS4;
1668 ULONGLONG IntS5;
1669 ULONGLONG IntFp;
1670 ULONGLONG IntA0;
1671 ULONGLONG IntA1;
1672 ULONGLONG IntA2;
1673 ULONGLONG IntA3;
1674 ULONGLONG IntA4;
1675 ULONGLONG IntA5;
1676 ULONGLONG IntT8;
1677 ULONGLONG IntT9;
1678 ULONGLONG IntT10;
1679 ULONGLONG IntT11;
1680 ULONGLONG IntRa;
1681 ULONGLONG IntT12;
1682 ULONGLONG IntAt;
1683 ULONGLONG IntGp;
1684 ULONGLONG IntSp;
1685 ULONGLONG IntZero;
1687 /* selected by CONTEXT_FLOATING_POINT */
1688 ULONGLONG Fpcr;
1689 ULONGLONG SoftFpcr;
1691 /* selected by CONTEXT_CONTROL */
1692 ULONGLONG Fir;
1693 DWORD Psr;
1694 DWORD ContextFlags;
1695 DWORD Fill[4];
1696 } CONTEXT, *PCONTEXT;
1698 #define _QUAD_PSR_OFFSET HighSoftFpcr
1699 #define _QUAD_FLAGS_OFFSET HighFir
1701 #endif /* _ALPHA_ */
1703 #ifdef __arm__
1705 /* The following flags control the contents of the CONTEXT structure. */
1707 #define CONTEXT_ARM 0x0200000
1708 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1709 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1710 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1711 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1713 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1714 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1716 #define EXCEPTION_READ_FAULT 0
1717 #define EXCEPTION_WRITE_FAULT 1
1718 #define EXCEPTION_EXECUTE_FAULT 8
1720 #define ARM_MAX_BREAKPOINTS 8
1721 #define ARM_MAX_WATCHPOINTS 1
1723 typedef struct _RUNTIME_FUNCTION
1725 DWORD BeginAddress;
1726 union {
1727 DWORD UnwindData;
1728 struct {
1729 DWORD Flag : 2;
1730 DWORD FunctionLength : 11;
1731 DWORD Ret : 2;
1732 DWORD H : 1;
1733 DWORD Reg : 3;
1734 DWORD R : 1;
1735 DWORD L : 1;
1736 DWORD C : 1;
1737 DWORD StackAdjust : 10;
1738 } DUMMYSTRUCTNAME;
1739 } DUMMYUNIONNAME;
1740 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1742 #define UNWIND_HISTORY_TABLE_SIZE 12
1744 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1746 DWORD ImageBase;
1747 PRUNTIME_FUNCTION FunctionEntry;
1748 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1750 typedef struct _UNWIND_HISTORY_TABLE
1752 DWORD Count;
1753 BYTE LocalHint;
1754 BYTE GlobalHint;
1755 BYTE Search;
1756 BYTE Once;
1757 DWORD LowAddress;
1758 DWORD HighAddress;
1759 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1760 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1762 typedef struct _NEON128
1764 ULONGLONG Low;
1765 LONGLONG High;
1766 } NEON128, *PNEON128;
1768 typedef struct _CONTEXT
1770 ULONG ContextFlags; /* 000 */
1771 /* CONTEXT_INTEGER */
1772 ULONG R0; /* 004 */
1773 ULONG R1; /* 008 */
1774 ULONG R2; /* 00c */
1775 ULONG R3; /* 010 */
1776 ULONG R4; /* 014 */
1777 ULONG R5; /* 018 */
1778 ULONG R6; /* 01c */
1779 ULONG R7; /* 020 */
1780 ULONG R8; /* 024 */
1781 ULONG R9; /* 028 */
1782 ULONG R10; /* 02c */
1783 ULONG R11; /* 030 */
1784 ULONG R12; /* 034 */
1785 /* CONTEXT_CONTROL */
1786 ULONG Sp; /* 038 */
1787 ULONG Lr; /* 03c */
1788 ULONG Pc; /* 040 */
1789 ULONG Cpsr; /* 044 */
1790 /* CONTEXT_FLOATING_POINT */
1791 ULONG Fpscr; /* 048 */
1792 ULONG Padding; /* 04c */
1793 union
1795 NEON128 Q[16];
1796 ULONGLONG D[32];
1797 ULONG S[32];
1798 } DUMMYUNIONNAME; /* 050 */
1799 /* CONTEXT_DEBUG_REGISTERS */
1800 ULONG Bvr[ARM_MAX_BREAKPOINTS]; /* 150 */
1801 ULONG Bcr[ARM_MAX_BREAKPOINTS]; /* 170 */
1802 ULONG Wvr[ARM_MAX_WATCHPOINTS]; /* 190 */
1803 ULONG Wcr[ARM_MAX_WATCHPOINTS]; /* 194 */
1804 ULONG Padding2[2]; /* 198 */
1805 } CONTEXT, *PCONTEXT;
1807 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1809 PDWORD R4;
1810 PDWORD R5;
1811 PDWORD R6;
1812 PDWORD R7;
1813 PDWORD R8;
1814 PDWORD R9;
1815 PDWORD R10;
1816 PDWORD R11;
1817 PDWORD Lr;
1818 PULONGLONG D8;
1819 PULONGLONG D9;
1820 PULONGLONG D10;
1821 PULONGLONG D11;
1822 PULONGLONG D12;
1823 PULONGLONG D13;
1824 PULONGLONG D14;
1825 PULONGLONG D15;
1826 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1828 typedef struct _DISPATCHER_CONTEXT
1830 DWORD ControlPc;
1831 DWORD ImageBase;
1832 PRUNTIME_FUNCTION FunctionEntry;
1833 DWORD EstablisherFrame;
1834 DWORD TargetPc;
1835 PCONTEXT ContextRecord;
1836 PEXCEPTION_ROUTINE LanguageHandler;
1837 PVOID HandlerData;
1838 PUNWIND_HISTORY_TABLE HistoryTable;
1839 DWORD ScopeIndex;
1840 BOOLEAN ControlPcIsUnwound;
1841 PBYTE NonVolatileRegisters;
1842 DWORD Reserved;
1843 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
1845 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD);
1846 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD);
1848 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,DWORD,DWORD,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,DWORD*,KNONVOLATILE_CONTEXT_POINTERS*);
1850 #define UNW_FLAG_NHANDLER 0
1851 #define UNW_FLAG_EHANDLER 1
1852 #define UNW_FLAG_UHANDLER 2
1854 #endif /* __arm__ */
1856 #ifdef __aarch64__
1858 #define CONTEXT_ARM64 0x400000
1859 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001)
1860 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002)
1861 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1862 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1864 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1865 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1867 #define EXCEPTION_READ_FAULT 0
1868 #define EXCEPTION_WRITE_FAULT 1
1869 #define EXCEPTION_EXECUTE_FAULT 8
1871 #define ARM64_MAX_BREAKPOINTS 8
1872 #define ARM64_MAX_WATCHPOINTS 2
1874 typedef struct _RUNTIME_FUNCTION
1876 DWORD BeginAddress;
1877 union
1879 DWORD UnwindData;
1880 struct
1882 DWORD Flag : 2;
1883 DWORD FunctionLength : 11;
1884 DWORD RegF : 3;
1885 DWORD RegI : 4;
1886 DWORD H : 1;
1887 DWORD CR : 2;
1888 DWORD FrameSize : 9;
1889 } DUMMYSTRUCTNAME;
1890 } DUMMYUNIONNAME;
1891 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1893 #define UNWIND_HISTORY_TABLE_SIZE 12
1895 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1897 DWORD64 ImageBase;
1898 PRUNTIME_FUNCTION FunctionEntry;
1899 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1901 typedef struct _UNWIND_HISTORY_TABLE
1903 DWORD Count;
1904 BYTE LocalHint;
1905 BYTE GlobalHint;
1906 BYTE Search;
1907 BYTE Once;
1908 DWORD64 LowAddress;
1909 DWORD64 HighAddress;
1910 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1911 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1913 typedef union _NEON128
1915 struct
1917 ULONGLONG Low;
1918 LONGLONG High;
1919 } DUMMYSTRUCTNAME;
1920 double D[2];
1921 float S[4];
1922 WORD H[8];
1923 BYTE B[16];
1924 } NEON128, *PNEON128;
1926 typedef struct _CONTEXT
1928 ULONG ContextFlags; /* 000 */
1929 /* CONTEXT_INTEGER */
1930 ULONG Cpsr; /* 004 */
1931 union
1933 struct
1935 DWORD64 X0; /* 008 */
1936 DWORD64 X1; /* 010 */
1937 DWORD64 X2; /* 018 */
1938 DWORD64 X3; /* 020 */
1939 DWORD64 X4; /* 028 */
1940 DWORD64 X5; /* 030 */
1941 DWORD64 X6; /* 038 */
1942 DWORD64 X7; /* 040 */
1943 DWORD64 X8; /* 048 */
1944 DWORD64 X9; /* 050 */
1945 DWORD64 X10; /* 058 */
1946 DWORD64 X11; /* 060 */
1947 DWORD64 X12; /* 068 */
1948 DWORD64 X13; /* 070 */
1949 DWORD64 X14; /* 078 */
1950 DWORD64 X15; /* 080 */
1951 DWORD64 X16; /* 088 */
1952 DWORD64 X17; /* 090 */
1953 DWORD64 X18; /* 098 */
1954 DWORD64 X19; /* 0a0 */
1955 DWORD64 X20; /* 0a8 */
1956 DWORD64 X21; /* 0b0 */
1957 DWORD64 X22; /* 0b8 */
1958 DWORD64 X23; /* 0c0 */
1959 DWORD64 X24; /* 0c8 */
1960 DWORD64 X25; /* 0d0 */
1961 DWORD64 X26; /* 0d8 */
1962 DWORD64 X27; /* 0e0 */
1963 DWORD64 X28; /* 0e8 */
1964 DWORD64 Fp; /* 0f0 */
1965 DWORD64 Lr; /* 0f8 */
1966 } DUMMYSTRUCTNAME;
1967 DWORD64 X[31]; /* 008 */
1968 } DUMMYUNIONNAME;
1969 /* CONTEXT_CONTROL */
1970 DWORD64 Sp; /* 100 */
1971 DWORD64 Pc; /* 108 */
1972 /* CONTEXT_FLOATING_POINT */
1973 NEON128 V[32]; /* 110 */
1974 DWORD Fpcr; /* 310 */
1975 DWORD Fpsr; /* 314 */
1976 /* CONTEXT_DEBUG_REGISTERS */
1977 DWORD Bcr[ARM64_MAX_BREAKPOINTS]; /* 318 */
1978 DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; /* 338 */
1979 DWORD Wcr[ARM64_MAX_WATCHPOINTS]; /* 378 */
1980 DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; /* 380 */
1981 } CONTEXT, *PCONTEXT;
1983 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1985 PDWORD64 X19;
1986 PDWORD64 X20;
1987 PDWORD64 X21;
1988 PDWORD64 X22;
1989 PDWORD64 X23;
1990 PDWORD64 X24;
1991 PDWORD64 X25;
1992 PDWORD64 X26;
1993 PDWORD64 X27;
1994 PDWORD64 X28;
1995 PDWORD64 Fp;
1996 PDWORD64 Lr;
1997 PDWORD64 D8;
1998 PDWORD64 D9;
1999 PDWORD64 D10;
2000 PDWORD64 D11;
2001 PDWORD64 D12;
2002 PDWORD64 D13;
2003 PDWORD64 D14;
2004 PDWORD64 D15;
2005 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
2007 typedef struct _DISPATCHER_CONTEXT
2009 ULONG_PTR ControlPc;
2010 ULONG_PTR ImageBase;
2011 PRUNTIME_FUNCTION FunctionEntry;
2012 ULONG_PTR EstablisherFrame;
2013 ULONG_PTR TargetPc;
2014 PCONTEXT ContextRecord;
2015 PEXCEPTION_ROUTINE LanguageHandler;
2016 PVOID HandlerData;
2017 PUNWIND_HISTORY_TABLE HistoryTable;
2018 DWORD ScopeIndex;
2019 BOOLEAN ControlPcIsUnwound;
2020 PBYTE NonVolatileRegisters;
2021 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
2023 typedef LONG (CALLBACK *PEXCEPTION_FILTER)(struct _EXCEPTION_POINTERS*,DWORD64);
2024 typedef void (CALLBACK *PTERMINATION_HANDLER)(BOOLEAN,DWORD64);
2026 NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,ULONG_PTR,ULONG_PTR,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG_PTR*,KNONVOLATILE_CONTEXT_POINTERS*);
2028 #define UNW_FLAG_NHANDLER 0
2029 #define UNW_FLAG_EHANDLER 1
2030 #define UNW_FLAG_UHANDLER 2
2032 #endif /* __aarch64__ */
2035 /* Mips context definitions */
2036 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
2038 #define CONTEXT_R4000 0x00010000
2040 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
2041 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
2042 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
2044 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2046 #define EXCEPTION_READ_FAULT 0
2047 #define EXCEPTION_WRITE_FAULT 1
2048 #define EXCEPTION_EXECUTE_FAULT 8
2050 typedef struct _CONTEXT
2052 DWORD Argument[4];
2053 /* These are selected by CONTEXT_FLOATING_POINT */
2054 DWORD FltF0;
2055 DWORD FltF1;
2056 DWORD FltF2;
2057 DWORD FltF3;
2058 DWORD FltF4;
2059 DWORD FltF5;
2060 DWORD FltF6;
2061 DWORD FltF7;
2062 DWORD FltF8;
2063 DWORD FltF9;
2064 DWORD FltF10;
2065 DWORD FltF11;
2066 DWORD FltF12;
2067 DWORD FltF13;
2068 DWORD FltF14;
2069 DWORD FltF15;
2070 DWORD FltF16;
2071 DWORD FltF17;
2072 DWORD FltF18;
2073 DWORD FltF19;
2074 DWORD FltF20;
2075 DWORD FltF21;
2076 DWORD FltF22;
2077 DWORD FltF23;
2078 DWORD FltF24;
2079 DWORD FltF25;
2080 DWORD FltF26;
2081 DWORD FltF27;
2082 DWORD FltF28;
2083 DWORD FltF29;
2084 DWORD FltF30;
2085 DWORD FltF31;
2087 /* These are selected by CONTEXT_INTEGER */
2088 DWORD IntZero;
2089 DWORD IntAt;
2090 DWORD IntV0;
2091 DWORD IntV1;
2092 DWORD IntA0;
2093 DWORD IntA1;
2094 DWORD IntA2;
2095 DWORD IntA3;
2096 DWORD IntT0;
2097 DWORD IntT1;
2098 DWORD IntT2;
2099 DWORD IntT3;
2100 DWORD IntT4;
2101 DWORD IntT5;
2102 DWORD IntT6;
2103 DWORD IntT7;
2104 DWORD IntS0;
2105 DWORD IntS1;
2106 DWORD IntS2;
2107 DWORD IntS3;
2108 DWORD IntS4;
2109 DWORD IntS5;
2110 DWORD IntS6;
2111 DWORD IntS7;
2112 DWORD IntT8;
2113 DWORD IntT9;
2114 DWORD IntK0;
2115 DWORD IntK1;
2116 DWORD IntGp;
2117 DWORD IntSp;
2118 DWORD IntS8;
2119 DWORD IntRa;
2120 DWORD IntLo;
2121 DWORD IntHi;
2123 /* These are selected by CONTEXT_FLOATING_POINT */
2124 DWORD Fsr;
2126 /* These are selected by CONTEXT_CONTROL */
2127 DWORD Fir;
2128 DWORD Psr;
2130 DWORD ContextFlags;
2131 DWORD Fill[2];
2132 } CONTEXT;
2134 #endif /* _MIPS_ */
2136 /* PowerPC context definitions */
2137 #ifdef __powerpc__
2139 #define CONTEXT_CONTROL 0x0001
2140 #define CONTEXT_FLOATING_POINT 0x0002
2141 #define CONTEXT_INTEGER 0x0004
2142 #define CONTEXT_DEBUG_REGISTERS 0x0008
2143 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2145 #define EXCEPTION_READ_FAULT 0
2146 #define EXCEPTION_WRITE_FAULT 1
2147 #define EXCEPTION_EXECUTE_FAULT 8
2149 typedef struct
2151 /* These are selected by CONTEXT_FLOATING_POINT */
2152 double Fpr0;
2153 double Fpr1;
2154 double Fpr2;
2155 double Fpr3;
2156 double Fpr4;
2157 double Fpr5;
2158 double Fpr6;
2159 double Fpr7;
2160 double Fpr8;
2161 double Fpr9;
2162 double Fpr10;
2163 double Fpr11;
2164 double Fpr12;
2165 double Fpr13;
2166 double Fpr14;
2167 double Fpr15;
2168 double Fpr16;
2169 double Fpr17;
2170 double Fpr18;
2171 double Fpr19;
2172 double Fpr20;
2173 double Fpr21;
2174 double Fpr22;
2175 double Fpr23;
2176 double Fpr24;
2177 double Fpr25;
2178 double Fpr26;
2179 double Fpr27;
2180 double Fpr28;
2181 double Fpr29;
2182 double Fpr30;
2183 double Fpr31;
2184 double Fpscr;
2186 /* These are selected by CONTEXT_INTEGER */
2187 DWORD Gpr0;
2188 DWORD Gpr1;
2189 DWORD Gpr2;
2190 DWORD Gpr3;
2191 DWORD Gpr4;
2192 DWORD Gpr5;
2193 DWORD Gpr6;
2194 DWORD Gpr7;
2195 DWORD Gpr8;
2196 DWORD Gpr9;
2197 DWORD Gpr10;
2198 DWORD Gpr11;
2199 DWORD Gpr12;
2200 DWORD Gpr13;
2201 DWORD Gpr14;
2202 DWORD Gpr15;
2203 DWORD Gpr16;
2204 DWORD Gpr17;
2205 DWORD Gpr18;
2206 DWORD Gpr19;
2207 DWORD Gpr20;
2208 DWORD Gpr21;
2209 DWORD Gpr22;
2210 DWORD Gpr23;
2211 DWORD Gpr24;
2212 DWORD Gpr25;
2213 DWORD Gpr26;
2214 DWORD Gpr27;
2215 DWORD Gpr28;
2216 DWORD Gpr29;
2217 DWORD Gpr30;
2218 DWORD Gpr31;
2220 DWORD Cr;
2221 DWORD Xer;
2223 /* These are selected by CONTEXT_CONTROL */
2224 DWORD Msr;
2225 DWORD Iar; /* Instruction Address Register , aka PC ... */
2226 DWORD Lr;
2227 DWORD Ctr;
2229 DWORD ContextFlags;
2231 DWORD Dar; /* Fault registers for coredump */
2232 DWORD Dsisr;
2233 DWORD Trap; /* number of powerpc exception taken */
2235 /* These are selected by CONTEXT_DEBUG_REGISTERS */
2236 DWORD Dr0;
2237 DWORD Dr1;
2238 DWORD Dr2;
2239 DWORD Dr3;
2240 DWORD Dr4;
2241 DWORD Dr5;
2242 DWORD Dr6;
2243 DWORD Dr7;
2244 } CONTEXT;
2246 typedef struct _STACK_FRAME_HEADER
2248 DWORD BackChain;
2249 DWORD GlueSaved1;
2250 DWORD GlueSaved2;
2251 DWORD Reserved1;
2252 DWORD Spare1;
2253 DWORD Spare2;
2255 DWORD Parameter0;
2256 DWORD Parameter1;
2257 DWORD Parameter2;
2258 DWORD Parameter3;
2259 DWORD Parameter4;
2260 DWORD Parameter5;
2261 DWORD Parameter6;
2262 DWORD Parameter7;
2263 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
2265 #endif /* __powerpc__ */
2267 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
2268 #error You need to define a CONTEXT for your CPU
2269 #endif
2271 NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
2273 #define WOW64_CONTEXT_i386 0x00010000
2274 #define WOW64_CONTEXT_i486 0x00010000
2275 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001))
2276 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002))
2277 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004))
2278 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008))
2279 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010))
2280 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020))
2281 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2282 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)
2283 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \
2284 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \
2285 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS)
2287 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040))
2289 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
2290 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
2291 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
2292 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000
2294 #define WOW64_SIZE_OF_80387_REGISTERS 80
2295 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512
2297 typedef struct _WOW64_FLOATING_SAVE_AREA
2299 DWORD ControlWord;
2300 DWORD StatusWord;
2301 DWORD TagWord;
2302 DWORD ErrorOffset;
2303 DWORD ErrorSelector;
2304 DWORD DataOffset;
2305 DWORD DataSelector;
2306 BYTE RegisterArea[WOW64_SIZE_OF_80387_REGISTERS];
2307 DWORD Cr0NpxState;
2308 } WOW64_FLOATING_SAVE_AREA, *PWOW64_FLOATING_SAVE_AREA;
2310 #include "pshpack4.h"
2311 typedef struct _WOW64_CONTEXT
2313 DWORD ContextFlags;
2314 DWORD Dr0;
2315 DWORD Dr1;
2316 DWORD Dr2;
2317 DWORD Dr3;
2318 DWORD Dr6;
2319 DWORD Dr7;
2320 WOW64_FLOATING_SAVE_AREA FloatSave;
2321 DWORD SegGs;
2322 DWORD SegFs;
2323 DWORD SegEs;
2324 DWORD SegDs;
2325 DWORD Edi;
2326 DWORD Esi;
2327 DWORD Ebx;
2328 DWORD Edx;
2329 DWORD Ecx;
2330 DWORD Eax;
2331 DWORD Ebp;
2332 DWORD Eip;
2333 DWORD SegCs;
2334 DWORD EFlags;
2335 DWORD Esp;
2336 DWORD SegSs;
2337 BYTE ExtendedRegisters[WOW64_MAXIMUM_SUPPORTED_EXTENSION];
2338 } WOW64_CONTEXT, *PWOW64_CONTEXT;
2339 #include "poppack.h"
2341 #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
2343 typedef PRUNTIME_FUNCTION (CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD_PTR,PVOID);
2345 NTSYSAPI BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD_PTR);
2346 NTSYSAPI DWORD WINAPI RtlAddGrowableFunctionTable(void**,PRUNTIME_FUNCTION,DWORD,DWORD,ULONG_PTR,ULONG_PTR);
2347 NTSYSAPI BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
2348 NTSYSAPI void WINAPI RtlDeleteGrowableFunctionTable(void*);
2349 NTSYSAPI void WINAPI RtlGrowFunctionTable(void*,DWORD);
2350 NTSYSAPI BOOLEAN CDECL RtlInstallFunctionTableCallback(DWORD_PTR,DWORD_PTR,DWORD,PGET_RUNTIME_FUNCTION_CALLBACK,PVOID,PCWSTR);
2351 NTSYSAPI PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD_PTR,DWORD_PTR*,UNWIND_HISTORY_TABLE*);
2352 NTSYSAPI void WINAPI RtlUnwindEx(PVOID,PVOID,struct _EXCEPTION_RECORD*,PVOID,CONTEXT*,UNWIND_HISTORY_TABLE*);
2353 #endif
2356 * Product types
2358 #define PRODUCT_UNDEFINED 0x00000000
2359 #define PRODUCT_ULTIMATE 0x00000001
2360 #define PRODUCT_HOME_BASIC 0x00000002
2361 #define PRODUCT_HOME_PREMIUM 0x00000003
2362 #define PRODUCT_ENTERPRISE 0x00000004
2363 #define PRODUCT_HOME_BASIC_N 0x00000005
2364 #define PRODUCT_BUSINESS 0x00000006
2365 #define PRODUCT_STANDARD_SERVER 0x00000007
2366 #define PRODUCT_DATACENTER_SERVER 0x00000008
2367 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
2368 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
2369 #define PRODUCT_STARTER 0x0000000B
2370 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
2371 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
2372 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
2373 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
2374 #define PRODUCT_BUSINESS_N 0x00000010
2375 #define PRODUCT_WEB_SERVER 0x00000011
2376 #define PRODUCT_CLUSTER_SERVER 0x00000012
2377 #define PRODUCT_HOME_SERVER 0x00000013
2378 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2379 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2380 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2381 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2382 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
2383 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
2384 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
2385 #define PRODUCT_ENTERPRISE_N 0x0000001B
2386 #define PRODUCT_ULTIMATE_N 0x0000001C
2387 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2388 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
2389 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
2390 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
2391 #define PRODUCT_SERVER_FOUNDATION 0x00000021
2392 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
2393 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
2394 #define PRODUCT_STANDARD_SERVER_V 0x00000024
2395 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
2396 #define PRODUCT_SERVER_V 0x00000025
2397 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
2398 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
2399 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
2400 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
2401 #define PRODUCT_HYPERV 0x0000002A
2402 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
2403 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
2404 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
2405 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
2406 #define PRODUCT_STARTER_N 0x0000002F
2407 #define PRODUCT_PROFESSIONAL 0x00000030
2408 #define PRODUCT_PROFESSIONAL_N 0x00000031
2409 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
2410 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
2411 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
2412 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
2413 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
2414 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
2415 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
2416 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
2417 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
2418 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
2419 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
2420 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
2421 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
2422 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
2423 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
2424 #define PRODUCT_EMBEDDED 0x00000041
2425 #define PRODUCT_STARTER_E 0x00000042
2426 #define PRODUCT_HOME_BASIC_E 0x00000043
2427 #define PRODUCT_HOME_PREMIUM_E 0x00000044
2428 #define PRODUCT_PROFESSIONAL_E 0x00000045
2429 #define PRODUCT_ENTERPRISE_E 0x00000046
2430 #define PRODUCT_ULTIMATE_E 0x00000047
2431 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
2432 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
2433 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
2434 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
2435 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
2436 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
2437 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
2438 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
2439 #define PRODUCT_THINPC 0x00000057
2440 #define PRODUCT_EMBEDDED_A 0x00000058
2441 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
2442 #define PRODUCT_EMBEDDED_E 0x0000005A
2443 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
2444 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
2445 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
2446 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
2447 #define PRODUCT_CORE_ARM 0x00000061
2448 #define PRODUCT_CORE_N 0x00000062
2449 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
2450 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
2451 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
2452 #define PRODUCT_CORE 0x00000065
2453 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
2454 #define PRODUCT_MOBILE_CORE 0x00000068
2455 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
2456 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
2457 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
2458 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
2459 #define PRODUCT_NANO_SERVER 0x0000006D
2460 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
2461 #define PRODUCT_CORE_CONNECTED 0x0000006F
2462 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
2463 #define PRODUCT_CORE_CONNECTED_N 0x00000071
2464 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
2465 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
2466 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
2467 #define PRODUCT_CONNECTED_CAR 0x00000075
2468 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
2469 #define PRODUCT_PPI_PRO 0x00000077
2470 #define PRODUCT_ARM64_SERVER 0x00000078
2471 #define PRODUCT_EDUCATION 0x00000079
2472 #define PRODUCT_EDUCATION_N 0x0000007A
2473 #define PRODUCT_IOTUAP 0x0000007B
2474 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
2475 #define PRODUCT_ENTERPRISE_S 0x0000007D
2476 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
2477 #define PRODUCT_PROFESSIONAL_S 0x0000007F
2478 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
2479 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
2480 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
2481 #define PRODUCT_UNLICENSED 0xABCDABCD
2485 * Language IDs
2488 #define MAKELCID(l, s) (MAKELONG(l, s))
2490 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2491 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2492 #define SUBLANGID(l) ((WORD)(l) >> 10)
2494 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2495 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2497 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2498 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2499 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2500 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2501 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2502 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2503 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2504 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2505 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2506 #define LOCALE_NAME_MAX_LENGTH 85
2509 #define UNREFERENCED_PARAMETER(u) (void)(u)
2510 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2511 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2513 #include <winnt.rh>
2517 * Definitions for IsTextUnicode()
2520 #define IS_TEXT_UNICODE_ASCII16 0x0001
2521 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2522 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2523 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2524 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2525 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2526 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2527 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2528 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2529 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2530 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2531 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2532 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2533 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2534 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2535 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2537 #define MAXIMUM_WAIT_OBJECTS 64
2538 #define MAXIMUM_SUSPEND_COUNT 127
2540 #define WT_EXECUTEDEFAULT 0x00
2541 #define WT_EXECUTEINIOTHREAD 0x01
2542 #define WT_EXECUTEINUITHREAD 0x02
2543 #define WT_EXECUTEINWAITTHREAD 0x04
2544 #define WT_EXECUTEONLYONCE 0x08
2545 #define WT_EXECUTELONGFUNCTION 0x10
2546 #define WT_EXECUTEINTIMERTHREAD 0x20
2547 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2548 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2549 #define WT_EXECUTEINLONGTHREAD 0x10
2550 #define WT_EXECUTEDELETEWAIT 0x08
2551 #define WT_TRANSFER_IMPERSONATION 0x0100
2554 #define EXCEPTION_CONTINUABLE 0
2555 #define EXCEPTION_NONCONTINUABLE 0x01
2558 * The exception record used by Win32 to give additional information
2559 * about exception to exception handlers.
2562 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2564 typedef struct _EXCEPTION_RECORD
2566 DWORD ExceptionCode;
2567 DWORD ExceptionFlags;
2568 struct _EXCEPTION_RECORD *ExceptionRecord;
2570 PVOID ExceptionAddress;
2571 DWORD NumberParameters;
2572 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2573 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2575 typedef struct _EXCEPTION_RECORD32
2577 DWORD ExceptionCode;
2578 DWORD ExceptionFlags;
2579 DWORD ExceptionRecord;
2580 DWORD ExceptionAddress;
2581 DWORD NumberParameters;
2582 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2583 } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;
2585 typedef struct _EXCEPTION_RECORD64
2587 DWORD ExceptionCode;
2588 DWORD ExceptionFlags;
2589 DWORD64 ExceptionRecord;
2590 DWORD64 ExceptionAddress;
2591 DWORD NumberParameters;
2592 DWORD __unusedAlignment;
2593 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2594 } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
2597 * The exception pointers structure passed to exception filters
2598 * in except() and the UnhandledExceptionFilter().
2601 typedef struct _EXCEPTION_POINTERS
2603 PEXCEPTION_RECORD ExceptionRecord;
2604 PCONTEXT ContextRecord;
2605 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
2609 * The exception frame, used for registering exception handlers
2610 * Win32 cares only about this, but compilers generally emit
2611 * larger exception frames for their own use.
2614 struct _EXCEPTION_REGISTRATION_RECORD;
2616 typedef DWORD (CDECL *PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
2617 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
2619 typedef struct _EXCEPTION_REGISTRATION_RECORD
2621 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
2622 PEXCEPTION_HANDLER Handler;
2623 } EXCEPTION_REGISTRATION_RECORD;
2626 * function pointer to an exception filter
2629 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
2631 typedef struct _NT_TIB
2633 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2634 PVOID StackBase;
2635 PVOID StackLimit;
2636 PVOID SubSystemTib;
2637 union {
2638 PVOID FiberData;
2639 DWORD Version;
2640 } DUMMYUNIONNAME;
2641 PVOID ArbitraryUserPointer;
2642 struct _NT_TIB *Self;
2643 } NT_TIB, *PNT_TIB;
2645 struct _TEB;
2647 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2648 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2650 struct _TEB *teb;
2651 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2652 return teb;
2654 #elif defined(__i386__) && defined(_MSC_VER)
2655 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2657 struct _TEB *teb;
2658 __asm mov eax, fs:[0x18];
2659 __asm mov teb, eax;
2660 return teb;
2662 #elif defined(__x86_64__) && defined(__GNUC__)
2663 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2665 struct _TEB *teb;
2666 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
2667 return teb;
2669 #elif defined(__x86_64__) && defined(_MSC_VER)
2670 #pragma intrinsic(__readgsqword)
2671 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2673 return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
2675 #else
2676 extern struct _TEB * WINAPI NtCurrentTeb(void);
2677 #endif
2679 #ifdef NONAMELESSUNION
2680 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2681 #else
2682 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2683 #endif
2684 #define GetFiberData() (*(void **)GetCurrentFiber())
2686 #define TLS_MINIMUM_AVAILABLE 64
2688 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024)
2690 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2691 #define IO_REPARSE_TAG_RESERVED_ONE 1
2692 #define IO_REPARSE_TAG_RESERVED_TWO 2
2694 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_TWO
2696 #define IO_REPARSE_TAG_MOUNT_POINT __MSABI_LONG(0xA0000003)
2697 #define IO_REPARSE_TAG_HSM __MSABI_LONG(0xC0000004)
2698 #define IO_REPARSE_TAG_DRIVE_EXTENDER __MSABI_LONG(0x80000005)
2699 #define IO_REPARSE_TAG_HSM2 __MSABI_LONG(0x80000006)
2700 #define IO_REPARSE_TAG_SIS __MSABI_LONG(0x80000007)
2701 #define IO_REPARSE_TAG_WIM __MSABI_LONG(0x80000008)
2702 #define IO_REPARSE_TAG_CSV __MSABI_LONG(0x80000009)
2703 #define IO_REPARSE_TAG_DFS __MSABI_LONG(0x8000000A)
2704 #define IO_REPARSE_TAG_FILTER_MANAGER __MSABI_LONG(0x8000000B)
2705 #define IO_REPARSE_TAG_SYMLINK __MSABI_LONG(0xA000000C)
2706 #define IO_REPARSE_TAG_IIS_CACHE __MSABI_LONG(0xA0000010)
2707 #define IO_REPARSE_TAG_DFSR __MSABI_LONG(0x80000012)
2708 #define IO_REPARSE_TAG_DEDUP __MSABI_LONG(0x80000013)
2709 #define IO_REPARSE_TAG_NFS __MSABI_LONG(0x80000014)
2710 #define IO_REPARSE_TAG_FILE_PLACEHOLDER __MSABI_LONG(0x80000015)
2711 #define IO_REPARSE_TAG_WOF __MSABI_LONG(0x80000017)
2712 #define IO_REPARSE_TAG_WCI __MSABI_LONG(0x80000018)
2713 #define IO_REPARSE_TAG_WCI_1 __MSABI_LONG(0x90001018)
2714 #define IO_REPARSE_TAG_GLOBAL_REPARSE __MSABI_LONG(0xA0000019)
2715 #define IO_REPARSE_TAG_CLOUD __MSABI_LONG(0x9000001A)
2716 #define IO_REPARSE_TAG_CLOUD_1 __MSABI_LONG(0x9000101A)
2717 #define IO_REPARSE_TAG_CLOUD_2 __MSABI_LONG(0x9000201A)
2718 #define IO_REPARSE_TAG_CLOUD_3 __MSABI_LONG(0x9000301A)
2719 #define IO_REPARSE_TAG_CLOUD_4 __MSABI_LONG(0x9000401A)
2720 #define IO_REPARSE_TAG_CLOUD_5 __MSABI_LONG(0x9000501A)
2721 #define IO_REPARSE_TAG_CLOUD_6 __MSABI_LONG(0x9000601A)
2722 #define IO_REPARSE_TAG_CLOUD_7 __MSABI_LONG(0x9000701A)
2723 #define IO_REPARSE_TAG_CLOUD_8 __MSABI_LONG(0x9000801A)
2724 #define IO_REPARSE_TAG_CLOUD_9 __MSABI_LONG(0x9000901A)
2725 #define IO_REPARSE_TAG_CLOUD_A __MSABI_LONG(0x9000A01A)
2726 #define IO_REPARSE_TAG_CLOUD_B __MSABI_LONG(0x9000B01A)
2727 #define IO_REPARSE_TAG_CLOUD_C __MSABI_LONG(0x9000C01A)
2728 #define IO_REPARSE_TAG_CLOUD_D __MSABI_LONG(0x9000D01A)
2729 #define IO_REPARSE_TAG_CLOUD_E __MSABI_LONG(0x9000E01A)
2730 #define IO_REPARSE_TAG_CLOUD_F __MSABI_LONG(0x9000F01A)
2731 #define IO_REPARSE_TAG_CLOUD_MASK __MSABI_LONG(0x0000F000)
2732 #define IO_REPARSE_TAG_APPEXECLINK __MSABI_LONG(0x8000001B)
2733 #define IO_REPARSE_TAG_GVFS __MSABI_LONG(0x9000001C)
2734 #define IO_REPARSE_TAG_STORAGE_SYNC __MSABI_LONG(0x8000001E)
2735 #define IO_REPARSE_TAG_WCI_TOMBSTONE __MSABI_LONG(0xA000001F)
2736 #define IO_REPARSE_TAG_UNHANDLED __MSABI_LONG(0x80000020)
2737 #define IO_REPARSE_TAG_ONEDRIVE __MSABI_LONG(0x80000021)
2738 #define IO_REPARSE_TAG_GVFS_TOMBSTONE __MSABI_LONG(0xA0000022)
2741 * File formats definitions
2744 #include <pshpack2.h>
2745 typedef struct _IMAGE_DOS_HEADER {
2746 WORD e_magic; /* 00: MZ Header signature */
2747 WORD e_cblp; /* 02: Bytes on last page of file */
2748 WORD e_cp; /* 04: Pages in file */
2749 WORD e_crlc; /* 06: Relocations */
2750 WORD e_cparhdr; /* 08: Size of header in paragraphs */
2751 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2752 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2753 WORD e_ss; /* 0e: Initial (relative) SS value */
2754 WORD e_sp; /* 10: Initial SP value */
2755 WORD e_csum; /* 12: Checksum */
2756 WORD e_ip; /* 14: Initial IP value */
2757 WORD e_cs; /* 16: Initial (relative) CS value */
2758 WORD e_lfarlc; /* 18: File address of relocation table */
2759 WORD e_ovno; /* 1a: Overlay number */
2760 WORD e_res[4]; /* 1c: Reserved words */
2761 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2762 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2763 WORD e_res2[10]; /* 28: Reserved words */
2764 DWORD e_lfanew; /* 3c: Offset to extended header */
2765 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2766 #include <poppack.h>
2768 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2769 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2770 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2771 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2772 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2773 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2776 * This is the Windows executable (NE) header.
2777 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2779 #include <pshpack2.h>
2780 typedef struct
2782 WORD ne_magic; /* 00 NE signature 'NE' */
2783 BYTE ne_ver; /* 02 Linker version number */
2784 BYTE ne_rev; /* 03 Linker revision number */
2785 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2786 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2787 LONG ne_crc; /* 08 Checksum */
2788 WORD ne_flags; /* 0c Flags about segments in this file */
2789 WORD ne_autodata; /* 0e Automatic data segment number */
2790 WORD ne_heap; /* 10 Initial size of local heap */
2791 WORD ne_stack; /* 12 Initial size of stack */
2792 DWORD ne_csip; /* 14 Initial CS:IP */
2793 DWORD ne_sssp; /* 18 Initial SS:SP */
2794 WORD ne_cseg; /* 1c # of entries in segment table */
2795 WORD ne_cmod; /* 1e # of entries in module reference tab. */
2796 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2797 WORD ne_segtab; /* 22 Offset to segment table */
2798 WORD ne_rsrctab; /* 24 Offset to resource table */
2799 WORD ne_restab; /* 26 Offset to resident-name table */
2800 WORD ne_modtab; /* 28 Offset to module reference table */
2801 WORD ne_imptab; /* 2a Offset to imported name table */
2802 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2803 WORD ne_cmovent; /* 30 # of movable entry points */
2804 WORD ne_align; /* 32 Logical sector alignment shift count */
2805 WORD ne_cres; /* 34 # of resource segments */
2806 BYTE ne_exetyp; /* 36 Flags indicating target OS */
2807 BYTE ne_flagsothers; /* 37 Additional information flags */
2808 WORD ne_pretthunks; /* 38 Offset to return thunks */
2809 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2810 WORD ne_swaparea; /* 3c Reserved by Microsoft */
2811 WORD ne_expver; /* 3e Expected Windows version number */
2812 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2813 #include <poppack.h>
2815 #include <pshpack2.h>
2816 typedef struct _IMAGE_VXD_HEADER {
2817 WORD e32_magic;
2818 BYTE e32_border;
2819 BYTE e32_worder;
2820 DWORD e32_level;
2821 WORD e32_cpu;
2822 WORD e32_os;
2823 DWORD e32_ver;
2824 DWORD e32_mflags;
2825 DWORD e32_mpages;
2826 DWORD e32_startobj;
2827 DWORD e32_eip;
2828 DWORD e32_stackobj;
2829 DWORD e32_esp;
2830 DWORD e32_pagesize;
2831 DWORD e32_lastpagesize;
2832 DWORD e32_fixupsize;
2833 DWORD e32_fixupsum;
2834 DWORD e32_ldrsize;
2835 DWORD e32_ldrsum;
2836 DWORD e32_objtab;
2837 DWORD e32_objcnt;
2838 DWORD e32_objmap;
2839 DWORD e32_itermap;
2840 DWORD e32_rsrctab;
2841 DWORD e32_rsrccnt;
2842 DWORD e32_restab;
2843 DWORD e32_enttab;
2844 DWORD e32_dirtab;
2845 DWORD e32_dircnt;
2846 DWORD e32_fpagetab;
2847 DWORD e32_frectab;
2848 DWORD e32_impmod;
2849 DWORD e32_impmodcnt;
2850 DWORD e32_impproc;
2851 DWORD e32_pagesum;
2852 DWORD e32_datapage;
2853 DWORD e32_preload;
2854 DWORD e32_nrestab;
2855 DWORD e32_cbnrestab;
2856 DWORD e32_nressum;
2857 DWORD e32_autodata;
2858 DWORD e32_debuginfo;
2859 DWORD e32_debuglen;
2860 DWORD e32_instpreload;
2861 DWORD e32_instdemand;
2862 DWORD e32_heapsize;
2863 BYTE e32_res3[12];
2864 DWORD e32_winresoff;
2865 DWORD e32_winreslen;
2866 WORD e32_devid;
2867 WORD e32_ddkver;
2868 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2869 #include <poppack.h>
2871 /* These defines describe the meanings of the bits in the Characteristics
2872 field */
2874 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2875 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2876 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2877 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2878 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2879 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2880 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2881 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2882 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2883 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2884 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2885 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2886 #define IMAGE_FILE_SYSTEM 0x1000
2887 #define IMAGE_FILE_DLL 0x2000
2888 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2889 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2891 /* These are the settings of the Machine field. */
2892 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2893 #define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001
2894 #define IMAGE_FILE_MACHINE_I860 0x014d
2895 #define IMAGE_FILE_MACHINE_I386 0x014c
2896 #define IMAGE_FILE_MACHINE_R3000 0x0162
2897 #define IMAGE_FILE_MACHINE_R4000 0x0166
2898 #define IMAGE_FILE_MACHINE_R10000 0x0168
2899 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2900 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2901 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2902 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2903 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2904 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2905 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2906 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2907 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2908 #define IMAGE_FILE_MACHINE_ARMNT 0x01c4
2909 #define IMAGE_FILE_MACHINE_ARM64 0xaa64
2910 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2911 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2912 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2913 #define IMAGE_FILE_MACHINE_IA64 0x0200
2914 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2915 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2916 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2917 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2918 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2919 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2920 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2921 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2922 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2923 #define IMAGE_FILE_MACHINE_M32R 0x9041
2924 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2926 #define IMAGE_SIZEOF_FILE_HEADER 20
2927 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2928 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2929 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2930 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2931 #define IMAGE_SIZEOF_SHORT_NAME 8
2932 #define IMAGE_SIZEOF_SECTION_HEADER 40
2933 #define IMAGE_SIZEOF_SYMBOL 18
2934 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2935 #define IMAGE_SIZEOF_RELOCATION 10
2936 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2937 #define IMAGE_SIZEOF_LINENUMBER 6
2938 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2940 /* Possible Magic values */
2941 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2942 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2943 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2945 #ifdef _WIN64
2946 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2947 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2948 #else
2949 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2950 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2951 #endif
2953 /* These are indexes into the DataDirectory array */
2954 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2955 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2956 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2957 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2958 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2959 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2960 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2961 #define IMAGE_FILE_DESCRIPTION_STRING 7
2962 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2963 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2964 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2966 /* Directory Entries, indices into the DataDirectory array */
2968 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2969 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2970 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2971 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2972 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2973 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2974 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2975 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2976 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2977 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2978 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2979 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2980 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2981 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2982 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2984 /* Subsystem Values */
2986 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2987 #define IMAGE_SUBSYSTEM_NATIVE 1
2988 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2989 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2990 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2991 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2992 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2993 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2994 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2995 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2996 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2997 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2998 #define IMAGE_SUBSYSTEM_XBOX 14
2999 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
3001 /* DLL Characteristics */
3002 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
3003 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
3004 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
3005 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
3006 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
3007 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
3008 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
3009 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
3011 typedef struct _IMAGE_FILE_HEADER {
3012 WORD Machine;
3013 WORD NumberOfSections;
3014 DWORD TimeDateStamp;
3015 DWORD PointerToSymbolTable;
3016 DWORD NumberOfSymbols;
3017 WORD SizeOfOptionalHeader;
3018 WORD Characteristics;
3019 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
3021 typedef struct _IMAGE_DATA_DIRECTORY {
3022 DWORD VirtualAddress;
3023 DWORD Size;
3024 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
3026 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
3028 typedef struct _IMAGE_OPTIONAL_HEADER64 {
3029 WORD Magic; /* 0x20b */
3030 BYTE MajorLinkerVersion;
3031 BYTE MinorLinkerVersion;
3032 DWORD SizeOfCode;
3033 DWORD SizeOfInitializedData;
3034 DWORD SizeOfUninitializedData;
3035 DWORD AddressOfEntryPoint;
3036 DWORD BaseOfCode;
3037 ULONGLONG ImageBase;
3038 DWORD SectionAlignment;
3039 DWORD FileAlignment;
3040 WORD MajorOperatingSystemVersion;
3041 WORD MinorOperatingSystemVersion;
3042 WORD MajorImageVersion;
3043 WORD MinorImageVersion;
3044 WORD MajorSubsystemVersion;
3045 WORD MinorSubsystemVersion;
3046 DWORD Win32VersionValue;
3047 DWORD SizeOfImage;
3048 DWORD SizeOfHeaders;
3049 DWORD CheckSum;
3050 WORD Subsystem;
3051 WORD DllCharacteristics;
3052 ULONGLONG SizeOfStackReserve;
3053 ULONGLONG SizeOfStackCommit;
3054 ULONGLONG SizeOfHeapReserve;
3055 ULONGLONG SizeOfHeapCommit;
3056 DWORD LoaderFlags;
3057 DWORD NumberOfRvaAndSizes;
3058 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
3059 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
3061 typedef struct _IMAGE_NT_HEADERS64 {
3062 DWORD Signature;
3063 IMAGE_FILE_HEADER FileHeader;
3064 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
3065 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
3067 typedef struct _IMAGE_OPTIONAL_HEADER {
3069 /* Standard fields */
3071 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
3072 BYTE MajorLinkerVersion;
3073 BYTE MinorLinkerVersion;
3074 DWORD SizeOfCode;
3075 DWORD SizeOfInitializedData;
3076 DWORD SizeOfUninitializedData;
3077 DWORD AddressOfEntryPoint; /* 0x10 */
3078 DWORD BaseOfCode;
3079 DWORD BaseOfData;
3081 /* NT additional fields */
3083 DWORD ImageBase;
3084 DWORD SectionAlignment; /* 0x20 */
3085 DWORD FileAlignment;
3086 WORD MajorOperatingSystemVersion;
3087 WORD MinorOperatingSystemVersion;
3088 WORD MajorImageVersion;
3089 WORD MinorImageVersion;
3090 WORD MajorSubsystemVersion; /* 0x30 */
3091 WORD MinorSubsystemVersion;
3092 DWORD Win32VersionValue;
3093 DWORD SizeOfImage;
3094 DWORD SizeOfHeaders;
3095 DWORD CheckSum; /* 0x40 */
3096 WORD Subsystem;
3097 WORD DllCharacteristics;
3098 DWORD SizeOfStackReserve;
3099 DWORD SizeOfStackCommit;
3100 DWORD SizeOfHeapReserve; /* 0x50 */
3101 DWORD SizeOfHeapCommit;
3102 DWORD LoaderFlags;
3103 DWORD NumberOfRvaAndSizes;
3104 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
3105 /* 0xE0 */
3106 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
3108 typedef struct _IMAGE_NT_HEADERS {
3109 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
3110 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
3111 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
3112 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
3114 #ifdef _WIN64
3115 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
3116 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
3117 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
3118 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
3119 #else
3120 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
3121 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
3122 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
3123 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
3124 #endif
3126 #define IMAGE_SIZEOF_SHORT_NAME 8
3128 typedef struct _IMAGE_SECTION_HEADER {
3129 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
3130 union {
3131 DWORD PhysicalAddress;
3132 DWORD VirtualSize;
3133 } Misc;
3134 DWORD VirtualAddress;
3135 DWORD SizeOfRawData;
3136 DWORD PointerToRawData;
3137 DWORD PointerToRelocations;
3138 DWORD PointerToLinenumbers;
3139 WORD NumberOfRelocations;
3140 WORD NumberOfLinenumbers;
3141 DWORD Characteristics;
3142 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
3144 #define IMAGE_SIZEOF_SECTION_HEADER 40
3146 #define IMAGE_FIRST_SECTION(ntheader) \
3147 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
3148 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
3150 /* These defines are for the Characteristics bitfield. */
3151 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
3152 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
3153 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
3154 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
3155 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
3156 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
3158 #define IMAGE_SCN_CNT_CODE 0x00000020
3159 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
3160 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
3162 #define IMAGE_SCN_LNK_OTHER 0x00000100
3163 #define IMAGE_SCN_LNK_INFO 0x00000200
3164 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
3165 #define IMAGE_SCN_LNK_REMOVE 0x00000800
3166 #define IMAGE_SCN_LNK_COMDAT 0x00001000
3168 /* 0x00002000 - Reserved */
3169 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
3170 #define IMAGE_SCN_MEM_FARDATA 0x00008000
3172 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
3173 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
3174 #define IMAGE_SCN_MEM_16BIT 0x00020000
3175 #define IMAGE_SCN_MEM_LOCKED 0x00040000
3176 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
3178 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
3179 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
3180 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
3181 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
3182 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
3183 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
3184 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
3185 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
3186 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
3187 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
3188 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
3189 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
3190 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
3191 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
3192 /* 0x00F00000 - Unused */
3193 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
3195 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3198 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3199 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3200 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3201 #define IMAGE_SCN_MEM_SHARED 0x10000000
3202 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3203 #define IMAGE_SCN_MEM_READ 0x40000000
3204 #define IMAGE_SCN_MEM_WRITE 0x80000000
3206 #include <pshpack2.h>
3208 typedef struct _IMAGE_SYMBOL {
3209 union {
3210 BYTE ShortName[8];
3211 struct {
3212 DWORD Short;
3213 DWORD Long;
3214 } Name;
3215 DWORD LongName[2];
3216 } N;
3217 DWORD Value;
3218 SHORT SectionNumber;
3219 WORD Type;
3220 BYTE StorageClass;
3221 BYTE NumberOfAuxSymbols;
3222 } IMAGE_SYMBOL;
3223 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
3225 #define IMAGE_SIZEOF_SYMBOL 18
3227 typedef struct _IMAGE_LINENUMBER {
3228 union {
3229 DWORD SymbolTableIndex;
3230 DWORD VirtualAddress;
3231 } Type;
3232 WORD Linenumber;
3233 } IMAGE_LINENUMBER;
3234 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
3236 #define IMAGE_SIZEOF_LINENUMBER 6
3238 typedef union _IMAGE_AUX_SYMBOL {
3239 struct {
3240 DWORD TagIndex;
3241 union {
3242 struct {
3243 WORD Linenumber;
3244 WORD Size;
3245 } LnSz;
3246 DWORD TotalSize;
3247 } Misc;
3248 union {
3249 struct {
3250 DWORD PointerToLinenumber;
3251 DWORD PointerToNextFunction;
3252 } Function;
3253 struct {
3254 WORD Dimension[4];
3255 } Array;
3256 } FcnAry;
3257 WORD TvIndex;
3258 } Sym;
3259 struct {
3260 BYTE Name[IMAGE_SIZEOF_SYMBOL];
3261 } File;
3262 struct {
3263 DWORD Length;
3264 WORD NumberOfRelocations;
3265 WORD NumberOfLinenumbers;
3266 DWORD CheckSum;
3267 SHORT Number;
3268 BYTE Selection;
3269 } Section;
3270 } IMAGE_AUX_SYMBOL;
3271 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
3273 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3275 #include <poppack.h>
3277 #define IMAGE_SYM_UNDEFINED (SHORT)0
3278 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3279 #define IMAGE_SYM_DEBUG (SHORT)-2
3281 #define IMAGE_SYM_TYPE_NULL 0x0000
3282 #define IMAGE_SYM_TYPE_VOID 0x0001
3283 #define IMAGE_SYM_TYPE_CHAR 0x0002
3284 #define IMAGE_SYM_TYPE_SHORT 0x0003
3285 #define IMAGE_SYM_TYPE_INT 0x0004
3286 #define IMAGE_SYM_TYPE_LONG 0x0005
3287 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3288 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3289 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3290 #define IMAGE_SYM_TYPE_UNION 0x0009
3291 #define IMAGE_SYM_TYPE_ENUM 0x000A
3292 #define IMAGE_SYM_TYPE_MOE 0x000B
3293 #define IMAGE_SYM_TYPE_BYTE 0x000C
3294 #define IMAGE_SYM_TYPE_WORD 0x000D
3295 #define IMAGE_SYM_TYPE_UINT 0x000E
3296 #define IMAGE_SYM_TYPE_DWORD 0x000F
3297 #define IMAGE_SYM_TYPE_PCODE 0x8000
3299 #define IMAGE_SYM_DTYPE_NULL 0
3300 #define IMAGE_SYM_DTYPE_POINTER 1
3301 #define IMAGE_SYM_DTYPE_FUNCTION 2
3302 #define IMAGE_SYM_DTYPE_ARRAY 3
3304 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3305 #define IMAGE_SYM_CLASS_NULL 0x0000
3306 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3307 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3308 #define IMAGE_SYM_CLASS_STATIC 0x0003
3309 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3310 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3311 #define IMAGE_SYM_CLASS_LABEL 0x0006
3312 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3313 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3314 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3315 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3316 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3317 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3318 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3319 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3320 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3321 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3322 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3323 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3325 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3326 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3327 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3328 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3329 #define IMAGE_SYM_CLASS_FILE 0x0067
3330 #define IMAGE_SYM_CLASS_SECTION 0x0068
3331 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3333 #define N_BTMASK 0x000F
3334 #define N_TMASK 0x0030
3335 #define N_TMASK1 0x00C0
3336 #define N_TMASK2 0x00F0
3337 #define N_BTSHFT 4
3338 #define N_TSHIFT 2
3340 #define BTYPE(x) ((x) & N_BTMASK)
3342 #ifndef ISPTR
3343 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3344 #endif
3346 #ifndef ISFCN
3347 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3348 #endif
3350 #ifndef ISARY
3351 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3352 #endif
3354 #ifndef ISTAG
3355 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3356 #endif
3358 #ifndef INCREF
3359 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3360 #endif
3361 #ifndef DECREF
3362 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3363 #endif
3365 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3366 #define IMAGE_COMDAT_SELECT_ANY 2
3367 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3368 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3369 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3370 #define IMAGE_COMDAT_SELECT_LARGEST 6
3371 #define IMAGE_COMDAT_SELECT_NEWEST 7
3373 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3374 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3375 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3377 /* Export module directory */
3379 typedef struct _IMAGE_EXPORT_DIRECTORY {
3380 DWORD Characteristics;
3381 DWORD TimeDateStamp;
3382 WORD MajorVersion;
3383 WORD MinorVersion;
3384 DWORD Name;
3385 DWORD Base;
3386 DWORD NumberOfFunctions;
3387 DWORD NumberOfNames;
3388 DWORD AddressOfFunctions;
3389 DWORD AddressOfNames;
3390 DWORD AddressOfNameOrdinals;
3391 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
3393 /* Import name entry */
3394 typedef struct _IMAGE_IMPORT_BY_NAME {
3395 WORD Hint;
3396 BYTE Name[1];
3397 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
3399 #include <pshpack8.h>
3400 /* Import thunk */
3401 typedef struct _IMAGE_THUNK_DATA64 {
3402 union {
3403 ULONGLONG ForwarderString;
3404 ULONGLONG Function;
3405 ULONGLONG Ordinal;
3406 ULONGLONG AddressOfData;
3407 } u1;
3408 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
3409 #include <poppack.h>
3411 typedef struct _IMAGE_THUNK_DATA32 {
3412 union {
3413 DWORD ForwarderString;
3414 DWORD Function;
3415 DWORD Ordinal;
3416 DWORD AddressOfData;
3417 } u1;
3418 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
3420 /* Import module directory */
3422 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3423 union {
3424 DWORD Characteristics; /* 0 for terminating null import descriptor */
3425 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
3426 } DUMMYUNIONNAME;
3427 DWORD TimeDateStamp; /* 0 if not bound,
3428 * -1 if bound, and real date\time stamp
3429 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3430 * (new BIND)
3431 * otherwise date/time stamp of DLL bound to
3432 * (Old BIND)
3434 DWORD ForwarderChain; /* -1 if no forwarders */
3435 DWORD Name;
3436 /* RVA to IAT (if bound this IAT has actual addresses) */
3437 DWORD FirstThunk;
3438 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
3440 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3441 #define IMAGE_ORDINAL_FLAG32 0x80000000
3442 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3443 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3444 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3445 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3447 #ifdef _WIN64
3448 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3449 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3450 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3451 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3452 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3453 #else
3454 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3455 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3456 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3457 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3458 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3459 #endif
3461 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3463 DWORD TimeDateStamp;
3464 WORD OffsetModuleName;
3465 WORD NumberOfModuleForwarderRefs;
3466 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3467 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3469 typedef struct _IMAGE_BOUND_FORWARDER_REF
3471 DWORD TimeDateStamp;
3472 WORD OffsetModuleName;
3473 WORD Reserved;
3474 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3476 typedef struct _IMAGE_BASE_RELOCATION
3478 DWORD VirtualAddress;
3479 DWORD SizeOfBlock;
3480 /* WORD TypeOffset[1]; */
3481 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
3483 #include <pshpack2.h>
3485 typedef struct _IMAGE_RELOCATION
3487 union {
3488 DWORD VirtualAddress;
3489 DWORD RelocCount;
3490 } DUMMYUNIONNAME;
3491 DWORD SymbolTableIndex;
3492 WORD Type;
3493 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
3495 #include <poppack.h>
3497 #define IMAGE_SIZEOF_RELOCATION 10
3499 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
3501 union
3503 DWORD AllAttributes;
3504 struct
3506 DWORD RvaBased:1;
3507 DWORD ReservedAttributes:31;
3508 } DUMMYSTRUCTNAME;
3509 } Attributes;
3511 DWORD DllNameRVA;
3512 DWORD ModuleHandleRVA;
3513 DWORD ImportAddressTableRVA;
3514 DWORD ImportNameTableRVA;
3515 DWORD BoundImportAddressTableRVA;
3516 DWORD UnloadInformationTableRVA;
3517 DWORD TimeDateStamp;
3518 } IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;
3519 typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR;
3521 /* generic relocation types */
3522 #define IMAGE_REL_BASED_ABSOLUTE 0
3523 #define IMAGE_REL_BASED_HIGH 1
3524 #define IMAGE_REL_BASED_LOW 2
3525 #define IMAGE_REL_BASED_HIGHLOW 3
3526 #define IMAGE_REL_BASED_HIGHADJ 4
3527 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3528 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
3529 #define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
3530 #define IMAGE_REL_BASED_SECTION 6
3531 #define IMAGE_REL_BASED_REL 7
3532 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
3533 #define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
3534 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3535 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3536 #define IMAGE_REL_BASED_DIR64 10
3537 #define IMAGE_REL_BASED_HIGH3ADJ 11
3539 /* I386 relocation types */
3540 #define IMAGE_REL_I386_ABSOLUTE 0
3541 #define IMAGE_REL_I386_DIR16 1
3542 #define IMAGE_REL_I386_REL16 2
3543 #define IMAGE_REL_I386_DIR32 6
3544 #define IMAGE_REL_I386_DIR32NB 7
3545 #define IMAGE_REL_I386_SEG12 9
3546 #define IMAGE_REL_I386_SECTION 10
3547 #define IMAGE_REL_I386_SECREL 11
3548 #define IMAGE_REL_I386_TOKEN 12
3549 #define IMAGE_REL_I386_SECREL7 13
3550 #define IMAGE_REL_I386_REL32 20
3552 /* MIPS relocation types */
3553 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3554 #define IMAGE_REL_MIPS_REFHALF 0x0001
3555 #define IMAGE_REL_MIPS_REFWORD 0x0002
3556 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3557 #define IMAGE_REL_MIPS_REFHI 0x0004
3558 #define IMAGE_REL_MIPS_REFLO 0x0005
3559 #define IMAGE_REL_MIPS_GPREL 0x0006
3560 #define IMAGE_REL_MIPS_LITERAL 0x0007
3561 #define IMAGE_REL_MIPS_SECTION 0x000A
3562 #define IMAGE_REL_MIPS_SECREL 0x000B
3563 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3564 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3565 #define IMAGE_REL_MIPS_TOKEN 0x000E
3566 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3567 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3568 #define IMAGE_REL_MIPS_PAIR 0x0025
3570 /* ALPHA relocation types */
3571 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3572 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3573 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3574 #define IMAGE_REL_ALPHA_GPREL 0x0003
3575 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3576 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3577 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3578 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3579 #define IMAGE_REL_ALPHA_HINT 0x0008
3580 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3581 #define IMAGE_REL_ALPHA_REFHI 0x000A
3582 #define IMAGE_REL_ALPHA_REFLO 0x000B
3583 #define IMAGE_REL_ALPHA_PAIR 0x000C
3584 #define IMAGE_REL_ALPHA_MATCH 0x000D
3585 #define IMAGE_REL_ALPHA_SECTION 0x000E
3586 #define IMAGE_REL_ALPHA_SECREL 0x000F
3587 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3588 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3589 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3590 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3591 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3592 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3593 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3594 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3596 /* PowerPC relocation types */
3597 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3598 #define IMAGE_REL_PPC_ADDR64 0x0001
3599 #define IMAGE_REL_PPC_ADDR 0x0002
3600 #define IMAGE_REL_PPC_ADDR24 0x0003
3601 #define IMAGE_REL_PPC_ADDR16 0x0004
3602 #define IMAGE_REL_PPC_ADDR14 0x0005
3603 #define IMAGE_REL_PPC_REL24 0x0006
3604 #define IMAGE_REL_PPC_REL14 0x0007
3605 #define IMAGE_REL_PPC_TOCREL16 0x0008
3606 #define IMAGE_REL_PPC_TOCREL14 0x0009
3607 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3608 #define IMAGE_REL_PPC_SECREL 0x000B
3609 #define IMAGE_REL_PPC_SECTION 0x000C
3610 #define IMAGE_REL_PPC_IFGLUE 0x000D
3611 #define IMAGE_REL_PPC_IMGLUE 0x000E
3612 #define IMAGE_REL_PPC_SECREL16 0x000F
3613 #define IMAGE_REL_PPC_REFHI 0x0010
3614 #define IMAGE_REL_PPC_REFLO 0x0011
3615 #define IMAGE_REL_PPC_PAIR 0x0012
3616 #define IMAGE_REL_PPC_SECRELLO 0x0013
3617 #define IMAGE_REL_PPC_SECRELHI 0x0014
3618 #define IMAGE_REL_PPC_GPREL 0x0015
3619 #define IMAGE_REL_PPC_TOKEN 0x0016
3620 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3621 /* modifier bits */
3622 #define IMAGE_REL_PPC_NEG 0x0100
3623 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3624 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3625 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3627 /* SH3 relocation types */
3628 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3629 #define IMAGE_REL_SH3_DIRECT16 0x0001
3630 #define IMAGE_REL_SH3_DIRECT 0x0002
3631 #define IMAGE_REL_SH3_DIRECT8 0x0003
3632 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3633 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3634 #define IMAGE_REL_SH3_DIRECT4 0x0006
3635 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3636 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3637 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3638 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3639 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3640 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3641 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3642 #define IMAGE_REL_SH3_SECTION 0x000E
3643 #define IMAGE_REL_SH3_SECREL 0x000F
3644 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3645 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3646 #define IMAGE_REL_SH3_TOKEN 0x0012
3648 /* ARM relocation types */
3649 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3650 #define IMAGE_REL_ARM_ADDR 0x0001
3651 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3652 #define IMAGE_REL_ARM_BRANCH24 0x0003
3653 #define IMAGE_REL_ARM_BRANCH11 0x0004
3654 #define IMAGE_REL_ARM_TOKEN 0x0005
3655 #define IMAGE_REL_ARM_GPREL12 0x0006
3656 #define IMAGE_REL_ARM_GPREL7 0x0007
3657 #define IMAGE_REL_ARM_BLX24 0x0008
3658 #define IMAGE_REL_ARM_BLX11 0x0009
3659 #define IMAGE_REL_ARM_SECTION 0x000E
3660 #define IMAGE_REL_ARM_SECREL 0x000F
3661 #define IMAGE_REL_ARM_MOV32A 0x0010
3662 #define IMAGE_REL_ARM_MOV32T 0x0011
3663 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3664 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3665 #define IMAGE_REL_ARM_BLX23T 0x0015
3667 /* ARM64 relocation types */
3668 #define IMAGE_REL_ARM64_ABSOLUTE 0x0000
3669 #define IMAGE_REL_ARM64_ADDR32 0x0001
3670 #define IMAGE_REL_ARM64_ADDR32NB 0x0002
3671 #define IMAGE_REL_ARM64_BRANCH26 0x0003
3672 #define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004
3673 #define IMAGE_REL_ARM64_REL21 0x0005
3674 #define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006
3675 #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007
3676 #define IMAGE_REL_ARM64_SECREL 0x0008
3677 #define IMAGE_REL_ARM64_SECREL_LOW12A 0x0009
3678 #define IMAGE_REL_ARM64_SECREL_HIGH12A 0x000A
3679 #define IMAGE_REL_ARM64_SECREL_LOW12L 0x000B
3680 #define IMAGE_REL_ARM64_TOKEN 0x000C
3681 #define IMAGE_REL_ARM64_SECTION 0x000D
3682 #define IMAGE_REL_ARM64_ADDR64 0x000E
3683 #define IMAGE_REL_ARM64_BRANCH19 0x000F
3685 /* IA64 relocation types */
3686 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3687 #define IMAGE_REL_IA64_IMM14 0x0001
3688 #define IMAGE_REL_IA64_IMM22 0x0002
3689 #define IMAGE_REL_IA64_IMM64 0x0003
3690 #define IMAGE_REL_IA64_DIR 0x0004
3691 #define IMAGE_REL_IA64_DIR64 0x0005
3692 #define IMAGE_REL_IA64_PCREL21B 0x0006
3693 #define IMAGE_REL_IA64_PCREL21M 0x0007
3694 #define IMAGE_REL_IA64_PCREL21F 0x0008
3695 #define IMAGE_REL_IA64_GPREL22 0x0009
3696 #define IMAGE_REL_IA64_LTOFF22 0x000A
3697 #define IMAGE_REL_IA64_SECTION 0x000B
3698 #define IMAGE_REL_IA64_SECREL22 0x000C
3699 #define IMAGE_REL_IA64_SECREL64I 0x000D
3700 #define IMAGE_REL_IA64_SECREL 0x000E
3701 #define IMAGE_REL_IA64_LTOFF64 0x000F
3702 #define IMAGE_REL_IA64_DIR32NB 0x0010
3703 #define IMAGE_REL_IA64_SREL14 0x0011
3704 #define IMAGE_REL_IA64_SREL22 0x0012
3705 #define IMAGE_REL_IA64_SREL32 0x0013
3706 #define IMAGE_REL_IA64_UREL32 0x0014
3707 #define IMAGE_REL_IA64_PCREL60X 0x0015
3708 #define IMAGE_REL_IA64_PCREL60B 0x0016
3709 #define IMAGE_REL_IA64_PCREL60F 0x0017
3710 #define IMAGE_REL_IA64_PCREL60I 0x0018
3711 #define IMAGE_REL_IA64_PCREL60M 0x0019
3712 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3713 #define IMAGE_REL_IA64_TOKEN 0x001B
3714 #define IMAGE_REL_IA64_GPREL32 0x001C
3715 #define IMAGE_REL_IA64_ADDEND 0x001F
3717 /* AMD64 relocation types */
3718 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3719 #define IMAGE_REL_AMD64_ADDR64 0x0001
3720 #define IMAGE_REL_AMD64_ADDR32 0x0002
3721 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3722 #define IMAGE_REL_AMD64_REL32 0x0004
3723 #define IMAGE_REL_AMD64_REL32_1 0x0005
3724 #define IMAGE_REL_AMD64_REL32_2 0x0006
3725 #define IMAGE_REL_AMD64_REL32_3 0x0007
3726 #define IMAGE_REL_AMD64_REL32_4 0x0008
3727 #define IMAGE_REL_AMD64_REL32_5 0x0009
3728 #define IMAGE_REL_AMD64_SECTION 0x000A
3729 #define IMAGE_REL_AMD64_SECREL 0x000B
3730 #define IMAGE_REL_AMD64_SECREL7 0x000C
3731 #define IMAGE_REL_AMD64_TOKEN 0x000D
3732 #define IMAGE_REL_AMD64_SREL32 0x000E
3733 #define IMAGE_REL_AMD64_PAIR 0x000F
3734 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3736 /* archive format */
3738 #define IMAGE_ARCHIVE_START_SIZE 8
3739 #define IMAGE_ARCHIVE_START "!<arch>\n"
3740 #define IMAGE_ARCHIVE_END "`\n"
3741 #define IMAGE_ARCHIVE_PAD "\n"
3742 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3743 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3745 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3747 BYTE Name[16];
3748 BYTE Date[12];
3749 BYTE UserID[6];
3750 BYTE GroupID[6];
3751 BYTE Mode[8];
3752 BYTE Size[10];
3753 BYTE EndHeader[2];
3754 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3756 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3758 typedef struct _IMPORT_OBJECT_HEADER
3760 WORD Sig1;
3761 WORD Sig2;
3762 WORD Version;
3763 WORD Machine;
3764 DWORD TimeDateStamp;
3765 DWORD SizeOfData;
3766 union
3768 WORD Ordinal;
3769 WORD Hint;
3770 } DUMMYUNIONNAME;
3771 WORD Type : 2;
3772 WORD NameType : 3;
3773 WORD Reserved : 11;
3774 } IMPORT_OBJECT_HEADER;
3776 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3778 typedef enum IMPORT_OBJECT_TYPE
3780 IMPORT_OBJECT_CODE = 0,
3781 IMPORT_OBJECT_DATA = 1,
3782 IMPORT_OBJECT_CONST = 2
3783 } IMPORT_OBJECT_TYPE;
3785 typedef enum IMPORT_OBJECT_NAME_TYPE
3787 IMPORT_OBJECT_ORDINAL = 0,
3788 IMPORT_OBJECT_NAME = 1,
3789 IMPORT_OBJECT_NAME_NO_PREFIX = 2,
3790 IMPORT_OBJECT_NAME_UNDECORATE = 3
3791 } IMPORT_OBJECT_NAME_TYPE;
3793 typedef struct _ANON_OBJECT_HEADER
3795 WORD Sig1;
3796 WORD Sig2;
3797 WORD Version;
3798 WORD Machine;
3799 DWORD TimeDateStamp;
3800 CLSID ClassID;
3801 DWORD SizeOfData;
3802 } ANON_OBJECT_HEADER;
3805 * Resource directory stuff
3807 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3808 DWORD Characteristics;
3809 DWORD TimeDateStamp;
3810 WORD MajorVersion;
3811 WORD MinorVersion;
3812 WORD NumberOfNamedEntries;
3813 WORD NumberOfIdEntries;
3814 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3815 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3817 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3818 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3820 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3821 union {
3822 struct {
3823 #ifdef BITFIELDS_BIGENDIAN
3824 unsigned NameIsString:1;
3825 unsigned NameOffset:31;
3826 #else
3827 unsigned NameOffset:31;
3828 unsigned NameIsString:1;
3829 #endif
3830 } DUMMYSTRUCTNAME;
3831 DWORD Name;
3832 #ifdef WORDS_BIGENDIAN
3833 WORD __pad;
3834 WORD Id;
3835 #else
3836 WORD Id;
3837 WORD __pad;
3838 #endif
3839 } DUMMYUNIONNAME;
3840 union {
3841 DWORD OffsetToData;
3842 struct {
3843 #ifdef BITFIELDS_BIGENDIAN
3844 unsigned DataIsDirectory:1;
3845 unsigned OffsetToDirectory:31;
3846 #else
3847 unsigned OffsetToDirectory:31;
3848 unsigned DataIsDirectory:1;
3849 #endif
3850 } DUMMYSTRUCTNAME2;
3851 } DUMMYUNIONNAME2;
3852 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3855 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3856 WORD Length;
3857 CHAR NameString[ 1 ];
3858 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3860 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3861 WORD Length;
3862 WCHAR NameString[ 1 ];
3863 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3865 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3866 DWORD OffsetToData;
3867 DWORD Size;
3868 DWORD CodePage;
3869 DWORD Reserved;
3870 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3873 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
3874 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3877 typedef struct _IMAGE_TLS_DIRECTORY64 {
3878 ULONGLONG StartAddressOfRawData;
3879 ULONGLONG EndAddressOfRawData;
3880 ULONGLONG AddressOfIndex;
3881 ULONGLONG AddressOfCallBacks;
3882 DWORD SizeOfZeroFill;
3883 DWORD Characteristics;
3884 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3886 typedef struct _IMAGE_TLS_DIRECTORY32 {
3887 DWORD StartAddressOfRawData;
3888 DWORD EndAddressOfRawData;
3889 DWORD AddressOfIndex;
3890 DWORD AddressOfCallBacks;
3891 DWORD SizeOfZeroFill;
3892 DWORD Characteristics;
3893 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3895 #ifdef _WIN64
3896 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3897 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3898 #else
3899 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3900 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3901 #endif
3903 typedef struct _IMAGE_DEBUG_DIRECTORY {
3904 DWORD Characteristics;
3905 DWORD TimeDateStamp;
3906 WORD MajorVersion;
3907 WORD MinorVersion;
3908 DWORD Type;
3909 DWORD SizeOfData;
3910 DWORD AddressOfRawData;
3911 DWORD PointerToRawData;
3912 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3914 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3915 #define IMAGE_DEBUG_TYPE_COFF 1
3916 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3917 #define IMAGE_DEBUG_TYPE_FPO 3
3918 #define IMAGE_DEBUG_TYPE_MISC 4
3919 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3920 #define IMAGE_DEBUG_TYPE_FIXUP 6
3921 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3922 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3923 #define IMAGE_DEBUG_TYPE_BORLAND 9
3924 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3925 #define IMAGE_DEBUG_TYPE_CLSID 11
3926 #define IMAGE_DEBUG_TYPE_VC_FEATURE 12
3927 #define IMAGE_DEBUG_TYPE_POGO 13
3928 #define IMAGE_DEBUG_TYPE_ILTCG 14
3929 #define IMAGE_DEBUG_TYPE_MPX 15
3930 #define IMAGE_DEBUG_TYPE_REPRO 16
3932 typedef enum ReplacesCorHdrNumericDefines
3934 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3935 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3936 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3937 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3938 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT= 0x00000010,
3939 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3940 COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000,
3942 COR_VERSION_MAJOR_V2 = 2,
3943 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3944 COR_VERSION_MINOR = 5,
3945 COR_DELETED_NAME_LENGTH = 8,
3946 COR_VTABLEGAP_NAME_LENGTH = 8,
3948 NATIVE_TYPE_MAX_CB = 1,
3949 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xff,
3951 IMAGE_COR_MIH_METHODRVA = 0x01,
3952 IMAGE_COR_MIH_EHRVA = 0x02,
3953 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3955 COR_VTABLE_32BIT = 0x01,
3956 COR_VTABLE_64BIT = 0x02,
3957 COR_VTABLE_FROM_UNMANAGED = 0x04,
3958 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3960 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3962 MAX_CLASS_NAME = 1024,
3963 MAX_PACKAGE_NAME = 1024,
3964 } ReplacesCorHdrNumericDefines;
3966 typedef struct IMAGE_COR20_HEADER
3968 DWORD cb;
3969 WORD MajorRuntimeVersion;
3970 WORD MinorRuntimeVersion;
3972 IMAGE_DATA_DIRECTORY MetaData;
3973 DWORD Flags;
3974 union {
3975 DWORD EntryPointToken;
3976 DWORD EntryPointRVA;
3977 } DUMMYUNIONNAME;
3979 IMAGE_DATA_DIRECTORY Resources;
3980 IMAGE_DATA_DIRECTORY StrongNameSignature;
3981 IMAGE_DATA_DIRECTORY CodeManagerTable;
3982 IMAGE_DATA_DIRECTORY VTableFixups;
3983 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3984 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3986 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3988 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3989 DWORD NumberOfSymbols;
3990 DWORD LvaToFirstSymbol;
3991 DWORD NumberOfLinenumbers;
3992 DWORD LvaToFirstLinenumber;
3993 DWORD RvaToFirstByteOfCode;
3994 DWORD RvaToLastByteOfCode;
3995 DWORD RvaToFirstByteOfData;
3996 DWORD RvaToLastByteOfData;
3997 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3999 #define FRAME_FPO 0
4000 #define FRAME_TRAP 1
4001 #define FRAME_TSS 2
4002 #define FRAME_NONFPO 3
4004 typedef struct _FPO_DATA {
4005 DWORD ulOffStart;
4006 DWORD cbProcSize;
4007 DWORD cdwLocals;
4008 WORD cdwParams;
4009 WORD cbProlog : 8;
4010 WORD cbRegs : 3;
4011 WORD fHasSEH : 1;
4012 WORD fUseBP : 1;
4013 WORD reserved : 1;
4014 WORD cbFrame : 2;
4015 } FPO_DATA, *PFPO_DATA;
4017 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 {
4018 DWORD Size;
4019 DWORD TimeDateStamp;
4020 WORD MajorVersion;
4021 WORD MinorVersion;
4022 DWORD GlobalFlagsClear;
4023 DWORD GlobalFlagsSet;
4024 DWORD CriticalSectionDefaultTimeout;
4025 ULONGLONG DeCommitFreeBlockThreshold;
4026 ULONGLONG DeCommitTotalFreeThreshold;
4027 ULONGLONG LockPrefixTable;
4028 ULONGLONG MaximumAllocationSize;
4029 ULONGLONG VirtualMemoryThreshold;
4030 ULONGLONG ProcessAffinityMask;
4031 DWORD ProcessHeapFlags;
4032 WORD CSDVersion;
4033 WORD Reserved1;
4034 ULONGLONG EditList;
4035 ULONGLONG SecurityCookie;
4036 ULONGLONG SEHandlerTable;
4037 ULONGLONG SEHandlerCount;
4038 } IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64;
4040 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 {
4041 DWORD Size;
4042 DWORD TimeDateStamp;
4043 WORD MajorVersion;
4044 WORD MinorVersion;
4045 DWORD GlobalFlagsClear;
4046 DWORD GlobalFlagsSet;
4047 DWORD CriticalSectionDefaultTimeout;
4048 DWORD DeCommitFreeBlockThreshold;
4049 DWORD DeCommitTotalFreeThreshold;
4050 PVOID LockPrefixTable;
4051 DWORD MaximumAllocationSize;
4052 DWORD VirtualMemoryThreshold;
4053 DWORD ProcessHeapFlags;
4054 DWORD ProcessAffinityMask;
4055 WORD CSDVersion;
4056 WORD Reserved1;
4057 PVOID EditList;
4058 DWORD SecurityCookie;
4059 DWORD SEHandlerTable;
4060 DWORD SEHandlerCount;
4061 } IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32;
4063 #ifdef _WIN64
4064 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY;
4065 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY;
4066 #else
4067 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY;
4068 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY;
4069 #endif
4071 typedef struct _IMAGE_FUNCTION_ENTRY {
4072 DWORD StartingAddress;
4073 DWORD EndingAddress;
4074 DWORD EndOfPrologue;
4075 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
4077 #define IMAGE_DEBUG_MISC_EXENAME 1
4079 typedef struct _IMAGE_DEBUG_MISC {
4080 DWORD DataType;
4081 DWORD Length;
4082 BYTE Unicode;
4083 BYTE Reserved[ 3 ];
4084 BYTE Data[ 1 ];
4085 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
4087 /* This is the structure that appears at the very start of a .DBG file. */
4089 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
4090 WORD Signature;
4091 WORD Flags;
4092 WORD Machine;
4093 WORD Characteristics;
4094 DWORD TimeDateStamp;
4095 DWORD CheckSum;
4096 DWORD ImageBase;
4097 DWORD SizeOfImage;
4098 DWORD NumberOfSections;
4099 DWORD ExportedNamesSize;
4100 DWORD DebugDirectorySize;
4101 DWORD SectionAlignment;
4102 DWORD Reserved[ 2 ];
4103 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
4105 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
4108 typedef struct tagMESSAGE_RESOURCE_ENTRY {
4109 WORD Length;
4110 WORD Flags;
4111 BYTE Text[1];
4112 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
4113 #define MESSAGE_RESOURCE_UNICODE 0x0001
4115 typedef struct tagMESSAGE_RESOURCE_BLOCK {
4116 DWORD LowId;
4117 DWORD HighId;
4118 DWORD OffsetToEntries;
4119 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
4121 typedef struct tagMESSAGE_RESOURCE_DATA {
4122 DWORD NumberOfBlocks;
4123 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
4124 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
4127 * Here follows typedefs for security and tokens.
4131 * First a constant for the following typedefs.
4134 #define ANYSIZE_ARRAY 1
4136 /* FIXME: Orphan. What does it point to? */
4137 typedef PVOID PACCESS_TOKEN;
4138 typedef PVOID PSECURITY_DESCRIPTOR;
4139 typedef PVOID PSID;
4141 typedef enum _TOKEN_ELEVATION_TYPE {
4142 TokenElevationTypeDefault = 1,
4143 TokenElevationTypeFull,
4144 TokenElevationTypeLimited
4145 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
4148 * TOKEN_INFORMATION_CLASS
4151 typedef enum _TOKEN_INFORMATION_CLASS {
4152 TokenUser = 1,
4153 TokenGroups,
4154 TokenPrivileges,
4155 TokenOwner,
4156 TokenPrimaryGroup,
4157 TokenDefaultDacl,
4158 TokenSource,
4159 TokenType,
4160 TokenImpersonationLevel,
4161 TokenStatistics,
4162 TokenRestrictedSids,
4163 TokenSessionId,
4164 TokenGroupsAndPrivileges,
4165 TokenSessionReference,
4166 TokenSandBoxInert,
4167 TokenAuditPolicy,
4168 TokenOrigin,
4169 TokenElevationType,
4170 TokenLinkedToken,
4171 TokenElevation,
4172 TokenHasRestrictions,
4173 TokenAccessInformation,
4174 TokenVirtualizationAllowed,
4175 TokenVirtualizationEnabled,
4176 TokenIntegrityLevel,
4177 TokenUIAccess,
4178 TokenMandatoryPolicy,
4179 TokenLogonSid,
4180 TokenIsAppContainer,
4181 TokenCapabilities,
4182 TokenAppContainerSid,
4183 TokenAppContainerNumber,
4184 TokenUserClaimAttributes,
4185 TokenDeviceClaimAttributes,
4186 TokenRestrictedUserClaimAttributes,
4187 TokenRestrictedDeviceClaimAttributes,
4188 TokenDeviceGroups,
4189 TokenRestrictedDeviceGroups,
4190 TokenSecurityAttributes,
4191 TokenIsRestricted,
4192 TokenProcessTrustLevel,
4193 MaxTokenInfoClass
4194 } TOKEN_INFORMATION_CLASS;
4196 #define DISABLE_MAX_PRIVILEGE 0x1
4197 #define SANDBOX_INERT 0x2
4198 #define LUA_TOKEN 0x4
4199 #define WRITE_RESTRICTED 0x8
4201 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
4202 #define TOKEN_ADJUST_GROUPS 0x0040
4203 #define TOKEN_ADJUST_PRIVILEGES 0x0020
4204 #define TOKEN_ADJUST_SESSIONID 0x0100
4205 #define TOKEN_ASSIGN_PRIMARY 0x0001
4206 #define TOKEN_DUPLICATE 0x0002
4207 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
4208 #define TOKEN_IMPERSONATE 0x0004
4209 #define TOKEN_QUERY 0x0008
4210 #define TOKEN_QUERY_SOURCE 0x0010
4211 #define TOKEN_ADJUST_DEFAULT 0x0080
4212 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
4213 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
4214 TOKEN_ADJUST_PRIVILEGES | \
4215 TOKEN_ADJUST_GROUPS | \
4216 TOKEN_ADJUST_DEFAULT )
4217 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
4218 TOKEN_ASSIGN_PRIMARY | \
4219 TOKEN_DUPLICATE | \
4220 TOKEN_IMPERSONATE | \
4221 TOKEN_QUERY | \
4222 TOKEN_QUERY_SOURCE | \
4223 TOKEN_ADJUST_PRIVILEGES | \
4224 TOKEN_ADJUST_GROUPS | \
4225 TOKEN_ADJUST_SESSIONID | \
4226 TOKEN_ADJUST_DEFAULT )
4228 #ifndef _SECURITY_DEFINED
4229 #define _SECURITY_DEFINED
4232 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
4234 typedef struct _GENERIC_MAPPING {
4235 ACCESS_MASK GenericRead;
4236 ACCESS_MASK GenericWrite;
4237 ACCESS_MASK GenericExecute;
4238 ACCESS_MASK GenericAll;
4239 } GENERIC_MAPPING, *PGENERIC_MAPPING;
4241 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
4242 #define SID_IDENTIFIER_AUTHORITY_DEFINED
4243 typedef struct {
4244 BYTE Value[6];
4245 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
4246 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
4248 #ifndef SID_DEFINED
4249 #define SID_DEFINED
4250 typedef struct _SID {
4251 BYTE Revision;
4252 BYTE SubAuthorityCount;
4253 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
4254 DWORD SubAuthority[1];
4255 } SID,*PISID;
4256 #endif /* !defined(SID_DEFINED) */
4258 #define SID_REVISION (1) /* Current revision */
4259 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
4260 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
4262 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
4265 * ACL
4268 #define ACL_REVISION1 1
4269 #define ACL_REVISION2 2
4270 #define ACL_REVISION3 3
4271 #define ACL_REVISION4 4
4273 #define MIN_ACL_REVISION ACL_REVISION2
4274 #define MAX_ACL_REVISION ACL_REVISION4
4276 #define ACL_REVISION 2
4278 typedef struct _ACL {
4279 BYTE AclRevision;
4280 BYTE Sbz1;
4281 WORD AclSize;
4282 WORD AceCount;
4283 WORD Sbz2;
4284 } ACL, *PACL;
4286 typedef enum _ACL_INFORMATION_CLASS
4288 AclRevisionInformation = 1,
4289 AclSizeInformation
4290 } ACL_INFORMATION_CLASS;
4292 typedef struct _ACL_REVISION_INFORMATION
4294 DWORD AclRevision;
4295 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
4297 typedef struct _ACL_SIZE_INFORMATION
4299 DWORD AceCount;
4300 DWORD AclBytesInUse;
4301 DWORD AclBytesFree;
4302 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
4304 /* SECURITY_DESCRIPTOR */
4305 #define SECURITY_DESCRIPTOR_REVISION 1
4306 #define SECURITY_DESCRIPTOR_REVISION1 1
4310 * Privilege Names
4312 #ifdef UNICODE
4313 #if defined(_MSC_VER) || defined(__MINGW32__)
4314 #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege"
4315 #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege"
4316 #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
4317 #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege"
4318 #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege"
4319 #define SE_MACHINE_ACCOUNT_NAME L"SeMachineAccountPrivilege"
4320 #define SE_TCB_NAME L"SeTcbPrivilege"
4321 #define SE_SECURITY_NAME L"SeSecurityPrivilege"
4322 #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege"
4323 #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege"
4324 #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege"
4325 #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege"
4326 #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege"
4327 #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege"
4328 #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege"
4329 #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege"
4330 #define SE_BACKUP_NAME L"SeBackupPrivilege"
4331 #define SE_RESTORE_NAME L"SeRestorePrivilege"
4332 #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege"
4333 #define SE_DEBUG_NAME L"SeDebugPrivilege"
4334 #define SE_AUDIT_NAME L"SeAuditPrivilege"
4335 #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege"
4336 #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege"
4337 #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege"
4338 #define SE_UNDOCK_NAME L"SeUndockPrivilege"
4339 #define SE_ENABLE_DELEGATION_NAME L"SeEnableDelegationPrivilege"
4340 #define SE_MANAGE_VOLUME_NAME L"SeManageVolumePrivilege"
4341 #define SE_IMPERSONATE_NAME L"SeImpersonatePrivilege"
4342 #define SE_CREATE_GLOBAL_NAME L"SeCreateGlobalPrivilege"
4343 #define SE_TRUSTED_CREDMAN_ACCESS_NAME L"SeTrustedCredManAccessPrivilege"
4344 #define SE_RELABEL_NAME L"SeRelabelPrivilege"
4345 #define SE_INC_WORKING_SET_NAME L"SeIncreaseWorkingSetPrivilege"
4346 #define SE_TIME_ZONE_NAME L"SeTimeZonePrivilege"
4347 #define SE_CREATE_SYMBOLIC_LINK_NAME L"SeCreateSymbolicLinkPrivilege"
4348 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME L"SeDelegateSessionUserImpersonatePrivilege"
4349 #else /* _MSC_VER/__MINGW32__ */
4350 static const WCHAR SE_CREATE_TOKEN_NAME[] = { 'S','e','C','r','e','a','t','e','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
4351 static const WCHAR SE_ASSIGNPRIMARYTOKEN_NAME[] = { 'S','e','A','s','s','i','g','n','P','r','i','m','a','r','y','T','o','k','e','n','P','r','i','v','i','l','e','g','e',0 };
4352 static const WCHAR SE_LOCK_MEMORY_NAME[] = { 'S','e','L','o','c','k','M','e','m','o','r','y','P','r','i','v','i','l','e','g','e',0 };
4353 static const WCHAR SE_INCREASE_QUOTA_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','Q','u','o','t','a','P','r','i','v','i','l','e','g','e',0 };
4354 static const WCHAR SE_UNSOLICITED_INPUT_NAME[] = { 'S','e','U','n','s','o','l','i','c','i','t','e','d','I','n','p','u','t','P','r','i','v','i','l','e','g','e',0 };
4355 static const WCHAR SE_MACHINE_ACCOUNT_NAME[] = { 'S','e','M','a','c','h','i','n','e','A','c','c','o','u','n','t','P','r','i','v','i','l','e','g','e',0 };
4356 static const WCHAR SE_TCB_NAME[] = { 'S','e','T','c','b','P','r','i','v','i','l','e','g','e',0 };
4357 static const WCHAR SE_SECURITY_NAME[] = { 'S','e','S','e','c','u','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
4358 static const WCHAR SE_TAKE_OWNERSHIP_NAME[] = { 'S','e','T','a','k','e','O','w','n','e','r','s','h','i','p','P','r','i','v','i','l','e','g','e',0 };
4359 static const WCHAR SE_LOAD_DRIVER_NAME[] = { 'S','e','L','o','a','d','D','r','i','v','e','r','P','r','i','v','i','l','e','g','e',0 };
4360 static const WCHAR SE_SYSTEM_PROFILE_NAME[] = { 'S','e','S','y','s','t','e','m','P','r','o','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
4361 static const WCHAR SE_SYSTEMTIME_NAME[] = { 'S','e','S','y','s','t','e','m','t','i','m','e','P','r','i','v','i','l','e','g','e',0 };
4362 static const WCHAR SE_PROF_SINGLE_PROCESS_NAME[] = { 'S','e','P','r','o','f','i','l','e','S','i','n','g','l','e','P','r','o','c','e','s','s','P','r','i','v','i','l','e','g','e',0 };
4363 static const WCHAR SE_INC_BASE_PRIORITY_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','B','a','s','e','P','r','i','o','r','i','t','y','P','r','i','v','i','l','e','g','e',0 };
4364 static const WCHAR SE_CREATE_PAGEFILE_NAME[] = { 'S','e','C','r','e','a','t','e','P','a','g','e','f','i','l','e','P','r','i','v','i','l','e','g','e',0 };
4365 static const WCHAR SE_CREATE_PERMANENT_NAME[] = { 'S','e','C','r','e','a','t','e','P','e','r','m','a','n','e','n','t','P','r','i','v','i','l','e','g','e',0 };
4366 static const WCHAR SE_BACKUP_NAME[] = { 'S','e','B','a','c','k','u','p','P','r','i','v','i','l','e','g','e',0 };
4367 static const WCHAR SE_RESTORE_NAME[] = { 'S','e','R','e','s','t','o','r','e','P','r','i','v','i','l','e','g','e',0 };
4368 static const WCHAR SE_SHUTDOWN_NAME[] = { 'S','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
4369 static const WCHAR SE_DEBUG_NAME[] = { 'S','e','D','e','b','u','g','P','r','i','v','i','l','e','g','e',0 };
4370 static const WCHAR SE_AUDIT_NAME[] = { 'S','e','A','u','d','i','t','P','r','i','v','i','l','e','g','e',0 };
4371 static const WCHAR SE_SYSTEM_ENVIRONMENT_NAME[] = { 'S','e','S','y','s','t','e','m','E','n','v','i','r','o','n','m','e','n','t','P','r','i','v','i','l','e','g','e',0 };
4372 static const WCHAR SE_CHANGE_NOTIFY_NAME[] = { 'S','e','C','h','a','n','g','e','N','o','t','i','f','y','P','r','i','v','i','l','e','g','e',0 };
4373 static const WCHAR SE_REMOTE_SHUTDOWN_NAME[] = { 'S','e','R','e','m','o','t','e','S','h','u','t','d','o','w','n','P','r','i','v','i','l','e','g','e',0 };
4374 static const WCHAR SE_UNDOCK_NAME[] = { 'S','e','U','n','d','o','c','k','P','r','i','v','i','l','e','g','e',0 };
4375 static const WCHAR SE_ENABLE_DELEGATION_NAME[] = { 'S','e','E','n','a','b','l','e','D','e','l','e','g','a','t','i','o','n','P','r','i','v','i','l','e','g','e',0 };
4376 static const WCHAR SE_MANAGE_VOLUME_NAME[] = { 'S','e','M','a','n','a','g','e','V','o','l','u','m','e','P','r','i','v','i','l','e','g','e',0 };
4377 static const WCHAR SE_IMPERSONATE_NAME[] = { 'S','e','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 };
4378 static const WCHAR SE_CREATE_GLOBAL_NAME[] = { 'S','e','C','r','e','a','t','e','G','l','o','b','a','l','P','r','i','v','i','l','e','g','e',0 };
4379 static const WCHAR SE_TRUSTED_CREDMAN_ACCESS_NAME[] = { 'S','e','T','r','u','s','t','e','d','C','r','e','d','M','a','n','A','c','c','e','s','s','P','r','i','v','i','l','e','g','e',0 };
4380 static const WCHAR SE_RELABEL_NAME[] = { 'S','e','R','e','l','a','b','e','l','P','r','i','v','i','l','e','g','e',0 };
4381 static const WCHAR SE_INC_WORKING_SET_NAME[] = { 'S','e','I','n','c','r','e','a','s','e','W','o','r','k','i','n','g','S','e','t','P','r','i','v','i','l','e','g','e',0 };
4382 static const WCHAR SE_TIME_ZONE_NAME[] = { 'S','e','T','i','m','e','Z','o','n','e','P','r','i','v','i','l','e','g','e',0 };
4383 static const WCHAR SE_CREATE_SYMBOLIC_LINK_NAME[] = { 'S','e','C','r','e','a','t','e','S','y','m','b','o','l','i','c','L','i','n','k','P','r','i','v','i','l','e','g','e',0 };
4384 static const WCHAR SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME[] = { 'S','e','D','e','l','e','g','a','t','e','S','e','s','s','i','o','n','U','s','e','r','I','m','p','e','r','s','o','n','a','t','e','P','r','i','v','i','l','e','g','e',0 };
4385 #endif
4386 #else /* UNICODE */
4387 #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
4388 #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
4389 #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
4390 #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
4391 #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
4392 #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
4393 #define SE_TCB_NAME "SeTcbPrivilege"
4394 #define SE_SECURITY_NAME "SeSecurityPrivilege"
4395 #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
4396 #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
4397 #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
4398 #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
4399 #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
4400 #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
4401 #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
4402 #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
4403 #define SE_BACKUP_NAME "SeBackupPrivilege"
4404 #define SE_RESTORE_NAME "SeRestorePrivilege"
4405 #define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
4406 #define SE_DEBUG_NAME "SeDebugPrivilege"
4407 #define SE_AUDIT_NAME "SeAuditPrivilege"
4408 #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
4409 #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
4410 #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
4411 #define SE_UNDOCK_NAME "SeUndockPrivilege"
4412 #define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
4413 #define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
4414 #define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
4415 #define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
4416 #define SE_TRUSTED_CREDMAN_ACCESS_NAME "SeTrustedCredManAccessPrivilege"
4417 #define SE_RELABEL_NAME "SeRelabelPrivilege"
4418 #define SE_INC_WORKING_SET_NAME "SeIncreaseWorkingSetPrivilege"
4419 #define SE_TIME_ZONE_NAME "SeTimeZonePrivilege"
4420 #define SE_CREATE_SYMBOLIC_LINK_NAME "SeCreateSymbolicLinkPrivilege"
4421 #define SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME "SeDelegateSessionUserImpersonatePrivilege"
4422 #endif
4424 #define SE_GROUP_MANDATORY 0x00000001
4425 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4426 #define SE_GROUP_ENABLED 0x00000004
4427 #define SE_GROUP_OWNER 0x00000008
4428 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4429 #define SE_GROUP_INTEGRITY 0x00000020
4430 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
4431 #define SE_GROUP_LOGON_ID 0xC0000000
4432 #define SE_GROUP_RESOURCE 0x20000000
4433 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
4435 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4436 #define SE_PRIVILEGE_ENABLED 0x00000002
4437 #define SE_PRIVILEGE_REMOVED 0x00000004
4438 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4439 #define SE_PRIVILEGE_VALID_ATTRIBUTES 0x80000007
4441 #define PRIVILEGE_SET_ALL_NECESSARY 1
4443 #define SE_OWNER_DEFAULTED 0x00000001
4444 #define SE_GROUP_DEFAULTED 0x00000002
4445 #define SE_DACL_PRESENT 0x00000004
4446 #define SE_DACL_DEFAULTED 0x00000008
4447 #define SE_SACL_PRESENT 0x00000010
4448 #define SE_SACL_DEFAULTED 0x00000020
4449 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4450 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4451 #define SE_DACL_AUTO_INHERITED 0x00000400
4452 #define SE_SACL_AUTO_INHERITED 0x00000800
4453 #define SE_DACL_PROTECTED 0x00001000
4454 #define SE_SACL_PROTECTED 0x00002000
4455 #define SE_RM_CONTROL_VALID 0x00004000
4456 #define SE_SELF_RELATIVE 0x00008000
4458 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
4459 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
4461 /* The security descriptor structure */
4462 typedef struct {
4463 BYTE Revision;
4464 BYTE Sbz1;
4465 SECURITY_DESCRIPTOR_CONTROL Control;
4466 DWORD Owner;
4467 DWORD Group;
4468 DWORD Sacl;
4469 DWORD Dacl;
4470 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
4472 typedef struct {
4473 BYTE Revision;
4474 BYTE Sbz1;
4475 SECURITY_DESCRIPTOR_CONTROL Control;
4476 PSID Owner;
4477 PSID Group;
4478 PACL Sacl;
4479 PACL Dacl;
4480 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
4482 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4484 #endif /* _SECURITY_DEFINED */
4487 * SID_AND_ATTRIBUTES
4490 typedef struct _SID_AND_ATTRIBUTES {
4491 PSID Sid;
4492 DWORD Attributes;
4493 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
4495 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
4496 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
4498 #define SID_HASH_SIZE 32
4500 typedef ULONG_PTR SID_HASH_ENTRY, *PSID_HASH_ENTRY;
4502 typedef struct _SID_AND_ATTRIBUTES_HASH {
4503 DWORD SidCount;
4504 PSID_AND_ATTRIBUTES SidAttr;
4505 SID_HASH_ENTRY Hash[SID_HASH_SIZE];
4506 } SID_AND_ATTRIBUTES_HASH, *PSID_AND_ATTRIBUTES_HASH;
4508 /* security entities */
4509 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
4510 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
4511 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
4513 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4515 /* S-1-1 */
4516 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4518 /* S-1-2 */
4519 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4520 #define SECURITY_LOCAL_LOGON_RID __MSABI_LONG(0X00000000)
4522 /* S-1-3 */
4523 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4524 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
4525 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
4526 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
4527 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
4528 #define SECURITY_CREATOR_OWNER_RIGHTS_RID __MSABI_LONG(0x00000004)
4530 /* S-1-4 */
4531 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4533 /* S-1-5 */
4534 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4535 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
4536 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
4537 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
4538 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
4539 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
4540 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
4541 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
4542 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
4543 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
4544 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4545 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
4546 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
4547 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
4548 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
4549 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
4550 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
4551 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
4552 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
4553 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
4554 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
4555 #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID __MSABI_LONG(0x00000016)
4556 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
4557 #define SECURITY_WRITE_RESTRICTED_CODE_RID __MSABI_LONG(0x00000021)
4559 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
4560 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
4561 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
4562 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
4563 #define SECURITY_CRED_TYPE_BASE_RID __MSABI_LONG(0x00000041)
4564 #define SECURITY_CRED_TYPE_THIS_ORG_CERT_RID __MSABI_LONG(0x00000001)
4565 #define SECURITY_MIN_BASE_RID __MSABI_LONG(0x00000050)
4566 #define SECURITY_SERVICE_ID_BASE_RID __MSABI_LONG(0x00000050)
4567 #define SECURITY_RESERVED_ID_BASE_RID __MSABI_LONG(0x00000051)
4568 #define SECURITY_APPPOOL_ID_BASE_RID __MSABI_LONG(0x00000052)
4569 #define SECURITY_VIRTUALSERVER_ID_BASE_RID __MSABI_LONG(0x00000053)
4570 #define SECURITY_USERMODEDRIVERHOST_ID_BASE_RID __MSABI_LONG(0x00000054)
4571 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID __MSABI_LONG(0x00000055)
4572 #define SECURITY_WMIHOST_ID_BASE_RID __MSABI_LONG(0x00000056)
4573 #define SECURITY_TASK_ID_BASE_RID __MSABI_LONG(0x00000057)
4574 #define SECURITY_NFS_ID_BASE_RID __MSABI_LONG(0x00000058)
4575 #define SECURITY_COM_ID_BASE_RID __MSABI_LONG(0x00000059)
4576 #define SECURITY_MAX_BASE_RID __MSABI_LONG(0x0000006F)
4577 #define SECURITY_WINDOWSMOBILE_ID_BASE_RID __MSABI_LONG(0x00000070)
4578 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
4579 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
4580 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
4582 #define DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS __MSABI_LONG(0x000001F2)
4584 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
4585 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
4586 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
4587 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
4588 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
4590 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
4591 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
4592 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
4593 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
4594 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
4595 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
4596 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
4597 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
4598 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
4599 #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS __MSABI_LONG(0x00000209)
4601 #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
4603 #define SECURITY_APP_PACKAGE_AUTHORITY {0,0,0,0,0,15}
4604 #define SECURITY_APP_PACKAGE_BASE_RID __MSABI_LONG(0x000000002)
4605 #define SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000002)
4606 #define SECURITY_APP_PACKAGE_RID_COUNT __MSABI_LONG(0x000000008)
4607 #define SECURITY_CAPABILITY_BASE_RID __MSABI_LONG(0x000000003)
4608 #define SECURITY_CAPABILITY_APP_RID __MSABI_LONG(0x000000400)
4609 #define SECURITY_BUILTIN_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000002)
4610 #define SECURITY_CAPABILITY_RID_COUNT __MSABI_LONG(0x000000005)
4611 #define SECURITY_PARENT_PACKAGE_RID_COUNT SECURITY_APP_PACKAGE_RID_COUNT
4612 #define SECURITY_CHILD_PACKAGE_RID_COUNT __MSABI_LONG(0x00000000c)
4613 #define SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE __MSABI_LONG(0x000000001)
4615 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4616 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
4617 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
4618 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
4619 #define SECURITY_MANDATORY_MEDIUM_PLUS_RID __MSABI_LONG(0x00002100)
4620 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
4621 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
4622 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
4623 #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
4625 #define MANDATORY_LEVEL_TO_MANDATORY_RID(ML) (ML * 0x1000)
4627 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
4628 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
4629 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
4630 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
4632 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
4633 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
4634 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
4635 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
4637 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
4638 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
4639 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
4640 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
4641 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
4642 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
4644 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
4645 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
4646 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
4647 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
4648 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
4649 #define DOMAIN_ALIAS_RID_IUSERS __MSABI_LONG(0x00000238)
4650 #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS __MSABI_LONG(0x00000239)
4651 #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023B)
4652 #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP __MSABI_LONG(0x0000023C)
4653 #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP __MSABI_LONG(0x0000023D)
4654 #define DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP __MSABI_LONG(0x0000023E)
4656 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4658 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
4659 #define SECURITY_CRED_TYPE_RID_COUNT __MSABI_LONG(2)
4660 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
4661 #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT __MSABI_LONG(3)
4662 #define SECURITY_SERVICE_ID_RID_COUNT __MSABI_LONG(6)
4663 #define SECURITY_APPPOOL_ID_RID_COUNT __MSABI_LONG(6)
4664 #define SECURITY_VIRTUALSERVER_ID_RID_COUNT __MSABI_LONG(6)
4665 #define SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT __MSABI_LONG(6)
4666 #define SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT __MSABI_LONG(6)
4667 #define SECURITY_WMIHOST_ID_RID_COUNT __MSABI_LONG(6)
4668 #define SECURITY_VIRTUALACCOUNT_ID_RID_COUNT __MSABI_LONG(6)
4670 #define SYSTEM_LUID { 0x3e7, 0x0 }
4671 #define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 }
4672 #define LOCALSERVICE_LUID { 0x3e5, 0x0 }
4673 #define NETWORKSERVICE_LUID { 0x3e4, 0x0 }
4674 #define IUSER_LUID { 0x3e3, 0x0 }
4676 typedef enum {
4677 WinNullSid = 0,
4678 WinWorldSid = 1,
4679 WinLocalSid = 2,
4680 WinCreatorOwnerSid = 3,
4681 WinCreatorGroupSid = 4,
4682 WinCreatorOwnerServerSid = 5,
4683 WinCreatorGroupServerSid = 6,
4684 WinNtAuthoritySid = 7,
4685 WinDialupSid = 8,
4686 WinNetworkSid = 9,
4687 WinBatchSid = 10,
4688 WinInteractiveSid = 11,
4689 WinServiceSid = 12,
4690 WinAnonymousSid = 13,
4691 WinProxySid = 14,
4692 WinEnterpriseControllersSid = 15,
4693 WinSelfSid = 16,
4694 WinAuthenticatedUserSid = 17,
4695 WinRestrictedCodeSid = 18,
4696 WinTerminalServerSid = 19,
4697 WinRemoteLogonIdSid = 20,
4698 WinLogonIdsSid = 21,
4699 WinLocalSystemSid = 22,
4700 WinLocalServiceSid = 23,
4701 WinNetworkServiceSid = 24,
4702 WinBuiltinDomainSid = 25,
4703 WinBuiltinAdministratorsSid = 26,
4704 WinBuiltinUsersSid = 27,
4705 WinBuiltinGuestsSid = 28,
4706 WinBuiltinPowerUsersSid = 29,
4707 WinBuiltinAccountOperatorsSid = 30,
4708 WinBuiltinSystemOperatorsSid = 31,
4709 WinBuiltinPrintOperatorsSid = 32,
4710 WinBuiltinBackupOperatorsSid = 33,
4711 WinBuiltinReplicatorSid = 34,
4712 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
4713 WinBuiltinRemoteDesktopUsersSid = 36,
4714 WinBuiltinNetworkConfigurationOperatorsSid = 37,
4715 WinAccountAdministratorSid = 38,
4716 WinAccountGuestSid = 39,
4717 WinAccountKrbtgtSid = 40,
4718 WinAccountDomainAdminsSid = 41,
4719 WinAccountDomainUsersSid = 42,
4720 WinAccountDomainGuestsSid = 43,
4721 WinAccountComputersSid = 44,
4722 WinAccountControllersSid = 45,
4723 WinAccountCertAdminsSid = 46,
4724 WinAccountSchemaAdminsSid = 47,
4725 WinAccountEnterpriseAdminsSid = 48,
4726 WinAccountPolicyAdminsSid = 49,
4727 WinAccountRasAndIasServersSid = 50,
4728 WinNTLMAuthenticationSid = 51,
4729 WinDigestAuthenticationSid = 52,
4730 WinSChannelAuthenticationSid = 53,
4731 WinThisOrganizationSid = 54,
4732 WinOtherOrganizationSid = 55,
4733 WinBuiltinIncomingForestTrustBuildersSid = 56,
4734 WinBuiltinPerfMonitoringUsersSid = 57,
4735 WinBuiltinPerfLoggingUsersSid = 58,
4736 WinBuiltinAuthorizationAccessSid = 59,
4737 WinBuiltinTerminalServerLicenseServersSid = 60,
4738 WinBuiltinDCOMUsersSid = 61,
4739 WinBuiltinIUsersSid = 62,
4740 WinIUserSid = 63,
4741 WinBuiltinCryptoOperatorsSid = 64,
4742 WinUntrustedLabelSid = 65,
4743 WinLowLabelSid = 66,
4744 WinMediumLabelSid = 67,
4745 WinHighLabelSid = 68,
4746 WinSystemLabelSid = 69,
4747 WinWriteRestrictedCodeSid = 70,
4748 WinCreatorOwnerRightsSid = 71,
4749 WinCacheablePrincipalsGroupSid = 72,
4750 WinNonCacheablePrincipalsGroupSid = 73,
4751 WinEnterpriseReadonlyControllersSid = 74,
4752 WinAccountReadonlyControllersSid = 75,
4753 WinBuiltinEventLogReadersGroup = 76,
4754 WinNewEnterpriseReadonlyControllersSid = 77,
4755 WinBuiltinCertSvcDComAccessGroup = 78,
4756 WinMediumPlusLabelSid = 79,
4757 WinLocalLogonSid = 80,
4758 WinConsoleLogonSid = 81,
4759 WinThisOrganizationCertificateSid = 82,
4760 WinApplicationPackageAuthoritySid = 83,
4761 WinBuiltinAnyPackageSid = 84,
4762 WinCapabilityInternetClientSid = 85,
4763 WinCapabilityInternetClientServerSid = 86,
4764 WinCapabilityPrivateNetworkClientServerSid = 87,
4765 WinCapabilityPicturesLibrarySid = 88,
4766 WinCapabilityVideosLibrarySid = 89,
4767 WinCapabilityMusicLibrarySid = 90,
4768 WinCapabilityDocumentsLibrarySid = 91,
4769 WinCapabilitySharedUserCertificatesSid = 92,
4770 WinCapabilityEnterpriseAuthenticationSid = 93,
4771 WinCapabilityRemovableStorageSid = 94,
4772 WinBuiltinRDSRemoteAccessServersSid = 95,
4773 WinBuiltinRDSEndpointServersSid = 96,
4774 WinBuiltinRDSManagementServersSid = 97,
4775 WinUserModeDriversSid = 98,
4776 WinBuiltinHyperVAdminsSid = 99,
4777 WinAccountCloneableControllersSid = 100,
4778 WinBuiltinAccessControlAssistanceOperatorsSid = 101,
4779 WinBuiltinRemoteManagementUsersSid = 102,
4780 WinAuthenticationAuthorityAssertedSid = 103,
4781 WinAuthenticationServiceAssertedSid = 104,
4782 WinLocalAccountSid = 105,
4783 WinLocalAccountAndAdministratorSid = 106,
4784 WinAccountProtectedUsersSid = 107,
4785 } WELL_KNOWN_SID_TYPE;
4788 * TOKEN_USER
4791 typedef struct _TOKEN_USER {
4792 SID_AND_ATTRIBUTES User;
4793 } TOKEN_USER, *PTOKEN_USER;
4796 * TOKEN_GROUPS
4799 typedef struct _TOKEN_GROUPS {
4800 DWORD GroupCount;
4801 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
4802 } TOKEN_GROUPS, *PTOKEN_GROUPS;
4805 * LUID_AND_ATTRIBUTES
4808 typedef union _LARGE_INTEGER {
4809 struct {
4810 #ifdef WORDS_BIGENDIAN
4811 LONG HighPart;
4812 DWORD LowPart;
4813 #else
4814 DWORD LowPart;
4815 LONG HighPart;
4816 #endif
4817 } u;
4818 #ifndef NONAMELESSSTRUCT
4819 struct {
4820 #ifdef WORDS_BIGENDIAN
4821 LONG HighPart;
4822 DWORD LowPart;
4823 #else
4824 DWORD LowPart;
4825 LONG HighPart;
4826 #endif
4828 #endif
4829 LONGLONG QuadPart;
4830 } LARGE_INTEGER, *PLARGE_INTEGER;
4832 typedef union _ULARGE_INTEGER {
4833 struct {
4834 #ifdef WORDS_BIGENDIAN
4835 DWORD HighPart;
4836 DWORD LowPart;
4837 #else
4838 DWORD LowPart;
4839 DWORD HighPart;
4840 #endif
4841 } u;
4842 #ifndef NONAMELESSSTRUCT
4843 struct {
4844 #ifdef WORDS_BIGENDIAN
4845 DWORD HighPart;
4846 DWORD LowPart;
4847 #else
4848 DWORD LowPart;
4849 DWORD HighPart;
4850 #endif
4852 #endif
4853 ULONGLONG QuadPart;
4854 } ULARGE_INTEGER, *PULARGE_INTEGER;
4857 * Locally Unique Identifier
4860 typedef struct _LUID {
4861 DWORD LowPart;
4862 LONG HighPart;
4863 } LUID, *PLUID;
4865 #include <pshpack4.h>
4866 typedef struct _LUID_AND_ATTRIBUTES {
4867 LUID Luid;
4868 DWORD Attributes;
4869 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
4870 #include <poppack.h>
4873 * PRIVILEGE_SET
4876 typedef struct _PRIVILEGE_SET {
4877 DWORD PrivilegeCount;
4878 DWORD Control;
4879 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
4880 } PRIVILEGE_SET, *PPRIVILEGE_SET;
4883 * TOKEN_PRIVILEGES
4886 typedef struct _TOKEN_PRIVILEGES {
4887 DWORD PrivilegeCount;
4888 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
4889 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
4892 * TOKEN_OWNER
4895 typedef struct _TOKEN_OWNER {
4896 PSID Owner;
4897 } TOKEN_OWNER, *PTOKEN_OWNER;
4900 * TOKEN_PRIMARY_GROUP
4903 typedef struct _TOKEN_PRIMARY_GROUP {
4904 PSID PrimaryGroup;
4905 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
4909 * TOKEN_DEFAULT_DACL
4912 typedef struct _TOKEN_DEFAULT_DACL {
4913 PACL DefaultDacl;
4914 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
4917 * TOKEN_SOURCE
4920 #define TOKEN_SOURCE_LENGTH 8
4922 typedef struct _TOKEN_SOURCE {
4923 char SourceName[TOKEN_SOURCE_LENGTH];
4924 LUID SourceIdentifier;
4925 } TOKEN_SOURCE, *PTOKEN_SOURCE;
4928 * TOKEN_TYPE
4931 typedef enum tagTOKEN_TYPE {
4932 TokenPrimary = 1,
4933 TokenImpersonation
4934 } TOKEN_TYPE;
4937 * SECURITY_IMPERSONATION_LEVEL
4940 typedef enum _SECURITY_IMPERSONATION_LEVEL {
4941 SecurityAnonymous,
4942 SecurityIdentification,
4943 SecurityImpersonation,
4944 SecurityDelegation
4945 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
4947 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4948 #define SECURITY_STATIC_TRACKING (FALSE)
4950 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
4951 * PSECURITY_CONTEXT_TRACKING_MODE;
4953 * Quality of Service
4956 typedef struct _SECURITY_QUALITY_OF_SERVICE {
4957 DWORD Length;
4958 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4959 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
4960 BOOLEAN EffectiveOnly;
4961 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
4964 * TOKEN_STATISTICS
4967 #include <pshpack4.h>
4968 typedef struct _TOKEN_STATISTICS {
4969 LUID TokenId;
4970 LUID AuthenticationId;
4971 LARGE_INTEGER ExpirationTime;
4972 TOKEN_TYPE TokenType;
4973 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4974 DWORD DynamicCharged;
4975 DWORD DynamicAvailable;
4976 DWORD GroupCount;
4977 DWORD PrivilegeCount;
4978 LUID ModifiedId;
4979 } TOKEN_STATISTICS;
4980 #include <poppack.h>
4982 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
4983 DWORD SidCount;
4984 DWORD SidLength;
4985 PSID_AND_ATTRIBUTES Sids;
4986 DWORD RestrictedSidCount;
4987 DWORD RestrictedSidLength;
4988 PSID_AND_ATTRIBUTES RestrictedSids;
4989 DWORD PrivilegeCount;
4990 DWORD PrivilegeLength;
4991 PLUID_AND_ATTRIBUTES Privileges;
4992 LUID AuthenticationId;
4993 } TOKEN_GROUPS_AND_PRIVILEGES, * PTOKEN_GROUPS_AND_PRIVILEGES;
4995 typedef struct _TOKEN_ORIGIN {
4996 LUID OriginatingLogonSession;
4997 } TOKEN_ORIGIN, * PTOKEN_ORIGIN;
4999 typedef struct _TOKEN_LINKED_TOKEN {
5000 HANDLE LinkedToken;
5001 } TOKEN_LINKED_TOKEN, * PTOKEN_LINKED_TOKEN;
5003 typedef struct _TOKEN_ELEVATION {
5004 DWORD TokenIsElevated;
5005 } TOKEN_ELEVATION, * PTOKEN_ELEVATION;
5007 typedef struct _TOKEN_MANDATORY_LABEL {
5008 SID_AND_ATTRIBUTES Label;
5009 } TOKEN_MANDATORY_LABEL, * PTOKEN_MANDATORY_LABEL;
5011 #define TOKEN_MANDATORY_POLICY_OFF 0x0
5012 #define TOKEN_MANDATORY_POLICY_NO_WRITEUP 0x1
5013 #define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 0x2
5014 #define TOKEN_MANDATORY_POLICY_VALID_MASK 0x3
5016 typedef struct _TOKEN_MANDATORY_POLICY {
5017 DWORD Policy;
5018 } TOKEN_MANDATORY_POLICY, *PTOKEN_MANDATORY_POLICY;
5020 typedef struct _TOKEN_APPCONTAINER_INFORMATION {
5021 PSID TokenAppContainer;
5022 } TOKEN_APPCONTAINER_INFORMATION, * PTOKEN_APPCONTAINER_INFORMATION;
5024 #define POLICY_AUDIT_SUBCATEGORY_COUNT 53
5026 typedef struct _TOKEN_AUDIT_POLICY {
5027 BYTE PerUserPolicy[((POLICY_AUDIT_SUBCATEGORY_COUNT) >> 1) + 1];
5028 } TOKEN_AUDIT_POLICY, *PTOKEN_AUDIT_POLICY;
5030 typedef struct _TOKEN_ACCESS_INFORMATION {
5031 PSID_AND_ATTRIBUTES_HASH SidHash;
5032 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash;
5033 PTOKEN_PRIVILEGES Privileges;
5034 LUID AuthenticationId;
5035 TOKEN_TYPE TokenType;
5036 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
5037 TOKEN_MANDATORY_POLICY MandatoryPolicy;
5038 DWORD Flags;
5039 } TOKEN_ACCESS_INFORMATION, *PTOKEN_ACCESS_INFORMATION;
5041 typedef struct _TOKEN_CONTROL {
5042 LUID TokenId;
5043 LUID AuthenticationId;
5044 LUID ModifiedId;
5045 TOKEN_SOURCE TokenSource;
5046 } TOKEN_CONTROL, *PTOKEN_CONTROL;
5049 * ACLs of NT
5052 /* ACEs, directly starting after an ACL */
5053 typedef struct _ACE_HEADER {
5054 BYTE AceType;
5055 BYTE AceFlags;
5056 WORD AceSize;
5057 } ACE_HEADER,*PACE_HEADER;
5059 /* AceType */
5060 #define ACCESS_MIN_MS_ACE_TYPE 0x0
5061 #define ACCESS_ALLOWED_ACE_TYPE 0x0
5062 #define ACCESS_DENIED_ACE_TYPE 0x1
5063 #define SYSTEM_AUDIT_ACE_TYPE 0x2
5064 #define SYSTEM_ALARM_ACE_TYPE 0x3
5065 #define ACCESS_MAX_MS_V2_ACE_TYPE 0x3
5066 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x4
5067 #define ACCESS_MAX_MS_V3_ACE_TYPE 0x4
5068 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE 0x5
5069 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x5
5070 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x6
5071 #define ACCESS_AUDIT_OBJECT_ACE_TYPE 0x7
5072 #define ACCESS_ALARM_OBJECT_ACE_TYPE 0x8
5073 #define ACCESS_MAX_MS_V4_ACE_TYPE 0x8
5074 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x9
5075 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0xa
5076 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0xb
5077 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0xc
5078 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0xd
5079 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0xe
5080 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0xf
5081 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
5082 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
5083 #define ACCESS_MAX_MS_V5_ACE_TYPE 0x11
5085 /* inherit AceFlags */
5086 #define OBJECT_INHERIT_ACE 0x01
5087 #define CONTAINER_INHERIT_ACE 0x02
5088 #define NO_PROPAGATE_INHERIT_ACE 0x04
5089 #define INHERIT_ONLY_ACE 0x08
5090 #define INHERITED_ACE 0x10
5091 #define VALID_INHERIT_FLAGS 0x1F
5093 /* AceFlags mask for what events we (should) audit */
5094 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
5095 #define FAILED_ACCESS_ACE_FLAG 0x80
5097 /* different ACEs depending on AceType
5098 * SidStart marks the begin of a SID
5099 * so the thing finally looks like this:
5100 * 0: ACE_HEADER
5101 * 4: ACCESS_MASK
5102 * 8... : SID
5104 typedef struct _ACCESS_ALLOWED_ACE {
5105 ACE_HEADER Header;
5106 DWORD Mask;
5107 DWORD SidStart;
5108 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
5110 typedef struct _ACCESS_DENIED_ACE {
5111 ACE_HEADER Header;
5112 DWORD Mask;
5113 DWORD SidStart;
5114 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
5116 typedef struct _SYSTEM_AUDIT_ACE {
5117 ACE_HEADER Header;
5118 DWORD Mask;
5119 DWORD SidStart;
5120 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
5122 typedef struct _SYSTEM_ALARM_ACE {
5123 ACE_HEADER Header;
5124 DWORD Mask;
5125 DWORD SidStart;
5126 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
5128 typedef struct _SYSTEM_MANDATORY_LABEL_ACE {
5129 ACE_HEADER Header;
5130 ACCESS_MASK Mask;
5131 DWORD SidStart;
5132 } SYSTEM_MANDATORY_LABEL_ACE,*PSYSTEM_MANDATORY_LABEL_ACE;
5134 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
5135 ACE_HEADER Header;
5136 ACCESS_MASK Mask;
5137 DWORD Flags;
5138 GUID ObjectType;
5139 GUID InheritedObjectType;
5140 DWORD SidStart;
5141 } ACCESS_ALLOWED_OBJECT_ACE, *PACCESS_ALLOWED_OBJECT_ACE;
5143 typedef struct _ACCESS_DENIED_OBJECT_ACE {
5144 ACE_HEADER Header;
5145 ACCESS_MASK Mask;
5146 DWORD Flags;
5147 GUID ObjectType;
5148 GUID InheritedObjectType;
5149 DWORD SidStart;
5150 } ACCESS_DENIED_OBJECT_ACE, *PACCESS_DENIED_OBJECT_ACE;
5152 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
5153 ACE_HEADER Header;
5154 ACCESS_MASK Mask;
5155 DWORD Flags;
5156 GUID ObjectType;
5157 GUID InheritedObjectType;
5158 DWORD SidStart;
5159 } SYSTEM_AUDIT_OBJECT_ACE, *PSYSTEM_AUDIT_OBJECT_ACE;
5161 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
5162 ACE_HEADER Header;
5163 ACCESS_MASK Mask;
5164 DWORD Flags;
5165 GUID ObjectType;
5166 GUID InheritedObjectType;
5167 DWORD SidStart;
5168 } SYSTEM_ALARM_OBJECT_ACE, *PSYSTEM_ALARM_OBJECT_aCE;
5170 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
5171 ACE_HEADER Header;
5172 DWORD Mask;
5173 DWORD SidStart;
5174 } ACCESS_ALLOWED_CALLBACK_ACE,*PACCESS_ALLOWED_CALLBACK_ACE;
5176 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
5177 ACE_HEADER Header;
5178 DWORD Mask;
5179 DWORD SidStart;
5180 } ACCESS_DENIED_CALLBACK_ACE,*PACCESS_DENIED_CALLBACK_ACE;
5182 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
5183 ACE_HEADER Header;
5184 DWORD Mask;
5185 DWORD SidStart;
5186 } SYSTEM_AUDIT_CALLBACK_ACE,*PSYSTEM_AUDIT_CALLBACK_ACE;
5188 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
5189 ACE_HEADER Header;
5190 DWORD Mask;
5191 DWORD SidStart;
5192 } SYSTEM_ALARM_CALLBACK_ACE,*PSYSTEM_ALARM_CALLBACK_ACE;
5194 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
5195 ACE_HEADER Header;
5196 ACCESS_MASK Mask;
5197 DWORD Flags;
5198 GUID ObjectType;
5199 GUID InheritedObjectType;
5200 DWORD SidStart;
5201 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
5203 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
5204 ACE_HEADER Header;
5205 ACCESS_MASK Mask;
5206 DWORD Flags;
5207 GUID ObjectType;
5208 GUID InheritedObjectType;
5209 DWORD SidStart;
5210 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
5212 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
5213 ACE_HEADER Header;
5214 ACCESS_MASK Mask;
5215 DWORD Flags;
5216 GUID ObjectType;
5217 GUID InheritedObjectType;
5218 DWORD SidStart;
5219 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
5221 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
5222 ACE_HEADER Header;
5223 ACCESS_MASK Mask;
5224 DWORD Flags;
5225 GUID ObjectType;
5226 GUID InheritedObjectType;
5227 DWORD SidStart;
5228 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
5230 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
5231 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
5232 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
5233 #define SYSTEM_MANDATORY_LABEL_VALID_MASK 0x7
5235 typedef enum tagSID_NAME_USE {
5236 SidTypeUser = 1,
5237 SidTypeGroup,
5238 SidTypeDomain,
5239 SidTypeAlias,
5240 SidTypeWellKnownGroup,
5241 SidTypeDeletedAccount,
5242 SidTypeInvalid,
5243 SidTypeUnknown
5244 } SID_NAME_USE,*PSID_NAME_USE;
5246 #define ACE_OBJECT_TYPE_PRESENT 0x1
5247 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
5249 /* Access rights */
5251 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
5252 #undef DELETE
5253 #define DELETE 0x00010000
5254 #define READ_CONTROL 0x00020000
5255 #define WRITE_DAC 0x00040000
5256 #define WRITE_OWNER 0x00080000
5257 #define SYNCHRONIZE 0x00100000
5258 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
5260 #define STANDARD_RIGHTS_READ READ_CONTROL
5261 #define STANDARD_RIGHTS_WRITE READ_CONTROL
5262 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
5264 #define STANDARD_RIGHTS_ALL 0x001f0000
5266 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
5268 #define GENERIC_READ 0x80000000
5269 #define GENERIC_WRITE 0x40000000
5270 #define GENERIC_EXECUTE 0x20000000
5271 #define GENERIC_ALL 0x10000000
5273 #define MAXIMUM_ALLOWED 0x02000000
5274 #define ACCESS_SYSTEM_SECURITY 0x01000000
5276 #define EVENT_QUERY_STATE 0x0001
5277 #define EVENT_MODIFY_STATE 0x0002
5278 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5280 #define SEMAPHORE_QUERY_STATE 0x0001
5281 #define SEMAPHORE_MODIFY_STATE 0x0002
5282 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5284 #define MUTANT_QUERY_STATE 0x0001
5285 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
5287 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
5288 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
5289 #define JOB_OBJECT_QUERY 0x0004
5290 #define JOB_OBJECT_TERMINATE 0x0008
5291 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
5292 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
5294 #define TIMER_QUERY_STATE 0x0001
5295 #define TIMER_MODIFY_STATE 0x0002
5296 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
5298 #define PROCESS_TERMINATE 0x0001
5299 #define PROCESS_CREATE_THREAD 0x0002
5300 #define PROCESS_VM_OPERATION 0x0008
5301 #define PROCESS_VM_READ 0x0010
5302 #define PROCESS_VM_WRITE 0x0020
5303 #define PROCESS_DUP_HANDLE 0x0040
5304 #define PROCESS_CREATE_PROCESS 0x0080
5305 #define PROCESS_SET_QUOTA 0x0100
5306 #define PROCESS_SET_INFORMATION 0x0200
5307 #define PROCESS_QUERY_INFORMATION 0x0400
5308 #define PROCESS_SUSPEND_RESUME 0x0800
5309 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
5310 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
5311 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5313 #define THREAD_TERMINATE 0x0001
5314 #define THREAD_SUSPEND_RESUME 0x0002
5315 #define THREAD_GET_CONTEXT 0x0008
5316 #define THREAD_SET_CONTEXT 0x0010
5317 #define THREAD_SET_INFORMATION 0x0020
5318 #define THREAD_QUERY_INFORMATION 0x0040
5319 #define THREAD_SET_THREAD_TOKEN 0x0080
5320 #define THREAD_IMPERSONATE 0x0100
5321 #define THREAD_DIRECT_IMPERSONATION 0x0200
5322 #define THREAD_SET_LIMITED_INFORMATION 0x0400
5323 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
5324 #define THREAD_RESUME 0x1000
5325 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xffff)
5327 #define THREAD_BASE_PRIORITY_LOWRT 15
5328 #define THREAD_BASE_PRIORITY_MAX 2
5329 #define THREAD_BASE_PRIORITY_MIN -2
5330 #define THREAD_BASE_PRIORITY_IDLE -15
5332 typedef struct _QUOTA_LIMITS {
5333 SIZE_T PagedPoolLimit;
5334 SIZE_T NonPagedPoolLimit;
5335 SIZE_T MinimumWorkingSetSize;
5336 SIZE_T MaximumWorkingSetSize;
5337 SIZE_T PagefileLimit;
5338 LARGE_INTEGER TimeLimit;
5339 } QUOTA_LIMITS, *PQUOTA_LIMITS;
5341 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
5342 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
5343 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
5344 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
5345 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
5347 typedef union _RATE_QUOTA_LIMIT {
5348 DWORD RateData;
5349 struct {
5350 DWORD RatePercent:7;
5351 DWORD Reserved0:25;
5352 } DUMMYSTRUCTNAME;
5353 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT;
5355 typedef struct _QUOTA_LIMITS_EX {
5356 SIZE_T PagedPoolLimit;
5357 SIZE_T NonPagedPoolLimit;
5358 SIZE_T MinimumWorkingSetSize;
5359 SIZE_T MaximumWorkingSetSize;
5360 SIZE_T PagefileLimit;
5361 LARGE_INTEGER TimeLimit;
5362 SIZE_T WorkingSetLimit;
5363 SIZE_T Reserved2;
5364 SIZE_T Reserved3;
5365 SIZE_T Reserved4;
5366 DWORD Flags;
5367 RATE_QUOTA_LIMIT CpuRateLimit;
5368 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
5370 #define SECTION_QUERY 0x0001
5371 #define SECTION_MAP_WRITE 0x0002
5372 #define SECTION_MAP_READ 0x0004
5373 #define SECTION_MAP_EXECUTE 0x0008
5374 #define SECTION_EXTEND_SIZE 0x0010
5375 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
5376 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
5378 #define FILE_READ_DATA 0x0001 /* file & pipe */
5379 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
5380 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
5381 #define FILE_ADD_FILE 0x0002 /* directory */
5382 #define FILE_APPEND_DATA 0x0004 /* file */
5383 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
5384 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
5385 #define FILE_READ_EA 0x0008 /* file & directory */
5386 #define FILE_READ_PROPERTIES FILE_READ_EA
5387 #define FILE_WRITE_EA 0x0010 /* file & directory */
5388 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
5389 #define FILE_EXECUTE 0x0020 /* file */
5390 #define FILE_TRAVERSE 0x0020 /* directory */
5391 #define FILE_DELETE_CHILD 0x0040 /* directory */
5392 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
5393 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
5394 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
5396 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
5397 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
5398 SYNCHRONIZE)
5399 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
5400 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
5401 FILE_APPEND_DATA | SYNCHRONIZE)
5402 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
5403 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
5405 #define DUPLICATE_CLOSE_SOURCE 0x00000001
5406 #define DUPLICATE_SAME_ACCESS 0x00000002
5408 /* File attribute flags */
5409 #define FILE_SHARE_READ 0x00000001
5410 #define FILE_SHARE_WRITE 0x00000002
5411 #define FILE_SHARE_DELETE 0x00000004
5413 #define FILE_ATTRIBUTE_READONLY 0x00000001
5414 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
5415 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
5416 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
5417 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
5418 #define FILE_ATTRIBUTE_DEVICE 0x00000040
5419 #define FILE_ATTRIBUTE_NORMAL 0x00000080
5420 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
5421 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
5422 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
5423 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
5424 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
5425 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
5426 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
5427 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
5428 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
5429 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
5430 #define FILE_ATTRIBUTE_EA 0x00040000
5432 /* File notification flags */
5433 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
5434 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
5435 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
5436 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
5437 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
5438 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
5439 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
5440 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
5441 #define FILE_NOTIFY_CHANGE_EA 0x00000080
5442 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
5443 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
5444 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
5445 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
5447 #define FILE_ACTION_ADDED 0x00000001
5448 #define FILE_ACTION_REMOVED 0x00000002
5449 #define FILE_ACTION_MODIFIED 0x00000003
5450 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
5451 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
5452 #define FILE_ACTION_ADDED_STREAM 0x00000006
5453 #define FILE_ACTION_REMOVED_STREAM 0x00000007
5454 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
5455 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
5456 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000a
5457 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000b
5459 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
5460 #define FILE_CASE_PRESERVED_NAMES 0x00000002
5461 #define FILE_UNICODE_ON_DISK 0x00000004
5462 #define FILE_PERSISTENT_ACLS 0x00000008
5463 #define FILE_FILE_COMPRESSION 0x00000010
5464 #define FILE_VOLUME_QUOTAS 0x00000020
5465 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
5466 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
5467 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
5468 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
5469 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
5470 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
5471 #define FILE_NAMED_STREAMS 0x00040000
5472 #define FILE_READ_ONLY_VOLUME 0x00080000
5473 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
5474 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
5475 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
5476 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
5477 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
5478 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
5479 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000
5480 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000
5481 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000
5482 #define FILE_DAX_VOLUME 0x20000000
5483 #define FILE_SUPPORTS_GHOSTING 0x40000000
5485 /* File alignments (NT) */
5486 #define FILE_BYTE_ALIGNMENT 0x00000000
5487 #define FILE_WORD_ALIGNMENT 0x00000001
5488 #define FILE_LONG_ALIGNMENT 0x00000003
5489 #define FILE_QUAD_ALIGNMENT 0x00000007
5490 #define FILE_OCTA_ALIGNMENT 0x0000000f
5491 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
5492 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
5493 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
5494 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
5495 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
5497 #define COMPRESSION_FORMAT_NONE 0
5498 #define COMPRESSION_FORMAT_DEFAULT 1
5499 #define COMPRESSION_FORMAT_LZNT1 2
5500 #define COMPRESSION_ENGINE_STANDARD 0
5501 #define COMPRESSION_ENGINE_MAXIMUM 256
5503 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
5504 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
5506 #define REG_NONE 0 /* no type */
5507 #define REG_SZ 1 /* string type (ASCII) */
5508 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
5509 #define REG_BINARY 3 /* binary format, callerspecific */
5510 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
5511 #define REG_DWORD 4 /* DWORD in little endian format */
5512 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
5513 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
5514 #define REG_LINK 6 /* symbolic link (UNICODE) */
5515 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
5516 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
5517 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
5518 #define REG_RESOURCE_REQUIREMENTS_LIST 10
5519 #define REG_QWORD 11 /* QWORD in little endian format */
5520 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
5522 /* ----------------------------- begin power management --------------------- */
5524 typedef enum _LATENCY_TIME {
5525 LT_DONT_CARE,
5526 LT_LOWEST_LATENCY
5527 } LATENCY_TIME, *PLATENCY_TIME;
5529 #define DISCHARGE_POLICY_CRITICAL 0
5530 #define DISCHARGE_POLICY_LOW 1
5531 #define NUM_DISCHARGE_POLICIES 4
5533 #define PO_THROTTLE_NONE 0
5534 #define PO_THROTTLE_CONSTANT 1
5535 #define PO_THROTTLE_DEGRADE 2
5536 #define PO_THROTTLE_ADAPTIVE 3
5538 typedef enum _POWER_ACTION {
5539 PowerActionNone = 0,
5540 PowerActionReserved,
5541 PowerActionSleep,
5542 PowerActionHibernate,
5543 PowerActionShutdown,
5544 PowerActionShutdownReset,
5545 PowerActionShutdownOff,
5546 PowerActionWarmEject
5547 } POWER_ACTION,
5548 *PPOWER_ACTION;
5550 typedef enum _POWER_PLATFORM_ROLE {
5551 PlatformRoleUnspecified,
5552 PlatformRoleDesktop,
5553 PlatformRoleMobile,
5554 PlatformRoleWorkstation,
5555 PlatformRoleEnterpriseServer,
5556 PlatformRoleSOHOServer,
5557 PlatformRoleAppliancePC,
5558 PlatformRolePerformanceServer,
5559 PlatformRoleSlate,
5560 PlatformRoleMaximum
5561 } POWER_PLATFORM_ROLE, *PPOWER_PLATFORM_ROLE;
5563 typedef enum _SYSTEM_POWER_STATE {
5564 PowerSystemUnspecified = 0,
5565 PowerSystemWorking = 1,
5566 PowerSystemSleeping1 = 2,
5567 PowerSystemSleeping2 = 3,
5568 PowerSystemSleeping3 = 4,
5569 PowerSystemHibernate = 5,
5570 PowerSystemShutdown = 6,
5571 PowerSystemMaximum = 7
5572 } SYSTEM_POWER_STATE,
5573 *PSYSTEM_POWER_STATE;
5575 typedef enum _DEVICE_POWER_STATE {
5576 PowerDeviceUnspecified,
5577 PowerDeviceD0,
5578 PowerDeviceD1,
5579 PowerDeviceD2,
5580 PowerDeviceD3,
5581 PowerDeviceMaximum
5582 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
5584 typedef enum _POWER_INFORMATION_LEVEL {
5585 SystemPowerPolicyAc,
5586 SystemPowerPolicyDc,
5587 VerifySystemPolicyAc,
5588 VerifySystemPolicyDc,
5589 SystemPowerCapabilities,
5590 SystemBatteryState,
5591 SystemPowerStateHandler,
5592 ProcessorStateHandler,
5593 SystemPowerPolicyCurrent,
5594 AdministratorPowerPolicy,
5595 SystemReserveHiberFile,
5596 ProcessorInformation,
5597 SystemPowerInformation,
5598 ProcessorStateHandler2,
5599 LastWakeTime,
5600 LastSleepTime,
5601 SystemExecutionState,
5602 SystemPowerStateNotifyHandler,
5603 ProcessorPowerPolicyAc,
5604 ProcessorPowerPolicyDc,
5605 VerifyProcessorPowerPolicyAc,
5606 VerifyProcessorPowerPolicyDc,
5607 ProcessorPowerPolicyCurrent
5608 } POWER_INFORMATION_LEVEL;
5610 typedef struct _ADMINISTRATOR_POWER_POLICY {
5611 SYSTEM_POWER_STATE MinSleep;
5612 SYSTEM_POWER_STATE MaxSleep;
5613 ULONG MinVideoTimeout;
5614 ULONG MaxVideoTimeout;
5615 ULONG MinSpindownTimeout;
5616 ULONG MaxSpindownTimeout;
5617 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
5619 typedef struct {
5620 ULONG Granularity;
5621 ULONG Capacity;
5622 } BATTERY_REPORTING_SCALE,
5623 *PBATTERY_REPORTING_SCALE;
5625 typedef struct {
5626 POWER_ACTION Action;
5627 ULONG Flags;
5628 ULONG EventCode;
5629 } POWER_ACTION_POLICY,
5630 *PPOWER_ACTION_POLICY;
5632 typedef struct _PROCESSOR_POWER_INFORMATION {
5633 ULONG Number;
5634 ULONG MaxMhz;
5635 ULONG CurrentMhz;
5636 ULONG MhzLimit;
5637 ULONG MaxIdleState;
5638 ULONG CurrentIdleState;
5639 } PROCESSOR_POWER_INFORMATION,
5640 *PPROCESSOR_POWER_INFORMATION;
5642 typedef struct _PROCESSOR_POWER_POLICY_INFO {
5643 ULONG TimeCheck;
5644 ULONG DemoteLimit;
5645 ULONG PromoteLimit;
5646 UCHAR DemotePercent;
5647 UCHAR PromotePercent;
5648 UCHAR Spare[2];
5649 ULONG AllowDemotion:1;
5650 ULONG AllowPromotion:1;
5651 ULONG Reserved:30;
5652 } PROCESSOR_POWER_POLICY_INFO,
5653 *PPROCESSOR_POWER_POLICY_INFO;
5655 typedef struct _PROCESSOR_POWER_POLICY {
5656 DWORD Revision;
5657 BYTE DynamicThrottle;
5658 BYTE Spare[3];
5659 DWORD DisableCStates:1;
5660 DWORD Reserved:31;
5661 DWORD PolicyCount;
5662 PROCESSOR_POWER_POLICY_INFO Policy[3];
5663 } PROCESSOR_POWER_POLICY,
5664 *PPROCESSOR_POWER_POLICY;
5666 typedef struct {
5667 BOOLEAN AcOnLine;
5668 BOOLEAN BatteryPresent;
5669 BOOLEAN Charging;
5670 BOOLEAN Discharging;
5671 BOOLEAN Spare1[3];
5672 BYTE Tag;
5673 ULONG MaxCapacity;
5674 ULONG RemainingCapacity;
5675 ULONG Rate;
5676 ULONG EstimatedTime;
5677 ULONG DefaultAlert1;
5678 ULONG DefaultAlert2;
5679 } SYSTEM_BATTERY_STATE,
5680 *PSYSTEM_BATTERY_STATE;
5682 typedef struct {
5683 BOOLEAN PowerButtonPresent;
5684 BOOLEAN SleepButtonPresent;
5685 BOOLEAN LidPresent;
5686 BOOLEAN SystemS1;
5687 BOOLEAN SystemS2;
5688 BOOLEAN SystemS3;
5689 BOOLEAN SystemS4;
5690 BOOLEAN SystemS5;
5691 BOOLEAN HiberFilePresent;
5692 BOOLEAN FullWake;
5693 BOOLEAN VideoDimPresent;
5694 BOOLEAN ApmPresent;
5695 BOOLEAN UpsPresent;
5696 BOOLEAN ThermalControl;
5697 BOOLEAN ProcessorThrottle;
5698 UCHAR ProcessorMinThrottle;
5699 UCHAR ProcessorMaxThrottle;
5700 UCHAR spare2[4];
5701 BOOLEAN DiskSpinDown;
5702 UCHAR spare3[8];
5703 BOOLEAN SystemBatteriesPresent;
5704 BOOLEAN BatteriesAreShortTerm;
5705 BATTERY_REPORTING_SCALE BatteryScale[3];
5706 SYSTEM_POWER_STATE AcOnLineWake;
5707 SYSTEM_POWER_STATE SoftLidWake;
5708 SYSTEM_POWER_STATE RtcWake;
5709 SYSTEM_POWER_STATE MinDeviceWakeState;
5710 SYSTEM_POWER_STATE DefaultLowLatencyWake;
5711 } SYSTEM_POWER_CAPABILITIES,
5712 *PSYSTEM_POWER_CAPABILITIES;
5714 typedef struct _SYSTEM_POWER_INFORMATION {
5715 ULONG MaxIdlenessAllowed;
5716 ULONG Idleness;
5717 ULONG TimeRemaining;
5718 UCHAR CoolingMode;
5719 } SYSTEM_POWER_INFORMATION,
5720 *PSYSTEM_POWER_INFORMATION;
5722 typedef struct _SYSTEM_POWER_LEVEL {
5723 BOOLEAN Enable;
5724 UCHAR Spare[3];
5725 ULONG BatteryLevel;
5726 POWER_ACTION_POLICY PowerPolicy;
5727 SYSTEM_POWER_STATE MinSystemState;
5728 } SYSTEM_POWER_LEVEL,
5729 *PSYSTEM_POWER_LEVEL;
5731 typedef struct _SYSTEM_POWER_POLICY {
5732 ULONG Revision;
5733 POWER_ACTION_POLICY PowerButton;
5734 POWER_ACTION_POLICY SleepButton;
5735 POWER_ACTION_POLICY LidClose;
5736 SYSTEM_POWER_STATE LidOpenWake;
5737 ULONG Reserved;
5738 POWER_ACTION_POLICY Idle;
5739 ULONG IdleTimeout;
5740 UCHAR IdleSensitivity;
5741 UCHAR DynamicThrottle;
5742 UCHAR Spare2[2];
5743 SYSTEM_POWER_STATE MinSleep;
5744 SYSTEM_POWER_STATE MaxSleep;
5745 SYSTEM_POWER_STATE ReducedLatencySleep;
5746 ULONG WinLogonFlags;
5747 ULONG Spare3;
5748 ULONG DozeS4Timeout;
5749 ULONG BroadcastCapacityResolution;
5750 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
5751 ULONG VideoTimeout;
5752 BOOLEAN VideoDimDisplay;
5753 ULONG VideoReserved[3];
5754 ULONG SpindownTimeout;
5755 BOOLEAN OptimizeForPower;
5756 UCHAR FanThrottleTolerance;
5757 UCHAR ForcedThrottle;
5758 UCHAR MinThrottle;
5759 POWER_ACTION_POLICY OverThrottled;
5760 } SYSTEM_POWER_POLICY,
5761 *PSYSTEM_POWER_POLICY;
5763 typedef enum _POWER_REQUEST_TYPE
5765 PowerRequestDisplayRequired,
5766 PowerRequestSystemRequired,
5767 PowerRequestAwayModeRequired
5768 } POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE;
5770 #define POWER_REQUEST_CONTEXT_VERSION 0
5772 #define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
5773 #define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
5775 typedef union _FILE_SEGMENT_ELEMENT {
5776 PVOID64 Buffer;
5777 ULONGLONG Alignment;
5778 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
5780 typedef struct _FILE_NOTIFY_INFORMATION {
5781 DWORD NextEntryOffset;
5782 DWORD Action;
5783 DWORD FileNameLength;
5784 WCHAR FileName[1];
5785 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
5787 /* ----------------------------- begin tape storage --------------------- */
5789 #define TAPE_FIXED_PARTITIONS 0
5790 #define TAPE_SELECT_PARTITIONS 1
5791 #define TAPE_INITIATOR_PARTITIONS 2
5792 #define TAPE_ERASE_SHORT 0
5793 #define TAPE_ERASE_LONG 1
5794 #define TAPE_LOAD 0
5795 #define TAPE_UNLOAD 1
5796 #define TAPE_TENSION 2
5797 #define TAPE_LOCK 3
5798 #define TAPE_UNLOCK 4
5799 #define TAPE_FORMAT 5
5800 #define TAPE_SETMARKS 0
5801 #define TAPE_FILEMARKS 1
5802 #define TAPE_SHORT_FILEMARKS 2
5803 #define TAPE_LONG_FILEMARKS 3
5804 #define TAPE_REWIND 0
5805 #define TAPE_ABSOLUTE_BLOCK 1
5806 #define TAPE_LOGICAL_BLOCK 2
5807 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5808 #define TAPE_SPACE_END_OF_DATA 4
5809 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5810 #define TAPE_SPACE_FILEMARKS 6
5811 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5812 #define TAPE_SPACE_SETMARKS 8
5813 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5815 typedef struct _TAPE_CREATE_PARTITION {
5816 DWORD Method;
5817 DWORD Count;
5818 DWORD Size;
5819 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
5821 typedef struct _TAPE_ERASE {
5822 DWORD Type;
5823 BOOLEAN Immediate;
5824 } TAPE_ERASE, *PTAPE_ERASE;
5826 typedef struct _TAPE_PREPARE {
5827 DWORD Operation;
5828 BOOLEAN Immediate;
5829 } TAPE_PREPARE, *PTAPE_PREPARE;
5831 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
5832 BOOLEAN ECC;
5833 BOOLEAN Compression;
5834 BOOLEAN DataPadding;
5835 BOOLEAN ReportSetmarks;
5836 ULONG EOTWarningZoneSize;
5837 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
5839 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
5840 ULONG BlockSize;
5841 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
5843 typedef struct _TAPE_WRITE_MARKS {
5844 DWORD Type;
5845 DWORD Count;
5846 BOOLEAN Immediate;
5847 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
5849 typedef struct _TAPE_GET_POSITION {
5850 ULONG Type;
5851 ULONG Partition;
5852 ULONG OffsetLow;
5853 ULONG OffsetHigh;
5854 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
5856 typedef struct _TAPE_SET_POSITION {
5857 ULONG Method;
5858 ULONG Partition;
5859 LARGE_INTEGER Offset;
5860 BOOLEAN Immediate;
5861 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
5863 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
5864 BOOLEAN ECC;
5865 BOOLEAN Compression;
5866 BOOLEAN DataPadding;
5867 BOOLEAN ReportSetmarks;
5868 DWORD DefaultBlockSize;
5869 DWORD MaximumBlockSize;
5870 DWORD MinimumBlockSize;
5871 DWORD MaximumPartitionCount;
5872 DWORD FeaturesLow;
5873 DWORD FeaturesHigh;
5874 DWORD EOTWarningZoneSize;
5875 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
5877 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
5878 LARGE_INTEGER Capacity;
5879 LARGE_INTEGER Remaining;
5880 DWORD BlockSize;
5881 DWORD PartitionCount;
5882 BOOLEAN WriteProtected;
5883 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
5885 /* ----------------------------- begin registry ----------------------------- */
5887 /* Registry security values */
5888 #define OWNER_SECURITY_INFORMATION 0x00000001
5889 #define GROUP_SECURITY_INFORMATION 0x00000002
5890 #define DACL_SECURITY_INFORMATION 0x00000004
5891 #define SACL_SECURITY_INFORMATION 0x00000008
5892 #define LABEL_SECURITY_INFORMATION 0x00000010
5894 #define REG_OPTION_RESERVED 0x00000000
5895 #define REG_OPTION_NON_VOLATILE 0x00000000
5896 #define REG_OPTION_VOLATILE 0x00000001
5897 #define REG_OPTION_CREATE_LINK 0x00000002
5898 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5899 #define REG_OPTION_OPEN_LINK 0x00000008
5900 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | \
5901 REG_OPTION_NON_VOLATILE | \
5902 REG_OPTION_VOLATILE | \
5903 REG_OPTION_CREATE_LINK | \
5904 REG_OPTION_BACKUP_RESTORE | \
5905 REG_OPTION_OPEN_LINK)
5908 #define REG_CREATED_NEW_KEY 0x00000001
5909 #define REG_OPENED_EXISTING_KEY 0x00000002
5911 /* For RegNotifyChangeKeyValue */
5912 #define REG_NOTIFY_CHANGE_NAME 0x01
5913 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5914 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5915 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5916 #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000
5918 #define KEY_QUERY_VALUE 0x00000001
5919 #define KEY_SET_VALUE 0x00000002
5920 #define KEY_CREATE_SUB_KEY 0x00000004
5921 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5922 #define KEY_NOTIFY 0x00000010
5923 #define KEY_CREATE_LINK 0x00000020
5924 #define KEY_WOW64_64KEY 0x00000100
5925 #define KEY_WOW64_32KEY 0x00000200
5926 #define KEY_WOW64_RES 0x00000300
5928 /* for RegKeyRestore flags */
5929 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5930 #define REG_REFRESH_HIVE 0x00000002
5931 #define REG_NO_LAZY_FLUSH 0x00000004
5932 #define REG_FORCE_RESTORE 0x00000008
5934 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5935 KEY_QUERY_VALUE| \
5936 KEY_ENUMERATE_SUB_KEYS| \
5937 KEY_NOTIFY) \
5938 & (~SYNCHRONIZE) \
5940 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5941 KEY_SET_VALUE| \
5942 KEY_CREATE_SUB_KEY) \
5943 & (~SYNCHRONIZE) \
5945 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5946 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5947 KEY_QUERY_VALUE| \
5948 KEY_SET_VALUE| \
5949 KEY_CREATE_SUB_KEY| \
5950 KEY_ENUMERATE_SUB_KEYS| \
5951 KEY_NOTIFY| \
5952 KEY_CREATE_LINK) \
5953 & (~SYNCHRONIZE) \
5955 /* ------------------------------ end registry ------------------------------ */
5958 #define EVENTLOG_SUCCESS 0x0000
5959 #define EVENTLOG_ERROR_TYPE 0x0001
5960 #define EVENTLOG_WARNING_TYPE 0x0002
5961 #define EVENTLOG_INFORMATION_TYPE 0x0004
5962 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5963 #define EVENTLOG_AUDIT_FAILURE 0x0010
5965 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5966 #define EVENTLOG_SEEK_READ 0x0002
5967 #define EVENTLOG_FORWARDS_READ 0x0004
5968 #define EVENTLOG_BACKWARDS_READ 0x0008
5970 typedef struct _EVENTLOGRECORD {
5971 DWORD Length;
5972 DWORD Reserved;
5973 DWORD RecordNumber;
5974 DWORD TimeGenerated;
5975 DWORD TimeWritten;
5976 DWORD EventID;
5977 WORD EventType;
5978 WORD NumStrings;
5979 WORD EventCategory;
5980 WORD ReservedFlags;
5981 DWORD ClosingRecordNumber;
5982 DWORD StringOffset;
5983 DWORD UserSidLength;
5984 DWORD UserSidOffset;
5985 DWORD DataLength;
5986 DWORD DataOffset;
5987 } EVENTLOGRECORD, *PEVENTLOGRECORD;
5989 #define SERVICE_BOOT_START 0x00000000
5990 #define SERVICE_SYSTEM_START 0x00000001
5991 #define SERVICE_AUTO_START 0x00000002
5992 #define SERVICE_DEMAND_START 0x00000003
5993 #define SERVICE_DISABLED 0x00000004
5995 #define SERVICE_ERROR_IGNORE 0x00000000
5996 #define SERVICE_ERROR_NORMAL 0x00000001
5997 #define SERVICE_ERROR_SEVERE 0x00000002
5998 #define SERVICE_ERROR_CRITICAL 0x00000003
6000 /* Service types */
6001 #define SERVICE_KERNEL_DRIVER 0x00000001
6002 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
6003 #define SERVICE_ADAPTER 0x00000004
6004 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
6006 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
6007 SERVICE_RECOGNIZER_DRIVER )
6009 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
6010 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
6011 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
6013 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
6015 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
6016 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
6019 typedef enum _CM_SERVICE_NODE_TYPE
6021 DriverType = SERVICE_KERNEL_DRIVER,
6022 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
6023 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
6024 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
6025 AdapterType = SERVICE_ADAPTER,
6026 RecognizerType = SERVICE_RECOGNIZER_DRIVER
6027 } SERVICE_NODE_TYPE;
6029 typedef enum _CM_SERVICE_LOAD_TYPE
6031 BootLoad = SERVICE_BOOT_START,
6032 SystemLoad = SERVICE_SYSTEM_START,
6033 AutoLoad = SERVICE_AUTO_START,
6034 DemandLoad = SERVICE_DEMAND_START,
6035 DisableLoad = SERVICE_DISABLED
6036 } SERVICE_LOAD_TYPE;
6038 typedef enum _CM_ERROR_CONTROL_TYPE
6040 IgnoreError = SERVICE_ERROR_IGNORE,
6041 NormalError = SERVICE_ERROR_NORMAL,
6042 SevereError = SERVICE_ERROR_SEVERE,
6043 CriticalError = SERVICE_ERROR_CRITICAL
6044 } SERVICE_ERROR_TYPE;
6046 NTSYSAPI SIZE_T WINAPI RtlCompareMemory(const VOID*, const VOID*, SIZE_T);
6048 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
6049 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
6050 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
6051 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
6052 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
6054 static FORCEINLINE void *RtlSecureZeroMemory(void *buffer, SIZE_T length)
6056 volatile char *ptr = (volatile char *)buffer;
6058 while (length--) *ptr++ = 0;
6059 return buffer;
6062 #include <guiddef.h>
6064 typedef struct _OBJECT_TYPE_LIST {
6065 WORD Level;
6066 WORD Sbz;
6067 GUID *ObjectType;
6068 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
6070 typedef struct _RTL_CRITICAL_SECTION_DEBUG
6072 WORD Type;
6073 WORD CreatorBackTraceIndex;
6074 struct _RTL_CRITICAL_SECTION *CriticalSection;
6075 LIST_ENTRY ProcessLocksList;
6076 DWORD EntryCount;
6077 DWORD ContentionCount;
6078 #ifdef __WINESRC__ /* in Wine we store the name here */
6079 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
6080 #else
6081 DWORD Spare[ 2 ];
6082 #endif
6083 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
6085 typedef struct _RTL_CRITICAL_SECTION {
6086 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
6087 LONG LockCount;
6088 LONG RecursionCount;
6089 HANDLE OwningThread;
6090 HANDLE LockSemaphore;
6091 ULONG_PTR SpinCount;
6092 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
6094 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
6095 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
6096 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
6097 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
6098 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
6100 typedef struct _RTL_SRWLOCK {
6101 PVOID Ptr;
6102 } RTL_SRWLOCK, *PRTL_SRWLOCK;
6104 #define RTL_SRWLOCK_INIT {0}
6106 typedef struct _RTL_CONDITION_VARIABLE {
6107 PVOID Ptr;
6108 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
6109 #define RTL_CONDITION_VARIABLE_INIT {0}
6110 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
6112 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
6113 typedef VOID (NTAPI * PFLS_CALLBACK_FUNCTION) ( PVOID );
6115 #define RTL_RUN_ONCE_INIT {0}
6116 typedef union _RTL_RUN_ONCE {
6117 PVOID Ptr;
6118 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
6120 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
6121 #define RTL_RUN_ONCE_ASYNC 0x00000002
6122 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004
6124 typedef DWORD WINAPI RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE, PVOID, PVOID*);
6125 typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN;
6126 NTSYSAPI VOID WINAPI RtlRunOnceInitialize(PRTL_RUN_ONCE);
6127 NTSYSAPI DWORD WINAPI RtlRunOnceExecuteOnce(PRTL_RUN_ONCE,PRTL_RUN_ONCE_INIT_FN,PVOID,PVOID*);
6128 NTSYSAPI DWORD WINAPI RtlRunOnceBeginInitialize(PRTL_RUN_ONCE, DWORD, PVOID*);
6129 NTSYSAPI DWORD WINAPI RtlRunOnceComplete(PRTL_RUN_ONCE, DWORD, PVOID);
6131 #include <pshpack8.h>
6132 typedef struct _IO_COUNTERS {
6133 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
6134 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
6135 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
6136 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
6137 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
6138 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
6139 } IO_COUNTERS, *PIO_COUNTERS;
6140 #include <poppack.h>
6142 typedef struct {
6143 DWORD dwOSVersionInfoSize;
6144 DWORD dwMajorVersion;
6145 DWORD dwMinorVersion;
6146 DWORD dwBuildNumber;
6147 DWORD dwPlatformId;
6148 CHAR szCSDVersion[128];
6149 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
6151 typedef struct {
6152 DWORD dwOSVersionInfoSize;
6153 DWORD dwMajorVersion;
6154 DWORD dwMinorVersion;
6155 DWORD dwBuildNumber;
6156 DWORD dwPlatformId;
6157 WCHAR szCSDVersion[128];
6158 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
6160 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
6161 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
6162 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
6164 typedef struct {
6165 DWORD dwOSVersionInfoSize;
6166 DWORD dwMajorVersion;
6167 DWORD dwMinorVersion;
6168 DWORD dwBuildNumber;
6169 DWORD dwPlatformId;
6170 CHAR szCSDVersion[128];
6171 WORD wServicePackMajor;
6172 WORD wServicePackMinor;
6173 WORD wSuiteMask;
6174 BYTE wProductType;
6175 BYTE wReserved;
6176 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
6178 typedef struct {
6179 DWORD dwOSVersionInfoSize;
6180 DWORD dwMajorVersion;
6181 DWORD dwMinorVersion;
6182 DWORD dwBuildNumber;
6183 DWORD dwPlatformId;
6184 WCHAR szCSDVersion[128];
6185 WORD wServicePackMajor;
6186 WORD wServicePackMinor;
6187 WORD wSuiteMask;
6188 BYTE wProductType;
6189 BYTE wReserved;
6190 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
6192 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
6193 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
6194 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
6196 NTSYSAPI ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
6198 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
6200 #define VER_PLATFORM_WIN32s 0
6201 #define VER_PLATFORM_WIN32_WINDOWS 1
6202 #define VER_PLATFORM_WIN32_NT 2
6204 #define VER_MINORVERSION 0x00000001
6205 #define VER_MAJORVERSION 0x00000002
6206 #define VER_BUILDNUMBER 0x00000004
6207 #define VER_PLATFORMID 0x00000008
6208 #define VER_SERVICEPACKMINOR 0x00000010
6209 #define VER_SERVICEPACKMAJOR 0x00000020
6210 #define VER_SUITENAME 0x00000040
6211 #define VER_PRODUCT_TYPE 0x00000080
6213 #define VER_NT_WORKSTATION 1
6214 #define VER_NT_DOMAIN_CONTROLLER 2
6215 #define VER_NT_SERVER 3
6217 #define VER_SUITE_SMALLBUSINESS 0x00000001
6218 #define VER_SUITE_ENTERPRISE 0x00000002
6219 #define VER_SUITE_BACKOFFICE 0x00000004
6220 #define VER_SUITE_COMMUNICATIONS 0x00000008
6221 #define VER_SUITE_TERMINAL 0x00000010
6222 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
6223 #define VER_SUITE_EMBEDDEDNT 0x00000040
6224 #define VER_SUITE_DATACENTER 0x00000080
6225 #define VER_SUITE_SINGLEUSERTS 0x00000100
6226 #define VER_SUITE_PERSONAL 0x00000200
6227 #define VER_SUITE_BLADE 0x00000400
6228 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
6229 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
6230 #define VER_SUITE_STORAGE_SERVER 0x00002000
6231 #define VER_SUITE_COMPUTE_SERVER 0x00004000
6232 #define VER_SUITE_WH_SERVER 0x00008000
6234 #define VER_EQUAL 1
6235 #define VER_GREATER 2
6236 #define VER_GREATER_EQUAL 3
6237 #define VER_LESS 4
6238 #define VER_LESS_EQUAL 5
6239 #define VER_AND 6
6240 #define VER_OR 7
6242 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
6243 DWORD dwFlags;
6244 DWORD ulFormatVersion;
6245 DWORD ulAssemblyCount;
6246 DWORD ulRootManifestPathType;
6247 DWORD ulRootManifestPathChars;
6248 DWORD ulRootConfigurationPathType;
6249 DWORD ulRootConfigurationPathChars;
6250 DWORD ulAppDirPathType;
6251 DWORD ulAppDirPathChars;
6252 PCWSTR lpRootManifestPath;
6253 PCWSTR lpRootConfigurationPath;
6254 PCWSTR lpAppDirPath;
6255 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
6257 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
6258 DWORD ulFlags;
6259 DWORD ulEncodedAssemblyIdentityLength;
6260 DWORD ulManifestPathType;
6261 DWORD ulManifestPathLength;
6262 LARGE_INTEGER liManifestLastWriteTime;
6263 DWORD ulPolicyPathType;
6264 DWORD ulPolicyPathLength;
6265 LARGE_INTEGER liPolicyLastWriteTime;
6266 DWORD ulMetadataSatelliteRosterIndex;
6267 DWORD ulManifestVersionMajor;
6268 DWORD ulManifestVersionMinor;
6269 DWORD ulPolicyVersionMajor;
6270 DWORD ulPolicyVersionMinor;
6271 DWORD ulAssemblyDirectoryNameLength;
6272 PCWSTR lpAssemblyEncodedAssemblyIdentity;
6273 PCWSTR lpAssemblyManifestPath;
6274 PCWSTR lpAssemblyPolicyPath;
6275 PCWSTR lpAssemblyDirectoryName;
6276 DWORD ulFileCount;
6277 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
6279 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
6280 DWORD ulAssemblyIndex;
6281 DWORD ulFileIndexInAssembly;
6282 } ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
6284 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
6286 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
6287 DWORD ulFlags;
6288 DWORD ulFilenameLength;
6289 DWORD ulPathLength;
6290 PCWSTR lpFileName;
6291 PCWSTR lpFilePath;
6292 } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
6294 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
6296 typedef enum {
6297 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0,
6298 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS,
6299 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION,
6300 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED
6301 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE;
6303 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT {
6304 GUID Id;
6305 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type;
6306 } COMPATIBILITY_CONTEXT_ELEMENT, *PCOMPATIBILITY_CONTEXT_ELEMENT;
6308 #if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3)))
6309 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION {
6310 DWORD ElementCount;
6311 COMPATIBILITY_CONTEXT_ELEMENT Elements[];
6312 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION;
6313 #endif
6315 typedef enum {
6316 ACTCTX_RUN_LEVEL_UNSPECIFIED = 0,
6317 ACTCTX_RUN_LEVEL_AS_INVOKER,
6318 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE,
6319 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN,
6320 ACTCTX_RUN_LEVEL_NUMBERS
6321 } ACTCTX_REQUESTED_RUN_LEVEL;
6323 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION {
6324 DWORD ulFlags;
6325 ACTCTX_REQUESTED_RUN_LEVEL RunLevel;
6326 DWORD UiAccess;
6327 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION;
6329 typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION *PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION;
6331 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
6332 ActivationContextBasicInformation = 1,
6333 ActivationContextDetailedInformation = 2,
6334 AssemblyDetailedInformationInActivationContext = 3,
6335 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
6336 RunlevelInformationInActivationContext = 5,
6337 CompatibilityInformationInActivationContext = 6,
6338 ActivationContextManifestResourceName = 7,
6339 MaxActivationContextInfoClass,
6340 AssemblyDetailedInformationInActivationContxt = AssemblyDetailedInformationInActivationContext,
6341 FileInformationInAssemblyOfAssemblyInActivationContxt = FileInformationInAssemblyOfAssemblyInActivationContext
6342 } ACTIVATION_CONTEXT_INFO_CLASS;
6344 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
6345 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
6346 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
6347 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
6349 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
6350 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
6351 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
6352 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
6353 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
6354 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
6355 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
6356 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
6357 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
6358 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10
6359 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11
6361 typedef enum _JOBOBJECTINFOCLASS
6363 JobObjectBasicAccountingInformation = 1,
6364 JobObjectBasicLimitInformation,
6365 JobObjectBasicProcessIdList,
6366 JobObjectBasicUIRestrictions,
6367 JobObjectSecurityLimitInformation,
6368 JobObjectEndOfJobTimeInformation,
6369 JobObjectAssociateCompletionPortInformation,
6370 JobObjectBasicAndIoAccountingInformation,
6371 JobObjectExtendedLimitInformation,
6372 JobObjectJobSetInformation,
6373 MaxJobObjectInfoClass
6374 } JOBOBJECTINFOCLASS;
6376 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
6377 LARGE_INTEGER TotalUserTime;
6378 LARGE_INTEGER TotalKernelTime;
6379 LARGE_INTEGER ThisPeriodTotalUserTime;
6380 LARGE_INTEGER ThisPeriodTotalKernelTime;
6381 DWORD TotalPageFaultCount;
6382 DWORD TotalProcesses;
6383 DWORD ActiveProcesses;
6384 DWORD TotalTerminatedProcesses;
6385 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
6387 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
6388 LARGE_INTEGER PerProcessUserTimeLimit;
6389 LARGE_INTEGER PerJobUserTimeLimit;
6390 DWORD LimitFlags;
6391 SIZE_T MinimumWorkingSetSize;
6392 SIZE_T MaximumWorkingSetSize;
6393 DWORD ActiveProcessLimit;
6394 ULONG_PTR Affinity;
6395 DWORD PriorityClass;
6396 DWORD SchedulingClass;
6397 } JOBOBJECT_BASIC_LIMIT_INFORMATION, *PJOBOBJECT_BASIC_LIMIT_INFORMATION;
6399 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
6400 DWORD NumberOfAssignedProcesses;
6401 DWORD NumberOfProcessIdsInList;
6402 ULONG_PTR ProcessIdList[1];
6403 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
6405 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
6406 DWORD UIRestrictionsClass;
6407 } JOBOBJECT_BASIC_UI_RESTRICTIONS, *PJOBOBJECT_BASIC_UI_RESTRICTIONS;
6409 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
6410 DWORD SecurityLimitFlags;
6411 HANDLE JobToken;
6412 PTOKEN_GROUPS SidsToDisable;
6413 PTOKEN_PRIVILEGES PrivilegesToDelete;
6414 PTOKEN_GROUPS RestrictedSids;
6415 } JOBOBJECT_SECURITY_LIMIT_INFORMATION, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
6417 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
6418 DWORD EndOfJobTimeAction;
6419 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION, PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
6421 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
6422 PVOID CompletionKey;
6423 HANDLE CompletionPort;
6424 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
6426 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
6427 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
6428 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
6429 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
6430 #define JOB_OBJECT_MSG_NEW_PROCESS 6
6431 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
6432 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
6433 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
6434 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
6436 typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
6437 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
6438 IO_COUNTERS IoInfo;
6439 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
6441 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
6442 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
6443 IO_COUNTERS IoInfo;
6444 SIZE_T ProcessMemoryLimit;
6445 SIZE_T JobMemoryLimit;
6446 SIZE_T PeakProcessMemoryUsed;
6447 SIZE_T PeakJobMemoryUsed;
6448 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
6450 #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
6451 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
6452 #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
6453 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
6454 #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
6455 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
6456 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
6457 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
6458 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
6459 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
6460 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
6461 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
6462 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
6463 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
6464 #define JOB_OBJECT_LIMIT_SUBSET_AFFINITY 0x00004000
6466 #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
6467 #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
6468 #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00007fff
6470 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
6472 RelationProcessorCore = 0,
6473 RelationNumaNode = 1,
6474 RelationCache = 2,
6475 RelationProcessorPackage = 3,
6476 RelationGroup = 4,
6477 RelationAll = 0xffff
6478 } LOGICAL_PROCESSOR_RELATIONSHIP;
6480 #define LTP_PC_SMT 0x1
6482 typedef enum _PROCESSOR_CACHE_TYPE
6484 CacheUnified,
6485 CacheInstruction,
6486 CacheData,
6487 CacheTrace
6488 } PROCESSOR_CACHE_TYPE;
6490 typedef struct _PROCESSOR_GROUP_INFO
6492 BYTE MaximumProcessorCount;
6493 BYTE ActiveProcessorCount;
6494 BYTE Reserved[38];
6495 KAFFINITY ActiveProcessorMask;
6496 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
6498 typedef struct _CACHE_DESCRIPTOR
6500 BYTE Level;
6501 BYTE Associativity;
6502 WORD LineSize;
6503 DWORD Size;
6504 PROCESSOR_CACHE_TYPE Type;
6505 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
6507 typedef struct _GROUP_AFFINITY
6509 KAFFINITY Mask;
6510 WORD Group;
6511 WORD Reserved[3];
6512 } GROUP_AFFINITY, *PGROUP_AFFINITY;
6514 typedef struct _PROCESSOR_NUMBER
6516 WORD Group;
6517 BYTE Number;
6518 BYTE Reserved;
6519 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
6521 typedef struct _PROCESSOR_RELATIONSHIP
6523 BYTE Flags;
6524 BYTE EfficiencyClass;
6525 BYTE Reserved[20];
6526 WORD GroupCount;
6527 GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
6528 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
6530 typedef struct _NUMA_NODE_RELATIONSHIP
6532 DWORD NodeNumber;
6533 BYTE Reserved[20];
6534 GROUP_AFFINITY GroupMask;
6535 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
6537 typedef struct _CACHE_RELATIONSHIP
6539 BYTE Level;
6540 BYTE Associativity;
6541 WORD LineSize;
6542 DWORD CacheSize;
6543 PROCESSOR_CACHE_TYPE Type;
6544 BYTE Reserved[20];
6545 GROUP_AFFINITY GroupMask;
6546 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
6548 typedef struct _GROUP_RELATIONSHIP
6550 WORD MaximumGroupCount;
6551 WORD ActiveGroupCount;
6552 BYTE Reserved[20];
6553 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
6554 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
6556 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
6558 ULONG_PTR ProcessorMask;
6559 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
6560 union
6562 struct
6564 BYTE Flags;
6565 } ProcessorCore;
6566 struct
6568 DWORD NodeNumber;
6569 } NumaNode;
6570 CACHE_DESCRIPTOR Cache;
6571 ULONGLONG Reserved[2];
6572 } DUMMYUNIONNAME;
6573 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
6575 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
6577 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
6578 DWORD Size;
6579 union
6581 PROCESSOR_RELATIONSHIP Processor;
6582 NUMA_NODE_RELATIONSHIP NumaNode;
6583 CACHE_RELATIONSHIP Cache;
6584 GROUP_RELATIONSHIP Group;
6585 } DUMMYUNIONNAME;
6586 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
6588 /* Threadpool things */
6589 typedef DWORD TP_VERSION,*PTP_VERSION;
6591 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE,*PTP_CALLBACK_INSTANCE;
6593 typedef VOID (CALLBACK *PTP_SIMPLE_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID);
6595 typedef struct _TP_POOL TP_POOL,*PTP_POOL;
6597 typedef enum _TP_CALLBACK_PRIORITY
6599 TP_CALLBACK_PRIORITY_HIGH,
6600 TP_CALLBACK_PRIORITY_NORMAL,
6601 TP_CALLBACK_PRIORITY_LOW,
6602 TP_CALLBACK_PRIORITY_INVALID,
6603 TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID
6604 } TP_CALLBACK_PRIORITY;
6606 typedef struct _TP_POOL_STACK_INFORMATION
6608 SIZE_T StackReserve;
6609 SIZE_T StackCommit;
6610 } TP_POOL_STACK_INFORMATION,*PTP_POOL_STACK_INFORMATION;
6612 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP,*PTP_CLEANUP_GROUP;
6614 typedef VOID (CALLBACK *PTP_CLEANUP_GROUP_CANCEL_CALLBACK)(PVOID,PVOID);
6616 typedef struct _TP_CALLBACK_ENVIRON_V1
6618 TP_VERSION Version;
6619 PTP_POOL Pool;
6620 PTP_CLEANUP_GROUP CleanupGroup;
6621 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback;
6622 PVOID RaceDll;
6623 struct _ACTIVATION_CONTEXT* ActivationContext;
6624 PTP_SIMPLE_CALLBACK FinalizationCallback;
6625 union
6627 DWORD Flags;
6628 struct
6630 DWORD LongFunction:1;
6631 DWORD Persistent:1;
6632 DWORD Private:30;
6633 } s;
6634 } u;
6635 } TP_CALLBACK_ENVIRON_V1;
6637 typedef struct _TP_CALLBACK_ENVIRON_V3
6639 TP_VERSION Version;
6640 PTP_POOL Pool;
6641 PTP_CLEANUP_GROUP CleanupGroup;
6642 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback;
6643 PVOID RaceDll;
6644 struct _ACTIVATION_CONTEXT *ActivationContext;
6645 PTP_SIMPLE_CALLBACK FinalizationCallback;
6646 union
6648 DWORD Flags;
6649 struct
6651 DWORD LongFunction:1;
6652 DWORD Persistent:1;
6653 DWORD Private:30;
6654 } s;
6655 } u;
6656 TP_CALLBACK_PRIORITY CallbackPriority;
6657 DWORD Size;
6658 } TP_CALLBACK_ENVIRON_V3;
6660 typedef struct _TP_WORK TP_WORK, *PTP_WORK;
6661 typedef struct _TP_TIMER TP_TIMER, *PTP_TIMER;
6663 typedef DWORD TP_WAIT_RESULT;
6664 typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT;
6666 typedef struct _TP_IO TP_IO, *PTP_IO;
6668 typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON;
6670 typedef VOID (CALLBACK *PTP_WORK_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WORK);
6671 typedef VOID (CALLBACK *PTP_TIMER_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_TIMER);
6672 typedef VOID (CALLBACK *PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WAIT,TP_WAIT_RESULT);
6675 NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
6677 typedef enum _RTL_UMS_THREAD_INFO_CLASS
6679 UmsThreadInvalidInfoClass,
6680 UmsThreadUserContext,
6681 UmsThreadPriority,
6682 UmsThreadAffinity,
6683 UmsThreadTeb,
6684 UmsThreadIsSuspended,
6685 UmsThreadIsTerminated,
6686 UmsThreadMaxInfoClass
6687 } RTL_UMS_THREAD_INFO_CLASS, *PRTL_UMS_THREAD_INFO_CLASS;
6689 typedef enum _RTL_UMS_SCHEDULER_REASON
6691 UmsSchedulerStartup,
6692 UmsSchedulerThreadBlocked,
6693 UmsSchedulerThreadYield,
6694 } RTL_UMS_SCHEDULER_REASON, *PRTL_UMS_SCHEDULER_REASON;
6696 typedef void (CALLBACK *PRTL_UMS_SCHEDULER_ENTRY_POINT)(RTL_UMS_SCHEDULER_REASON,ULONG_PTR,PVOID);
6698 typedef enum _PROCESS_MITIGATION_POLICY
6700 ProcessDEPPolicy,
6701 ProcessASLRPolicy,
6702 ProcessDynamicCodePolicy,
6703 ProcessStrictHandleCheckPolicy,
6704 ProcessSystemCallDisablePolicy,
6705 ProcessMitigationOptionsMask,
6706 ProcessExtensionPointDisablePolicy,
6707 ProcessControlFlowGuardPolicy,
6708 ProcessSignaturePolicy,
6709 ProcessFontDisablePolicy,
6710 ProcessImageLoadPolicy,
6711 ProcessSystemCallFilterPolicy,
6712 ProcessPayloadRestrictionPolicy,
6713 ProcessChildProcessPolicy,
6714 ProcessSideChannelIsolationPolicy,
6715 MaxProcessMitigationPolicy
6716 } PROCESS_MITIGATION_POLICY, *PPROCESS_MITIGATION_POLICY;
6718 #ifdef __cplusplus
6720 #endif
6722 #endif /* _WINNT_ */