[PSDK]
[reactos.git] / reactos / include / psdk / winnt.h
1 #ifndef _WINNT_
2 #define _WINNT_
3
4 #if !defined(__ROS_LONG64__)
5 #ifdef __WINESRC__
6 #define __ROS_LONG64__
7 #endif
8 #endif
9
10 #ifdef __GNUC__
11 #include <msvctarget.h>
12 #endif
13
14 #ifndef __ANONYMOUS_DEFINED
15 #define __ANONYMOUS_DEFINED
16 #ifndef NONAMELESSUNION
17 #ifdef __GNUC__
18 #define _ANONYMOUS_UNION __extension__
19 #define _ANONYMOUS_STRUCT __extension__
20 #elif defined(__WATCOMC__) || defined(_MSC_VER)
21 #define _ANONYMOUS_UNION
22 #define _ANONYMOUS_STRUCT
23 #endif /* __GNUC__/__WATCOMC__ */
24 #endif /* NONAMELESSUNION */
25 #ifndef _ANONYMOUS_UNION
26 #define _ANONYMOUS_UNION
27 #define _UNION_NAME(x) x
28 #define DUMMYUNIONNAME u
29 #define DUMMYUNIONNAME1 u1
30 #define DUMMYUNIONNAME2 u2
31 #define DUMMYUNIONNAME3 u3
32 #define DUMMYUNIONNAME4 u4
33 #define DUMMYUNIONNAME5 u5
34 #define DUMMYUNIONNAME6 u6
35 #define DUMMYUNIONNAME7 u7
36 #define DUMMYUNIONNAME8 u8
37 #else
38 #define _UNION_NAME(x)
39 #define DUMMYUNIONNAME
40 #define DUMMYUNIONNAME1
41 #define DUMMYUNIONNAME2
42 #define DUMMYUNIONNAME3
43 #define DUMMYUNIONNAME4
44 #define DUMMYUNIONNAME5
45 #define DUMMYUNIONNAME6
46 #define DUMMYUNIONNAME7
47 #define DUMMYUNIONNAME8
48 #endif
49 #ifndef _ANONYMOUS_STRUCT
50 #define _ANONYMOUS_STRUCT
51 #define _STRUCT_NAME(x) x
52 #define DUMMYSTRUCTNAME s
53 #define DUMMYSTRUCTNAME1 s1
54 #define DUMMYSTRUCTNAME2 s2
55 #define DUMMYSTRUCTNAME3 s3
56 #define DUMMYSTRUCTNAME4 s4
57 #define DUMMYSTRUCTNAME5 s5
58 #else
59 #define _STRUCT_NAME(x)
60 #define DUMMYSTRUCTNAME
61 #define DUMMYSTRUCTNAME1
62 #define DUMMYSTRUCTNAME2
63 #define DUMMYSTRUCTNAME3
64 #define DUMMYSTRUCTNAME4
65 #define DUMMYSTRUCTNAME5
66 #endif
67 #endif /* __ANONYMOUS_DEFINED */
68
69 #undef __C89_NAMELESS
70 #undef __C89_NAMELESSSTRUCTNAME
71 #undef __C89_NAMELESSSTRUCTNAME1
72 #undef __C89_NAMELESSSTRUCTNAME2
73 #undef __C89_NAMELESSSTRUCTNAME3
74 #undef __C89_NAMELESSSTRUCTNAME4
75 #undef __C89_NAMELESSSTRUCTNAME5
76 #undef __C89_NAMELESSUNIONNAME
77 #undef __C89_NAMELESSUNIONNAME1
78 #undef __C89_NAMELESSUNIONNAME2
79 #undef __C89_NAMELESSUNIONNAME3
80 #undef __C89_NAMELESSUNIONNAME4
81 #undef __C89_NAMELESSUNIONNAME5
82 #undef __C89_NAMELESSUNIONNAME6
83 #undef __C89_NAMELESSUNIONNAME7
84 #undef __C89_NAMELESSUNIONNAME8
85
86 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
87 # ifdef __GNUC__
88 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
89 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
90 # define __C89_NAMELESS __extension__
91 # endif
92 # elif defined(_MSC_VER)
93 # define __C89_NAMELESS
94 # endif
95 #endif
96
97 #ifdef __C89_NAMELESS
98 # define __C89_NAMELESSSTRUCTNAME
99 # define __C89_NAMELESSSTRUCTNAME1
100 # define __C89_NAMELESSSTRUCTNAME2
101 # define __C89_NAMELESSSTRUCTNAME3
102 # define __C89_NAMELESSSTRUCTNAME4
103 # define __C89_NAMELESSSTRUCTNAME5
104 # define __C89_NAMELESSUNIONNAME
105 # define __C89_NAMELESSUNIONNAME1
106 # define __C89_NAMELESSUNIONNAME2
107 # define __C89_NAMELESSUNIONNAME3
108 # define __C89_NAMELESSUNIONNAME4
109 # define __C89_NAMELESSUNIONNAME5
110 # define __C89_NAMELESSUNIONNAME6
111 # define __C89_NAMELESSUNIONNAME7
112 # define __C89_NAMELESSUNIONNAME8
113 #else
114 # define __C89_NAMELESS
115 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
116 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
117 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
118 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
119 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
120 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
121 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
122 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
123 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
124 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
125 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
126 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
127 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
128 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
129 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
130 #endif
131
132 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
133 #define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
134 #define DBG_UNREFERENCED_PARAMETER(P) {(P)=(P);}
135 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
136
137 #ifndef DECLSPEC_ALIGN
138 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
139 # define DECLSPEC_ALIGN(x) __declspec(align(x))
140 # elif defined(__GNUC__)
141 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
142 # else
143 # define DECLSPEC_ALIGN(x)
144 # endif
145 #endif
146
147 #ifndef NOP_FUNCTION
148 #if (_MSC_VER >= 1210)
149 #define NOP_FUNCTION __noop
150 #else
151 #define NOP_FUNCTION (void)0
152 #endif
153 #endif
154
155 # define DECLSPEC_HIDDEN
156
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160
161 #include <excpt.h>
162 #include <basetsd.h>
163 #include <guiddef.h>
164
165 #include <ctype.h>
166 #undef __need_wchar_t
167
168 #include <winerror.h>
169 #include <stddef.h>
170 #include <sdkddkver.h>
171
172 #ifndef RC_INVOKED
173 #include <string.h>
174
175 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
176 #define ALIGNMENT_MACHINE
177 #define UNALIGNED __unaligned
178 #if defined(_WIN64)
179 #define UNALIGNED64 __unaligned
180 #else
181 #define UNALIGNED64
182 #endif
183 #else
184 #undef ALIGNMENT_MACHINE
185 #define UNALIGNED
186 #define UNALIGNED64
187 #endif
188
189 #if defined(_WIN64) || defined(_M_ALPHA)
190 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
191 #define MEMORY_ALLOCATION_ALIGNMENT 16
192 #else
193 #define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
194 #define MEMORY_ALLOCATION_ALIGNMENT 8
195 #endif
196
197 /* Returns the type's alignment */
198 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
199 #define TYPE_ALIGNMENT(t) __alignof(t)
200 #else
201 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
202 #endif
203
204 #if defined(_AMD64_) || defined(_X86_)
205 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG)
206 #elif defined(_IA64_) || defined(_ARM_)
207 #define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG))
208 #else
209 #error "unknown architecture"
210 #endif
211
212 #ifndef DECLSPEC_NOVTABLE
213 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
214 # define DECLSPEC_NOVTABLE __declspec(novtable)
215 # else
216 # define DECLSPEC_NOVTABLE
217 # endif
218 #endif
219
220 #ifndef DECLSPEC_SELECTANY
221 #if (_MSC_VER >= 1100) || defined(__GNUC__)
222 #define DECLSPEC_SELECTANY __declspec(selectany)
223 #else
224 #define DECLSPEC_SELECTANY
225 #endif
226 #endif
227
228 #ifndef DECLSPEC_ADDRSAFE
229 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
230 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
231 #else
232 #define DECLSPEC_ADDRSAFE
233 #endif
234 #endif
235
236 /*#ifdef _WINE*/
237 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
238 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
239 #else
240 #define __WINE_ALLOC_SIZE(x)
241 #endif
242 /*#endif*/
243
244 #ifndef FORCEINLINE
245 #if (_MSC_VER >= 1200)
246 #define FORCEINLINE __forceinline
247 #elif (_MSC_VER)
248 #define FORCEINLINE __inline
249 #else
250 # if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
251 # define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
252 # else
253 # define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
254 # endif
255 #endif
256 #endif
257
258 #if !defined(_NTSYSTEM_)
259 #define NTSYSAPI DECLSPEC_IMPORT
260 #define NTSYSCALLAPI DECLSPEC_IMPORT
261 #else
262 #define NTSYSAPI
263 #if defined(_NTDLLBUILD_)
264 #define NTSYSCALLAPI
265 #else
266 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
267 #endif
268 #endif
269
270 #ifndef VOID
271 #define VOID void
272 #endif
273 typedef char CHAR;
274 typedef short SHORT;
275 #if !defined(__ROS_LONG64__) || defined(_M_AMD64)
276 typedef long LONG;
277 #else
278 typedef int LONG;
279 #endif
280 typedef char CCHAR, *PCCHAR;
281 typedef void *PVOID;
282
283 /* FIXME for __WIN64 */
284 #ifndef __ptr64
285 #define __ptr64
286 #endif
287 typedef void* __ptr64 PVOID64;
288
289 #ifdef __cplusplus
290 # define EXTERN_C extern "C"
291 #else
292 # define EXTERN_C extern
293 #endif
294
295 #define STDMETHODCALLTYPE __stdcall
296 #define STDMETHODVCALLTYPE __cdecl
297 #define STDAPICALLTYPE __stdcall
298 #define STDAPIVCALLTYPE __cdecl
299
300 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
301 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
302 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
303 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
304 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
305 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
306 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
307 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
308
309 /* C99 restrict support */
310 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
311 #if defined(_MSC_VER) && defined(_M_MRX000)
312 #define RESTRICTED_POINTER __restrict
313 #elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
314 #define RESTRICTED_POINTER __restrict
315 #else
316 #define RESTRICTED_POINTER
317 #endif
318 #else
319 #define RESTRICTED_POINTER
320 #endif
321
322 typedef wchar_t WCHAR;
323
324 typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR;
325 typedef _Null_terminated_ PWSTR *PZPWSTR;
326 typedef _Null_terminated_ CONST PWSTR *PCZPWSTR;
327 typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
328 typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR;
329 typedef _Null_terminated_ PCWSTR *PZPCWSTR;
330 typedef _Null_terminated_ CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
331
332 typedef _NullNull_terminated_ WCHAR *PZZWSTR;
333 typedef _NullNull_terminated_ CONST WCHAR *PCZZWSTR;
334 typedef _NullNull_terminated_ WCHAR UNALIGNED *PUZZWSTR;
335 typedef _NullNull_terminated_ CONST WCHAR UNALIGNED *PCUZZWSTR;
336
337 typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
338 typedef CONST WCHAR *LPCWCH, *PCWCH;
339 typedef CHAR *PCHAR, *LPCH, *PCH;
340 typedef CONST CHAR *LPCCH, *PCCH;
341
342 typedef _Null_terminated_ CHAR *NPSTR, *LPSTR, *PSTR;
343 typedef _Null_terminated_ PSTR *PZPSTR;
344 typedef _Null_terminated_ CONST PSTR *PCZPSTR;
345 typedef _Null_terminated_ CONST CHAR *LPCSTR, *PCSTR;
346 typedef _Null_terminated_ PCSTR *PZPCSTR;
347
348 typedef _NullNull_terminated_ CHAR *PZZSTR;
349 typedef _NullNull_terminated_ CONST CHAR *PCZZSTR;
350
351 #ifdef UNICODE
352 #ifndef _TCHAR_DEFINED
353 #define _TCHAR_DEFINED
354 typedef WCHAR TCHAR,*PTCHAR;
355 typedef WCHAR TBYTE ,*PTBYTE;
356 #endif
357 typedef LPWSTR LPTCH,PTCH,PTSTR,LPTSTR,LP;
358 typedef LPCWSTR PCTSTR,LPCTSTR;
359 typedef LPUWSTR PUTSTR,LPUTSTR;
360 typedef LPCUWSTR PCUTSTR,LPCUTSTR;
361 #define __TEXT(quote) L##quote
362 #else
363 #ifndef _TCHAR_DEFINED
364 #define _TCHAR_DEFINED
365 typedef char TCHAR,*PTCHAR;
366 typedef unsigned char TBYTE ,*PTBYTE;
367 #endif
368 typedef LPSTR LPTCH,PTCH,PTSTR,LPTSTR,PUTSTR,LPUTSTR;
369 typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR;
370 #define __TEXT(quote) quote
371 #endif
372
373 #define TEXT(quote) __TEXT(quote)
374
375 typedef SHORT *PSHORT;
376 typedef LONG *PLONG;
377 #ifdef STRICT
378 typedef void *HANDLE;
379 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
380 #else
381 typedef PVOID HANDLE;
382 #define DECLARE_HANDLE(n) typedef HANDLE n
383 #endif
384 typedef HANDLE *PHANDLE;
385 typedef DWORD LCID;
386 typedef PDWORD PLCID;
387 typedef WORD LANGID;
388 #ifdef __GNUC__
389 #define _HAVE_INT64
390 #ifndef _INTEGRAL_MAX_BITS
391 # define _INTEGRAL_MAX_BITS 64
392 #endif
393 #undef __int64
394 #define __int64 long long
395 #elif (defined(__WATCOMC__) || defined(_MSC_VER)) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
396 #define _HAVE_INT64
397 #endif /* __GNUC__/__WATCOMC */
398 #if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
399 typedef __int64 LONGLONG;
400 typedef unsigned __int64 DWORDLONG;
401 #else
402 typedef double LONGLONG,DWORDLONG;
403 #endif
404 typedef LONGLONG *PLONGLONG;
405 typedef DWORDLONG *PDWORDLONG;
406 typedef DWORDLONG ULONGLONG,*PULONGLONG;
407 typedef LONGLONG USN;
408 #ifdef _HAVE_INT64
409 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
410 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
411 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
412 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
413 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
414 #endif
415 #define ANSI_NULL ((CHAR)0)
416 #define UNICODE_NULL ((WCHAR)0)
417 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
418 #define UNICODE_STRING_MAX_CHARS (32767)
419 typedef BYTE BOOLEAN,*PBOOLEAN;
420 #endif
421 typedef BYTE FCHAR;
422 typedef WORD FSHORT;
423 typedef DWORD FLONG;
424
425 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
426
427 /* Eliminate Microsoft C/C++ compiler warning 4715 */
428 #if defined(_MSC_VER) && (_MSC_VER > 1200)
429 # define DEFAULT_UNREACHABLE default: __assume(0)
430 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
431 # define DEFAULT_UNREACHABLE default: __builtin_unreachable()
432 #else
433 # define DEFAULT_UNREACHABLE default: break
434 #endif
435
436 #include "intrin.h"
437
438 #define NTAPI __stdcall
439 #include <basetsd.h>
440
441 #ifdef _MSC_VER
442 #pragma warning(push)
443 #pragma warning(disable:4201)
444 #pragma warning(disable:4214)
445 #pragma warning(disable:4820)
446 #endif
447
448 #define ACE_OBJECT_TYPE_PRESENT 0x00000001
449 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
450 #define APPLICATION_ERROR_MASK 0x20000000
451 #define ERROR_SEVERITY_SUCCESS 0x00000000
452 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
453 #define ERROR_SEVERITY_WARNING 0x80000000
454 #define ERROR_SEVERITY_ERROR 0xC0000000
455
456 #ifdef __cplusplus
457 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
458 extern "C++" { \
459 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
460 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
461 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
462 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
463 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
464 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
465 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
466 }
467 #else
468 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
469 #endif
470
471 /* also in ddk/ntifs.h */
472 #define COMPRESSION_FORMAT_NONE (0x0000)
473 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
474 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
475 #define COMPRESSION_ENGINE_STANDARD (0x0000)
476 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
477 #define COMPRESSION_ENGINE_HIBER (0x0200)
478 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
479 #define ACCESS_DENIED_ACE_TYPE (0x1)
480 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
481 #define SYSTEM_ALARM_ACE_TYPE (0x3)
482 /*end ntifs.h */
483 #define ANYSIZE_ARRAY 1
484 #define OBJECT_INHERIT_ACE 1
485 #define CONTAINER_INHERIT_ACE 2
486 #define NO_PROPAGATE_INHERIT_ACE 4
487 #define INHERIT_ONLY_ACE 8
488 #define INHERITED_ACE 16
489 #define VALID_INHERIT_FLAGS 0x1F
490 #define SUCCESSFUL_ACCESS_ACE_FLAG 64
491 #define FAILED_ACCESS_ACE_FLAG 128
492 #define DELETE 0x00010000L
493 #define READ_CONTROL 0x20000L
494 #define WRITE_DAC 0x40000L
495 #define WRITE_OWNER 0x80000L
496 #define SYNCHRONIZE 0x100000L
497 #define STANDARD_RIGHTS_REQUIRED 0xF0000
498 #define STANDARD_RIGHTS_READ 0x20000
499 #define STANDARD_RIGHTS_WRITE 0x20000
500 #define STANDARD_RIGHTS_EXECUTE 0x20000
501 #define STANDARD_RIGHTS_ALL 0x1F0000
502 #define SPECIFIC_RIGHTS_ALL 0xFFFF
503 #define ACCESS_SYSTEM_SECURITY 0x1000000
504
505 #define REG_STANDARD_FORMAT 1
506 #define REG_LATEST_FORMAT 2
507 #define REG_NO_COMPRESSION 4
508
509 #ifndef WIN32_NO_STATUS
510
511 #define STATUS_WAIT_0 ((DWORD)0x00000000)
512 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080)
513 #define STATUS_USER_APC ((DWORD)0x000000C0)
514 #define STATUS_TIMEOUT ((DWORD)0x00000102)
515 #define STATUS_PENDING ((DWORD)0x00000103)
516 #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005)
517 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001)
518 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002)
519 #define STATUS_BREAKPOINT ((DWORD)0x80000003)
520 #define STATUS_SINGLE_STEP ((DWORD)0x80000004)
521 #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005)
522 #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006)
523 #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008)
524 #define STATUS_NO_MEMORY ((DWORD)0xC0000017)
525 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D)
526 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025)
527 #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026)
528 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C)
529 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D)
530 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E)
531 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F)
532 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090)
533 #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091)
534 #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092)
535 #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093)
536 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094)
537 #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095)
538 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096)
539 #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD)
540 #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A)
541 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4)
542 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5)
543 #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9)
544 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F)
545 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010)
546
547 #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001)
548 #define DBG_CONTINUE ((DWORD)0x00010002)
549 #define DBG_TERMINATE_THREAD ((DWORD)0x40010003)
550 #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004)
551 #define DBG_CONTROL_C ((DWORD)0x40010005)
552 #define DBG_CONTROL_BREAK ((DWORD)0x40010008)
553 #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009)
554 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001)
555
556 #endif /* WIN32_NO_STATUS */
557
558 #define MAXIMUM_ALLOWED 0x2000000
559 #define GENERIC_READ 0x80000000
560 #define GENERIC_WRITE 0x40000000
561 #define GENERIC_EXECUTE 0x20000000
562 #define GENERIC_ALL 0x10000000
563
564 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
565
566 /* Also in ddk/winddk.h */
567 #define FILE_LIST_DIRECTORY 0x00000001
568 #define FILE_READ_DATA 0x00000001
569 #define FILE_ADD_FILE 0x00000002
570 #define FILE_WRITE_DATA 0x00000002
571 #define FILE_ADD_SUBDIRECTORY 0x00000004
572 #define FILE_APPEND_DATA 0x00000004
573 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
574 #define FILE_READ_EA 0x00000008
575 #define FILE_READ_PROPERTIES 0x00000008
576 #define FILE_WRITE_EA 0x00000010
577 #define FILE_WRITE_PROPERTIES 0x00000010
578 #define FILE_EXECUTE 0x00000020
579 #define FILE_TRAVERSE 0x00000020
580 #define FILE_DELETE_CHILD 0x00000040
581 #define FILE_READ_ATTRIBUTES 0x00000080
582 #define FILE_WRITE_ATTRIBUTES 0x00000100
583
584 #define FILE_SHARE_READ 0x00000001
585 #define FILE_SHARE_WRITE 0x00000002
586 #define FILE_SHARE_DELETE 0x00000004
587 #define FILE_SHARE_VALID_FLAGS 0x00000007
588
589 #define FILE_ATTRIBUTE_READONLY 0x00000001
590 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
591 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
592 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
593 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
594 #define FILE_ATTRIBUTE_DEVICE 0x00000040
595 #define FILE_ATTRIBUTE_NORMAL 0x00000080
596 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
597 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
598 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
599 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
600 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
601 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
602 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
603 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
604 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
605
606 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
607 #define FILE_STRUCTURED_STORAGE 0x00000441
608
609 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
610 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
611 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
612 #define FILE_VALID_SET_FLAGS 0x00000036
613
614 #define FILE_DIRECTORY_FILE 0x00000001
615 #define FILE_WRITE_THROUGH 0x00000002
616 #define FILE_SEQUENTIAL_ONLY 0x00000004
617 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
618 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
619 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
620 #define FILE_NON_DIRECTORY_FILE 0x00000040
621 #define FILE_CREATE_TREE_CONNECTION 0x00000080
622 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
623 #define FILE_NO_EA_KNOWLEDGE 0x00000200
624 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
625 #define FILE_RANDOM_ACCESS 0x00000800
626 #define FILE_DELETE_ON_CLOSE 0x00001000
627 #define FILE_OPEN_BY_FILE_ID 0x00002000
628 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
629 #define FILE_NO_COMPRESSION 0x00008000
630 #define FILE_RESERVE_OPFILTER 0x00100000
631 #define FILE_OPEN_REPARSE_POINT 0x00200000
632 #define FILE_OPEN_NO_RECALL 0x00400000
633 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
634
635 #define FILE_ALL_ACCESS \
636 (STANDARD_RIGHTS_REQUIRED | \
637 SYNCHRONIZE | \
638 0x1FF)
639
640 #define FILE_GENERIC_EXECUTE \
641 (STANDARD_RIGHTS_EXECUTE | \
642 FILE_READ_ATTRIBUTES | \
643 FILE_EXECUTE | \
644 SYNCHRONIZE)
645
646 #define FILE_GENERIC_READ \
647 (STANDARD_RIGHTS_READ | \
648 FILE_READ_DATA | \
649 FILE_READ_ATTRIBUTES | \
650 FILE_READ_EA | \
651 SYNCHRONIZE)
652
653 #define FILE_GENERIC_WRITE \
654 (STANDARD_RIGHTS_WRITE | \
655 FILE_WRITE_DATA | \
656 FILE_WRITE_ATTRIBUTES | \
657 FILE_WRITE_EA | \
658 FILE_APPEND_DATA | \
659 SYNCHRONIZE)
660 /* end winddk.h */
661 /* also in ddk/ntifs.h */
662 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
663 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
664 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
665 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
666 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
667 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
668 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
669 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
670 #define FILE_NOTIFY_CHANGE_EA 0x00000080
671 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
672 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
673 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
674 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
675 #define FILE_NOTIFY_VALID_MASK 0x00000fff
676
677 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
678 #define FILE_CASE_PRESERVED_NAMES 0x00000002
679 #define FILE_UNICODE_ON_DISK 0x00000004
680 #define FILE_PERSISTENT_ACLS 0x00000008
681 #define FILE_FILE_COMPRESSION 0x00000010
682 #define FILE_VOLUME_QUOTAS 0x00000020
683 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
684 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
685 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
686 #define FS_LFN_APIS 0x00004000
687 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
688 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
689 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
690 #define FILE_NAMED_STREAMS 0x00040000
691
692 #define IO_COMPLETION_QUERY_STATE 0x0001
693 #define IO_COMPLETION_MODIFY_STATE 0x0002
694 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
695 /* end ntifs.h */
696
697 /* also in ddk/winddk.h */
698 #define DUPLICATE_CLOSE_SOURCE 0x00000001
699 #define DUPLICATE_SAME_ACCESS 0x00000002
700 /* end winddk.k */
701
702 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
703 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
704 #define PROCESS_TERMINATE 1
705 #define PROCESS_CREATE_THREAD 2
706 #define PROCESS_SET_SESSIONID 4
707 #define PROCESS_VM_OPERATION 8
708 #define PROCESS_VM_READ 16
709 #define PROCESS_VM_WRITE 32
710 #define PROCESS_CREATE_PROCESS 128
711 #define PROCESS_SET_QUOTA 256
712 #define PROCESS_SET_INFORMATION 512
713 #define PROCESS_QUERY_INFORMATION 1024
714 #define PROCESS_SUSPEND_RESUME 2048
715 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
716 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
717 #define PROCESS_DUP_HANDLE 64
718 #define THREAD_TERMINATE 1
719 #define THREAD_SUSPEND_RESUME 2
720 #define THREAD_GET_CONTEXT 8
721 #define THREAD_SET_CONTEXT 16
722 #define THREAD_SET_INFORMATION 32
723 #define THREAD_QUERY_INFORMATION 64
724 #define THREAD_SET_THREAD_TOKEN 128
725 #define THREAD_IMPERSONATE 256
726 #define THREAD_DIRECT_IMPERSONATION 0x200
727 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
728 #define MUTANT_QUERY_STATE 0x0001
729 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
730 #define TIMER_QUERY_STATE 0x0001
731 #define TIMER_MODIFY_STATE 0x0002
732 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
733 #define THREAD_BASE_PRIORITY_LOWRT 15
734 #define THREAD_BASE_PRIORITY_MAX 2
735 #define THREAD_BASE_PRIORITY_MIN (-2)
736 #define THREAD_BASE_PRIORITY_IDLE (-15)
737 /*
738 * To prevent gcc compiler warnings, bracket these defines when initialising
739 * a SID_IDENTIFIER_AUTHORITY, eg.
740 * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
741 */
742 #define SID_MAX_SUB_AUTHORITIES 15
743
744 /* security entities */
745 #define SECURITY_NULL_RID (0x00000000L)
746 #define SECURITY_WORLD_RID (0x00000000L)
747 #define SECURITY_LOCAL_RID (0X00000000L)
748
749 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
750
751 /* S-1-1 */
752 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
753
754 /* S-1-2 */
755 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
756
757 /* S-1-3 */
758 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
759 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
760 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
761 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
762 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
763
764 /* S-1-4 */
765 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
766
767 /* S-1-5 */
768 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
769 #define SECURITY_DIALUP_RID 0x00000001L
770 #define SECURITY_NETWORK_RID 0x00000002L
771 #define SECURITY_BATCH_RID 0x00000003L
772 #define SECURITY_INTERACTIVE_RID 0x00000004L
773 #define SECURITY_LOGON_IDS_RID 0x00000005L
774 #define SECURITY_SERVICE_RID 0x00000006L
775 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
776 #define SECURITY_PROXY_RID 0x00000008L
777 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
778 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
779 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
780 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
781 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
782 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
783 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
784 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
785 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
786 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
787 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
788 #define SECURITY_NT_NON_UNIQUE 0x00000015L
789 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
790
791 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
792 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
793 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
794 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
795 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
796
797 #define SECURITY_LOGON_IDS_RID_COUNT 0x3
798 #define SID_REVISION 1
799
800 #define FOREST_USER_RID_MAX 0x000001F3L
801 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
802 #define DOMAIN_USER_RID_GUEST 0x000001F5L
803 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
804 #define DOMAIN_USER_RID_MAX 0x000003E7L
805
806 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
807 #define DOMAIN_GROUP_RID_USERS 0x00000201L
808 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
809 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
810 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
811 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
812 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
813 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
814 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
815
816 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
817 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
818 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
819 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
820 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
821 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
822 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
823
824 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
825 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
826 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
827 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
828
829 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
830 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
831 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
832 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
833
834 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
835 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
836 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
837 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
838 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
839 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
840
841 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
842 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
843 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
844 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
845 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
846
847 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
848
849 typedef enum {
850 WinNullSid = 0,
851 WinWorldSid = 1,
852 WinLocalSid = 2,
853 WinCreatorOwnerSid = 3,
854 WinCreatorGroupSid = 4,
855 WinCreatorOwnerServerSid = 5,
856 WinCreatorGroupServerSid = 6,
857 WinNtAuthoritySid = 7,
858 WinDialupSid = 8,
859 WinNetworkSid = 9,
860 WinBatchSid = 10,
861 WinInteractiveSid = 11,
862 WinServiceSid = 12,
863 WinAnonymousSid = 13,
864 WinProxySid = 14,
865 WinEnterpriseControllersSid = 15,
866 WinSelfSid = 16,
867 WinAuthenticatedUserSid = 17,
868 WinRestrictedCodeSid = 18,
869 WinTerminalServerSid = 19,
870 WinRemoteLogonIdSid = 20,
871 WinLogonIdsSid = 21,
872 WinLocalSystemSid = 22,
873 WinLocalServiceSid = 23,
874 WinNetworkServiceSid = 24,
875 WinBuiltinDomainSid = 25,
876 WinBuiltinAdministratorsSid = 26,
877 WinBuiltinUsersSid = 27,
878 WinBuiltinGuestsSid = 28,
879 WinBuiltinPowerUsersSid = 29,
880 WinBuiltinAccountOperatorsSid = 30,
881 WinBuiltinSystemOperatorsSid = 31,
882 WinBuiltinPrintOperatorsSid = 32,
883 WinBuiltinBackupOperatorsSid = 33,
884 WinBuiltinReplicatorSid = 34,
885 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
886 WinBuiltinRemoteDesktopUsersSid = 36,
887 WinBuiltinNetworkConfigurationOperatorsSid = 37,
888 WinAccountAdministratorSid = 38,
889 WinAccountGuestSid = 39,
890 WinAccountKrbtgtSid = 40,
891 WinAccountDomainAdminsSid = 41,
892 WinAccountDomainUsersSid = 42,
893 WinAccountDomainGuestsSid = 43,
894 WinAccountComputersSid = 44,
895 WinAccountControllersSid = 45,
896 WinAccountCertAdminsSid = 46,
897 WinAccountSchemaAdminsSid = 47,
898 WinAccountEnterpriseAdminsSid = 48,
899 WinAccountPolicyAdminsSid = 49,
900 WinAccountRasAndIasServersSid = 50,
901 WinNTLMAuthenticationSid = 51,
902 WinDigestAuthenticationSid = 52,
903 WinSChannelAuthenticationSid = 53,
904 WinThisOrganizationSid = 54,
905 WinOtherOrganizationSid = 55,
906 WinBuiltinIncomingForestTrustBuildersSid = 56,
907 WinBuiltinPerfMonitoringUsersSid = 57,
908 WinBuiltinPerfLoggingUsersSid = 58,
909 WinBuiltinAuthorizationAccessSid = 59,
910 WinBuiltinTerminalServerLicenseServersSid = 60,
911 WinBuiltinDCOMUsersSid = 61,
912 WinBuiltinIUsersSid = 62,
913 WinIUserSid = 63,
914 WinBuiltinCryptoOperatorsSid = 64,
915 WinUntrustedLabelSid = 65,
916 WinLowLabelSid = 66,
917 WinMediumLabelSid = 67,
918 WinHighLabelSid = 68,
919 WinSystemLabelSid = 69,
920 WinWriteRestrictedCodeSid = 70,
921 WinCreatorOwnerRightsSid = 71,
922 WinCacheablePrincipalsGroupSid = 72,
923 WinNonCacheablePrincipalsGroupSid = 73,
924 WinEnterpriseReadonlyControllersSid = 74,
925 WinAccountReadonlyControllersSid = 75,
926 WinBuiltinEventLogReadersGroup = 76,
927 WinNewEnterpriseReadonlyControllersSid = 77,
928 WinBuiltinCertSvcDComAccessGroup = 78,
929 WinMediumPlusLabelSid = 79,
930 WinLocalLogonSid = 80,
931 WinConsoleLogonSid = 81,
932 WinThisOrganizationCertificateSid = 82,
933 } WELL_KNOWN_SID_TYPE;
934
935 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
936 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
937 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
938 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
939 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
940 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
941 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
942 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
943 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
944 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
945 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
946 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
947 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
948 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
949 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
950 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
951 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
952 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
953 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
954 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
955 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
956 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
957 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
958 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
959 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
960 #define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege")
961 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
962 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
963 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
964 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
965
966 #define SE_GROUP_MANDATORY 0x00000001
967 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
968 #define SE_GROUP_ENABLED 0x00000004
969 #define SE_GROUP_OWNER 0x00000008
970 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
971 #define SE_GROUP_INTEGRITY 0x00000020
972 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
973 #define SE_GROUP_LOGON_ID 0xC0000000
974 #define SE_GROUP_RESOURCE 0x20000000
975 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
976
977 /*
978 * Product types
979 */
980 #define PRODUCT_UNDEFINED 0x00000000
981 #define PRODUCT_ULTIMATE 0x00000001
982 #define PRODUCT_HOME_BASIC 0x00000002
983 #define PRODUCT_HOME_PREMIUM 0x00000003
984 #define PRODUCT_ENTERPRISE 0x00000004
985 #define PRODUCT_HOME_BASIC_N 0x00000005
986 #define PRODUCT_BUSINESS 0x00000006
987 #define PRODUCT_STANDARD_SERVER 0x00000007
988 #define PRODUCT_DATACENTER_SERVER 0x00000008
989 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
990 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
991 #define PRODUCT_STARTER 0x0000000B
992 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
993 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
994 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
995 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
996 #define PRODUCT_BUSINESS_N 0x00000010
997 #define PRODUCT_WEB_SERVER 0x00000011
998 #define PRODUCT_CLUSTER_SERVER 0x00000012
999 #define PRODUCT_HOME_SERVER 0x00000013
1000 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1001 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1002 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1003 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1004 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1005 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
1006 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1007 #define PRODUCT_ENTERPRISE_N 0x0000001B
1008 #define PRODUCT_ULTIMATE_N 0x0000001C
1009 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1010 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1011 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1012 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1013 #define PRODUCT_SERVER_FOUNDATION 0x00000021
1014 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
1015 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1016 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1017 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
1018 #define PRODUCT_SERVER_V 0x00000025
1019 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1020 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1021 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1022 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1023 #define PRODUCT_HYPERV 0x0000002A
1024 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
1025 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
1026 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
1027 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
1028 #define PRODUCT_STARTER_N 0x0000002F
1029 #define PRODUCT_PROFESSIONAL 0x00000030
1030 #define PRODUCT_PROFESSIONAL_N 0x00000031
1031 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
1032 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
1033 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
1034 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
1035 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
1036 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
1037 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
1038 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
1039 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
1040 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
1041 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
1042 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
1043 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
1044 #define PRODUCT_EMBEDDED 0x00000041
1045 #define PRODUCT_STARTER_E 0x00000042
1046 #define PRODUCT_HOME_BASIC_E 0x00000043
1047 #define PRODUCT_HOME_PREMIUM_E 0x00000044
1048 #define PRODUCT_PROFESSIONAL_E 0x00000045
1049 #define PRODUCT_ENTERPRISE_E 0x00000046
1050 #define PRODUCT_ULTIMATE_E 0x00000047
1051 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
1052 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
1053 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
1054 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
1055 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
1056 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
1057 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
1058 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
1059 #define PRODUCT_CORE_ARM 0x00000061
1060 #define PRODUCT_CORE_N 0x00000062
1061 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
1062 #define PRODUCT_CORE_LANGUAGESPECIFIC 0x00000064
1063 #define PRODUCT_CORE 0x00000065
1064 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
1065 #define PRODUCT_UNLICENSED 0xABCDABCD
1066
1067 #define LANG_NEUTRAL 0x00
1068 #define LANG_INVARIANT 0x7f
1069 #define LANG_AFRIKAANS 0x36
1070 #define LANG_ALBANIAN 0x1c
1071 #define LANG_ALSATIAN 0x84
1072 #define LANG_AMHARIC 0x5e
1073 #define LANG_ARABIC 0x01
1074 #define LANG_ARMENIAN 0x2b
1075 #define LANG_ASSAMESE 0x4d
1076 #define LANG_AZERI 0x2c
1077 #define LANG_BASHKIR 0x6d
1078 #define LANG_BASQUE 0x2d
1079 #define LANG_BELARUSIAN 0x23
1080 #define LANG_BENGALI 0x45
1081 #define LANG_BOSNIAN 0x1a
1082 #define LANG_BRETON 0x7e
1083 #define LANG_BULGARIAN 0x02
1084 #define LANG_CATALAN 0x03
1085 #define LANG_CHINESE 0x04
1086 #define LANG_CHINESE_SIMPLIFIED 0x04
1087 #define LANG_CHINESE_TRADITIONAL 0x7c04
1088 #define LANG_CORSICAN 0x83
1089 #define LANG_CROATIAN 0x1a
1090 #define LANG_CROATIAN 0x1a
1091 #define LANG_CZECH 0x05
1092 #define LANG_DANISH 0x06
1093 #define LANG_DARI 0x8c
1094 #define LANG_DIVEHI 0x65
1095 #define LANG_DUTCH 0x13
1096 #define LANG_ENGLISH 0x09
1097 #define LANG_ESTONIAN 0x25
1098 #define LANG_FAEROESE 0x38
1099 #define LANG_FILIPINO 0x64
1100 #define LANG_FINNISH 0x0b
1101 #define LANG_FRENCH 0x0c
1102 #define LANG_FRISIAN 0x62
1103 #define LANG_GALICIAN 0x56
1104 #define LANG_GEORGIAN 0x37
1105 #define LANG_GERMAN 0x07
1106 #define LANG_GREEK 0x08
1107 #define LANG_GREENLANDIC 0x6f
1108 #define LANG_GUJARATI 0x47
1109 #define LANG_HAUSA 0x68
1110 #define LANG_HEBREW 0x0d
1111 #define LANG_HINDI 0x39
1112 #define LANG_HUNGARIAN 0x0e
1113 #define LANG_ICELANDIC 0x0f
1114 #define LANG_IGBO 0x70
1115 #define LANG_INDONESIAN 0x21
1116 #define LANG_INUKTITUT 0x5d
1117 #define LANG_IRISH 0x3c
1118 #define LANG_ITALIAN 0x10
1119 #define LANG_JAPANESE 0x11
1120 #define LANG_KANNADA 0x4b
1121 #define LANG_KASHMIRI 0x60
1122 #define LANG_KAZAK 0x3f
1123 #define LANG_KHMER 0x53
1124 #define LANG_KICHE 0x86
1125 #define LANG_KINYARWANDA 0x87
1126 #define LANG_KONKANI 0x57
1127 #define LANG_KOREAN 0x12
1128 #define LANG_KYRGYZ 0x40
1129 #define LANG_LAO 0x54
1130 #define LANG_LATVIAN 0x26
1131 #define LANG_LITHUANIAN 0x27
1132 #define LANG_LOWER_SORBIAN 0x2e
1133 #define LANG_LUXEMBOURGISH 0x6e
1134 #define LANG_MACEDONIAN 0x2f
1135 #define LANG_MALAY 0x3e
1136 #define LANG_MALAYALAM 0x4c
1137 #define LANG_MALTESE 0x3a
1138 #define LANG_MANIPURI 0x58
1139 #define LANG_MAORI 0x81
1140 #define LANG_MAPUDUNGUN 0x7a
1141 #define LANG_MARATHI 0x4e
1142 #define LANG_MOHAWK 0x7c
1143 #define LANG_MONGOLIAN 0x50
1144 #define LANG_NEPALI 0x61
1145 #define LANG_NORWEGIAN 0x14
1146 #define LANG_OCCITAN 0x82
1147 #define LANG_ORIYA 0x48
1148 #define LANG_PASHTO 0x63
1149 #define LANG_FARSI 0x29
1150 #define LANG_PERSIAN 0x29
1151 #define LANG_POLISH 0x15
1152 #define LANG_PORTUGUESE 0x16
1153 #define LANG_PUNJABI 0x46
1154 #define LANG_QUECHUA 0x6b
1155 #define LANG_ROMANIAN 0x18
1156 #define LANG_ROMANSH 0x17
1157 #define LANG_RUSSIAN 0x19
1158 #define LANG_SAMI 0x3b
1159 #define LANG_SANSKRIT 0x4f
1160 #define LANG_SCOTTISH_GAELIC 0x91
1161 #define LANG_SERBIAN 0x1a
1162 #define LANG_SOTHO 0x6c
1163 #define LANG_TSWANA 0x32
1164 #define LANG_SINDHI 0x59
1165 #define LANG_SINHALESE 0x5b
1166 #define LANG_SLOVAK 0x1b
1167 #define LANG_SLOVENIAN 0x24
1168 #define LANG_SPANISH 0x0a
1169 #define LANG_SWAHILI 0x41
1170 #define LANG_SWEDISH 0x1d
1171 #define LANG_SYRIAC 0x5a
1172 #define LANG_TAJIK 0x28
1173 #define LANG_TAMAZIGHT 0x5f
1174 #define LANG_TAMIL 0x49
1175 #define LANG_TATAR 0x44
1176 #define LANG_TELUGU 0x4a
1177 #define LANG_THAI 0x1e
1178 #define LANG_TIBETAN 0x51
1179 #define LANG_TIGRIGNA 0x73
1180 #define LANG_TURKISH 0x1f
1181 #define LANG_TURKMEN 0x42
1182 #define LANG_UIGHUR 0x80
1183 #define LANG_UKRAINIAN 0x22
1184 #define LANG_UPPER_SORBIAN 0x2e
1185 #define LANG_URDU 0x20
1186 #define LANG_UZBEK 0x43
1187 #define LANG_VIETNAMESE 0x2a
1188 #define LANG_WELSH 0x52
1189 #define LANG_WOLOF 0x88
1190 #define LANG_XHOSA 0x34
1191 #define LANG_YAKUT 0x85
1192 #define LANG_YI 0x78
1193 #define LANG_YORUBA 0x6a
1194 #define LANG_ZULU 0x35
1195
1196 /* FIXME: non-standard */
1197 #define LANG_ESPERANTO 0x8f
1198 #define LANG_WALON 0x90
1199 #define LANG_CORNISH 0x92
1200
1201 /* FIXME: not present in the official headers */
1202 #define LANG_MALAGASY 0x8d
1203 #define LANG_GAELIC 0x94
1204 #define LANG_SAAMI 0x3b
1205 #define LANG_SUTU 0x30
1206 #define LANG_TSONGA 0x31
1207 #define LANG_VENDA 0x33
1208 #define LANG_MANX_GAELIC 0x94
1209
1210 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1211 #define SUBLANG_CUSTOM_DEFAULT 0x03
1212 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1213 #define SUBLANG_NEUTRAL 0x00
1214 #define SUBLANG_SYS_DEFAULT 0x02
1215 #define SUBLANG_DEFAULT 0x01
1216 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1217 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1218 #define SUBLANG_ALSATIAN_FRANCE 0x01
1219 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1220 #define SUBLANG_ARABIC_ALGERIA 0x05
1221 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1222 #define SUBLANG_ARABIC_EGYPT 0x03
1223 #define SUBLANG_ARABIC_IRAQ 0x02
1224 #define SUBLANG_ARABIC_JORDAN 0x0b
1225 #define SUBLANG_ARABIC_KUWAIT 0x0d
1226 #define SUBLANG_ARABIC_LEBANON 0x0c
1227 #define SUBLANG_ARABIC_LIBYA 0x04
1228 #define SUBLANG_ARABIC_MOROCCO 0x06
1229 #define SUBLANG_ARABIC_OMAN 0x08
1230 #define SUBLANG_ARABIC_QATAR 0x10
1231 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1232 #define SUBLANG_ARABIC_SYRIA 0x0a
1233 #define SUBLANG_ARABIC_TUNISIA 0x07
1234 #define SUBLANG_ARABIC_UAE 0x0e
1235 #define SUBLANG_ARABIC_YEMEN 0x09
1236 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1237 #define SUBLANG_ASSAMESE_INDIA 0x01
1238 #define SUBLANG_AZERI_CYRILLIC 0x02
1239 #define SUBLANG_AZERI_LATIN 0x01
1240 #define SUBLANG_BASHKIR_RUSSIA 0x01
1241 #define SUBLANG_BASQUE_BASQUE 0x01
1242 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1243 #define SUBLANG_BENGALI_BANGLADESH 0x02
1244 #define SUBLANG_BENGALI_INDIA 0x01
1245 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1246 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1247 #define SUBLANG_BRETON_FRANCE 0x01
1248 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1249 #define SUBLANG_CATALAN_CATALAN 0x01
1250 #define SUBLANG_CHINESE_HONGKONG 0x03
1251 #define SUBLANG_CHINESE_MACAU 0x05
1252 #define SUBLANG_CHINESE_SINGAPORE 0x04
1253 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1254 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1255 #define SUBLANG_CORSICAN_FRANCE 0x01
1256 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1257 #define SUBLANG_CROATIAN_CROATIA 0x01
1258 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1259 #define SUBLANG_DANISH_DENMARK 0x01
1260 #define SUBLANG_DARI_AFGHANISTAN 0x01
1261 #define SUBLANG_DIVEHI_MALDIVES 0x01
1262 #define SUBLANG_DUTCH_BELGIAN 0x02
1263 #define SUBLANG_DUTCH 0x01
1264 #define SUBLANG_ENGLISH_AUS 0x03
1265 #define SUBLANG_ENGLISH_BELIZE 0x0a
1266 #define SUBLANG_ENGLISH_CAN 0x04
1267 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1268 #define SUBLANG_ENGLISH_INDIA 0x10
1269 #define SUBLANG_ENGLISH_EIRE 0x06
1270 #define SUBLANG_ENGLISH_IRELAND 0x06
1271 #define SUBLANG_ENGLISH_JAMAICA 0x08
1272 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1273 #define SUBLANG_ENGLISH_NZ 0x05
1274 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1275 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1276 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1277 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1278 #define SUBLANG_ENGLISH_UK 0x02
1279 #define SUBLANG_ENGLISH_US 0x01
1280 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1281 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1282 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1283 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
1284 #define SUBLANG_FINNISH_FINLAND 0x01
1285 #define SUBLANG_FRENCH_BELGIAN 0x02
1286 #define SUBLANG_FRENCH_CANADIAN 0x03
1287 #define SUBLANG_FRENCH 0x01
1288 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1289 #define SUBLANG_FRENCH_MONACO 0x06
1290 #define SUBLANG_FRENCH_SWISS 0x04
1291 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
1292 #define SUBLANG_GALICIAN_GALICIAN 0x01
1293 #define SUBLANG_GEORGIAN_GEORGIA 0x01
1294 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1295 #define SUBLANG_GERMAN 0x01
1296 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1297 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1298 #define SUBLANG_GERMAN_SWISS 0x02
1299 #define SUBLANG_GREEK_GREECE 0x01
1300 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
1301 #define SUBLANG_GUJARATI_INDIA 0x01
1302 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
1303 #define SUBLANG_HAUSA_NIGERIA 0x01
1304 #define SUBLANG_HEBREW_ISRAEL 0x01
1305 #define SUBLANG_HINDI_INDIA 0x01
1306 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
1307 #define SUBLANG_ICELANDIC_ICELAND 0x01
1308 #define SUBLANG_IGBO_NIGERIA 0x01
1309 #define SUBLANG_INDONESIAN_INDONESIA 0x01
1310 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
1311 #define SUBLANG_INUKTITUT_CANADA 0x01
1312 #define SUBLANG_IRISH_IRELAND 0x02
1313 #define SUBLANG_ITALIAN 0x01
1314 #define SUBLANG_ITALIAN_SWISS 0x02
1315 #define SUBLANG_JAPANESE_JAPAN 0x01
1316 #define SUBLANG_KANNADA_INDIA 0x01
1317 #define SUBLANG_KASHMIRI_INDIA 0x02
1318 #define SUBLANG_KASHMIRI_SASIA 0x02
1319 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
1320 #define SUBLANG_KHMER_CAMBODIA 0x01
1321 #define SUBLANG_KICHE_GUATEMALA 0x01
1322 #define SUBLANG_KINYARWANDA_RWANDA 0x01
1323 #define SUBLANG_KONKANI_INDIA 0x01
1324 #define SUBLANG_KOREAN 0x01
1325 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
1326 #define SUBLANG_LAO_LAO 0x01
1327 #define SUBLANG_LAO_LAO_PDR 0x01
1328 #define SUBLANG_LATVIAN_LATVIA 0x01
1329 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
1330 #define SUBLANG_LITHUANIAN 0x01
1331 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
1332 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
1333 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
1334 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1335 #define SUBLANG_MALAY_MALAYSIA 0x01
1336 #define SUBLANG_MALAYALAM_INDIA 0x01
1337 #define SUBLANG_MALTESE_MALTA 0x01
1338 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1339 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1340 #define SUBLANG_MARATHI_INDIA 0x01
1341 #define SUBLANG_MOHAWK_MOHAWK 0x01
1342 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1343 #define SUBLANG_MONGOLIAN_PRC 0x02
1344 #define SUBLANG_NEPALI_NEPAL 0x01
1345 #define SUBLANG_NEPALI_INDIA 0x02
1346 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1347 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1348 #define SUBLANG_OCCITAN_FRANCE 0x01
1349 #define SUBLANG_ORIYA_INDIA 0x01
1350 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1351 #define SUBLANG_PERSIAN_IRAN 0x01
1352 #define SUBLANG_POLISH_POLAND 0x01
1353 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1354 #define SUBLANG_PORTUGUESE 0x02
1355 #define SUBLANG_PORTUGUESE_PORTUGAL 0x02
1356 #define SUBLANG_PUNJABI_INDIA 0x01
1357 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1358 #define SUBLANG_QUECHUA_ECUADOR 0x02
1359 #define SUBLANG_QUECHUA_PERU 0x03
1360 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1361 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1362 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1363 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1364 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1365 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1366 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1367 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1368 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1369 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1370 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1371 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1372 #define SUBLANG_SANSKRIT_INDIA 0x01
1373 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1374 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1375 #define SUBLANG_SERBIAN_CROATIA 0x01
1376 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1377 #define SUBLANG_SERBIAN_LATIN 0x02
1378 #define SUBLANG_SERBIAN_SERBIA_LATIN 0x09
1379 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1380 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1381 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1382 #define SUBLANG_SINDHI_PAKISTAN 0x01
1383 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1384 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1385 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1386 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1387 #define SUBLANG_SPANISH_BOLIVIA 0x10
1388 #define SUBLANG_SPANISH_CHILE 0x0d
1389 #define SUBLANG_SPANISH_COLOMBIA 0x09
1390 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1391 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1392 #define SUBLANG_SPANISH_ECUADOR 0x0c
1393 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1394 #define SUBLANG_SPANISH_GUATEMALA 0x04
1395 #define SUBLANG_SPANISH_HONDURAS 0x12
1396 #define SUBLANG_SPANISH_MEXICAN 0x02
1397 #define SUBLANG_SPANISH_MODERN 0x03
1398 #define SUBLANG_SPANISH_NICARAGUA 0x13
1399 #define SUBLANG_SPANISH_PANAMA 0x06
1400 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1401 #define SUBLANG_SPANISH_PERU 0x0a
1402 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1403 #define SUBLANG_SPANISH 0x01
1404 #define SUBLANG_SPANISH_US 0x15
1405 #define SUBLANG_SPANISH_URUGUAY 0x0e
1406 #define SUBLANG_SPANISH_VENEZUELA 0x08
1407 #define SUBLANG_SWAHILI 0x01
1408 #define SUBLANG_SWAHILI_KENYA 0x01
1409 #define SUBLANG_SWEDISH_FINLAND 0x02
1410 #define SUBLANG_SWEDISH 0x01
1411 #define SUBLANG_SWEDISH_SWEDEN 0x01
1412 #define SUBLANG_SYRIAC 0x01
1413 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1414 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1415 #define SUBLANG_TAMIL_INDIA 0x01
1416 #define SUBLANG_TATAR_RUSSIA 0x01
1417 #define SUBLANG_TELUGU_INDIA 0x01
1418 #define SUBLANG_THAI_THAILAND 0x01
1419 #define SUBLANG_TIBETAN_PRC 0x01
1420 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1421 #define SUBLANG_TURKISH_TURKEY 0x01
1422 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1423 #define SUBLANG_UIGHUR_PRC 0x01
1424 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1425 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1426 #define SUBLANG_URDU_INDIA 0x02
1427 #define SUBLANG_URDU_PAKISTAN 0x01
1428 #define SUBLANG_UZBEK_CYRILLIC 0x02
1429 #define SUBLANG_UZBEK_LATIN 0x01
1430 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1431 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1432 #define SUBLANG_WOLOF_SENEGAL 0x01
1433 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1434 #define SUBLANG_YAKUT_RUSSIA 0x01
1435 #define SUBLANG_YI_PRC 0x01
1436 #define SUBLANG_YORUBA_NIGERIA 0x01
1437 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1438 #define NLS_VALID_LOCALE_MASK 1048575
1439 #define SORT_DEFAULT 0
1440 #define SORT_JAPANESE_XJIS 0
1441 #define SORT_JAPANESE_UNICODE 1
1442 #define SORT_CHINESE_BIG5 0
1443 #define SORT_CHINESE_PRCP 0
1444 #define SORT_CHINESE_UNICODE 1
1445 #define SORT_CHINESE_PRC 2
1446 #define SORT_CHINESE_BOPOMOFO 3
1447 #define SORT_KOREAN_KSC 0
1448 #define SORT_KOREAN_UNICODE 1
1449 #define SORT_GERMAN_PHONE_BOOK 1
1450 #define SORT_HUNGARIAN_DEFAULT 0
1451 #define SORT_HUNGARIAN_TECHNICAL 1
1452 #define SORT_GEORGIAN_TRADITIONAL 0
1453 #define SORT_GEORGIAN_MODERN 1
1454 #define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
1455 #define MAKELCID(l,s) ((DWORD)((((DWORD)((WORD)(s)))<<16)|((DWORD)((WORD)(l)))))
1456 #define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
1457 #define SORTIDFROMLCID(l) ((WORD)((((DWORD)(l))&NLS_VALID_LOCALE_MASK)>>16))
1458 #define SORTVERSIONFROMLCID(l) ((WORD)((((DWORD)(l))>>20)&0xf))
1459 #define SUBLANGID(l) ((WORD)(l)>>10)
1460 #define LANGIDFROMLCID(l) ((WORD)(l))
1461 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)
1462 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
1463 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)
1464 #define LOCALE_INVARIANT MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
1465 #define LOCALE_NAME_MAX_LENGTH 85
1466 #define ACL_REVISION 2
1467 #define ACL_REVISION_DS 4
1468 #define ACL_REVISION1 1
1469 #define ACL_REVISION2 2
1470 #define ACL_REVISION3 3
1471 #define ACL_REVISION4 4
1472 #define MIN_ACL_REVISION 2
1473 #define MAX_ACL_REVISION 4
1474 #define MINCHAR 0x80
1475 #define MAXCHAR 0x7f
1476 #define MINSHORT 0x8000
1477 #define MAXSHORT 0x7fff
1478 #define MINLONG 0x80000000
1479 #define MAXLONG 0x7fffffff
1480 #define MAXBYTE 0xff
1481 #define MAXWORD 0xffff
1482 #define MAXDWORD 0xffffffff
1483 #define PROCESSOR_INTEL_386 386
1484 #define PROCESSOR_INTEL_486 486
1485 #define PROCESSOR_INTEL_PENTIUM 586
1486 #define PROCESSOR_MIPS_R4000 4000
1487 #define PROCESSOR_ALPHA_21064 21064
1488 #define PROCESSOR_INTEL_IA64 2200
1489 #define PROCESSOR_PPC_601 601
1490 #define PROCESSOR_PPC_603 603
1491 #define PROCESSOR_PPC_604 604
1492 #define PROCESSOR_PPC_620 620
1493 #define PROCESSOR_INTEL_860 860
1494 #define PROCESSOR_AMD_X8664 8664
1495 #define PROCESSOR_MIPS_R2000 2000
1496 #define PROCESSOR_MIPS_R3000 3000
1497 #define PROCESSOR_HITACHI_SH3 10003
1498 #define PROCESSOR_HITACHI_SH3E 10004
1499 #define PROCESSOR_HITACHI_SH4 10005
1500 #define PROCESSOR_MOTOROLA_821 821
1501 #define PROCESSOR_SHx_SH3 103
1502 #define PROCESSOR_SHx_SH4 104
1503 #define PROCESSOR_STRONGARM 2577
1504 #define PROCESSOR_ARM720 1824
1505 #define PROCESSOR_ARM820 2080
1506 #define PROCESSOR_ARM920 2336
1507 #define PROCESSOR_ARM_7TDMI 70001
1508 #define PROCESSOR_ARCHITECTURE_INTEL 0
1509 #define PROCESSOR_ARCHITECTURE_MIPS 1
1510 #define PROCESSOR_ARCHITECTURE_ALPHA 2
1511 #define PROCESSOR_ARCHITECTURE_PPC 3
1512 #define PROCESSOR_ARCHITECTURE_SHX 4
1513 #define PROCESSOR_ARCHITECTURE_ARM 5
1514 #define PROCESSOR_ARCHITECTURE_IA64 6
1515 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
1516 #define PROCESSOR_ARCHITECTURE_MSIL 8
1517 #define PROCESSOR_ARCHITECTURE_AMD64 9
1518 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
1519 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
1520 #define PF_FLOATING_POINT_EMULATED 1
1521 #define PF_COMPARE_EXCHANGE_DOUBLE 2
1522 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
1523 #define PF_PPC_MOVEMEM_64BIT_OK 4
1524 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
1525 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
1526 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
1527 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
1528 #define PF_PAE_ENABLED 9
1529 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
1530 /* also in ddk/ntifs.h */
1531 #define FILE_ACTION_ADDED 0x00000001
1532 #define FILE_ACTION_REMOVED 0x00000002
1533 #define FILE_ACTION_MODIFIED 0x00000003
1534 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
1535 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
1536 #define FILE_ACTION_ADDED_STREAM 0x00000006
1537 #define FILE_ACTION_REMOVED_STREAM 0x00000007
1538 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
1539 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
1540 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
1541 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
1542 /* end ntifs.h */
1543 #define HEAP_NO_SERIALIZE 1
1544 #define HEAP_GROWABLE 2
1545 #define HEAP_GENERATE_EXCEPTIONS 4
1546 #define HEAP_ZERO_MEMORY 8
1547 #define HEAP_REALLOC_IN_PLACE_ONLY 16
1548 #define HEAP_TAIL_CHECKING_ENABLED 32
1549 #define HEAP_FREE_CHECKING_ENABLED 64
1550 #define HEAP_DISABLE_COALESCE_ON_FREE 128
1551 #define HEAP_CREATE_ALIGN_16 0x10000
1552 #define HEAP_CREATE_ENABLE_TRACING 0x20000
1553 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
1554 #define HEAP_MAXIMUM_TAG 0xFFF
1555 #define HEAP_PSEUDO_TAG_FLAG 0x8000
1556 #define HEAP_TAG_SHIFT 16
1557 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
1558
1559 #define KEY_QUERY_VALUE 1
1560 #define KEY_SET_VALUE 2
1561 #define KEY_CREATE_SUB_KEY 4
1562 #define KEY_ENUMERATE_SUB_KEYS 8
1563 #define KEY_NOTIFY 16
1564 #define KEY_CREATE_LINK 32
1565 #define KEY_WOW64_64KEY 0x00000100
1566 #define KEY_WOW64_32KEY 0x00000200
1567 #define KEY_WOW64_RES 0x00000300
1568
1569 #define KEY_WRITE 0x20006
1570 #define KEY_EXECUTE 0x20019
1571 #define KEY_READ 0x20019
1572 #define KEY_ALL_ACCESS 0xf003f
1573 #define REG_WHOLE_HIVE_VOLATILE 1
1574 #define REG_REFRESH_HIVE 2
1575 #define REG_NO_LAZY_FLUSH 4
1576 #define REG_FORCE_RESTORE 8
1577 #define REG_OPTION_RESERVED 0
1578 #define REG_OPTION_NON_VOLATILE 0
1579 #define REG_OPTION_VOLATILE 1
1580 #define REG_OPTION_CREATE_LINK 2
1581 #define REG_OPTION_BACKUP_RESTORE 4
1582 #define REG_OPTION_OPEN_LINK 8
1583 #define REG_LEGAL_OPTION 15
1584 #define OWNER_SECURITY_INFORMATION 1
1585 #define GROUP_SECURITY_INFORMATION 2
1586 #define DACL_SECURITY_INFORMATION 4
1587 #define SACL_SECURITY_INFORMATION 8
1588 #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
1589 #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
1590 #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
1591 #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
1592 #define MAXIMUM_PROCESSORS 32
1593 #define PAGE_NOACCESS 0x0001
1594 #define PAGE_READONLY 0x0002
1595 #define PAGE_READWRITE 0x0004
1596 #define PAGE_WRITECOPY 0x0008
1597 #define PAGE_EXECUTE 0x0010
1598 #define PAGE_EXECUTE_READ 0x0020
1599 #define PAGE_EXECUTE_READWRITE 0x0040
1600 #define PAGE_EXECUTE_WRITECOPY 0x0080
1601 #define PAGE_GUARD 0x0100
1602 #define PAGE_NOCACHE 0x0200
1603 #define PAGE_WRITECOMBINE 0x0400
1604 #define MEM_COMMIT 0x1000
1605 #define MEM_RESERVE 0x2000
1606 #define MEM_DECOMMIT 0x4000
1607 #define MEM_RELEASE 0x8000
1608 #define MEM_FREE 0x10000
1609 #define MEM_PRIVATE 0x20000
1610 #define MEM_MAPPED 0x40000
1611 #define MEM_RESET 0x80000
1612 #define MEM_TOP_DOWN 0x100000
1613 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
1614 #define MEM_PHYSICAL 0x400000
1615 #define MEM_4MB_PAGES 0x80000000
1616 #define MEM_IMAGE SEC_IMAGE
1617 #define SEC_NO_CHANGE 0x00400000
1618 #define SEC_FILE 0x00800000
1619 #define SEC_IMAGE 0x01000000
1620 #define SEC_VLM 0x02000000
1621 #define SEC_RESERVE 0x04000000
1622 #define SEC_COMMIT 0x08000000
1623 #define SEC_NOCACHE 0x10000000
1624 #define SEC_WRITECOMBINE 0x40000000
1625 #define SEC_LARGE_PAGES 0x80000000
1626 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
1627 #define SECTION_EXTEND_SIZE 16
1628 #define SECTION_MAP_READ 4
1629 #define SECTION_MAP_WRITE 2
1630 #define SECTION_QUERY 1
1631 #define SECTION_MAP_EXECUTE 8
1632 #define SECTION_ALL_ACCESS 0xf001f
1633 #define WRITE_WATCH_FLAG_RESET 0x01
1634 #define MESSAGE_RESOURCE_UNICODE 1
1635 #define RTL_CRITSECT_TYPE 0
1636 #define RTL_RESOURCE_TYPE 1
1637
1638 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
1639 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
1640 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
1641
1642 /* Also in winddk.h */
1643 #if !defined(__GNUC__)
1644 #define FIELD_OFFSET(t,f) ((LONG)(LONG_PTR)&(((t*) 0)->f))
1645 #else
1646 #define FIELD_OFFSET(t,f) ((LONG)__builtin_offsetof(t,f))
1647 #endif
1648 #ifndef CONTAINING_RECORD
1649 #define CONTAINING_RECORD(address, type, field) \
1650 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
1651 #endif
1652
1653 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
1654 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
1655 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
1656 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
1657 ((((PCHAR) (&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR) (Struct)) + (Size)))
1658 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
1659
1660 #if defined(__cplusplus) && \
1661 !defined(MIDL_PASS) && \
1662 !defined(RC_INVOKED) && \
1663 !defined(_PREFAST_) && \
1664 (_MSC_FULL_VER >= 13009466) && \
1665 !defined(SORTPP_PASS)
1666 #define RTL_NUMBER_OF_V2(A) (sizeof(*RtlpNumberOf(A)))
1667 #else
1668 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
1669 #endif
1670
1671 #ifdef ENABLE_RTL_NUMBER_OF_V2
1672 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
1673 #else
1674 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
1675 #endif
1676 //#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
1677 //#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
1678
1679 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
1680 #define RTL_NUMBER_OF_FIELD(type, field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))
1681 #define RTL_PADDING_BETWEEN_FIELDS(T, F1, F2) \
1682 ((FIELD_OFFSET(T, F2) > FIELD_OFFSET(T, F1)) \
1683 ? (FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1) - RTL_FIELD_SIZE(T, F1)) \
1684 : (FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2) - RTL_FIELD_SIZE(T, F2)))
1685
1686 #if defined(__cplusplus)
1687 #define RTL_CONST_CAST(type) const_cast<type>
1688 #else
1689 #define RTL_CONST_CAST(type) (type)
1690 #endif
1691
1692 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
1693 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
1694
1695 /* end winddk.h */
1696 #define IMAGE_SIZEOF_FILE_HEADER 20
1697 #define IMAGE_FILE_RELOCS_STRIPPED 1
1698 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
1699 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
1700 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
1701 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
1702 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
1703 #define IMAGE_FILE_BYTES_REVERSED_LO 128
1704 #define IMAGE_FILE_32BIT_MACHINE 256
1705 #define IMAGE_FILE_DEBUG_STRIPPED 512
1706 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
1707 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
1708 #define IMAGE_FILE_SYSTEM 4096
1709 #define IMAGE_FILE_DLL 8192
1710 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
1711 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
1712 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1713
1714 #define IMAGE_FILE_MACHINE_AM33 0x1d3
1715 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1716 #define IMAGE_FILE_MACHINE_ARM 0x1c0
1717 #define IMAGE_FILE_MACHINE_ARMNT 0x1c4
1718 #define IMAGE_FILE_MACHINE_EBC 0xebc
1719 #define IMAGE_FILE_MACHINE_I386 0x14c
1720 #define IMAGE_FILE_MACHINE_IA64 0x200
1721 #define IMAGE_FILE_MACHINE_M32R 0x9041
1722 #define IMAGE_FILE_MACHINE_MIPS16 0x266
1723 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366
1724 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466
1725 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0
1726 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1
1727 #define IMAGE_FILE_MACHINE_R4000 0x166
1728 #define IMAGE_FILE_MACHINE_SH3 0x1a2
1729 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1730 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3
1731 #define IMAGE_FILE_MACHINE_SH4 0x1a6
1732 #define IMAGE_FILE_MACHINE_SH5 0x1a8
1733 #define IMAGE_FILE_MACHINE_THUMB 0x1c2
1734 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169
1735 #define IMAGE_FILE_MACHINE_R3000 0x162
1736 #define IMAGE_FILE_MACHINE_R10000 0x168
1737 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1738 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1739 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1740 #define IMAGE_FILE_MACHINE_CEE 0xC0EE
1741 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1742 #define IMAGE_FILE_MACHINE_CEF 0x0CEF
1743
1744 /* Wine extension */
1745 #define IMAGE_FILE_MACHINE_ARM64 0x1c5
1746
1747 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1748 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1749 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1750 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1751 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1752 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1753 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1754 #define IMAGE_FILE_DESCRIPTION_STRING 7
1755 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1756 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1757 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1758
1759 #define IMAGE_DOS_SIGNATURE 0x5A4D
1760 #define IMAGE_OS2_SIGNATURE 0x454E
1761 #define IMAGE_OS2_SIGNATURE_LE 0x454C
1762 #define IMAGE_VXD_SIGNATURE 0x454C
1763 #define IMAGE_NT_SIGNATURE 0x00004550
1764 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
1765 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
1766 #ifdef _WIN64
1767 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
1768 #else
1769 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
1770 #endif
1771 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1772 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
1773 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1774 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1775 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1776 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1777 #define IMAGE_SIZEOF_SHORT_NAME 8
1778 #define IMAGE_SIZEOF_SECTION_HEADER 40
1779 #define IMAGE_SIZEOF_SYMBOL 18
1780 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1781 #define IMAGE_SIZEOF_RELOCATION 10
1782 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1783 #define IMAGE_SIZEOF_LINENUMBER 6
1784 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1785 #define SIZEOF_RFPO_DATA 16
1786
1787 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1788 #define IMAGE_SUBSYSTEM_NATIVE 1
1789 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
1790 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
1791 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1792 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1793 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
1794 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
1795 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1796 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1797 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1798 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1799 #define IMAGE_SUBSYSTEM_XBOX 14
1800
1801 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
1802 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
1803 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
1804 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
1805 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
1806 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
1807 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
1808 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
1809 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
1810 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1811 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1812 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1813 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1814 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1815 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1816 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1817 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1818 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
1819 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1820 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1821 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1822 #define IMAGE_DIRECTORY_ENTRY_IAT 12
1823 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1824 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1825 #define IMAGE_SCN_TYPE_REG 0
1826 #define IMAGE_SCN_TYPE_DSECT 1
1827 //#define IMAGE_SCN_TYPE_NOLOAD 2
1828 #define IMAGE_SCN_TYPE_GROUP 4
1829 #define IMAGE_SCN_TYPE_NO_PAD 8
1830 #define IMAGE_SCN_CNT_CODE 32
1831 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
1832 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
1833 #define IMAGE_SCN_LNK_OTHER 256
1834 #define IMAGE_SCN_LNK_INFO 512
1835 #define IMAGE_SCN_LNK_REMOVE 2048
1836 #define IMAGE_SCN_LNK_COMDAT 4096
1837 #define IMAGE_SCN_MEM_FARDATA 0x8000
1838 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
1839 #define IMAGE_SCN_MEM_16BIT 0x20000
1840 #define IMAGE_SCN_MEM_LOCKED 0x40000
1841 #define IMAGE_SCN_MEM_PRELOAD 0x80000
1842 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
1843 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
1844 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
1845 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
1846 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
1847 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
1848 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
1849 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
1850 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
1851 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
1852 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
1853 #define IMAGE_SCN_MEM_SHARED 0x10000000
1854 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1855 #define IMAGE_SCN_MEM_READ 0x40000000
1856 #define IMAGE_SCN_MEM_WRITE 0x80000000
1857 #define IMAGE_SYM_UNDEFINED 0
1858 #define IMAGE_SYM_ABSOLUTE (-1)
1859 #define IMAGE_SYM_DEBUG (-2)
1860 #define IMAGE_SYM_TYPE_NULL 0
1861 #define IMAGE_SYM_TYPE_VOID 1
1862 #define IMAGE_SYM_TYPE_CHAR 2
1863 #define IMAGE_SYM_TYPE_SHORT 3
1864 #define IMAGE_SYM_TYPE_INT 4
1865 #define IMAGE_SYM_TYPE_LONG 5
1866 #define IMAGE_SYM_TYPE_FLOAT 6
1867 #define IMAGE_SYM_TYPE_DOUBLE 7
1868 #define IMAGE_SYM_TYPE_STRUCT 8
1869 #define IMAGE_SYM_TYPE_UNION 9
1870 #define IMAGE_SYM_TYPE_ENUM 10
1871 #define IMAGE_SYM_TYPE_MOE 11
1872 #define IMAGE_SYM_TYPE_BYTE 12
1873 #define IMAGE_SYM_TYPE_WORD 13
1874 #define IMAGE_SYM_TYPE_UINT 14
1875 #define IMAGE_SYM_TYPE_DWORD 15
1876 #define IMAGE_SYM_TYPE_PCODE 32768
1877 #define IMAGE_SYM_DTYPE_NULL 0
1878 #define IMAGE_SYM_DTYPE_POINTER 1
1879 #define IMAGE_SYM_DTYPE_FUNCTION 2
1880 #define IMAGE_SYM_DTYPE_ARRAY 3
1881 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1882 #define IMAGE_SYM_CLASS_NULL 0
1883 #define IMAGE_SYM_CLASS_AUTOMATIC 1
1884 #define IMAGE_SYM_CLASS_EXTERNAL 2
1885 #define IMAGE_SYM_CLASS_STATIC 3
1886 #define IMAGE_SYM_CLASS_REGISTER 4
1887 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1888 #define IMAGE_SYM_CLASS_LABEL 6
1889 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1890 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1891 #define IMAGE_SYM_CLASS_ARGUMENT 9
1892 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
1893 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1894 #define IMAGE_SYM_CLASS_UNION_TAG 12
1895 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1896 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1897 #define IMAGE_SYM_CLASS_ENUM_TAG 15
1898 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1899 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1900 #define IMAGE_SYM_CLASS_BIT_FIELD 18
1901 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
1902 #define IMAGE_SYM_CLASS_BLOCK 100
1903 #define IMAGE_SYM_CLASS_FUNCTION 101
1904 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1905 #define IMAGE_SYM_CLASS_FILE 103
1906 #define IMAGE_SYM_CLASS_SECTION 104
1907 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1908 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1909 #define IMAGE_COMDAT_SELECT_ANY 2
1910 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1911 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1912 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1913 #define IMAGE_COMDAT_SELECT_LARGEST 6
1914 #define IMAGE_COMDAT_SELECT_NEWEST 7
1915 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1916 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1917 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1918 #define IMAGE_REL_I386_ABSOLUTE 0
1919 #define IMAGE_REL_I386_DIR16 1
1920 #define IMAGE_REL_I386_REL16 2
1921 #define IMAGE_REL_I386_DIR32 6
1922 #define IMAGE_REL_I386_DIR32NB 7
1923 #define IMAGE_REL_I386_SEG12 9
1924 #define IMAGE_REL_I386_SECTION 10
1925 #define IMAGE_REL_I386_SECREL 11
1926 #define IMAGE_REL_I386_REL32 20
1927 #define IMAGE_REL_MIPS_ABSOLUTE 0
1928 #define IMAGE_REL_MIPS_REFHALF 1
1929 #define IMAGE_REL_MIPS_REFWORD 2
1930 #define IMAGE_REL_MIPS_JMPADDR 3
1931 #define IMAGE_REL_MIPS_REFHI 4
1932 #define IMAGE_REL_MIPS_REFLO 5
1933 #define IMAGE_REL_MIPS_GPREL 6
1934 #define IMAGE_REL_MIPS_LITERAL 7
1935 #define IMAGE_REL_MIPS_SECTION 10
1936 #define IMAGE_REL_MIPS_SECREL 11
1937 #define IMAGE_REL_MIPS_SECRELLO 12
1938 #define IMAGE_REL_MIPS_SECRELHI 13
1939 #define IMAGE_REL_MIPS_REFWORDNB 34
1940 #define IMAGE_REL_MIPS_PAIR 35
1941 #define IMAGE_REL_ALPHA_ABSOLUTE 0
1942 #define IMAGE_REL_ALPHA_REFLONG 1
1943 #define IMAGE_REL_ALPHA_REFQUAD 2
1944 #define IMAGE_REL_ALPHA_GPREL32 3
1945 #define IMAGE_REL_ALPHA_LITERAL 4
1946 #define IMAGE_REL_ALPHA_LITUSE 5
1947 #define IMAGE_REL_ALPHA_GPDISP 6
1948 #define IMAGE_REL_ALPHA_BRADDR 7
1949 #define IMAGE_REL_ALPHA_HINT 8
1950 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1951 #define IMAGE_REL_ALPHA_REFHI 10
1952 #define IMAGE_REL_ALPHA_REFLO 11
1953 #define IMAGE_REL_ALPHA_PAIR 12
1954 #define IMAGE_REL_ALPHA_MATCH 13
1955 #define IMAGE_REL_ALPHA_SECTION 14
1956 #define IMAGE_REL_ALPHA_SECREL 15
1957 #define IMAGE_REL_ALPHA_REFLONGNB 16
1958 #define IMAGE_REL_ALPHA_SECRELLO 17
1959 #define IMAGE_REL_ALPHA_SECRELHI 18
1960 #define IMAGE_REL_PPC_ABSOLUTE 0
1961 #define IMAGE_REL_PPC_ADDR64 1
1962 #define IMAGE_REL_PPC_ADDR32 2
1963 #define IMAGE_REL_PPC_ADDR24 3
1964 #define IMAGE_REL_PPC_ADDR16 4
1965 #define IMAGE_REL_PPC_ADDR14 5
1966 #define IMAGE_REL_PPC_REL24 6
1967 #define IMAGE_REL_PPC_REL14 7
1968 #define IMAGE_REL_PPC_TOCREL16 8
1969 #define IMAGE_REL_PPC_TOCREL14 9
1970 #define IMAGE_REL_PPC_ADDR32NB 10
1971 #define IMAGE_REL_PPC_SECREL 11
1972 #define IMAGE_REL_PPC_SECTION 12
1973 #define IMAGE_REL_PPC_IFGLUE 13
1974 #define IMAGE_REL_PPC_IMGLUE 14
1975 #define IMAGE_REL_PPC_SECREL16 15
1976 #define IMAGE_REL_PPC_REFHI 16
1977 #define IMAGE_REL_PPC_REFLO 17
1978 #define IMAGE_REL_PPC_PAIR 18
1979 #define IMAGE_REL_PPC_TYPEMASK 255
1980 #define IMAGE_REL_PPC_NEG 256
1981 #define IMAGE_REL_PPC_BRTAKEN 512
1982 #define IMAGE_REL_PPC_BRNTAKEN 1024
1983 #define IMAGE_REL_PPC_TOCDEFN 2048
1984 #define IMAGE_REL_BASED_ABSOLUTE 0
1985 #define IMAGE_REL_BASED_HIGH 1
1986 #define IMAGE_REL_BASED_LOW 2
1987 #define IMAGE_REL_BASED_HIGHLOW 3
1988 #define IMAGE_REL_BASED_HIGHADJ 4
1989 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1990 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
1991 #define IMAGE_REL_BASED_IA64_IMM64 9
1992 #define IMAGE_REL_BASED_DIR64 10
1993 #define IMAGE_ARCHIVE_START_SIZE 8
1994 #define IMAGE_ARCHIVE_START "!<arch>\n"
1995 #define IMAGE_ARCHIVE_END "`\n"
1996 #define IMAGE_ARCHIVE_PAD "\n"
1997 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1998 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1999 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2000 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2001 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2002 #define IMAGE_DEBUG_TYPE_COFF 1
2003 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2004 #define IMAGE_DEBUG_TYPE_FPO 3
2005 #define IMAGE_DEBUG_TYPE_MISC 4
2006 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2007 #define IMAGE_DEBUG_TYPE_FIXUP 6
2008 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2009 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2010 #define FRAME_FPO 0
2011 #define FRAME_TRAP 1
2012 #define FRAME_TSS 2
2013 #define FRAME_NONFPO 3
2014 #define IMAGE_DEBUG_MISC_EXENAME 1
2015 #define N_BTMASK 0x000F
2016 #define N_TMASK 0x0030
2017 #define N_TMASK1 0x00C0
2018 #define N_TMASK2 0x00F0
2019 #define N_BTSHFT 4
2020 #define N_TSHIFT 2
2021 #define IS_TEXT_UNICODE_ASCII16 1
2022 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
2023 #define IS_TEXT_UNICODE_STATISTICS 2
2024 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
2025 #define IS_TEXT_UNICODE_CONTROLS 4
2026 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
2027 #define IS_TEXT_UNICODE_SIGNATURE 8
2028 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
2029 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
2030 #define IS_TEXT_UNICODE_ODD_LENGTH 512
2031 #define IS_TEXT_UNICODE_NULL_BYTES 4096
2032 #define IS_TEXT_UNICODE_UNICODE_MASK 15
2033 #define IS_TEXT_UNICODE_REVERSE_MASK 240
2034 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
2035 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
2036 #define SERVICE_KERNEL_DRIVER 1
2037 #define SERVICE_FILE_SYSTEM_DRIVER 2
2038 #define SERVICE_ADAPTER 4
2039 #define SERVICE_RECOGNIZER_DRIVER 8
2040 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
2041 #define SERVICE_WIN32_OWN_PROCESS 16
2042 #define SERVICE_WIN32_SHARE_PROCESS 32
2043 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
2044 #define SERVICE_INTERACTIVE_PROCESS 256
2045 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
2046 #define SERVICE_BOOT_START 0
2047 #define SERVICE_SYSTEM_START 1
2048 #define SERVICE_AUTO_START 2
2049 #define SERVICE_DEMAND_START 3
2050 #define SERVICE_DISABLED 4
2051 #define SERVICE_ERROR_IGNORE 0
2052 #define SERVICE_ERROR_NORMAL 1
2053 #define SERVICE_ERROR_SEVERE 2
2054 #define SERVICE_ERROR_CRITICAL 3
2055 #define SE_OWNER_DEFAULTED 0x0001
2056 #define SE_GROUP_DEFAULTED 0x0002
2057 #define SE_DACL_PRESENT 0x0004
2058 #define SE_DACL_DEFAULTED 0x0008
2059 #define SE_SACL_PRESENT 0x0010
2060 #define SE_SACL_DEFAULTED 0x0020
2061 #define SE_DACL_UNTRUSTED 0x0040
2062 #define SE_SERVER_SECURITY 0x0080
2063 #define SE_DACL_AUTO_INHERIT_REQ 0x0100
2064 #define SE_SACL_AUTO_INHERIT_REQ 0x0200
2065 #define SE_DACL_AUTO_INHERITED 0x0400
2066 #define SE_SACL_AUTO_INHERITED 0x0800
2067 #define SE_DACL_PROTECTED 0x1000
2068 #define SE_SACL_PROTECTED 0x2000
2069 #define SE_RM_CONTROL_VALID 0x4000
2070 #define SE_SELF_RELATIVE 0x8000
2071 #define SECURITY_DESCRIPTOR_MIN_LENGTH 20
2072 #define SECURITY_DESCRIPTOR_REVISION 1
2073 #define SECURITY_DESCRIPTOR_REVISION1 1
2074 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
2075 #define SE_PRIVILEGE_ENABLED 2
2076 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2077 #define PRIVILEGE_SET_ALL_NECESSARY 1
2078 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
2079 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
2080 #define SECURITY_DYNAMIC_TRACKING TRUE
2081 #define SECURITY_STATIC_TRACKING FALSE
2082 /* also in ddk/ntifs.h */
2083 #define TOKEN_ASSIGN_PRIMARY (0x0001)
2084 #define TOKEN_DUPLICATE (0x0002)
2085 #define TOKEN_IMPERSONATE (0x0004)
2086 #define TOKEN_QUERY (0x0008)
2087 #define TOKEN_QUERY_SOURCE (0x0010)
2088 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
2089 #define TOKEN_ADJUST_GROUPS (0x0040)
2090 #define TOKEN_ADJUST_DEFAULT (0x0080)
2091 #define TOKEN_ADJUST_SESSIONID (0x0100)
2092 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
2093 TOKEN_ASSIGN_PRIMARY |\
2094 TOKEN_DUPLICATE |\
2095 TOKEN_IMPERSONATE |\
2096 TOKEN_QUERY |\
2097 TOKEN_QUERY_SOURCE |\
2098 TOKEN_ADJUST_PRIVILEGES |\
2099 TOKEN_ADJUST_GROUPS |\
2100 TOKEN_ADJUST_DEFAULT |\
2101 TOKEN_ADJUST_SESSIONID)
2102 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
2103 TOKEN_QUERY)
2104 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
2105 TOKEN_ADJUST_PRIVILEGES |\
2106 TOKEN_ADJUST_GROUPS |\
2107 TOKEN_ADJUST_DEFAULT)
2108
2109 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
2110 #define TOKEN_SOURCE_LENGTH 8
2111 /* end ddk/ntifs.h */
2112 #define DLL_PROCESS_DETACH 0
2113 #define DLL_PROCESS_ATTACH 1
2114 #define DLL_THREAD_ATTACH 2
2115 #define DLL_THREAD_DETACH 3
2116 #ifdef __WINESRC__
2117 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */
2118 #endif
2119 #define TAPE_ABSOLUTE_POSITION 0
2120 #define TAPE_LOGICAL_POSITION 1
2121 #define TAPE_PSEUDO_LOGICAL_POSITION 2
2122 #define TAPE_REWIND 0
2123 #define TAPE_ABSOLUTE_BLOCK 1
2124 #define TAPE_LOGICAL_BLOCK 2
2125 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
2126 #define TAPE_SPACE_END_OF_DATA 4
2127 #define TAPE_SPACE_RELATIVE_BLOCKS 5
2128 #define TAPE_SPACE_FILEMARKS 6
2129 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
2130 #define TAPE_SPACE_SETMARKS 8
2131 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
2132 #define TAPE_DRIVE_FIXED 1
2133 #define TAPE_DRIVE_SELECT 2
2134 #define TAPE_DRIVE_INITIATOR 4
2135 #define TAPE_DRIVE_ERASE_SHORT 16
2136 #define TAPE_DRIVE_ERASE_LONG 32
2137 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
2138 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
2139 #define TAPE_DRIVE_TAPE_CAPACITY 256
2140 #define TAPE_DRIVE_TAPE_REMAINING 512
2141 #define TAPE_DRIVE_FIXED_BLOCK 1024
2142 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
2143 #define TAPE_DRIVE_WRITE_PROTECT 4096
2144 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
2145 #define TAPE_DRIVE_ECC 0x10000
2146 #define TAPE_DRIVE_COMPRESSION 0x20000
2147 #define TAPE_DRIVE_PADDING 0x40000
2148 #define TAPE_DRIVE_REPORT_SMKS 0x80000
2149 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
2150 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
2151 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
2152 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
2153 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
2154 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
2155 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
2156 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
2157 #define TAPE_DRIVE_TENSION 0x80000002
2158 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
2159 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
2160 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
2161 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
2162 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
2163 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
2164 #define TAPE_DRIVE_SET_ECC 0x80000100
2165 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
2166 #define TAPE_DRIVE_SET_PADDING 0x80000400
2167 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
2168 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
2169 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
2170 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
2171 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
2172 #define TAPE_DRIVE_END_OF_DATA 0x80010000
2173 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
2174 #define TAPE_DRIVE_FILEMARKS 0x80040000
2175 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
2176 #define TAPE_DRIVE_SETMARKS 0x80100000
2177 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
2178 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
2179 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
2180 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
2181 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
2182 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
2183 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
2184 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
2185 #define TAPE_DRIVE_FORMAT 0xA0000000
2186 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
2187 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
2188 #define TAPE_FIXED_PARTITIONS 0
2189 #define TAPE_INITIATOR_PARTITIONS 2
2190 #define TAPE_SELECT_PARTITIONS 1
2191 #define TAPE_FILEMARKS 1
2192 #define TAPE_LONG_FILEMARKS 3
2193 #define TAPE_SETMARKS 0
2194 #define TAPE_SHORT_FILEMARKS 2
2195 #define TAPE_ERASE_LONG 1
2196 #define TAPE_ERASE_SHORT 0
2197 #define TAPE_LOAD 0
2198 #define TAPE_UNLOAD 1
2199 #define TAPE_TENSION 2
2200 #define TAPE_LOCK 3
2201 #define TAPE_UNLOCK 4
2202 #define TAPE_FORMAT 5
2203 #if (_WIN32_WINNT >= 0x0500)
2204 #define VER_MINORVERSION 0x0000001
2205 #define VER_MAJORVERSION 0x0000002
2206 #define VER_BUILDNUMBER 0x0000004
2207 #define VER_PLATFORMID 0x0000008
2208 #define VER_SERVICEPACKMINOR 0x0000010
2209 #define VER_SERVICEPACKMAJOR 0x0000020
2210 #define VER_SUITENAME 0x0000040
2211 #define VER_PRODUCT_TYPE 0x0000080
2212 #define VER_EQUAL 1
2213 #define VER_GREATER 2
2214 #define VER_GREATER_EQUAL 3
2215 #define VER_LESS 4
2216 #define VER_LESS_EQUAL 5
2217 #define VER_AND 6
2218 #define VER_OR 7
2219 #endif
2220 #define VER_SERVER_NT 0x80000000
2221 #define VER_WORKSTATION_NT 0x40000000
2222 #define VER_PLATFORM_WIN32s 0
2223 #define VER_PLATFORM_WIN32_WINDOWS 1
2224 #define VER_PLATFORM_WIN32_NT 2
2225 #define VER_NT_WORKSTATION 1
2226 #define VER_NT_DOMAIN_CONTROLLER 2
2227 #define VER_NT_SERVER 3
2228 #define VER_SUITE_SMALLBUSINESS 1
2229 #define VER_SUITE_ENTERPRISE 2
2230 #define VER_SUITE_BACKOFFICE 4
2231 #define VER_SUITE_COMMUNICATIONS 8
2232 #define VER_SUITE_TERMINAL 16
2233 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
2234 #define VER_SUITE_EMBEDDEDNT 64
2235 #define VER_SUITE_DATACENTER 128
2236 #define VER_SUITE_SINGLEUSERTS 256
2237 #define VER_SUITE_PERSONAL 512
2238 #define VER_SUITE_BLADE 1024
2239 #define VER_SUITE_EMBEDDED_RESTRICTED 2048
2240 #define VER_SUITE_SECURITY_APPLIANCE 4096
2241 #define VER_SUITE_STORAGE_SERVER 8192
2242 #define VER_SUITE_COMPUTE_SERVER 16384
2243 #define VER_SUITE_WH_SERVER 32768
2244 #define WT_EXECUTEDEFAULT 0x00000000
2245 #define WT_EXECUTEINIOTHREAD 0x00000001
2246 #define WT_EXECUTEINUITHREAD 0x00000002
2247 #define WT_EXECUTEINWAITTHREAD 0x00000004
2248 #define WT_EXECUTEONLYONCE 0x00000008
2249 #define WT_EXECUTELONGFUNCTION 0x00000010
2250 #define WT_EXECUTEINTIMERTHREAD 0x00000020
2251 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
2252 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
2253 #define WT_TRANSFER_IMPERSONATION 0x00000100
2254 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16)
2255 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
2256 #if (_WIN32_WINNT >= 0x0501)
2257 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
2258 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
2259 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
2260 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
2261 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
2262 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
2263 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
2264 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
2265 #endif /* (_WIN32_WINNT >= 0x0501) */
2266 #define BTYPE(x) ((x)&N_BTMASK)
2267 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
2268 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
2269 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
2270 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
2271 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2272 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2273 #define TLS_MINIMUM_AVAILABLE 64
2274 #define FLS_MAXIMUM_AVAILABLE 128
2275 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
2276 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
2277 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2278 #define IO_REPARSE_TAG_RESERVED_ONE 1
2279 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
2280 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
2281 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
2282 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
2283 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
2284 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
2285 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
2286 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
2287 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
2288 #ifndef RC_INVOKED
2289 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2290
2291 #ifdef _GUID_DEFINED
2292 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
2293 #endif
2294
2295 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
2296 #define GUID_DEFINED
2297 typedef struct _GUID {
2298 unsigned long Data1;
2299 unsigned short Data2;
2300 unsigned short Data3;
2301 unsigned char Data4[8];
2302 } GUID, *REFGUID, *LPGUID;
2303 #endif /* GUID_DEFINED */
2304
2305 #define SYSTEM_LUID { 0x3E7, 0x0 }
2306
2307 /* ACE Access Types, also in ntifs.h */
2308 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
2309 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
2310 #define ACCESS_DENIED_ACE_TYPE (0x1)
2311 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
2312 #define SYSTEM_ALARM_ACE_TYPE (0x3)
2313 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
2314 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
2315 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
2316 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
2317 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
2318 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
2319 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
2320 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
2321 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
2322 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
2323 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
2324 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
2325 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
2326 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
2327 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
2328 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
2329 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
2330 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
2331 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
2332 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11)
2333 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x11)
2334 /* end ntifs.h */
2335
2336 typedef struct _GENERIC_MAPPING {
2337 ACCESS_MASK GenericRead;
2338 ACCESS_MASK GenericWrite;
2339 ACCESS_MASK GenericExecute;
2340 ACCESS_MASK GenericAll;
2341 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2342
2343 typedef struct _ACE_HEADER {
2344 BYTE AceType;
2345 BYTE AceFlags;
2346 WORD AceSize;
2347 } ACE_HEADER, *PACE_HEADER;
2348
2349 typedef struct _ACCESS_ALLOWED_ACE {
2350 ACE_HEADER Header;
2351 ACCESS_MASK Mask;
2352 DWORD SidStart;
2353 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
2354
2355 typedef struct _ACCESS_DENIED_ACE {
2356 ACE_HEADER Header;
2357 ACCESS_MASK Mask;
2358 DWORD SidStart;
2359 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
2360
2361 typedef struct _SYSTEM_AUDIT_ACE {
2362 ACE_HEADER Header;
2363 ACCESS_MASK Mask;
2364 DWORD SidStart;
2365 } SYSTEM_AUDIT_ACE, *PSYSTEM_AUDIT_ACE;
2366
2367 typedef struct _SYSTEM_ALARM_ACE {
2368 ACE_HEADER Header;
2369 ACCESS_MASK Mask;
2370 DWORD SidStart;
2371 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
2372
2373 typedef struct _SYSTEM_MANDATORY_LABEL_ACE {
2374 ACE_HEADER Header;
2375 ACCESS_MASK Mask;
2376 DWORD SidStart;
2377 } SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE;
2378
2379 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
2380 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
2381 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
2382 #define SYSTEM_MANDATORY_LABEL_VALID_MASK (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP | SYSTEM_MANDATORY_LABEL_NO_READ_UP | SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
2383
2384 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
2385 ACE_HEADER Header;
2386 ACCESS_MASK Mask;
2387 DWORD Flags;
2388 GUID ObjectType;
2389 GUID InheritedObjectType;
2390 DWORD SidStart;
2391 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
2392
2393 typedef struct _ACCESS_DENIED_OBJECT_ACE {
2394 ACE_HEADER Header;
2395 ACCESS_MASK Mask;
2396 DWORD Flags;
2397 GUID ObjectType;
2398 GUID InheritedObjectType;
2399 DWORD SidStart;
2400 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
2401
2402 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
2403 ACE_HEADER Header;
2404 ACCESS_MASK Mask;
2405 DWORD Flags;
2406 GUID ObjectType;
2407 GUID InheritedObjectType;
2408 DWORD SidStart;
2409 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
2410
2411 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
2412 ACE_HEADER Header;
2413 ACCESS_MASK Mask;
2414 DWORD Flags;
2415 GUID ObjectType;
2416 GUID InheritedObjectType;
2417 DWORD SidStart;
2418 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
2419
2420 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
2421 ACE_HEADER Header;
2422 ACCESS_MASK Mask;
2423 DWORD SidStart;
2424 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE;
2425
2426 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
2427 ACE_HEADER Header;
2428 ACCESS_MASK Mask;
2429 DWORD SidStart;
2430 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE;
2431
2432 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
2433 ACE_HEADER Header;
2434 ACCESS_MASK Mask;
2435 DWORD SidStart;
2436 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE;
2437
2438 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
2439 ACE_HEADER Header;
2440 ACCESS_MASK Mask;
2441 DWORD SidStart;
2442 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE;
2443
2444 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
2445 ACE_HEADER Header;
2446 ACCESS_MASK Mask;
2447 DWORD Flags;
2448 GUID ObjectType;
2449 GUID InheritedObjectType;
2450 DWORD SidStart;
2451 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2452
2453 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2454 ACE_HEADER Header;
2455 ACCESS_MASK Mask;
2456 DWORD Flags;
2457 GUID ObjectType;
2458 GUID InheritedObjectType;
2459 DWORD SidStart;
2460 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
2461
2462 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2463 ACE_HEADER Header;
2464 ACCESS_MASK Mask;
2465 DWORD Flags;
2466 GUID ObjectType;
2467 GUID InheritedObjectType;
2468 DWORD SidStart;
2469 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2470
2471 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2472 ACE_HEADER Header;
2473 ACCESS_MASK Mask;
2474 DWORD Flags;
2475 GUID ObjectType;
2476 GUID InheritedObjectType;
2477 DWORD SidStart;
2478 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2479
2480 typedef struct _ACL {
2481 BYTE AclRevision;
2482 BYTE Sbz1;
2483 WORD AclSize;
2484 WORD AceCount;
2485 WORD Sbz2;
2486 } ACL,*PACL;
2487
2488 typedef enum _ACL_INFORMATION_CLASS {
2489 AclRevisionInformation = 1,
2490 AclSizeInformation
2491 } ACL_INFORMATION_CLASS;
2492
2493 typedef struct _ACL_REVISION_INFORMATION {
2494 DWORD AclRevision;
2495 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
2496
2497 typedef struct _ACL_SIZE_INFORMATION {
2498 DWORD AceCount;
2499 DWORD AclBytesInUse;
2500 DWORD AclBytesFree;
2501 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
2502
2503 typedef
2504 _IRQL_requires_same_
2505 _Function_class_(EXCEPTION_ROUTINE)
2506 EXCEPTION_DISPOSITION
2507 NTAPI
2508 EXCEPTION_ROUTINE(
2509 _Inout_ struct _EXCEPTION_RECORD *ExceptionRecord,
2510 _In_ PVOID EstablisherFrame,
2511 _Inout_ struct _CONTEXT *ContextRecord,
2512 _In_ PVOID DispatcherContext);
2513
2514 typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
2515
2516 #ifndef _LDT_ENTRY_DEFINED
2517 #define _LDT_ENTRY_DEFINED
2518
2519 typedef struct _LDT_ENTRY {
2520 WORD LimitLow;
2521 WORD BaseLow;
2522 union {
2523 struct {
2524 BYTE BaseMid;
2525 BYTE Flags1;
2526 BYTE Flags2;
2527 BYTE BaseHi;
2528 } Bytes;
2529 struct {
2530 DWORD BaseMid:8;
2531 DWORD Type:5;
2532 DWORD Dpl:2;
2533 DWORD Pres:1;
2534 DWORD LimitHi:4;
2535 DWORD Sys:1;
2536 DWORD Reserved_0:1;
2537 DWORD Default_Big:1;
2538 DWORD Granularity:1;
2539 DWORD BaseHi:8;
2540 } Bits;
2541 } HighWord;
2542 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
2543
2544 #endif /* _LDT_ENTRY_DEFINED */
2545
2546 /* FIXME: add more machines */
2547 #if defined(_X86_) && !defined(__PowerPC__)
2548 #define SIZE_OF_80387_REGISTERS 80
2549 #define CONTEXT_i386 0x10000
2550 #define CONTEXT_i486 0x10000
2551 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
2552 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
2553 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
2554 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
2555 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
2556 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
2557 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
2558 #define MAXIMUM_SUPPORTED_EXTENSION 512
2559
2560 #define EXCEPTION_READ_FAULT 0
2561 #define EXCEPTION_WRITE_FAULT 1
2562 #define EXCEPTION_EXECUTE_FAULT 8
2563
2564 typedef struct _FLOATING_SAVE_AREA {
2565 DWORD ControlWord;
2566 DWORD StatusWord;
2567 DWORD TagWord;
2568 DWORD ErrorOffset;
2569 DWORD ErrorSelector;
2570 DWORD DataOffset;
2571 DWORD DataSelector;
2572 BYTE RegisterArea[80];
2573 DWORD Cr0NpxState;
2574 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
2575
2576 typedef struct _CONTEXT {
2577 DWORD ContextFlags;
2578 DWORD Dr0;
2579 DWORD Dr1;
2580 DWORD Dr2;
2581 DWORD Dr3;
2582 DWORD Dr6;
2583 DWORD Dr7;
2584 FLOATING_SAVE_AREA FloatSave;
2585 DWORD SegGs;
2586 DWORD SegFs;
2587 DWORD SegEs;
2588 DWORD SegDs;
2589 DWORD Edi;
2590 DWORD Esi;
2591 DWORD Ebx;
2592 DWORD Edx;
2593 DWORD Ecx;
2594 DWORD Eax;
2595 DWORD Ebp;
2596 DWORD Eip;
2597 DWORD SegCs;
2598 DWORD EFlags;
2599 DWORD Esp;
2600 DWORD SegSs;
2601 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
2602 } CONTEXT;
2603 #elif defined(__x86_64__)
2604
2605 #define CONTEXT_AMD64 0x100000
2606
2607 #if !defined(RC_INVOKED)
2608 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
2609 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
2610 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
2611 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
2612 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
2613
2614 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
2615 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
2616
2617 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
2618 #define CONTEXT_SERVICE_ACTIVE 0x10000000
2619 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
2620 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
2621 #endif
2622
2623 #define INITIAL_MXCSR 0x1f80
2624 #define INITIAL_FPCSR 0x027f
2625 #define EXCEPTION_READ_FAULT 0
2626 #define EXCEPTION_WRITE_FAULT 1
2627 #define EXCEPTION_EXECUTE_FAULT 8
2628
2629 typedef struct DECLSPEC_ALIGN(16) _M128A {
2630 ULONGLONG Low;
2631 LONGLONG High;
2632 } M128A, *PM128A;
2633
2634 typedef struct _XMM_SAVE_AREA32 {
2635 WORD ControlWord;
2636 WORD StatusWord;
2637 BYTE TagWord;
2638 BYTE Reserved1;
2639 WORD ErrorOpcode;
2640 DWORD ErrorOffset;
2641 WORD ErrorSelector;
2642 WORD Reserved2;
2643 DWORD DataOffset;
2644 WORD DataSelector;
2645 WORD Reserved3;
2646 DWORD MxCsr;
2647 DWORD MxCsr_Mask;
2648 M128A FloatRegisters[8];
2649 M128A XmmRegisters[16];
2650 BYTE Reserved4[96];
2651 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
2652
2653 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
2654 DWORD64 P1Home;
2655 DWORD64 P2Home;
2656 DWORD64 P3Home;
2657 DWORD64 P4Home;
2658 DWORD64 P5Home;
2659 DWORD64 P6Home;
2660
2661 /* Control flags */
2662 DWORD ContextFlags;
2663 DWORD MxCsr;
2664
2665 /* Segment */
2666 WORD SegCs;
2667 WORD SegDs;
2668 WORD SegEs;
2669 WORD SegFs;
2670 WORD SegGs;
2671 WORD SegSs;
2672 DWORD EFlags;
2673
2674 /* Debug */
2675 DWORD64 Dr0;
2676 DWORD64 Dr1;
2677 DWORD64 Dr2;
2678 DWORD64 Dr3;
2679 DWORD64 Dr6;
2680 DWORD64 Dr7;
2681
2682 /* Integer */
2683 DWORD64 Rax;
2684 DWORD64 Rcx;
2685 DWORD64 Rdx;
2686 DWORD64 Rbx;
2687 DWORD64 Rsp;
2688 DWORD64 Rbp;
2689 DWORD64 Rsi;
2690 DWORD64 Rdi;
2691 DWORD64 R8;
2692 DWORD64 R9;
2693 DWORD64 R10;
2694 DWORD64 R11;
2695 DWORD64 R12;
2696 DWORD64 R13;
2697 DWORD64 R14;
2698 DWORD64 R15;
2699
2700 /* Counter */
2701 DWORD64 Rip;
2702
2703 /* Floating point */
2704 union {
2705 XMM_SAVE_AREA32 FltSave;
2706 struct {
2707 M128A Header[2];
2708 M128A Legacy[8];
2709 M128A Xmm0;
2710 M128A Xmm1;
2711 M128A Xmm2;
2712 M128A Xmm3;
2713 M128A Xmm4;
2714 M128A Xmm5;
2715 M128A Xmm6;
2716 M128A Xmm7;
2717 M128A Xmm8;
2718 M128A Xmm9;
2719 M128A Xmm10;
2720 M128A Xmm11;
2721 M128A Xmm12;
2722 M128A Xmm13;
2723 M128A Xmm14;
2724 M128A Xmm15;
2725 } DUMMYSTRUCTNAME;
2726 } DUMMYUNIONNAME;
2727
2728 /* Vector */
2729 M128A VectorRegister[26];
2730 DWORD64 VectorControl;
2731
2732 /* Debug control */
2733 DWORD64 DebugControl;
2734 DWORD64 LastBranchToRip;
2735 DWORD64 LastBranchFromRip;
2736 DWORD64 LastExceptionToRip;
2737 DWORD64 LastExceptionFromRip;
2738 } CONTEXT;
2739
2740
2741 typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
2742 union {
2743 PM128A FloatingContext[16];
2744 struct {
2745 PM128A Xmm0;
2746 PM128A Xmm1;
2747 PM128A Xmm2;
2748 PM128A Xmm3;
2749 PM128A Xmm4;
2750 PM128A Xmm5;
2751 PM128A Xmm6;
2752 PM128A Xmm7;
2753 PM128A Xmm8;
2754 PM128A Xmm9;
2755 PM128A Xmm10;
2756 PM128A Xmm11;
2757 PM128A Xmm12;
2758 PM128A Xmm13;
2759 PM128A Xmm14;
2760 PM128A Xmm15;
2761 } DUMMYSTRUCTNAME;
2762 } DUMMYUNIONNAME;
2763
2764 union {
2765 PULONG64 IntegerContext[16];
2766 struct {
2767 PULONG64 Rax;
2768 PULONG64 Rcx;
2769 PULONG64 Rdx;
2770 PULONG64 Rbx;
2771 PULONG64 Rsp;
2772 PULONG64 Rbp;
2773 PULONG64 Rsi;
2774 PULONG64 Rdi;
2775 PULONG64 R8;
2776 PULONG64 R9;
2777 PULONG64 R10;
2778 PULONG64 R11;
2779 PULONG64 R12;
2780 PULONG64 R13;
2781 PULONG64 R14;
2782 PULONG64 R15;
2783 } DUMMYSTRUCTNAME;
2784 } DUMMYUNIONNAME2;
2785 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
2786
2787 #define RUNTIME_FUNCTION_INDIRECT 0x1
2788
2789 typedef struct _RUNTIME_FUNCTION {
2790 DWORD BeginAddress;
2791 DWORD EndAddress;
2792 DWORD UnwindData;
2793 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
2794
2795 #define UNWIND_HISTORY_TABLE_SIZE 12
2796
2797 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
2798 {
2799 ULONG64 ImageBase;
2800 PRUNTIME_FUNCTION FunctionEntry;
2801 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
2802
2803 typedef struct _UNWIND_HISTORY_TABLE
2804 {
2805 ULONG Count;
2806 UCHAR Search;
2807 ULONG64 LowAddress;
2808 ULONG64 HighAddress;
2809 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
2810 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
2811
2812 typedef
2813 _Function_class_(GET_RUNTIME_FUNCTION_CALLBACK)
2814 PRUNTIME_FUNCTION
2815 (*PGET_RUNTIME_FUNCTION_CALLBACK)(
2816 _In_ DWORD64 ControlPc,
2817 _In_opt_ PVOID Context);
2818
2819 typedef
2820 _Function_class_(OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)
2821 _Must_inspect_result_
2822 DWORD
2823 (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(
2824 _In_ HANDLE Process,
2825 _In_ PVOID TableAddress,
2826 _Out_ PDWORD Entries,
2827 _Out_ PRUNTIME_FUNCTION *Functions);
2828
2829 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
2830
2831 NTSYSAPI
2832 VOID
2833 __cdecl
2834 RtlRestoreContext(struct _CONTEXT *ContextRecord,
2835 struct _EXCEPTION_RECORD *ExceptionRecord);
2836
2837 NTSYSAPI
2838 BOOLEAN
2839 __cdecl
2840 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,
2841 DWORD EntryCount,
2842 DWORD64 BaseAddress);
2843
2844 NTSYSAPI
2845 BOOLEAN
2846 __cdecl
2847 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,
2848 DWORD64 BaseAddress,
2849 DWORD Length,
2850 PGET_RUNTIME_FUNCTION_CALLBACK Callback,
2851 PVOID Context,
2852 PCWSTR OutOfProcessCallbackDll);
2853
2854 NTSYSAPI
2855 BOOLEAN
2856 __cdecl
2857 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
2858
2859 NTSYSAPI
2860 PRUNTIME_FUNCTION
2861 NTAPI
2862 RtlLookupFunctionEntry(
2863 _In_ DWORD64 ControlPc,
2864 _Out_ PDWORD64 ImageBase,
2865 _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable);
2866
2867 NTSYSAPI
2868 PEXCEPTION_ROUTINE
2869 NTAPI
2870 RtlVirtualUnwind(
2871 _In_ DWORD HandlerType,
2872 _In_ DWORD64 ImageBase,
2873 _In_ DWORD64 ControlPc,
2874 _In_ PRUNTIME_FUNCTION FunctionEntry,
2875 _Inout_ struct _CONTEXT *ContextRecord,
2876 _Out_ PVOID *HandlerData,
2877 _Out_ PDWORD64 EstablisherFrame,
2878 _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
2879
2880 #elif defined(_PPC_)
2881 #define CONTEXT_CONTROL 1L
2882 #define CONTEXT_FLOATING_POINT 2L
2883 #define CONTEXT_INTEGER 4L
2884 #define CONTEXT_DEBUG_REGISTERS 8L
2885 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2886 typedef struct _FLOATING_SAVE_AREA
2887 {
2888 double Fpr0;
2889 double Fpr1;
2890 double Fpr2;
2891 double Fpr3;
2892 double Fpr4;
2893 double Fpr5;
2894 double Fpr6;
2895 double Fpr7;
2896 double Fpr8;
2897 double Fpr9;
2898 double Fpr10;
2899 double Fpr11;
2900 double Fpr12;
2901 double Fpr13;
2902 double Fpr14;
2903 double Fpr15;
2904 double Fpr16;
2905 double Fpr17;
2906 double Fpr18;
2907 double Fpr19;
2908 double Fpr20;
2909 double Fpr21;
2910 double Fpr22;
2911 double Fpr23;
2912 double Fpr24;
2913 double Fpr25;
2914 double Fpr26;
2915 double Fpr27;
2916 double Fpr28;
2917 double Fpr29;
2918 double Fpr30;
2919 double Fpr31;
2920 double Fpscr;
2921 } FLOATING_SAVE_AREA;
2922
2923 typedef struct _CONTEXT {
2924 FLOATING_SAVE_AREA FloatSave;
2925 DWORD Gpr0;
2926 DWORD Gpr1;
2927 DWORD Gpr2;
2928 DWORD Gpr3;
2929 DWORD Gpr4;
2930 DWORD Gpr5;
2931 DWORD Gpr6;
2932 DWORD Gpr7;
2933 DWORD Gpr8;
2934 DWORD Gpr9;
2935 DWORD Gpr10;
2936 DWORD Gpr11;
2937 DWORD Gpr12;
2938 DWORD Gpr13;
2939 DWORD Gpr14;
2940 DWORD Gpr15;
2941 DWORD Gpr16;
2942 DWORD Gpr17;
2943 DWORD Gpr18;
2944 DWORD Gpr19;
2945 DWORD Gpr20;
2946 DWORD Gpr21;
2947 DWORD Gpr22;
2948 DWORD Gpr23;
2949 DWORD Gpr24;
2950 DWORD Gpr25;
2951 DWORD Gpr26;
2952 DWORD Gpr27;
2953 DWORD Gpr28;
2954 DWORD Gpr29;
2955 DWORD Gpr30;
2956 DWORD Gpr31;
2957 DWORD Cr;
2958 DWORD Xer;
2959 DWORD Msr;
2960 DWORD Iar;
2961 DWORD Lr;
2962 DWORD Ctr;
2963 DWORD ContextFlags;
2964 DWORD Fill[3];
2965 DWORD Dr0;
2966 DWORD Dr1;
2967 DWORD Dr2;
2968 DWORD Dr3;
2969 DWORD Dr4;
2970 DWORD Dr5;
2971 DWORD Dr6;
2972 DWORD Dr7;
2973 } CONTEXT;
2974 #elif defined(_ALPHA_)
2975 #define CONTEXT_ALPHA 0x20000
2976 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
2977 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
2978 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
2979 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2980 typedef struct _CONTEXT {
2981 ULONGLONG FltF0;
2982 ULONGLONG FltF1;
2983 ULONGLONG FltF2;
2984 ULONGLONG FltF3;
2985 ULONGLONG FltF4;
2986 ULONGLONG FltF5;
2987 ULONGLONG FltF6;
2988 ULONGLONG FltF7;
2989 ULONGLONG FltF8;
2990 ULONGLONG FltF9;
2991 ULONGLONG FltF10;
2992 ULONGLONG FltF11;
2993 ULONGLONG FltF12;
2994 ULONGLONG FltF13;
2995 ULONGLONG FltF14;
2996 ULONGLONG FltF15;
2997 ULONGLONG FltF16;
2998 ULONGLONG FltF17;
2999 ULONGLONG FltF18;
3000 ULONGLONG FltF19;
3001 ULONGLONG FltF20;
3002 ULONGLONG FltF21;
3003 ULONGLONG FltF22;
3004 ULONGLONG FltF23;
3005 ULONGLONG FltF24;
3006 ULONGLONG FltF25;
3007 ULONGLONG FltF26;
3008 ULONGLONG FltF27;
3009 ULONGLONG FltF28;
3010 ULONGLONG FltF29;
3011 ULONGLONG FltF30;
3012 ULONGLONG FltF31;
3013 ULONGLONG IntV0;
3014 ULONGLONG IntT0;
3015 ULONGLONG IntT1;
3016 ULONGLONG IntT2;
3017 ULONGLONG IntT3;
3018 ULONGLONG IntT4;
3019 ULONGLONG IntT5;
3020 ULONGLONG IntT6;
3021 ULONGLONG IntT7;
3022 ULONGLONG IntS0;
3023 ULONGLONG IntS1;
3024 ULONGLONG IntS2;
3025 ULONGLONG IntS3;
3026 ULONGLONG IntS4;
3027 ULONGLONG IntS5;
3028 ULONGLONG IntFp;
3029 ULONGLONG IntA0;
3030 ULONGLONG IntA1;
3031 ULONGLONG IntA2;
3032 ULONGLONG IntA3;
3033 ULONGLONG IntA4;
3034 ULONGLONG IntA5;
3035 ULONGLONG IntT8;
3036 ULONGLONG IntT9;
3037 ULONGLONG IntT10;
3038 ULONGLONG IntT11;
3039 ULONGLONG IntRa;
3040 ULONGLONG IntT12;
3041 ULONGLONG IntAt;
3042 ULONGLONG IntGp;
3043 ULONGLONG IntSp;
3044 ULONGLONG IntZero;
3045 ULONGLONG Fpcr;
3046 ULONGLONG SoftFpcr;
3047 ULONGLONG Fir;
3048 DWORD Psr;
3049 DWORD ContextFlags;
3050 DWORD Fill[4];
3051 } CONTEXT;
3052 #elif defined(SHx)
3053
3054 /* These are the debug or break registers on the SH3 */
3055 typedef struct _DEBUG_REGISTERS {
3056 ULONG BarA;
3057 UCHAR BasrA;
3058 UCHAR BamrA;
3059 USHORT BbrA;
3060 ULONG BarB;
3061 UCHAR BasrB;
3062 UCHAR BamrB;
3063 USHORT BbrB;
3064 ULONG BdrB;
3065 ULONG BdmrB;
3066 USHORT Brcr;
3067 USHORT Align;
3068 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
3069
3070 /* The following flags control the contents of the CONTEXT structure. */
3071
3072 #define CONTEXT_SH3 0x00000040
3073 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
3074
3075 #ifdef SH3
3076 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
3077 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
3078 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
3079 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
3080 #else /* SH4 */
3081 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
3082 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
3083 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
3084 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
3085 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
3086 #endif
3087
3088 /* Context Frame */
3089
3090 /* This frame is used to store a limited processor context into the */
3091 /* Thread structure for CPUs which have no floating point support. */
3092
3093 typedef struct _CONTEXT {
3094 /* The flags values within this flag control the contents of */
3095 /* a CONTEXT record. */
3096
3097 /* If the context record is used as an input parameter, then */
3098 /* for each portion of the context record controlled by a flag */
3099 /* whose value is set, it is assumed that that portion of the */
3100 /* context record contains valid context. If the context record */
3101 /* is being used to modify a thread's context, then only that */
3102 /* portion of the threads context will be modified. */
3103
3104 /* If the context record is used as an IN OUT parameter to capture */
3105 /* the context of a thread, then only those portions of the thread's */
3106 /* context corresponding to set flags will be returned. */
3107
3108 /* The context record is never used as an OUT only parameter. */
3109
3110
3111 ULONG ContextFlags;
3112
3113 /* This section is specified/returned if the ContextFlags word contains */
3114 /* the flag CONTEXT_INTEGER. */
3115
3116 /* N.B. The registers RA and R15 are defined in this section, but are */
3117 /* considered part of the control context rather than part of the integer */
3118 /* context. */
3119
3120 ULONG PR;
3121 ULONG MACH;
3122 ULONG MACL;
3123 ULONG GBR;
3124 ULONG R0;
3125 ULONG R1;
3126 ULONG R2;
3127 ULONG R3;
3128 ULONG R4;
3129 ULONG R5;
3130 ULONG R6;
3131 ULONG R7;
3132 ULONG R8;
3133 ULONG R9;
3134 ULONG R10;
3135 ULONG R11;
3136 ULONG R12;
3137 ULONG R13;
3138 ULONG R14;
3139 ULONG R15;
3140
3141 /* This section is specified/returned if the ContextFlags word contains */
3142 /* the flag CONTEXT_CONTROL. */
3143
3144 /* N.B. The registers r15 and ra are defined in the integer section, */
3145 /* but are considered part of the control context rather than part of */
3146 /* the integer context. */
3147
3148 ULONG Fir;
3149 ULONG Psr;
3150
3151 #if !defined(SH3e) && !defined(SH4)
3152 ULONG OldStuff[2];
3153 DEBUG_REGISTERS DebugRegisters;
3154 #else
3155 ULONG Fpscr;
3156 ULONG Fpul;
3157 ULONG FRegs[16];
3158 #if defined(SH4)
3159 ULONG xFRegs[16];
3160 #endif
3161 #endif
3162 } CONTEXT;
3163
3164 #elif defined(_MIPS_)
3165
3166 /* The following flags control the contents of the CONTEXT structure. */
3167
3168 #define CONTEXT_R4000 0x00010000 /* r4000 context */
3169
3170 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
3171 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
3172 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
3173
3174 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
3175
3176 /* Context Frame */
3177
3178 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
3179
3180 /* This frame has a several purposes: 1) it is used as an argument to */
3181 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
3182 /* 3) it is used to construct a call frame for exception dispatching */
3183 /* in user mode, and 4) it is used in the user level thread creation */
3184 /* routines. */
3185
3186 /* The layout of the record conforms to a standard call frame. */
3187
3188
3189 typedef struct _CONTEXT {
3190
3191 /* This section is always present and is used as an argument build */
3192 /* area. */
3193
3194 DWORD Argument[4];
3195
3196 /* This section is specified/returned if the ContextFlags word contains */
3197 /* the flag CONTEXT_FLOATING_POINT. */
3198
3199 DWORD FltF0;
3200 DWORD FltF1;
3201 DWORD FltF2;
3202 DWORD FltF3;
3203 DWORD FltF4;
3204 DWORD FltF5;
3205 DWORD FltF6;
3206 DWORD FltF7;
3207 DWORD FltF8;
3208 DWORD FltF9;
3209 DWORD FltF10;
3210 DWORD FltF11;
3211 DWORD FltF12;
3212 DWORD FltF13;
3213 DWORD FltF14;
3214 DWORD FltF15;
3215 DWORD FltF16;
3216 DWORD FltF17;
3217 DWORD FltF18;
3218 DWORD FltF19;
3219 DWORD FltF20;
3220 DWORD FltF21;
3221 DWORD FltF22;
3222 DWORD FltF23;
3223 DWORD FltF24;
3224 DWORD FltF25;
3225 DWORD FltF26;
3226 DWORD FltF27;
3227 DWORD FltF28;
3228 DWORD FltF29;
3229 DWORD FltF30;
3230 DWORD FltF31;
3231
3232 /* This section is specified/returned if the ContextFlags word contains */
3233 /* the flag CONTEXT_INTEGER. */
3234
3235 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
3236 /* considered part of the control context rather than part of the integer */
3237 /* context. */
3238
3239 /* N.B. Register zero is not stored in the frame. */
3240
3241 DWORD IntZero;
3242 DWORD IntAt;
3243 DWORD IntV0;
3244 DWORD IntV1;
3245 DWORD IntA0;
3246 DWORD IntA1;
3247 DWORD IntA2;
3248 DWORD IntA3;
3249 DWORD IntT0;
3250 DWORD IntT1;
3251 DWORD IntT2;
3252 DWORD IntT3;
3253 DWORD IntT4;
3254 DWORD IntT5;
3255 DWORD IntT6;
3256 DWORD IntT7;
3257 DWORD IntS0;
3258 DWORD IntS1;
3259 DWORD IntS2;
3260 DWORD IntS3;
3261 DWORD IntS4;
3262 DWORD IntS5;
3263 DWORD IntS6;
3264 DWORD IntS7;
3265 DWORD IntT8;
3266 DWORD IntT9;
3267 DWORD IntK0;
3268 DWORD IntK1;
3269 DWORD IntGp;
3270 DWORD IntSp;
3271 DWORD IntS8;
3272 DWORD IntRa;
3273 DWORD IntLo;
3274 DWORD IntHi;
3275
3276 /* This section is specified/returned if the ContextFlags word contains */
3277 /* the flag CONTEXT_FLOATING_POINT. */
3278
3279 DWORD Fsr;
3280
3281 /* This section is specified/returned if the ContextFlags word contains */
3282 /* the flag CONTEXT_CONTROL. */
3283
3284 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
3285 /* but are considered part of the control context rather than part of */
3286 /* the integer context. */
3287
3288 DWORD Fir;
3289 DWORD Psr;
3290
3291 /* The flags values within this flag control the contents of */
3292 /* a CONTEXT record. */
3293
3294 /* If the context record is used as an input parameter, then */
3295 /* for each portion of the context record controlled by a flag */
3296 /* whose value is set, it is assumed that that portion of the */
3297 /* context record contains valid context. If the context record */
3298 /* is being used to modify a thread's context, then only that */
3299 /* portion of the threads context will be modified. */
3300
3301 /* If the context record is used as an IN OUT parameter to capture */
3302 /* the context of a thread, then only those portions of the thread's */
3303 /* context corresponding to set flags will be returned. */
3304
3305 /* The context record is never used as an OUT only parameter. */
3306
3307 DWORD ContextFlags;
3308
3309 DWORD Fill[2];
3310
3311 } CONTEXT;
3312 #elif defined(ARM)
3313
3314 #ifndef PAGE_SIZE
3315 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
3316 #endif
3317
3318 /* The following flags control the contents of the CONTEXT structure. */
3319
3320 #define CONTEXT_ARM 0x0000040
3321 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
3322 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
3323
3324 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
3325
3326 typedef struct _CONTEXT {
3327 /* The flags values within this flag control the contents of
3328 a CONTEXT record.
3329
3330 If the context record is used as an input parameter, then
3331 for each portion of the context record controlled by a flag
3332 whose value is set, it is assumed that that portion of the
3333 context record contains valid context. If the context record
3334 is being used to modify a thread's context, then only that
3335 portion of the threads context will be modified.
3336
3337 If the context record is used as an IN OUT parameter to capture
3338 the context of a thread, then only those portions of the thread's
3339 context corresponding to set flags will be returned.
3340
3341 The context record is never used as an OUT only parameter. */
3342
3343 ULONG ContextFlags;
3344
3345 /* This section is specified/returned if the ContextFlags word contains
3346 the flag CONTEXT_INTEGER. */
3347 ULONG R0;
3348 ULONG R1;
3349 ULONG R2;
3350 ULONG R3;
3351 ULONG R4;
3352 ULONG R5;
3353 ULONG R6;
3354 ULONG R7;
3355 ULONG R8;
3356 ULONG R9;
3357 ULONG R10;
3358 ULONG R11;
3359 ULONG R12;
3360
3361 ULONG Sp;
3362 ULONG Lr;
3363 ULONG Pc;
3364 ULONG Psr;
3365 } CONTEXT;
3366
3367 #else
3368 #error "undefined processor type"
3369 #endif
3370 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
3371
3372 #define EXCEPTION_MAXIMUM_PARAMETERS 15
3373 #define EXCEPTION_NONCONTINUABLE 0x01
3374 #define EXCEPTION_UNWINDING 0x02
3375 #define EXCEPTION_EXIT_UNWIND 0x04
3376 #define EXCEPTION_STACK_INVALID 0x08
3377 #define EXCEPTION_NESTED_CALL 0x10
3378 #define EXCEPTION_TARGET_UNWIND 0x20
3379 #define EXCEPTION_COLLIDED_UNWIND 0x40
3380 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
3381 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
3382
3383 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
3384 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
3385 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
3386
3387 typedef struct _EXCEPTION_RECORD {
3388 DWORD ExceptionCode;
3389 DWORD ExceptionFlags;
3390 struct _EXCEPTION_RECORD *ExceptionRecord;
3391 PVOID ExceptionAddress;
3392 DWORD NumberParameters;
3393 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3394 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
3395
3396 typedef struct _EXCEPTION_RECORD32 {
3397 DWORD ExceptionCode;
3398 DWORD ExceptionFlags;
3399 DWORD ExceptionRecord;
3400 DWORD ExceptionAddress;
3401 DWORD NumberParameters;
3402 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3403 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
3404
3405 typedef struct _EXCEPTION_RECORD64 {
3406 DWORD ExceptionCode;
3407 DWORD ExceptionFlags;
3408 DWORD64 ExceptionRecord;
3409 DWORD64 ExceptionAddress;
3410 DWORD NumberParameters;
3411 DWORD __unusedAlignment;
3412 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3413 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
3414
3415 typedef struct _EXCEPTION_POINTERS {
3416 PEXCEPTION_RECORD ExceptionRecord;
3417 PCONTEXT ContextRecord;
3418 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
3419
3420 #ifdef _M_PPC
3421 #define LARGE_INTEGER_ORDER(x) x HighPart; DWORD LowPart;
3422 #else
3423 #define LARGE_INTEGER_ORDER(x) DWORD LowPart; x HighPart;
3424 #endif
3425
3426 typedef union _LARGE_INTEGER {
3427 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
3428 _ANONYMOUS_STRUCT struct {
3429 LARGE_INTEGER_ORDER(LONG)
3430 };
3431 #endif /* NONAMELESSUNION */
3432 struct {
3433 LARGE_INTEGER_ORDER(LONG)
3434 } u;
3435 LONGLONG QuadPart;
3436 } LARGE_INTEGER, *PLARGE_INTEGER;
3437 typedef union _ULARGE_INTEGER {
3438 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
3439 _ANONYMOUS_STRUCT struct {
3440 LARGE_INTEGER_ORDER(DWORD)
3441 };
3442 #endif /* NONAMELESSUNION */
3443 struct {
3444 LARGE_INTEGER_ORDER(DWORD)
3445 } u;
3446 ULONGLONG QuadPart;
3447 } ULARGE_INTEGER, *PULARGE_INTEGER;
3448 typedef struct _LUID {
3449 LARGE_INTEGER_ORDER(LONG)
3450 } LUID, *PLUID;
3451
3452 #include <pshpack4.h>
3453
3454 typedef struct _LUID_AND_ATTRIBUTES {
3455 LUID Luid;
3456 DWORD Attributes;
3457 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3458 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
3459 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
3460
3461 #include <poppack.h>
3462
3463 typedef struct _PRIVILEGE_SET {
3464 DWORD PrivilegeCount;
3465 DWORD Control;
3466 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3467 } PRIVILEGE_SET,*PPRIVILEGE_SET;
3468
3469 typedef struct _SECURITY_ATTRIBUTES {
3470 DWORD nLength;
3471 LPVOID lpSecurityDescriptor;
3472 BOOL bInheritHandle;
3473 } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
3474
3475 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3476 SecurityAnonymous,
3477 SecurityIdentification,
3478 SecurityImpersonation,
3479 SecurityDelegation
3480 } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
3481
3482 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
3483
3484 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3485 DWORD Length;
3486 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3487 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3488 BOOLEAN EffectiveOnly;
3489 } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
3490
3491 typedef PVOID PACCESS_TOKEN;
3492
3493 typedef struct _SE_IMPERSONATION_STATE {
3494 PACCESS_TOKEN Token;
3495 BOOLEAN CopyOnOpen;
3496 BOOLEAN EffectiveOnly;
3497 SECURITY_IMPERSONATION_LEVEL Level;
3498 } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
3499
3500 typedef struct _SID_IDENTIFIER_AUTHORITY {
3501 BYTE Value[6];
3502 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
3503
3504 typedef PVOID PSID;
3505
3506 typedef struct _SID {
3507 BYTE Revision;
3508 BYTE SubAuthorityCount;
3509 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3510 DWORD SubAuthority[ANYSIZE_ARRAY];
3511 } SID, *PISID;
3512
3513 #define SECURITY_MIN_SID_SIZE (sizeof(SID))
3514 #define SECURITY_MAX_SID_SIZE (FIELD_OFFSET(SID, SubAuthority) + SID_MAX_SUB_AUTHORITIES * sizeof(DWORD))
3515
3516 typedef struct _SID_AND_ATTRIBUTES {
3517 PSID Sid;
3518 DWORD Attributes;
3519 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
3520 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
3521 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
3522
3523 typedef struct _TOKEN_SOURCE {
3524 CHAR SourceName[TOKEN_SOURCE_LENGTH];
3525 LUID SourceIdentifier;
3526 } TOKEN_SOURCE,*PTOKEN_SOURCE;
3527
3528 typedef struct _TOKEN_CONTROL {
3529 LUID TokenId;
3530 LUID AuthenticationId;
3531 LUID ModifiedId;
3532 TOKEN_SOURCE TokenSource;
3533 } TOKEN_CONTROL,*PTOKEN_CONTROL;
3534
3535 typedef struct _TOKEN_DEFAULT_DACL {
3536 PACL DefaultDacl;
3537 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
3538
3539 typedef struct _TOKEN_GROUPS {
3540 DWORD GroupCount;
3541 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3542 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
3543
3544 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
3545 DWORD SidCount;
3546 DWORD SidLength;
3547 PSID_AND_ATTRIBUTES Sids;
3548 DWORD RestrictedSidCount;
3549 DWORD RestrictedSidLength;
3550 PSID_AND_ATTRIBUTES RestrictedSids;
3551 DWORD PrivilegeCount;
3552 DWORD PrivilegeLength;
3553 PLUID_AND_ATTRIBUTES Privileges;
3554 LUID AuthenticationId;
3555 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
3556
3557 typedef struct _TOKEN_ORIGIN {
3558 LUID OriginatingLogonSession;
3559 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
3560
3561 typedef struct _TOKEN_OWNER {
3562 PSID Owner;
3563 } TOKEN_OWNER,*PTOKEN_OWNER;
3564
3565 typedef struct _TOKEN_PRIMARY_GROUP {
3566 PSID PrimaryGroup;
3567 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
3568
3569 typedef struct _TOKEN_PRIVILEGES {
3570 DWORD PrivilegeCount;
3571 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3572 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
3573
3574 typedef enum tagTOKEN_TYPE {
3575 TokenPrimary = 1,
3576 TokenImpersonation
3577 } TOKEN_TYPE,*PTOKEN_TYPE;
3578
3579 typedef enum _TOKEN_ELEVATION_TYPE {
3580 TokenElevationTypeDefault = 1,
3581 TokenElevationTypeFull,
3582 TokenElevationTypeLimited,
3583 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
3584
3585 typedef struct _TOKEN_MANDATORY_LABEL {
3586 SID_AND_ATTRIBUTES Label;
3587 } TOKEN_MANDATORY_LABEL, * PTOKEN_MANDATORY_LABEL;
3588
3589 #include <pshpack4.h>
3590 typedef struct _TOKEN_STATISTICS {
3591 LUID TokenId;
3592 LUID AuthenticationId;
3593 LARGE_INTEGER ExpirationTime;
3594 TOKEN_TYPE TokenType;
3595 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3596 DWORD DynamicCharged;
3597 DWORD DynamicAvailable;
3598 DWORD GroupCount;
3599 DWORD PrivilegeCount;
3600 LUID ModifiedId;
3601 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
3602 #include <poppack.h>
3603
3604 typedef struct _TOKEN_USER {
3605 SID_AND_ATTRIBUTES User;
3606 } TOKEN_USER, *PTOKEN_USER;
3607
3608 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
3609 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
3610
3611 #ifndef _SECURITY_ATTRIBUTES_
3612 #define _SECURITY_ATTRIBUTES_
3613 typedef struct _SECURITY_DESCRIPTOR {
3614 BYTE Revision;
3615 BYTE Sbz1;
3616 SECURITY_DESCRIPTOR_CONTROL Control;
3617 PSID Owner;
3618 PSID Group;
3619 PACL Sacl;
3620 PACL Dacl;
3621 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3622 typedef PVOID PSECURITY_DESCRIPTOR;
3623 #endif
3624
3625 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
3626 BYTE Revision;
3627 BYTE Sbz1;
3628 SECURITY_DESCRIPTOR_CONTROL Control;
3629 DWORD Owner;
3630 DWORD Group;
3631 DWORD Sacl;
3632 DWORD Dacl;
3633 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3634
3635 typedef enum _TOKEN_INFORMATION_CLASS {
3636 TokenUser = 1,
3637 TokenGroups,
3638 TokenPrivileges,
3639 TokenOwner,
3640 TokenPrimaryGroup,
3641 TokenDefaultDacl,
3642 TokenSource,
3643 TokenType,
3644 TokenImpersonationLevel,
3645 TokenStatistics,
3646 TokenRestrictedSids,
3647 TokenSessionId,
3648 TokenGroupsAndPrivileges,
3649 TokenSessionReference,
3650 TokenSandBoxInert,
3651 TokenAuditPolicy,
3652 TokenOrigin,
3653 TokenElevationType,
3654 TokenLinkedToken,
3655 TokenElevation,
3656 TokenHasRestrictions,
3657 TokenAccessInformation,
3658 TokenVirtualizationAllowed,
3659 TokenVirtualizationEnabled,
3660 TokenIntegrityLevel,
3661 TokenUIAccess,
3662 TokenMandatoryPolicy,
3663 TokenLogonSid,
3664 MaxTokenInfoClass
3665 } TOKEN_INFORMATION_CLASS;
3666
3667 typedef enum _SID_NAME_USE {
3668 SidTypeUser=1,
3669 SidTypeGroup,
3670 SidTypeDomain,
3671 SidTypeAlias,
3672 SidTypeWellKnownGroup,
3673 SidTypeDeletedAccount,
3674 SidTypeInvalid,
3675 SidTypeUnknown,
3676 SidTypeComputer,
3677 SidTypeLabel
3678 } SID_NAME_USE,*PSID_NAME_USE;
3679
3680 typedef struct _QUOTA_LIMITS {
3681 SIZE_T PagedPoolLimit;
3682 SIZE_T NonPagedPoolLimit;
3683 SIZE_T MinimumWorkingSetSize;
3684 SIZE_T MaximumWorkingSetSize;
3685 SIZE_T PagefileLimit;
3686 LARGE_INTEGER TimeLimit;
3687 } QUOTA_LIMITS,*PQUOTA_LIMITS;
3688
3689 typedef struct _QUOTA_LIMITS_EX {
3690 SIZE_T PagedPoolLimit;
3691 SIZE_T NonPagedPoolLimit;
3692 SIZE_T MinimumWorkingSetSize;
3693 SIZE_T MaximumWorkingSetSize;
3694 SIZE_T PagefileLimit;
3695 LARGE_INTEGER TimeLimit;
3696 SIZE_T Reserved1;
3697 SIZE_T Reserved2;
3698 SIZE_T Reserved3;
3699 SIZE_T Reserved4;
3700 ULONG Flags;
3701 ULONG Reserved5;
3702 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
3703
3704 typedef struct _IO_COUNTERS {
3705 ULONGLONG ReadOperationCount;
3706 ULONGLONG WriteOperationCount;
3707 ULONGLONG OtherOperationCount;
3708 ULONGLONG ReadTransferCount;
3709 ULONGLONG WriteTransferCount;
3710 ULONGLONG OtherTransferCount;