3f7111ac5c37871c5cabd722b606d5e9b9f53a0c
[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 MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff)
1484 #define PROCESSOR_INTEL_386 386
1485 #define PROCESSOR_INTEL_486 486
1486 #define PROCESSOR_INTEL_PENTIUM 586
1487 #define PROCESSOR_MIPS_R4000 4000
1488 #define PROCESSOR_ALPHA_21064 21064
1489 #define PROCESSOR_INTEL_IA64 2200
1490 #define PROCESSOR_PPC_601 601
1491 #define PROCESSOR_PPC_603 603
1492 #define PROCESSOR_PPC_604 604
1493 #define PROCESSOR_PPC_620 620
1494 #define PROCESSOR_INTEL_860 860
1495 #define PROCESSOR_AMD_X8664 8664
1496 #define PROCESSOR_MIPS_R2000 2000
1497 #define PROCESSOR_MIPS_R3000 3000
1498 #define PROCESSOR_HITACHI_SH3 10003
1499 #define PROCESSOR_HITACHI_SH3E 10004
1500 #define PROCESSOR_HITACHI_SH4 10005
1501 #define PROCESSOR_MOTOROLA_821 821
1502 #define PROCESSOR_SHx_SH3 103
1503 #define PROCESSOR_SHx_SH4 104
1504 #define PROCESSOR_STRONGARM 2577
1505 #define PROCESSOR_ARM720 1824
1506 #define PROCESSOR_ARM820 2080
1507 #define PROCESSOR_ARM920 2336
1508 #define PROCESSOR_ARM_7TDMI 70001
1509 #define PROCESSOR_ARCHITECTURE_INTEL 0
1510 #define PROCESSOR_ARCHITECTURE_MIPS 1
1511 #define PROCESSOR_ARCHITECTURE_ALPHA 2
1512 #define PROCESSOR_ARCHITECTURE_PPC 3
1513 #define PROCESSOR_ARCHITECTURE_SHX 4
1514 #define PROCESSOR_ARCHITECTURE_ARM 5
1515 #define PROCESSOR_ARCHITECTURE_IA64 6
1516 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
1517 #define PROCESSOR_ARCHITECTURE_MSIL 8
1518 #define PROCESSOR_ARCHITECTURE_AMD64 9
1519 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
1520 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
1521 #define PF_FLOATING_POINT_EMULATED 1
1522 #define PF_COMPARE_EXCHANGE_DOUBLE 2
1523 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
1524 #define PF_PPC_MOVEMEM_64BIT_OK 4
1525 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
1526 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
1527 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
1528 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
1529 #define PF_PAE_ENABLED 9
1530 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
1531 /* also in ddk/ntifs.h */
1532 #define FILE_ACTION_ADDED 0x00000001
1533 #define FILE_ACTION_REMOVED 0x00000002
1534 #define FILE_ACTION_MODIFIED 0x00000003
1535 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
1536 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
1537 #define FILE_ACTION_ADDED_STREAM 0x00000006
1538 #define FILE_ACTION_REMOVED_STREAM 0x00000007
1539 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
1540 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
1541 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
1542 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
1543 /* end ntifs.h */
1544 #define HEAP_NO_SERIALIZE 1
1545 #define HEAP_GROWABLE 2
1546 #define HEAP_GENERATE_EXCEPTIONS 4
1547 #define HEAP_ZERO_MEMORY 8
1548 #define HEAP_REALLOC_IN_PLACE_ONLY 16
1549 #define HEAP_TAIL_CHECKING_ENABLED 32
1550 #define HEAP_FREE_CHECKING_ENABLED 64
1551 #define HEAP_DISABLE_COALESCE_ON_FREE 128
1552 #define HEAP_CREATE_ALIGN_16 0x10000
1553 #define HEAP_CREATE_ENABLE_TRACING 0x20000
1554 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
1555 #define HEAP_MAXIMUM_TAG 0xFFF
1556 #define HEAP_PSEUDO_TAG_FLAG 0x8000
1557 #define HEAP_TAG_SHIFT 16
1558 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
1559
1560 #define KEY_QUERY_VALUE 1
1561 #define KEY_SET_VALUE 2
1562 #define KEY_CREATE_SUB_KEY 4
1563 #define KEY_ENUMERATE_SUB_KEYS 8
1564 #define KEY_NOTIFY 16
1565 #define KEY_CREATE_LINK 32
1566 #define KEY_WOW64_64KEY 0x00000100
1567 #define KEY_WOW64_32KEY 0x00000200
1568 #define KEY_WOW64_RES 0x00000300
1569
1570 #define KEY_WRITE 0x20006
1571 #define KEY_EXECUTE 0x20019
1572 #define KEY_READ 0x20019
1573 #define KEY_ALL_ACCESS 0xf003f
1574 #define REG_WHOLE_HIVE_VOLATILE 1
1575 #define REG_REFRESH_HIVE 2
1576 #define REG_NO_LAZY_FLUSH 4
1577 #define REG_FORCE_RESTORE 8
1578 #define REG_OPTION_RESERVED 0
1579 #define REG_OPTION_NON_VOLATILE 0
1580 #define REG_OPTION_VOLATILE 1
1581 #define REG_OPTION_CREATE_LINK 2
1582 #define REG_OPTION_BACKUP_RESTORE 4
1583 #define REG_OPTION_OPEN_LINK 8
1584 #define REG_LEGAL_OPTION 15
1585 #define OWNER_SECURITY_INFORMATION 1
1586 #define GROUP_SECURITY_INFORMATION 2
1587 #define DACL_SECURITY_INFORMATION 4
1588 #define SACL_SECURITY_INFORMATION 8
1589 #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
1590 #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
1591 #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
1592 #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
1593 #define MAXIMUM_PROCESSORS 32
1594 #define PAGE_NOACCESS 0x0001
1595 #define PAGE_READONLY 0x0002
1596 #define PAGE_READWRITE 0x0004
1597 #define PAGE_WRITECOPY 0x0008
1598 #define PAGE_EXECUTE 0x0010
1599 #define PAGE_EXECUTE_READ 0x0020
1600 #define PAGE_EXECUTE_READWRITE 0x0040
1601 #define PAGE_EXECUTE_WRITECOPY 0x0080
1602 #define PAGE_GUARD 0x0100
1603 #define PAGE_NOCACHE 0x0200
1604 #define PAGE_WRITECOMBINE 0x0400
1605 #define MEM_COMMIT 0x1000
1606 #define MEM_RESERVE 0x2000
1607 #define MEM_DECOMMIT 0x4000
1608 #define MEM_RELEASE 0x8000
1609 #define MEM_FREE 0x10000
1610 #define MEM_PRIVATE 0x20000
1611 #define MEM_MAPPED 0x40000
1612 #define MEM_RESET 0x80000
1613 #define MEM_TOP_DOWN 0x100000
1614 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
1615 #define MEM_PHYSICAL 0x400000
1616 #define MEM_4MB_PAGES 0x80000000
1617 #define MEM_IMAGE SEC_IMAGE
1618 #define SEC_NO_CHANGE 0x00400000
1619 #define SEC_FILE 0x00800000
1620 #define SEC_IMAGE 0x01000000
1621 #define SEC_VLM 0x02000000
1622 #define SEC_RESERVE 0x04000000
1623 #define SEC_COMMIT 0x08000000
1624 #define SEC_NOCACHE 0x10000000
1625 #define SEC_WRITECOMBINE 0x40000000
1626 #define SEC_LARGE_PAGES 0x80000000
1627 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
1628 #define SECTION_EXTEND_SIZE 16
1629 #define SECTION_MAP_READ 4
1630 #define SECTION_MAP_WRITE 2
1631 #define SECTION_QUERY 1
1632 #define SECTION_MAP_EXECUTE 8
1633 #define SECTION_ALL_ACCESS 0xf001f
1634 #define WRITE_WATCH_FLAG_RESET 0x01
1635 #define MESSAGE_RESOURCE_UNICODE 1
1636 #define RTL_CRITSECT_TYPE 0
1637 #define RTL_RESOURCE_TYPE 1
1638
1639 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
1640 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
1641 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
1642
1643 /* Also in winddk.h */
1644 #if !defined(__GNUC__)
1645 #define FIELD_OFFSET(t,f) ((LONG)(LONG_PTR)&(((t*) 0)->f))
1646 #else
1647 #define FIELD_OFFSET(t,f) ((LONG)__builtin_offsetof(t,f))
1648 #endif
1649 #ifndef CONTAINING_RECORD
1650 #define CONTAINING_RECORD(address, type, field) \
1651 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
1652 #endif
1653
1654 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
1655 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
1656 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
1657 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
1658 ((((PCHAR) (&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR) (Struct)) + (Size)))
1659 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
1660
1661 #if defined(__cplusplus) && \
1662 !defined(MIDL_PASS) && \
1663 !defined(RC_INVOKED) && \
1664 !defined(_PREFAST_) && \
1665 (_MSC_FULL_VER >= 13009466) && \
1666 !defined(SORTPP_PASS)
1667 #define RTL_NUMBER_OF_V2(A) (sizeof(*RtlpNumberOf(A)))
1668 #else
1669 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
1670 #endif
1671
1672 #ifdef ENABLE_RTL_NUMBER_OF_V2
1673 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
1674 #else
1675 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
1676 #endif
1677 //#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
1678 //#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
1679
1680 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
1681 #define RTL_NUMBER_OF_FIELD(type, field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))
1682 #define RTL_PADDING_BETWEEN_FIELDS(T, F1, F2) \
1683 ((FIELD_OFFSET(T, F2) > FIELD_OFFSET(T, F1)) \
1684 ? (FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1) - RTL_FIELD_SIZE(T, F1)) \
1685 : (FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2) - RTL_FIELD_SIZE(T, F2)))
1686
1687 #if defined(__cplusplus)
1688 #define RTL_CONST_CAST(type) const_cast<type>
1689 #else
1690 #define RTL_CONST_CAST(type) (type)
1691 #endif
1692
1693 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
1694 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
1695
1696 /* end winddk.h */
1697 #define IMAGE_SIZEOF_FILE_HEADER 20
1698 #define IMAGE_FILE_RELOCS_STRIPPED 1
1699 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
1700 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
1701 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
1702 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
1703 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
1704 #define IMAGE_FILE_BYTES_REVERSED_LO 128
1705 #define IMAGE_FILE_32BIT_MACHINE 256
1706 #define IMAGE_FILE_DEBUG_STRIPPED 512
1707 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
1708 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
1709 #define IMAGE_FILE_SYSTEM 4096
1710 #define IMAGE_FILE_DLL 8192
1711 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
1712 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
1713 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1714
1715 #define IMAGE_FILE_MACHINE_AM33 0x1d3
1716 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1717 #define IMAGE_FILE_MACHINE_ARM 0x1c0
1718 #define IMAGE_FILE_MACHINE_ARMNT 0x1c4
1719 #define IMAGE_FILE_MACHINE_EBC 0xebc
1720 #define IMAGE_FILE_MACHINE_I386 0x14c
1721 #define IMAGE_FILE_MACHINE_IA64 0x200
1722 #define IMAGE_FILE_MACHINE_M32R 0x9041
1723 #define IMAGE_FILE_MACHINE_MIPS16 0x266
1724 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366
1725 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466
1726 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0
1727 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1
1728 #define IMAGE_FILE_MACHINE_R4000 0x166
1729 #define IMAGE_FILE_MACHINE_SH3 0x1a2
1730 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1731 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3
1732 #define IMAGE_FILE_MACHINE_SH4 0x1a6
1733 #define IMAGE_FILE_MACHINE_SH5 0x1a8
1734 #define IMAGE_FILE_MACHINE_THUMB 0x1c2
1735 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169
1736 #define IMAGE_FILE_MACHINE_R3000 0x162
1737 #define IMAGE_FILE_MACHINE_R10000 0x168
1738 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1739 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1740 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1741 #define IMAGE_FILE_MACHINE_CEE 0xC0EE
1742 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1743 #define IMAGE_FILE_MACHINE_CEF 0x0CEF
1744
1745 /* Wine extension */
1746 #define IMAGE_FILE_MACHINE_ARM64 0x1c5
1747
1748 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1749 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1750 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1751 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1752 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1753 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1754 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1755 #define IMAGE_FILE_DESCRIPTION_STRING 7
1756 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1757 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1758 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1759
1760 #define IMAGE_DOS_SIGNATURE 0x5A4D
1761 #define IMAGE_OS2_SIGNATURE 0x454E
1762 #define IMAGE_OS2_SIGNATURE_LE 0x454C
1763 #define IMAGE_VXD_SIGNATURE 0x454C
1764 #define IMAGE_NT_SIGNATURE 0x00004550
1765 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
1766 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
1767 #ifdef _WIN64
1768 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
1769 #else
1770 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
1771 #endif
1772 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1773 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
1774 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1775 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1776 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1777 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1778 #define IMAGE_SIZEOF_SHORT_NAME 8
1779 #define IMAGE_SIZEOF_SECTION_HEADER 40
1780 #define IMAGE_SIZEOF_SYMBOL 18
1781 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1782 #define IMAGE_SIZEOF_RELOCATION 10
1783 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1784 #define IMAGE_SIZEOF_LINENUMBER 6
1785 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1786 #define SIZEOF_RFPO_DATA 16
1787
1788 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1789 #define IMAGE_SUBSYSTEM_NATIVE 1
1790 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
1791 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
1792 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1793 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1794 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
1795 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
1796 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1797 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1798 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1799 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1800 #define IMAGE_SUBSYSTEM_XBOX 14
1801
1802 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
1803 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
1804 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
1805 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
1806 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
1807 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
1808 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
1809 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
1810 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
1811 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1812 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1813 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1814 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1815 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1816 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1817 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1818 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1819 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
1820 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1821 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1822 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1823 #define IMAGE_DIRECTORY_ENTRY_IAT 12
1824 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1825 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1826 #define IMAGE_SCN_TYPE_REG 0
1827 #define IMAGE_SCN_TYPE_DSECT 1
1828 //#define IMAGE_SCN_TYPE_NOLOAD 2
1829 #define IMAGE_SCN_TYPE_GROUP 4
1830 #define IMAGE_SCN_TYPE_NO_PAD 8
1831 #define IMAGE_SCN_CNT_CODE 32
1832 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
1833 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
1834 #define IMAGE_SCN_LNK_OTHER 256
1835 #define IMAGE_SCN_LNK_INFO 512
1836 #define IMAGE_SCN_LNK_REMOVE 2048
1837 #define IMAGE_SCN_LNK_COMDAT 4096
1838 #define IMAGE_SCN_MEM_FARDATA 0x8000
1839 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
1840 #define IMAGE_SCN_MEM_16BIT 0x20000
1841 #define IMAGE_SCN_MEM_LOCKED 0x40000
1842 #define IMAGE_SCN_MEM_PRELOAD 0x80000
1843 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
1844 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
1845 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
1846 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
1847 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
1848 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
1849 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
1850 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
1851 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
1852 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
1853 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
1854 #define IMAGE_SCN_MEM_SHARED 0x10000000
1855 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1856 #define IMAGE_SCN_MEM_READ 0x40000000
1857 #define IMAGE_SCN_MEM_WRITE 0x80000000
1858 #define IMAGE_SYM_UNDEFINED 0
1859 #define IMAGE_SYM_ABSOLUTE (-1)
1860 #define IMAGE_SYM_DEBUG (-2)
1861 #define IMAGE_SYM_TYPE_NULL 0
1862 #define IMAGE_SYM_TYPE_VOID 1
1863 #define IMAGE_SYM_TYPE_CHAR 2
1864 #define IMAGE_SYM_TYPE_SHORT 3
1865 #define IMAGE_SYM_TYPE_INT 4
1866 #define IMAGE_SYM_TYPE_LONG 5
1867 #define IMAGE_SYM_TYPE_FLOAT 6
1868 #define IMAGE_SYM_TYPE_DOUBLE 7
1869 #define IMAGE_SYM_TYPE_STRUCT 8
1870 #define IMAGE_SYM_TYPE_UNION 9
1871 #define IMAGE_SYM_TYPE_ENUM 10
1872 #define IMAGE_SYM_TYPE_MOE 11
1873 #define IMAGE_SYM_TYPE_BYTE 12
1874 #define IMAGE_SYM_TYPE_WORD 13
1875 #define IMAGE_SYM_TYPE_UINT 14
1876 #define IMAGE_SYM_TYPE_DWORD 15
1877 #define IMAGE_SYM_TYPE_PCODE 32768
1878 #define IMAGE_SYM_DTYPE_NULL 0
1879 #define IMAGE_SYM_DTYPE_POINTER 1
1880 #define IMAGE_SYM_DTYPE_FUNCTION 2
1881 #define IMAGE_SYM_DTYPE_ARRAY 3
1882 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1883 #define IMAGE_SYM_CLASS_NULL 0
1884 #define IMAGE_SYM_CLASS_AUTOMATIC 1
1885 #define IMAGE_SYM_CLASS_EXTERNAL 2
1886 #define IMAGE_SYM_CLASS_STATIC 3
1887 #define IMAGE_SYM_CLASS_REGISTER 4
1888 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1889 #define IMAGE_SYM_CLASS_LABEL 6
1890 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1891 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1892 #define IMAGE_SYM_CLASS_ARGUMENT 9
1893 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
1894 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1895 #define IMAGE_SYM_CLASS_UNION_TAG 12
1896 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1897 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1898 #define IMAGE_SYM_CLASS_ENUM_TAG 15
1899 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1900 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1901 #define IMAGE_SYM_CLASS_BIT_FIELD 18
1902 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
1903 #define IMAGE_SYM_CLASS_BLOCK 100
1904 #define IMAGE_SYM_CLASS_FUNCTION 101
1905 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1906 #define IMAGE_SYM_CLASS_FILE 103
1907 #define IMAGE_SYM_CLASS_SECTION 104
1908 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1909 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1910 #define IMAGE_COMDAT_SELECT_ANY 2
1911 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1912 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1913 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1914 #define IMAGE_COMDAT_SELECT_LARGEST 6
1915 #define IMAGE_COMDAT_SELECT_NEWEST 7
1916 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1917 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1918 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1919 #define IMAGE_REL_I386_ABSOLUTE 0
1920 #define IMAGE_REL_I386_DIR16 1
1921 #define IMAGE_REL_I386_REL16 2
1922 #define IMAGE_REL_I386_DIR32 6
1923 #define IMAGE_REL_I386_DIR32NB 7
1924 #define IMAGE_REL_I386_SEG12 9
1925 #define IMAGE_REL_I386_SECTION 10
1926 #define IMAGE_REL_I386_SECREL 11
1927 #define IMAGE_REL_I386_REL32 20
1928 #define IMAGE_REL_MIPS_ABSOLUTE 0
1929 #define IMAGE_REL_MIPS_REFHALF 1
1930 #define IMAGE_REL_MIPS_REFWORD 2
1931 #define IMAGE_REL_MIPS_JMPADDR 3
1932 #define IMAGE_REL_MIPS_REFHI 4
1933 #define IMAGE_REL_MIPS_REFLO 5
1934 #define IMAGE_REL_MIPS_GPREL 6
1935 #define IMAGE_REL_MIPS_LITERAL 7
1936 #define IMAGE_REL_MIPS_SECTION 10
1937 #define IMAGE_REL_MIPS_SECREL 11
1938 #define IMAGE_REL_MIPS_SECRELLO 12
1939 #define IMAGE_REL_MIPS_SECRELHI 13
1940 #define IMAGE_REL_MIPS_REFWORDNB 34
1941 #define IMAGE_REL_MIPS_PAIR 35
1942 #define IMAGE_REL_ALPHA_ABSOLUTE 0
1943 #define IMAGE_REL_ALPHA_REFLONG 1
1944 #define IMAGE_REL_ALPHA_REFQUAD 2
1945 #define IMAGE_REL_ALPHA_GPREL32 3
1946 #define IMAGE_REL_ALPHA_LITERAL 4
1947 #define IMAGE_REL_ALPHA_LITUSE 5
1948 #define IMAGE_REL_ALPHA_GPDISP 6
1949 #define IMAGE_REL_ALPHA_BRADDR 7
1950 #define IMAGE_REL_ALPHA_HINT 8
1951 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1952 #define IMAGE_REL_ALPHA_REFHI 10
1953 #define IMAGE_REL_ALPHA_REFLO 11
1954 #define IMAGE_REL_ALPHA_PAIR 12
1955 #define IMAGE_REL_ALPHA_MATCH 13
1956 #define IMAGE_REL_ALPHA_SECTION 14
1957 #define IMAGE_REL_ALPHA_SECREL 15
1958 #define IMAGE_REL_ALPHA_REFLONGNB 16
1959 #define IMAGE_REL_ALPHA_SECRELLO 17
1960 #define IMAGE_REL_ALPHA_SECRELHI 18
1961 #define IMAGE_REL_PPC_ABSOLUTE 0
1962 #define IMAGE_REL_PPC_ADDR64 1
1963 #define IMAGE_REL_PPC_ADDR32 2
1964 #define IMAGE_REL_PPC_ADDR24 3
1965 #define IMAGE_REL_PPC_ADDR16 4
1966 #define IMAGE_REL_PPC_ADDR14 5
1967 #define IMAGE_REL_PPC_REL24 6
1968 #define IMAGE_REL_PPC_REL14 7
1969 #define IMAGE_REL_PPC_TOCREL16 8
1970 #define IMAGE_REL_PPC_TOCREL14 9
1971 #define IMAGE_REL_PPC_ADDR32NB 10
1972 #define IMAGE_REL_PPC_SECREL 11
1973 #define IMAGE_REL_PPC_SECTION 12
1974 #define IMAGE_REL_PPC_IFGLUE 13
1975 #define IMAGE_REL_PPC_IMGLUE 14
1976 #define IMAGE_REL_PPC_SECREL16 15
1977 #define IMAGE_REL_PPC_REFHI 16
1978 #define IMAGE_REL_PPC_REFLO 17
1979 #define IMAGE_REL_PPC_PAIR 18
1980 #define IMAGE_REL_PPC_TYPEMASK 255
1981 #define IMAGE_REL_PPC_NEG 256
1982 #define IMAGE_REL_PPC_BRTAKEN 512
1983 #define IMAGE_REL_PPC_BRNTAKEN 1024
1984 #define IMAGE_REL_PPC_TOCDEFN 2048
1985 #define IMAGE_REL_BASED_ABSOLUTE 0
1986 #define IMAGE_REL_BASED_HIGH 1
1987 #define IMAGE_REL_BASED_LOW 2
1988 #define IMAGE_REL_BASED_HIGHLOW 3
1989 #define IMAGE_REL_BASED_HIGHADJ 4
1990 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1991 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
1992 #define IMAGE_REL_BASED_IA64_IMM64 9
1993 #define IMAGE_REL_BASED_DIR64 10
1994 #define IMAGE_ARCHIVE_START_SIZE 8
1995 #define IMAGE_ARCHIVE_START "!<arch>\n"
1996 #define IMAGE_ARCHIVE_END "`\n"
1997 #define IMAGE_ARCHIVE_PAD "\n"
1998 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1999 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2000 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2001 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2002 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2003 #define IMAGE_DEBUG_TYPE_COFF 1
2004 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2005 #define IMAGE_DEBUG_TYPE_FPO 3
2006 #define IMAGE_DEBUG_TYPE_MISC 4
2007 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2008 #define IMAGE_DEBUG_TYPE_FIXUP 6
2009 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2010 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2011 #define FRAME_FPO 0
2012 #define FRAME_TRAP 1
2013 #define FRAME_TSS 2
2014 #define FRAME_NONFPO 3
2015 #define IMAGE_DEBUG_MISC_EXENAME 1
2016 #define N_BTMASK 0x000F
2017 #define N_TMASK 0x0030
2018 #define N_TMASK1 0x00C0
2019 #define N_TMASK2 0x00F0
2020 #define N_BTSHFT 4
2021 #define N_TSHIFT 2
2022 #define IS_TEXT_UNICODE_ASCII16 1
2023 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
2024 #define IS_TEXT_UNICODE_STATISTICS 2
2025 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
2026 #define IS_TEXT_UNICODE_CONTROLS 4
2027 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
2028 #define IS_TEXT_UNICODE_SIGNATURE 8
2029 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
2030 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
2031 #define IS_TEXT_UNICODE_ODD_LENGTH 512
2032 #define IS_TEXT_UNICODE_NULL_BYTES 4096
2033 #define IS_TEXT_UNICODE_UNICODE_MASK 15
2034 #define IS_TEXT_UNICODE_REVERSE_MASK 240
2035 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
2036 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
2037 #define SERVICE_KERNEL_DRIVER 1
2038 #define SERVICE_FILE_SYSTEM_DRIVER 2
2039 #define SERVICE_ADAPTER 4
2040 #define SERVICE_RECOGNIZER_DRIVER 8
2041 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
2042 #define SERVICE_WIN32_OWN_PROCESS 16
2043 #define SERVICE_WIN32_SHARE_PROCESS 32
2044 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
2045 #define SERVICE_INTERACTIVE_PROCESS 256
2046 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
2047 #define SERVICE_BOOT_START 0
2048 #define SERVICE_SYSTEM_START 1
2049 #define SERVICE_AUTO_START 2
2050 #define SERVICE_DEMAND_START 3
2051 #define SERVICE_DISABLED 4
2052 #define SERVICE_ERROR_IGNORE 0
2053 #define SERVICE_ERROR_NORMAL 1
2054 #define SERVICE_ERROR_SEVERE 2
2055 #define SERVICE_ERROR_CRITICAL 3
2056 #define SE_OWNER_DEFAULTED 0x0001
2057 #define SE_GROUP_DEFAULTED 0x0002
2058 #define SE_DACL_PRESENT 0x0004
2059 #define SE_DACL_DEFAULTED 0x0008
2060 #define SE_SACL_PRESENT 0x0010
2061 #define SE_SACL_DEFAULTED 0x0020
2062 #define SE_DACL_UNTRUSTED 0x0040
2063 #define SE_SERVER_SECURITY 0x0080
2064 #define SE_DACL_AUTO_INHERIT_REQ 0x0100
2065 #define SE_SACL_AUTO_INHERIT_REQ 0x0200
2066 #define SE_DACL_AUTO_INHERITED 0x0400
2067 #define SE_SACL_AUTO_INHERITED 0x0800
2068 #define SE_DACL_PROTECTED 0x1000
2069 #define SE_SACL_PROTECTED 0x2000
2070 #define SE_RM_CONTROL_VALID 0x4000
2071 #define SE_SELF_RELATIVE 0x8000
2072 #define SECURITY_DESCRIPTOR_MIN_LENGTH 20
2073 #define SECURITY_DESCRIPTOR_REVISION 1
2074 #define SECURITY_DESCRIPTOR_REVISION1 1
2075 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
2076 #define SE_PRIVILEGE_ENABLED 2
2077 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2078 #define PRIVILEGE_SET_ALL_NECESSARY 1
2079 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
2080 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
2081 #define SECURITY_DYNAMIC_TRACKING TRUE
2082 #define SECURITY_STATIC_TRACKING FALSE
2083 /* also in ddk/ntifs.h */
2084 #define TOKEN_ASSIGN_PRIMARY (0x0001)
2085 #define TOKEN_DUPLICATE (0x0002)
2086 #define TOKEN_IMPERSONATE (0x0004)
2087 #define TOKEN_QUERY (0x0008)
2088 #define TOKEN_QUERY_SOURCE (0x0010)
2089 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
2090 #define TOKEN_ADJUST_GROUPS (0x0040)
2091 #define TOKEN_ADJUST_DEFAULT (0x0080)
2092 #define TOKEN_ADJUST_SESSIONID (0x0100)
2093 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
2094 TOKEN_ASSIGN_PRIMARY |\
2095 TOKEN_DUPLICATE |\
2096 TOKEN_IMPERSONATE |\
2097 TOKEN_QUERY |\
2098 TOKEN_QUERY_SOURCE |\
2099 TOKEN_ADJUST_PRIVILEGES |\
2100 TOKEN_ADJUST_GROUPS |\
2101 TOKEN_ADJUST_DEFAULT |\
2102 TOKEN_ADJUST_SESSIONID)
2103 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
2104 TOKEN_QUERY)
2105 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
2106 TOKEN_ADJUST_PRIVILEGES |\
2107 TOKEN_ADJUST_GROUPS |\
2108 TOKEN_ADJUST_DEFAULT)
2109
2110 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
2111 #define TOKEN_SOURCE_LENGTH 8
2112 /* end ddk/ntifs.h */
2113 #define DLL_PROCESS_DETACH 0
2114 #define DLL_PROCESS_ATTACH 1
2115 #define DLL_THREAD_ATTACH 2
2116 #define DLL_THREAD_DETACH 3
2117 #ifdef __WINESRC__
2118 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */
2119 #endif
2120 #define TAPE_ABSOLUTE_POSITION 0
2121 #define TAPE_LOGICAL_POSITION 1
2122 #define TAPE_PSEUDO_LOGICAL_POSITION 2
2123 #define TAPE_REWIND 0
2124 #define TAPE_ABSOLUTE_BLOCK 1
2125 #define TAPE_LOGICAL_BLOCK 2
2126 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
2127 #define TAPE_SPACE_END_OF_DATA 4
2128 #define TAPE_SPACE_RELATIVE_BLOCKS 5
2129 #define TAPE_SPACE_FILEMARKS 6
2130 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
2131 #define TAPE_SPACE_SETMARKS 8
2132 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
2133 #define TAPE_DRIVE_FIXED 1
2134 #define TAPE_DRIVE_SELECT 2
2135 #define TAPE_DRIVE_INITIATOR 4
2136 #define TAPE_DRIVE_ERASE_SHORT 16
2137 #define TAPE_DRIVE_ERASE_LONG 32
2138 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
2139 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
2140 #define TAPE_DRIVE_TAPE_CAPACITY 256
2141 #define TAPE_DRIVE_TAPE_REMAINING 512
2142 #define TAPE_DRIVE_FIXED_BLOCK 1024
2143 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
2144 #define TAPE_DRIVE_WRITE_PROTECT 4096
2145 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
2146 #define TAPE_DRIVE_ECC 0x10000
2147 #define TAPE_DRIVE_COMPRESSION 0x20000
2148 #define TAPE_DRIVE_PADDING 0x40000
2149 #define TAPE_DRIVE_REPORT_SMKS 0x80000
2150 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
2151 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
2152 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
2153 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
2154 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
2155 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
2156 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
2157 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
2158 #define TAPE_DRIVE_TENSION 0x80000002
2159 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
2160 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
2161 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
2162 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
2163 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
2164 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
2165 #define TAPE_DRIVE_SET_ECC 0x80000100
2166 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
2167 #define TAPE_DRIVE_SET_PADDING 0x80000400
2168 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
2169 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
2170 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
2171 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
2172 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
2173 #define TAPE_DRIVE_END_OF_DATA 0x80010000
2174 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
2175 #define TAPE_DRIVE_FILEMARKS 0x80040000
2176 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
2177 #define TAPE_DRIVE_SETMARKS 0x80100000
2178 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
2179 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
2180 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
2181 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
2182 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
2183 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
2184 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
2185 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
2186 #define TAPE_DRIVE_FORMAT 0xA0000000
2187 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
2188 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
2189 #define TAPE_FIXED_PARTITIONS 0
2190 #define TAPE_INITIATOR_PARTITIONS 2
2191 #define TAPE_SELECT_PARTITIONS 1
2192 #define TAPE_FILEMARKS 1
2193 #define TAPE_LONG_FILEMARKS 3
2194 #define TAPE_SETMARKS 0
2195 #define TAPE_SHORT_FILEMARKS 2
2196 #define TAPE_ERASE_LONG 1
2197 #define TAPE_ERASE_SHORT 0
2198 #define TAPE_LOAD 0
2199 #define TAPE_UNLOAD 1
2200 #define TAPE_TENSION 2
2201 #define TAPE_LOCK 3
2202 #define TAPE_UNLOCK 4
2203 #define TAPE_FORMAT 5
2204 #if (_WIN32_WINNT >= 0x0500)
2205 #define VER_MINORVERSION 0x0000001
2206 #define VER_MAJORVERSION 0x0000002
2207 #define VER_BUILDNUMBER 0x0000004
2208 #define VER_PLATFORMID 0x0000008
2209 #define VER_SERVICEPACKMINOR 0x0000010
2210 #define VER_SERVICEPACKMAJOR 0x0000020
2211 #define VER_SUITENAME 0x0000040
2212 #define VER_PRODUCT_TYPE 0x0000080
2213 #define VER_EQUAL 1
2214 #define VER_GREATER 2
2215 #define VER_GREATER_EQUAL 3
2216 #define VER_LESS 4
2217 #define VER_LESS_EQUAL 5
2218 #define VER_AND 6
2219 #define VER_OR 7
2220 #endif
2221 #define VER_SERVER_NT 0x80000000
2222 #define VER_WORKSTATION_NT 0x40000000
2223 #define VER_PLATFORM_WIN32s 0
2224 #define VER_PLATFORM_WIN32_WINDOWS 1
2225 #define VER_PLATFORM_WIN32_NT 2
2226 #define VER_NT_WORKSTATION 1
2227 #define VER_NT_DOMAIN_CONTROLLER 2
2228 #define VER_NT_SERVER 3
2229 #define VER_SUITE_SMALLBUSINESS 1
2230 #define VER_SUITE_ENTERPRISE 2
2231 #define VER_SUITE_BACKOFFICE 4
2232 #define VER_SUITE_COMMUNICATIONS 8
2233 #define VER_SUITE_TERMINAL 16
2234 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
2235 #define VER_SUITE_EMBEDDEDNT 64
2236 #define VER_SUITE_DATACENTER 128
2237 #define VER_SUITE_SINGLEUSERTS 256
2238 #define VER_SUITE_PERSONAL 512
2239 #define VER_SUITE_BLADE 1024
2240 #define VER_SUITE_EMBEDDED_RESTRICTED 2048
2241 #define VER_SUITE_SECURITY_APPLIANCE 4096
2242 #define VER_SUITE_STORAGE_SERVER 8192
2243 #define VER_SUITE_COMPUTE_SERVER 16384
2244 #define VER_SUITE_WH_SERVER 32768
2245 #define WT_EXECUTEDEFAULT 0x00000000
2246 #define WT_EXECUTEINIOTHREAD 0x00000001
2247 #define WT_EXECUTEINUITHREAD 0x00000002
2248 #define WT_EXECUTEINWAITTHREAD 0x00000004
2249 #define WT_EXECUTEONLYONCE 0x00000008
2250 #define WT_EXECUTELONGFUNCTION 0x00000010
2251 #define WT_EXECUTEINTIMERTHREAD 0x00000020
2252 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
2253 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
2254 #define WT_TRANSFER_IMPERSONATION 0x00000100
2255 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16)
2256 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
2257 #if (_WIN32_WINNT >= 0x0501)
2258 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
2259 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
2260 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
2261 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
2262 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
2263 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
2264 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
2265 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
2266 #endif /* (_WIN32_WINNT >= 0x0501) */
2267 #define BTYPE(x) ((x)&N_BTMASK)
2268 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
2269 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
2270 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
2271 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
2272 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2273 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2274 #define TLS_MINIMUM_AVAILABLE 64
2275 #define FLS_MAXIMUM_AVAILABLE 128
2276 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
2277 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
2278 #define IO_REPARSE_TAG_RESERVED_ZERO 0
2279 #define IO_REPARSE_TAG_RESERVED_ONE 1
2280 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
2281 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
2282 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
2283 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
2284 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
2285 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
2286 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
2287 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
2288 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
2289 #ifndef RC_INVOKED
2290 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2291
2292 #ifdef _GUID_DEFINED
2293 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
2294 #endif
2295
2296 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
2297 #define GUID_DEFINED
2298 typedef struct _GUID {
2299 unsigned long Data1;
2300 unsigned short Data2;
2301 unsigned short Data3;
2302 unsigned char Data4[8];
2303 } GUID, *REFGUID, *LPGUID;
2304 #endif /* GUID_DEFINED */
2305
2306 #define SYSTEM_LUID { 0x3E7, 0x0 }
2307
2308 /* ACE Access Types, also in ntifs.h */
2309 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
2310 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
2311 #define ACCESS_DENIED_ACE_TYPE (0x1)
2312 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
2313 #define SYSTEM_ALARM_ACE_TYPE (0x3)
2314 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
2315 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
2316 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
2317 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
2318 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
2319 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
2320 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
2321 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
2322 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
2323 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
2324 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
2325 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
2326 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
2327 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
2328 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
2329 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
2330 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
2331 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
2332 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
2333 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11)
2334 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x11)
2335 /* end ntifs.h */
2336
2337 typedef struct _GENERIC_MAPPING {
2338 ACCESS_MASK GenericRead;
2339 ACCESS_MASK GenericWrite;
2340 ACCESS_MASK GenericExecute;
2341 ACCESS_MASK GenericAll;
2342 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2343
2344 typedef struct _ACE_HEADER {
2345 BYTE AceType;
2346 BYTE AceFlags;
2347 WORD AceSize;
2348 } ACE_HEADER, *PACE_HEADER;
2349
2350 typedef struct _ACCESS_ALLOWED_ACE {
2351 ACE_HEADER Header;
2352 ACCESS_MASK Mask;
2353 DWORD SidStart;
2354 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
2355
2356 typedef struct _ACCESS_DENIED_ACE {
2357 ACE_HEADER Header;
2358 ACCESS_MASK Mask;
2359 DWORD SidStart;
2360 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
2361
2362 typedef struct _SYSTEM_AUDIT_ACE {
2363 ACE_HEADER Header;
2364 ACCESS_MASK Mask;
2365 DWORD SidStart;
2366 } SYSTEM_AUDIT_ACE, *PSYSTEM_AUDIT_ACE;
2367
2368 typedef struct _SYSTEM_ALARM_ACE {
2369 ACE_HEADER Header;
2370 ACCESS_MASK Mask;
2371 DWORD SidStart;
2372 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
2373
2374 typedef struct _SYSTEM_MANDATORY_LABEL_ACE {
2375 ACE_HEADER Header;
2376 ACCESS_MASK Mask;
2377 DWORD SidStart;
2378 } SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE;
2379
2380 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
2381 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
2382 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
2383 #define SYSTEM_MANDATORY_LABEL_VALID_MASK (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP | SYSTEM_MANDATORY_LABEL_NO_READ_UP | SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
2384
2385 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
2386 ACE_HEADER Header;
2387 ACCESS_MASK Mask;
2388 DWORD Flags;
2389 GUID ObjectType;
2390 GUID InheritedObjectType;
2391 DWORD SidStart;
2392 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
2393
2394 typedef struct _ACCESS_DENIED_OBJECT_ACE {
2395 ACE_HEADER Header;
2396 ACCESS_MASK Mask;
2397 DWORD Flags;
2398 GUID ObjectType;
2399 GUID InheritedObjectType;
2400 DWORD SidStart;
2401 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
2402
2403 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
2404 ACE_HEADER Header;
2405 ACCESS_MASK Mask;
2406 DWORD Flags;
2407 GUID ObjectType;
2408 GUID InheritedObjectType;
2409 DWORD SidStart;
2410 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
2411
2412 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
2413 ACE_HEADER Header;
2414 ACCESS_MASK Mask;
2415 DWORD Flags;
2416 GUID ObjectType;
2417 GUID InheritedObjectType;
2418 DWORD SidStart;
2419 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
2420
2421 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
2422 ACE_HEADER Header;
2423 ACCESS_MASK Mask;
2424 DWORD SidStart;
2425 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE;
2426
2427 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
2428 ACE_HEADER Header;
2429 ACCESS_MASK Mask;
2430 DWORD SidStart;
2431 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE;
2432
2433 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
2434 ACE_HEADER Header;
2435 ACCESS_MASK Mask;
2436 DWORD SidStart;
2437 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE;
2438
2439 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
2440 ACE_HEADER Header;
2441 ACCESS_MASK Mask;
2442 DWORD SidStart;
2443 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE;
2444
2445 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
2446 ACE_HEADER Header;
2447 ACCESS_MASK Mask;
2448 DWORD Flags;
2449 GUID ObjectType;
2450 GUID InheritedObjectType;
2451 DWORD SidStart;
2452 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2453
2454 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2455 ACE_HEADER Header;
2456 ACCESS_MASK Mask;
2457 DWORD Flags;
2458 GUID ObjectType;
2459 GUID InheritedObjectType;
2460 DWORD SidStart;
2461 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
2462
2463 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2464 ACE_HEADER Header;
2465 ACCESS_MASK Mask;
2466 DWORD Flags;
2467 GUID ObjectType;
2468 GUID InheritedObjectType;
2469 DWORD SidStart;
2470 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2471
2472 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2473 ACE_HEADER Header;
2474 ACCESS_MASK Mask;
2475 DWORD Flags;
2476 GUID ObjectType;
2477 GUID InheritedObjectType;
2478 DWORD SidStart;
2479 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2480
2481 typedef struct _ACL {
2482 BYTE AclRevision;
2483 BYTE Sbz1;
2484 WORD AclSize;
2485 WORD AceCount;
2486 WORD Sbz2;
2487 } ACL,*PACL;
2488
2489 typedef enum _ACL_INFORMATION_CLASS {
2490 AclRevisionInformation = 1,
2491 AclSizeInformation
2492 } ACL_INFORMATION_CLASS;
2493
2494 typedef struct _ACL_REVISION_INFORMATION {
2495 DWORD AclRevision;
2496 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
2497
2498 typedef struct _ACL_SIZE_INFORMATION {
2499 DWORD AceCount;
2500 DWORD AclBytesInUse;
2501 DWORD AclBytesFree;
2502 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
2503
2504 typedef
2505 _IRQL_requires_same_
2506 _Function_class_(EXCEPTION_ROUTINE)
2507 EXCEPTION_DISPOSITION
2508 NTAPI
2509 EXCEPTION_ROUTINE(
2510 _Inout_ struct _EXCEPTION_RECORD *ExceptionRecord,
2511 _In_ PVOID EstablisherFrame,
2512 _Inout_ struct _CONTEXT *ContextRecord,
2513 _In_ PVOID DispatcherContext);
2514
2515 typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
2516
2517 #ifndef _LDT_ENTRY_DEFINED
2518 #define _LDT_ENTRY_DEFINED
2519
2520 typedef struct _LDT_ENTRY {
2521 WORD LimitLow;
2522 WORD BaseLow;
2523 union {
2524 struct {
2525 BYTE BaseMid;
2526 BYTE Flags1;
2527 BYTE Flags2;
2528 BYTE BaseHi;
2529 } Bytes;
2530 struct {
2531 DWORD BaseMid:8;
2532 DWORD Type:5;
2533 DWORD Dpl:2;
2534 DWORD Pres:1;
2535 DWORD LimitHi:4;
2536 DWORD Sys:1;
2537 DWORD Reserved_0:1;
2538 DWORD Default_Big:1;
2539 DWORD Granularity:1;
2540 DWORD BaseHi:8;
2541 } Bits;
2542 } HighWord;
2543 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
2544
2545 #endif /* _LDT_ENTRY_DEFINED */
2546
2547 /* FIXME: add more machines */
2548 #if defined(_X86_) && !defined(__PowerPC__)
2549 #define SIZE_OF_80387_REGISTERS 80
2550 #define CONTEXT_i386 0x10000
2551 #define CONTEXT_i486 0x10000
2552 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
2553 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
2554 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
2555 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
2556 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
2557 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
2558 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
2559 #define MAXIMUM_SUPPORTED_EXTENSION 512
2560
2561 #define EXCEPTION_READ_FAULT 0
2562 #define EXCEPTION_WRITE_FAULT 1
2563 #define EXCEPTION_EXECUTE_FAULT 8
2564
2565 typedef struct _FLOATING_SAVE_AREA {
2566 DWORD ControlWord;
2567 DWORD StatusWord;
2568 DWORD TagWord;
2569 DWORD ErrorOffset;
2570 DWORD ErrorSelector;
2571 DWORD DataOffset;
2572 DWORD DataSelector;
2573 BYTE RegisterArea[80];
2574 DWORD Cr0NpxState;
2575 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
2576
2577 typedef struct _CONTEXT {
2578 DWORD ContextFlags;
2579 DWORD Dr0;
2580 DWORD Dr1;
2581 DWORD Dr2;
2582 DWORD Dr3;
2583 DWORD Dr6;
2584 DWORD Dr7;
2585 FLOATING_SAVE_AREA FloatSave;
2586 DWORD SegGs;
2587 DWORD SegFs;
2588 DWORD SegEs;
2589 DWORD SegDs;
2590 DWORD Edi;
2591 DWORD Esi;
2592 DWORD Ebx;
2593 DWORD Edx;
2594 DWORD Ecx;
2595 DWORD Eax;
2596 DWORD Ebp;
2597 DWORD Eip;
2598 DWORD SegCs;
2599 DWORD EFlags;
2600 DWORD Esp;
2601 DWORD SegSs;
2602 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
2603 } CONTEXT;
2604 #elif defined(__x86_64__)
2605
2606 #define CONTEXT_AMD64 0x100000
2607
2608 #if !defined(RC_INVOKED)
2609 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
2610 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
2611 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
2612 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
2613 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
2614
2615 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
2616 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
2617
2618 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
2619 #define CONTEXT_SERVICE_ACTIVE 0x10000000
2620 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
2621 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
2622 #endif
2623
2624 #define INITIAL_MXCSR 0x1f80
2625 #define INITIAL_FPCSR 0x027f
2626 #define EXCEPTION_READ_FAULT 0
2627 #define EXCEPTION_WRITE_FAULT 1
2628 #define EXCEPTION_EXECUTE_FAULT 8
2629
2630 typedef struct DECLSPEC_ALIGN(16) _M128A {
2631 ULONGLONG Low;
2632 LONGLONG High;
2633 } M128A, *PM128A;
2634
2635 typedef struct _XMM_SAVE_AREA32 {
2636 WORD ControlWord;
2637 WORD StatusWord;
2638 BYTE TagWord;
2639 BYTE Reserved1;
2640 WORD ErrorOpcode;
2641 DWORD ErrorOffset;
2642 WORD ErrorSelector;
2643 WORD Reserved2;
2644 DWORD DataOffset;
2645 WORD DataSelector;
2646 WORD Reserved3;
2647 DWORD MxCsr;
2648 DWORD MxCsr_Mask;
2649 M128A FloatRegisters[8];
2650 M128A XmmRegisters[16];
2651 BYTE Reserved4[96];
2652 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
2653
2654 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
2655 DWORD64 P1Home;
2656 DWORD64 P2Home;
2657 DWORD64 P3Home;
2658 DWORD64 P4Home;
2659 DWORD64 P5Home;
2660 DWORD64 P6Home;
2661
2662 /* Control flags */
2663 DWORD ContextFlags;
2664 DWORD MxCsr;
2665
2666 /* Segment */
2667 WORD SegCs;
2668 WORD SegDs;
2669 WORD SegEs;
2670 WORD SegFs;
2671 WORD SegGs;
2672 WORD SegSs;
2673 DWORD EFlags;
2674
2675 /* Debug */
2676 DWORD64 Dr0;
2677 DWORD64 Dr1;
2678 DWORD64 Dr2;
2679 DWORD64 Dr3;
2680 DWORD64 Dr6;
2681 DWORD64 Dr7;
2682
2683 /* Integer */
2684 DWORD64 Rax;
2685 DWORD64 Rcx;
2686 DWORD64 Rdx;
2687 DWORD64 Rbx;
2688 DWORD64 Rsp;
2689 DWORD64 Rbp;
2690 DWORD64 Rsi;
2691 DWORD64 Rdi;
2692 DWORD64 R8;
2693 DWORD64 R9;
2694 DWORD64 R10;
2695 DWORD64 R11;
2696 DWORD64 R12;
2697 DWORD64 R13;
2698 DWORD64 R14;
2699 DWORD64 R15;
2700
2701 /* Counter */
2702 DWORD64 Rip;
2703
2704 /* Floating point */
2705 union {
2706 XMM_SAVE_AREA32 FltSave;
2707 struct {
2708 M128A Header[2];
2709 M128A Legacy[8];
2710 M128A Xmm0;
2711 M128A Xmm1;
2712 M128A Xmm2;
2713 M128A Xmm3;
2714 M128A Xmm4;
2715 M128A Xmm5;
2716 M128A Xmm6;
2717 M128A Xmm7;
2718 M128A Xmm8;
2719 M128A Xmm9;
2720 M128A Xmm10;
2721 M128A Xmm11;
2722 M128A Xmm12;
2723 M128A Xmm13;
2724 M128A Xmm14;
2725 M128A Xmm15;
2726 } DUMMYSTRUCTNAME;
2727 } DUMMYUNIONNAME;
2728
2729 /* Vector */
2730 M128A VectorRegister[26];
2731 DWORD64 VectorControl;
2732
2733 /* Debug control */
2734 DWORD64 DebugControl;
2735 DWORD64 LastBranchToRip;
2736 DWORD64 LastBranchFromRip;
2737 DWORD64 LastExceptionToRip;
2738 DWORD64 LastExceptionFromRip;
2739 } CONTEXT;
2740
2741
2742 typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
2743 union {
2744 PM128A FloatingContext[16];
2745 struct {
2746 PM128A Xmm0;
2747 PM128A Xmm1;
2748 PM128A Xmm2;
2749 PM128A Xmm3;
2750 PM128A Xmm4;
2751 PM128A Xmm5;
2752 PM128A Xmm6;
2753 PM128A Xmm7;
2754 PM128A Xmm8;
2755 PM128A Xmm9;
2756 PM128A Xmm10;
2757 PM128A Xmm11;
2758 PM128A Xmm12;
2759 PM128A Xmm13;
2760 PM128A Xmm14;
2761 PM128A Xmm15;
2762 } DUMMYSTRUCTNAME;
2763 } DUMMYUNIONNAME;
2764
2765 union {
2766 PULONG64 IntegerContext[16];
2767 struct {
2768 PULONG64 Rax;
2769 PULONG64 Rcx;
2770 PULONG64 Rdx;
2771 PULONG64 Rbx;
2772 PULONG64 Rsp;
2773 PULONG64 Rbp;
2774 PULONG64 Rsi;
2775 PULONG64 Rdi;
2776 PULONG64 R8;
2777 PULONG64 R9;
2778 PULONG64 R10;
2779 PULONG64 R11;
2780 PULONG64 R12;
2781 PULONG64 R13;
2782 PULONG64 R14;
2783 PULONG64 R15;
2784 } DUMMYSTRUCTNAME;
2785 } DUMMYUNIONNAME2;
2786 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
2787
2788 #define RUNTIME_FUNCTION_INDIRECT 0x1
2789
2790 typedef struct _RUNTIME_FUNCTION {
2791 DWORD BeginAddress;
2792 DWORD EndAddress;
2793 DWORD UnwindData;
2794 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
2795
2796 #define UNWIND_HISTORY_TABLE_SIZE 12
2797
2798 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
2799 {
2800 ULONG64 ImageBase;
2801 PRUNTIME_FUNCTION FunctionEntry;
2802 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
2803
2804 typedef struct _UNWIND_HISTORY_TABLE
2805 {
2806 ULONG Count;
2807 UCHAR Search;
2808 ULONG64 LowAddress;
2809 ULONG64 HighAddress;
2810 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
2811 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
2812
2813 typedef
2814 _Function_class_(GET_RUNTIME_FUNCTION_CALLBACK)
2815 PRUNTIME_FUNCTION
2816 (*PGET_RUNTIME_FUNCTION_CALLBACK)(
2817 _In_ DWORD64 ControlPc,
2818 _In_opt_ PVOID Context);
2819
2820 typedef
2821 _Function_class_(OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)
2822 _Must_inspect_result_
2823 DWORD
2824 (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(
2825 _In_ HANDLE Process,
2826 _In_ PVOID TableAddress,
2827 _Out_ PDWORD Entries,
2828 _Out_ PRUNTIME_FUNCTION *Functions);
2829
2830 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
2831
2832 NTSYSAPI
2833 VOID
2834 __cdecl
2835 RtlRestoreContext(struct _CONTEXT *ContextRecord,
2836 struct _EXCEPTION_RECORD *ExceptionRecord);
2837
2838 NTSYSAPI
2839 BOOLEAN
2840 __cdecl
2841 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,
2842 DWORD EntryCount,
2843 DWORD64 BaseAddress);
2844
2845 NTSYSAPI
2846 BOOLEAN
2847 __cdecl
2848 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,
2849 DWORD64 BaseAddress,
2850 DWORD Length,
2851 PGET_RUNTIME_FUNCTION_CALLBACK Callback,
2852 PVOID Context,
2853 PCWSTR OutOfProcessCallbackDll);
2854
2855 NTSYSAPI
2856 BOOLEAN
2857 __cdecl
2858 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
2859
2860 NTSYSAPI
2861 PRUNTIME_FUNCTION
2862 NTAPI
2863 RtlLookupFunctionEntry(
2864 _In_ DWORD64 ControlPc,
2865 _Out_ PDWORD64 ImageBase,
2866 _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable);
2867
2868 NTSYSAPI
2869 PEXCEPTION_ROUTINE
2870 NTAPI
2871 RtlVirtualUnwind(
2872 _In_ DWORD HandlerType,
2873 _In_ DWORD64 ImageBase,
2874 _In_ DWORD64 ControlPc,
2875 _In_ PRUNTIME_FUNCTION FunctionEntry,
2876 _Inout_ struct _CONTEXT *ContextRecord,
2877 _Out_ PVOID *HandlerData,
2878 _Out_ PDWORD64 EstablisherFrame,
2879 _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
2880
2881 #elif defined(_PPC_)
2882 #define CONTEXT_CONTROL 1L
2883 #define CONTEXT_FLOATING_POINT 2L
2884 #define CONTEXT_INTEGER 4L
2885 #define CONTEXT_DEBUG_REGISTERS 8L
2886 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2887 typedef struct _FLOATING_SAVE_AREA
2888 {
2889 double Fpr0;
2890 double Fpr1;
2891 double Fpr2;
2892 double Fpr3;
2893 double Fpr4;
2894 double Fpr5;
2895 double Fpr6;
2896 double Fpr7;
2897 double Fpr8;
2898 double Fpr9;
2899 double Fpr10;
2900 double Fpr11;
2901 double Fpr12;
2902 double Fpr13;
2903 double Fpr14;
2904 double Fpr15;
2905 double Fpr16;
2906 double Fpr17;
2907 double Fpr18;
2908 double Fpr19;
2909 double Fpr20;
2910 double Fpr21;
2911 double Fpr22;
2912 double Fpr23;
2913 double Fpr24;
2914 double Fpr25;
2915 double Fpr26;
2916 double Fpr27;
2917 double Fpr28;
2918 double Fpr29;
2919 double Fpr30;
2920 double Fpr31;
2921 double Fpscr;
2922 } FLOATING_SAVE_AREA;
2923
2924 typedef struct _CONTEXT {
2925 FLOATING_SAVE_AREA FloatSave;
2926 DWORD Gpr0;
2927 DWORD Gpr1;
2928 DWORD Gpr2;
2929 DWORD Gpr3;
2930 DWORD Gpr4;
2931 DWORD Gpr5;
2932 DWORD Gpr6;
2933 DWORD Gpr7;
2934 DWORD Gpr8;
2935 DWORD Gpr9;
2936 DWORD Gpr10;
2937 DWORD Gpr11;
2938 DWORD Gpr12;
2939 DWORD Gpr13;
2940 DWORD Gpr14;
2941 DWORD Gpr15;
2942 DWORD Gpr16;
2943 DWORD Gpr17;
2944 DWORD Gpr18;
2945 DWORD Gpr19;
2946 DWORD Gpr20;
2947 DWORD Gpr21;
2948 DWORD Gpr22;
2949 DWORD Gpr23;
2950 DWORD Gpr24;
2951 DWORD Gpr25;
2952 DWORD Gpr26;
2953 DWORD Gpr27;
2954 DWORD Gpr28;
2955 DWORD Gpr29;
2956 DWORD Gpr30;
2957 DWORD Gpr31;
2958 DWORD Cr;
2959 DWORD Xer;
2960 DWORD Msr;
2961 DWORD Iar;
2962 DWORD Lr;
2963 DWORD Ctr;
2964 DWORD ContextFlags;
2965 DWORD Fill[3];
2966 DWORD Dr0;
2967 DWORD Dr1;
2968 DWORD Dr2;
2969 DWORD Dr3;
2970 DWORD Dr4;
2971 DWORD Dr5;
2972 DWORD Dr6;
2973 DWORD Dr7;
2974 } CONTEXT;
2975 #elif defined(_ALPHA_)
2976 #define CONTEXT_ALPHA 0x20000
2977 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
2978 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
2979 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
2980 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2981 typedef struct _CONTEXT {
2982 ULONGLONG FltF0;
2983 ULONGLONG FltF1;
2984 ULONGLONG FltF2;
2985 ULONGLONG FltF3;
2986 ULONGLONG FltF4;
2987 ULONGLONG FltF5;
2988 ULONGLONG FltF6;
2989 ULONGLONG FltF7;
2990 ULONGLONG FltF8;
2991 ULONGLONG FltF9;
2992 ULONGLONG FltF10;
2993 ULONGLONG FltF11;
2994 ULONGLONG FltF12;
2995 ULONGLONG FltF13;
2996 ULONGLONG FltF14;
2997 ULONGLONG FltF15;
2998 ULONGLONG FltF16;
2999 ULONGLONG FltF17;
3000 ULONGLONG FltF18;
3001 ULONGLONG FltF19;
3002 ULONGLONG FltF20;
3003 ULONGLONG FltF21;
3004 ULONGLONG FltF22;
3005 ULONGLONG FltF23;
3006 ULONGLONG FltF24;
3007 ULONGLONG FltF25;
3008 ULONGLONG FltF26;
3009 ULONGLONG FltF27;
3010 ULONGLONG FltF28;
3011 ULONGLONG FltF29;
3012 ULONGLONG FltF30;
3013 ULONGLONG FltF31;
3014 ULONGLONG IntV0;
3015 ULONGLONG IntT0;
3016 ULONGLONG IntT1;
3017 ULONGLONG IntT2;
3018 ULONGLONG IntT3;
3019 ULONGLONG IntT4;
3020 ULONGLONG IntT5;
3021 ULONGLONG IntT6;
3022 ULONGLONG IntT7;
3023 ULONGLONG IntS0;
3024 ULONGLONG IntS1;
3025 ULONGLONG IntS2;
3026 ULONGLONG IntS3;
3027 ULONGLONG IntS4;
3028 ULONGLONG IntS5;
3029 ULONGLONG IntFp;
3030 ULONGLONG IntA0;
3031 ULONGLONG IntA1;
3032 ULONGLONG IntA2;
3033 ULONGLONG IntA3;
3034 ULONGLONG IntA4;
3035 ULONGLONG IntA5;
3036 ULONGLONG IntT8;
3037 ULONGLONG IntT9;
3038 ULONGLONG IntT10;
3039 ULONGLONG IntT11;
3040 ULONGLONG IntRa;
3041 ULONGLONG IntT12;
3042 ULONGLONG IntAt;
3043 ULONGLONG IntGp;
3044 ULONGLONG IntSp;
3045 ULONGLONG IntZero;
3046 ULONGLONG Fpcr;
3047 ULONGLONG SoftFpcr;
3048 ULONGLONG Fir;
3049 DWORD Psr;
3050 DWORD ContextFlags;
3051 DWORD Fill[4];
3052 } CONTEXT;
3053 #elif defined(SHx)
3054
3055 /* These are the debug or break registers on the SH3 */
3056 typedef struct _DEBUG_REGISTERS {
3057 ULONG BarA;
3058 UCHAR BasrA;
3059 UCHAR BamrA;
3060 USHORT BbrA;
3061 ULONG BarB;
3062 UCHAR BasrB;
3063 UCHAR BamrB;
3064 USHORT BbrB;
3065 ULONG BdrB;
3066 ULONG BdmrB;
3067 USHORT Brcr;
3068 USHORT Align;
3069 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
3070
3071 /* The following flags control the contents of the CONTEXT structure. */
3072
3073 #define CONTEXT_SH3 0x00000040
3074 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
3075
3076 #ifdef SH3
3077 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
3078 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
3079 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
3080 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
3081 #else /* SH4 */
3082 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
3083 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
3084 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
3085 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
3086 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
3087 #endif
3088
3089 /* Context Frame */
3090
3091 /* This frame is used to store a limited processor context into the */
3092 /* Thread structure for CPUs which have no floating point support. */
3093
3094 typedef struct _CONTEXT {
3095 /* The flags values within this flag control the contents of */
3096 /* a CONTEXT record. */
3097
3098 /* If the context record is used as an input parameter, then */
3099 /* for each portion of the context record controlled by a flag */
3100 /* whose value is set, it is assumed that that portion of the */
3101 /* context record contains valid context. If the context record */
3102 /* is being used to modify a thread's context, then only that */
3103 /* portion of the threads context will be modified. */
3104
3105 /* If the context record is used as an IN OUT parameter to capture */
3106 /* the context of a thread, then only those portions of the thread's */
3107 /* context corresponding to set flags will be returned. */
3108
3109 /* The context record is never used as an OUT only parameter. */
3110
3111
3112 ULONG ContextFlags;
3113
3114 /* This section is specified/returned if the ContextFlags word contains */
3115 /* the flag CONTEXT_INTEGER. */
3116
3117 /* N.B. The registers RA and R15 are defined in this section, but are */
3118 /* considered part of the control context rather than part of the integer */
3119 /* context. */
3120
3121 ULONG PR;
3122 ULONG MACH;
3123 ULONG MACL;
3124 ULONG GBR;
3125 ULONG R0;
3126 ULONG R1;
3127 ULONG R2;
3128 ULONG R3;
3129 ULONG R4;
3130 ULONG R5;
3131 ULONG R6;
3132 ULONG R7;
3133 ULONG R8;
3134 ULONG R9;
3135 ULONG R10;
3136 ULONG R11;
3137 ULONG R12;
3138 ULONG R13;
3139 ULONG R14;
3140 ULONG R15;
3141
3142 /* This section is specified/returned if the ContextFlags word contains */
3143 /* the flag CONTEXT_CONTROL. */
3144
3145 /* N.B. The registers r15 and ra are defined in the integer section, */
3146 /* but are considered part of the control context rather than part of */
3147 /* the integer context. */
3148
3149 ULONG Fir;
3150 ULONG Psr;
3151
3152 #if !defined(SH3e) && !defined(SH4)
3153 ULONG OldStuff[2];
3154 DEBUG_REGISTERS DebugRegisters;
3155 #else
3156 ULONG Fpscr;
3157 ULONG Fpul;
3158 ULONG FRegs[16];
3159 #if defined(SH4)
3160 ULONG xFRegs[16];
3161 #endif
3162 #endif
3163 } CONTEXT;
3164
3165 #elif defined(_MIPS_)
3166
3167 /* The following flags control the contents of the CONTEXT structure. */
3168
3169 #define CONTEXT_R4000 0x00010000 /* r4000 context */
3170
3171 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
3172 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
3173 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
3174
3175 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
3176
3177 /* Context Frame */
3178
3179 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
3180
3181 /* This frame has a several purposes: 1) it is used as an argument to */
3182 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
3183 /* 3) it is used to construct a call frame for exception dispatching */
3184 /* in user mode, and 4) it is used in the user level thread creation */
3185 /* routines. */
3186
3187 /* The layout of the record conforms to a standard call frame. */
3188
3189
3190 typedef struct _CONTEXT {
3191
3192 /* This section is always present and is used as an argument build */
3193 /* area. */
3194
3195 DWORD Argument[4];
3196
3197 /* This section is specified/returned if the ContextFlags word contains */
3198 /* the flag CONTEXT_FLOATING_POINT. */
3199
3200 DWORD FltF0;
3201 DWORD FltF1;
3202 DWORD FltF2;
3203 DWORD FltF3;
3204 DWORD FltF4;
3205 DWORD FltF5;
3206 DWORD FltF6;
3207 DWORD FltF7;
3208 DWORD FltF8;
3209 DWORD FltF9;
3210 DWORD FltF10;
3211 DWORD FltF11;
3212 DWORD FltF12;
3213 DWORD FltF13;
3214 DWORD FltF14;
3215 DWORD FltF15;
3216 DWORD FltF16;
3217 DWORD FltF17;
3218 DWORD FltF18;
3219 DWORD FltF19;
3220 DWORD FltF20;
3221 DWORD FltF21;
3222 DWORD FltF22;
3223 DWORD FltF23;
3224 DWORD FltF24;
3225 DWORD FltF25;
3226 DWORD FltF26;
3227 DWORD FltF27;
3228 DWORD FltF28;
3229 DWORD FltF29;
3230 DWORD FltF30;
3231 DWORD FltF31;
3232
3233 /* This section is specified/returned if the ContextFlags word contains */
3234 /* the flag CONTEXT_INTEGER. */
3235
3236 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
3237 /* considered part of the control context rather than part of the integer */
3238 /* context. */
3239
3240 /* N.B. Register zero is not stored in the frame. */
3241
3242 DWORD IntZero;
3243 DWORD IntAt;
3244 DWORD IntV0;
3245 DWORD IntV1;
3246 DWORD IntA0;
3247 DWORD IntA1;
3248 DWORD IntA2;
3249 DWORD IntA3;
3250 DWORD IntT0;
3251 DWORD IntT1;
3252 DWORD IntT2;
3253 DWORD IntT3;
3254 DWORD IntT4;
3255 DWORD IntT5;
3256 DWORD IntT6;
3257 DWORD IntT7;
3258 DWORD IntS0;
3259 DWORD IntS1;
3260 DWORD IntS2;
3261 DWORD IntS3;
3262 DWORD IntS4;
3263 DWORD IntS5;
3264 DWORD IntS6;
3265 DWORD IntS7;
3266 DWORD IntT8;
3267 DWORD IntT9;
3268 DWORD IntK0;
3269 DWORD IntK1;
3270 DWORD IntGp;
3271 DWORD IntSp;
3272 DWORD IntS8;
3273 DWORD IntRa;
3274 DWORD IntLo;
3275 DWORD IntHi;
3276
3277 /* This section is specified/returned if the ContextFlags word contains */
3278 /* the flag CONTEXT_FLOATING_POINT. */
3279
3280 DWORD Fsr;
3281
3282 /* This section is specified/returned if the ContextFlags word contains */
3283 /* the flag CONTEXT_CONTROL. */
3284
3285 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
3286 /* but are considered part of the control context rather than part of */
3287 /* the integer context. */
3288
3289 DWORD Fir;
3290 DWORD Psr;
3291
3292 /* The flags values within this flag control the contents of */
3293 /* a CONTEXT record. */
3294
3295 /* If the context record is used as an input parameter, then */
3296 /* for each portion of the context record controlled by a flag */
3297 /* whose value is set, it is assumed that that portion of the */
3298 /* context record contains valid context. If the context record */
3299 /* is being used to modify a thread's context, then only that */
3300 /* portion of the threads context will be modified. */
3301
3302 /* If the context record is used as an IN OUT parameter to capture */
3303 /* the context of a thread, then only those portions of the thread's */
3304 /* context corresponding to set flags will be returned. */
3305
3306 /* The context record is never used as an OUT only parameter. */
3307
3308 DWORD ContextFlags;
3309
3310 DWORD Fill[2];
3311
3312 } CONTEXT;
3313 #elif defined(ARM)
3314
3315 #ifndef PAGE_SIZE
3316 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
3317 #endif
3318
3319 /* The following flags control the contents of the CONTEXT structure. */
3320
3321 #define CONTEXT_ARM 0x0000040
3322 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
3323 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
3324
3325 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
3326
3327 typedef struct _CONTEXT {
3328 /* The flags values within this flag control the contents of
3329 a CONTEXT record.
3330
3331 If the context record is used as an input parameter, then
3332 for each portion of the context record controlled by a flag
3333 whose value is set, it is assumed that that portion of the
3334 context record contains valid context. If the context record
3335 is being used to modify a thread's context, then only that
3336 portion of the threads context will be modified.
3337
3338 If the context record is used as an IN OUT parameter to capture
3339 the context of a thread, then only those portions of the thread's
3340 context corresponding to set flags will be returned.
3341
3342 The context record is never used as an OUT only parameter. */
3343
3344 ULONG ContextFlags;
3345
3346 /* This section is specified/returned if the ContextFlags word contains
3347 the flag CONTEXT_INTEGER. */
3348 ULONG R0;
3349 ULONG R1;
3350 ULONG R2;
3351 ULONG R3;
3352 ULONG R4;
3353 ULONG R5;
3354 ULONG R6;
3355 ULONG R7;
3356 ULONG R8;
3357 ULONG R9;
3358 ULONG R10;
3359 ULONG R11;
3360 ULONG R12;
3361
3362 ULONG Sp;
3363 ULONG Lr;
3364 ULONG Pc;
3365 ULONG Psr;
3366 } CONTEXT;
3367
3368 #else
3369 #error "undefined processor type"
3370 #endif
3371 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
3372
3373 #define EXCEPTION_MAXIMUM_PARAMETERS 15
3374 #define EXCEPTION_NONCONTINUABLE 0x01
3375 #define EXCEPTION_UNWINDING 0x02
3376 #define EXCEPTION_EXIT_UNWIND 0x04
3377 #define EXCEPTION_STACK_INVALID 0x08
3378 #define EXCEPTION_NESTED_CALL 0x10
3379 #define EXCEPTION_TARGET_UNWIND 0x20
3380 #define EXCEPTION_COLLIDED_UNWIND 0x40
3381 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
3382 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
3383
3384 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
3385 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
3386 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
3387
3388 typedef struct _EXCEPTION_RECORD {
3389 DWORD ExceptionCode;
3390 DWORD ExceptionFlags;
3391 struct _EXCEPTION_RECORD *ExceptionRecord;
3392 PVOID ExceptionAddress;
3393 DWORD NumberParameters;
3394 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3395 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
3396
3397 typedef struct _EXCEPTION_RECORD32 {
3398 DWORD ExceptionCode;
3399 DWORD ExceptionFlags;
3400 DWORD ExceptionRecord;
3401 DWORD ExceptionAddress;
3402 DWORD NumberParameters;
3403 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3404 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
3405
3406 typedef struct _EXCEPTION_RECORD64 {
3407 DWORD ExceptionCode;
3408 DWORD ExceptionFlags;
3409 DWORD64 ExceptionRecord;
3410 DWORD64 ExceptionAddress;
3411 DWORD NumberParameters;
3412 DWORD __unusedAlignment;
3413 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3414 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
3415
3416 typedef struct _EXCEPTION_POINTERS {
3417 PEXCEPTION_RECORD ExceptionRecord;
3418 PCONTEXT ContextRecord;
3419 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
3420
3421 #ifdef _M_PPC
3422 #define LARGE_INTEGER_ORDER(x) x HighPart; DWORD LowPart;
3423 #else
3424 #define LARGE_INTEGER_ORDER(x) DWORD LowPart; x HighPart;
3425 #endif
3426
3427 typedef union _LARGE_INTEGER {
3428 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
3429 _ANONYMOUS_STRUCT struct {
3430 LARGE_INTEGER_ORDER(LONG)
3431 };
3432 #endif /* NONAMELESSUNION */
3433 struct {
3434 LARGE_INTEGER_ORDER(LONG)
3435 } u;
3436 LONGLONG QuadPart;
3437 } LARGE_INTEGER, *PLARGE_INTEGER;
3438 typedef union _ULARGE_INTEGER {
3439 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
3440 _ANONYMOUS_STRUCT struct {
3441 LARGE_INTEGER_ORDER(DWORD)
3442 };
3443 #endif /* NONAMELESSUNION */
3444 struct {
3445 LARGE_INTEGER_ORDER(DWORD)
3446 } u;
3447 ULONGLONG QuadPart;
3448 } ULARGE_INTEGER, *PULARGE_INTEGER;
3449 typedef struct _LUID {
3450 LARGE_INTEGER_ORDER(LONG)
3451 } LUID, *PLUID;
3452
3453 #include <pshpack4.h>
3454
3455 typedef struct _LUID_AND_ATTRIBUTES {
3456 LUID Luid;
3457 DWORD Attributes;
3458 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3459 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
3460 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
3461
3462 #include <poppack.h>
3463
3464 typedef struct _PRIVILEGE_SET {
3465 DWORD PrivilegeCount;
3466 DWORD Control;
3467 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3468 } PRIVILEGE_SET,*PPRIVILEGE_SET;
3469
3470 typedef struct _SECURITY_ATTRIBUTES {
3471 DWORD nLength;
3472 LPVOID lpSecurityDescriptor;
3473 BOOL bInheritHandle;
3474 } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
3475
3476 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3477 SecurityAnonymous,
3478 SecurityIdentification,
3479 SecurityImpersonation,
3480 SecurityDelegation
3481 } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
3482
3483 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
3484
3485 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3486 DWORD Length;
3487 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3488 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3489 BOOLEAN EffectiveOnly;
3490 } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
3491
3492 typedef PVOID PACCESS_TOKEN;
3493
3494 typedef struct _SE_IMPERSONATION_STATE {
3495 PACCESS_TOKEN Token;
3496 BOOLEAN CopyOnOpen;
3497 BOOLEAN EffectiveOnly;
3498 SECURITY_IMPERSONATION_LEVEL Level;
3499 } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
3500
3501 typedef struct _SID_IDENTIFIER_AUTHORITY {
3502 BYTE Value[6];
3503 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
3504
3505 typedef PVOID PSID;
3506
3507 typedef struct _SID {
3508 BYTE Revision;
3509 BYTE SubAuthorityCount;
3510 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3511 DWORD SubAuthority[ANYSIZE_ARRAY];
3512 } SID, *PISID;
3513
3514 #define SECURITY_MIN_SID_SIZE (sizeof(SID))
3515 #define SECURITY_MAX_SID_SIZE (FIELD_OFFSET(SID, SubAuthority) + SID_MAX_SUB_AUTHORITIES * sizeof(DWORD))
3516
3517 typedef struct _SID_AND_ATTRIBUTES {
3518 PSID Sid;
3519 DWORD Attributes;
3520 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
3521 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
3522 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
3523
3524 typedef struct _TOKEN_SOURCE {
3525 CHAR SourceName[TOKEN_SOURCE_LENGTH];
3526 LUID SourceIdentifier;
3527 } TOKEN_SOURCE,*PTOKEN_SOURCE;
3528
3529 typedef struct _TOKEN_CONTROL {
3530 LUID TokenId;
3531 LUID AuthenticationId;
3532 LUID ModifiedId;
3533 TOKEN_SOURCE TokenSource;
3534 } TOKEN_CONTROL,*PTOKEN_CONTROL;
3535
3536 typedef struct _TOKEN_DEFAULT_DACL {
3537 PACL DefaultDacl;
3538 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
3539
3540 typedef struct _TOKEN_GROUPS {
3541 DWORD GroupCount;
3542 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3543 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
3544
3545 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
3546 DWORD SidCount;
3547 DWORD SidLength;
3548 PSID_AND_ATTRIBUTES Sids;
3549 DWORD RestrictedSidCount;
3550 DWORD RestrictedSidLength;
3551 PSID_AND_ATTRIBUTES RestrictedSids;
3552 DWORD PrivilegeCount;
3553 DWORD PrivilegeLength;
3554 PLUID_AND_ATTRIBUTES Privileges;
3555 LUID AuthenticationId;
3556 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
3557
3558 typedef struct _TOKEN_ORIGIN {
3559 LUID OriginatingLogonSession;
3560 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
3561
3562 typedef struct _TOKEN_OWNER {
3563 PSID Owner;
3564 } TOKEN_OWNER,*PTOKEN_OWNER;
3565
3566 typedef struct _TOKEN_PRIMARY_GROUP {
3567 PSID PrimaryGroup;
3568 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
3569
3570 typedef struct _TOKEN_PRIVILEGES {
3571 DWORD PrivilegeCount;
3572 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3573 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
3574
3575 typedef enum tagTOKEN_TYPE {
3576 TokenPrimary = 1,
3577 TokenImpersonation
3578 } TOKEN_TYPE,*PTOKEN_TYPE;
3579
3580 typedef enum _TOKEN_ELEVATION_TYPE {
3581 TokenElevationTypeDefault = 1,
3582 TokenElevationTypeFull,
3583 TokenElevationTypeLimited,
3584 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
3585
3586 typedef struct _TOKEN_MANDATORY_LABEL {
3587 SID_AND_ATTRIBUTES Label;
3588 } TOKEN_MANDATORY_LABEL, * PTOKEN_MANDATORY_LABEL;
3589
3590 #include <pshpack4.h>
3591 typedef struct _TOKEN_STATISTICS {
3592 LUID TokenId;
3593 LUID AuthenticationId;
3594 LARGE_INTEGER ExpirationTime;
3595 TOKEN_TYPE TokenType;
3596 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3597 DWORD DynamicCharged;
3598 DWORD DynamicAvailable;
3599 DWORD GroupCount;
3600 DWORD PrivilegeCount;
3601 LUID ModifiedId;
3602 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
3603 #include <poppack.h>
3604
3605 typedef struct _TOKEN_USER {
3606 SID_AND_ATTRIBUTES User;
3607 } TOKEN_USER, *PTOKEN_USER;
3608
3609 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
3610 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
3611
3612 #ifndef _SECURITY_ATTRIBUTES_
3613 #define _SECURITY_ATTRIBUTES_
3614 typedef struct _SECURITY_DESCRIPTOR {
3615 BYTE Revision;
3616 BYTE Sbz1;
3617 SECURITY_DESCRIPTOR_CONTROL Control;
3618 PSID Owner;
3619 PSID Group;
3620 PACL Sacl;
3621 PACL Dacl;
3622 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3623 typedef PVOID PSECURITY_DESCRIPTOR;
3624 #endif
3625
3626 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
3627 BYTE Revision;
3628 BYTE Sbz1;
3629 SECURITY_DESCRIPTOR_CONTROL Control;
3630 DWORD Owner;
3631 DWORD Group;
3632 DWORD Sacl;
3633 DWORD Dacl;
3634 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3635
3636 typedef enum _TOKEN_INFORMATION_CLASS {
3637 TokenUser = 1,
3638 TokenGroups,
3639 TokenPrivileges,
3640 TokenOwner,
3641 TokenPrimaryGroup,
3642 TokenDefaultDacl,
3643 TokenSource,
3644 TokenType,
3645 TokenImpersonationLevel,
3646 TokenStatistics,
3647 TokenRestrictedSids,
3648 TokenSessionId,
3649 TokenGroupsAndPrivileges,
3650 TokenSessionReference,
3651 TokenSandBoxInert,
3652 TokenAuditPolicy,
3653 TokenOrigin,
3654 TokenElevationType,
3655 TokenLinkedToken,
3656 TokenElevation,
3657 TokenHasRestrictions,
3658 TokenAccessInformation,
3659 TokenVirtualizationAllowed,
3660 TokenVirtualizationEnabled,
3661 TokenIntegrityLevel,
3662 TokenUIAccess,
3663 TokenMandatoryPolicy,
3664 TokenLogonSid,
3665 MaxTokenInfoClass
3666 } TOKEN_INFORMATION_CLASS;
3667
3668 typedef enum _SID_NAME_USE {
3669 SidTypeUser=1,
3670 SidTypeGroup,
3671 SidTypeDomain,
3672 SidTypeAlias,
3673 SidTypeWellKnownGroup,
3674 SidTypeDeletedAccount,
3675 SidTypeInvalid,
3676 SidTypeUnknown,
3677 SidTypeComputer,
3678 SidTypeLabel
3679 } SID_NAME_USE,*PSID_NAME_USE;
3680
3681 typedef struct _QUOTA_LIMITS {
3682 SIZE_T PagedPoolLimit;
3683 SIZE_T NonPagedPoolLimit;
3684 SIZE_T MinimumWorkingSetSize;
3685 SIZE_T MaximumWorkingSetSize;
3686 SIZE_T PagefileLimit;
3687 LARGE_INTEGER TimeLimit;
3688 } QUOTA_LIMITS,*PQUOTA_LIMITS;
3689
3690 typedef struct _QUOTA_LIMITS_EX {
3691 SIZE_T PagedPoolLimit;
3692 SIZE_T NonPagedPoolLimit;
3693 SIZE_T MinimumWorkingSetSize;
3694 SIZE_T MaximumWorkingSetSize;
3695 SIZE_T PagefileLimit;
3696 LARGE_INTEGER TimeLimit;
3697 SIZE_T Reserved1;
3698 SIZE_T Reserved2;
3699 SIZE_T Reserved3;
3700 SIZE_T Reserved4;
3701 ULONG Flags;
3702 ULONG Reserved5;
3703 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
3704
3705 typedef struct _IO_COUNTERS {
3706 ULONGLONG ReadOperationCount;
3707 ULONGLONG WriteOperationCount;
3708 ULONGLONG OtherOperationCount;
3709 ULONGLONG ReadTransferCount;
3710 ULONGLONG WriteTransferCount;
3711 ULONGLONG OtherTransferCount;
3712 } IO_COUNTERS, *PIO_COUNTERS;
3713
3714 typedef struct _FILE_NOTIFY_INFORMATION {
3715 DWORD NextEntryOffset;
3716 DWORD Action;
3717 DWORD FileNameLength;
3718 WCHAR FileName[1];
3719 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
3720
3721 typedef struct _TAPE_ERASE {
3722 DWORD Type;
3723 BOOLEAN Immediate;
3724 } TAPE_ERASE, *PTAPE_ERASE;
3725
3726 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
3727 BOOLEAN ECC;
3728 BOOLEAN Compression;
3729 BOOLEAN DataPadding;
3730 BOOLEAN ReportSetmarks;
3731 DWORD DefaultBlockSize;
3732 DWORD MaximumBlockSize;
3733 DWORD MinimumBlockSize;
3734 DWORD MaximumPartitionCount;
3735 DWORD FeaturesLow;
3736 DWORD FeaturesHigh;
3737 DWORD EOTWarningZoneSize;
3738 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
3739
3740 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
3741 LARGE_INTEGER Capacity;
3742 LARGE_INTEGER Remaining;
3743 DWORD BlockSize;
3744 DWORD PartitionCount;
3745 BOOLEAN WriteProtected;
3746 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
3747
3748 typedef struct _TAPE_GET_POSITION {
3749 ULONG Type;
3750 ULONG Partition;
3751 LARGE_INTEGER Offset;
3752 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
3753
3754 typedef struct _TAPE_PREPARE {
3755 DWORD Operation;
3756 BOOLEAN Immediate;
3757 } TAPE_PREPARE, *PTAPE_PREPARE;
3758
3759 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
3760 BOOLEAN ECC;
3761 BOOLEAN Compression;
3762 BOOLEAN DataPadding;
3763 BOOLEAN ReportSetmarks;
3764 DWORD EOTWarningZoneSize;
3765 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
3766
3767 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
3768 DWORD BlockSize;
3769 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
3770
3771 typedef struct _TAPE_SET_POSITION {
3772 DWORD Method;
3773 DWORD Partition;
3774 LARGE_INTEGER Offset;
3775 BOOLEAN Immediate;
3776 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
3777
3778 typedef struct _TAPE_WRITE_MARKS {
3779 DWORD Type;
3780 DWORD Count;
3781 BOOLEAN Immediate;
3782 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
3783
3784 typedef struct _TAPE_CREATE_PARTITION {
3785 DWORD Method;
3786 DWORD Count;
3787 DWORD Size;
3788 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
3789
3790 typedef struct _MEMORY_BASIC_INFORMATION {
3791 PVOID BaseAddress;
3792 PVOID AllocationBase;
3793 DWORD AllocationProtect;
3794 SIZE_T RegionSize;
3795 DWORD State;
3796 DWORD Protect;
3797 DWORD Type;
3798 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
3799
3800 typedef struct _MESSAGE_RESOURCE_ENTRY {
3801 WORD Length;
3802 WORD Flags;
3803 BYTE Text[1];
3804 } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
3805
3806 typedef struct _MESSAGE_RESOURCE_BLOCK {
3807 DWORD LowId;
3808 DWORD HighId;
3809 DWORD OffsetToEntries;
3810 } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
3811
3812 typedef struct _MESSAGE_RESOURCE_DATA {
3813 DWORD NumberOfBlocks;
3814 MESSAGE_RESOURCE_BLOCK Blocks[1];
3815 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3816
3817 typedef struct _LIST_ENTRY {
3818 struct _LIST_ENTRY *Flink;
3819 struct _LIST_ENTRY *Blink;
3820 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
3821
3822 typedef struct _LIST_ENTRY32 {
3823 DWORD Flink;
3824 DWORD Blink;
3825 } LIST_ENTRY32,*PLIST_ENTRY32;
3826
3827 typedef struct _LIST_ENTRY64 {
3828 ULONGLONG Flink;
3829 ULONGLONG Blink;
3830 } LIST_ENTRY64,*PLIST_ENTRY64;
3831
3832 typedef struct _SINGLE_LIST_ENTRY {
3833 struct _SINGLE_LIST_ENTRY *Next;
3834 } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY;
3835
3836 //
3837 // Slist Header
3838 //
3839 #ifndef _SLIST_HEADER_
3840 #define _SLIST_HEADER_
3841
3842 #if defined(_WIN64)
3843
3844 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
3845 struct _SLIST_ENTRY *Next;
3846 } SLIST_ENTRY, *PSLIST_ENTRY;
3847
3848 typedef struct _SLIST_ENTRY32 {
3849 DWORD Next;
3850 } SLIST_ENTRY32, *PSLIST_ENTRY32;
3851
3852 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
3853 _ANONYMOUS_STRUCT struct {
3854 ULONGLONG Alignment;
3855 ULONGLONG Region;
3856 } DUMMYSTRUCTNAME;
3857 struct {
3858 ULONGLONG Depth:16;
3859 ULONGLONG Sequence:9;
3860 ULONGLONG NextEntry:39;
3861 ULONGLONG HeaderType:1;
3862 ULONGLONG Init:1;
3863 ULONGLONG Reserved:59;
3864 ULONGLONG Region:3;
3865 } Header8;
3866 struct {
3867 ULONGLONG Depth:16;
3868 ULONGLONG Sequence:48;
3869 ULONGLONG HeaderType:1;
3870 ULONGLONG Init:1;
3871 ULONGLONG Reserved:2;
3872 ULONGLONG NextEntry:60;
3873 } Header16;
3874 struct {
3875 ULONGLONG Depth:16;
3876 ULONGLONG Sequence:48;
3877 ULONGLONG HeaderType:1;
3878 ULONGLONG Reserved:3;
3879 ULONGLONG NextEntry:60;
3880 } HeaderX64;
3881 } SLIST_HEADER, *PSLIST_HEADER;
3882
3883 typedef union _SLIST_HEADER32{
3884 ULONGLONG Alignment;
3885 _ANONYMOUS_STRUCT struct {
3886 SLIST_ENTRY32 Next;
3887 WORD Depth;
3888 WORD Sequence;
3889 } DUMMYSTRUCTNAME;
3890 } SLIST_HEADER32, *PSLIST_HEADER32;
3891
3892 #else
3893
3894 #define SLIST_ENTRY SINGLE_LIST_ENTRY
3895 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
3896 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
3897
3898 typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32;
3899
3900 typedef union _SLIST_HEADER {
3901 ULONGLONG Alignment;
3902 _ANONYMOUS_STRUCT struct {
3903 SLIST_ENTRY Next;
3904 WORD Depth;
3905 WORD Sequence;
3906 } DUMMYSTRUCTNAME;
3907 } SLIST_HEADER, *PSLIST_HEADER;
3908
3909 typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32;
3910
3911 #endif /* defined(_WIN64) */
3912
3913 #endif /* _SLIST_HEADER_ */
3914
3915 NTSYSAPI
3916 VOID
3917 NTAPI
3918 RtlInitializeSListHead(
3919 _Out_ PSLIST_HEADER ListHead);
3920
3921 _Must_inspect_result_
3922 NTSYSAPI
3923 PSLIST_ENTRY
3924 NTAPI
3925 RtlFirstEntrySList(
3926 _In_ const SLIST_HEADER *ListHead);
3927
3928 NTSYSAPI
3929 PSLIST_ENTRY
3930 NTAPI
3931 RtlInterlockedPopEntrySList(
3932 _Inout_ PSLIST_HEADER ListHead);
3933
3934 NTSYSAPI
3935 PSLIST_ENTRY
3936 NTAPI
3937 RtlInterlockedPushEntrySList(
3938 _Inout_ PSLIST_HEADER ListHead,
3939 _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry);
3940
3941 NTSYSAPI
3942 PSLIST_ENTRY
3943 NTAPI
3944 RtlInterlockedFlushSList(
3945 _Inout_ PSLIST_HEADER ListHead);
3946
3947 NTSYSAPI
3948 WORD
3949 NTAPI
3950 RtlQueryDepthSList(
3951 _In_ PSLIST_HEADER ListHead);
3952
3953 #ifndef _RTL_RUN_ONCE_DEF
3954 #define _RTL_RUN_ONCE_DEF
3955
3956 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL
3957 #define RTL_RUN_ONCE_ASYNC 0x00000002UL
3958 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL
3959
3960 typedef union _RTL_RUN_ONCE {
3961 PVOID Ptr;
3962 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
3963
3964 #endif
3965
3966 #define RTL_CONDITION_VARIABLE_INIT {0}
3967 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
3968
3969 typedef struct _RTL_CONDITION_VARIABLE {
3970 PVOID Ptr;
3971 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
3972
3973 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
3974 WORD Type;
3975 WORD CreatorBackTraceIndex;
3976 struct _RTL_CRITICAL_SECTION *CriticalSection;
3977 LIST_ENTRY ProcessLocksList;
3978 DWORD EntryCount;
3979 DWORD ContentionCount;
3980 DWORD Flags;
3981 WORD CreatorBackTraceIndexHigh;
3982 WORD SpareWORD;
3983 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
3984
3985 #include "pshpack8.h"
3986 typedef struct _RTL_CRITICAL_SECTION {
3987 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3988 LONG LockCount;
3989 LONG RecursionCount;
3990 HANDLE OwningThread;
3991 HANDLE LockSemaphore;
3992 ULONG_PTR SpinCount;
3993 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
3994 #include "poppack.h"
3995
3996 NTSYSAPI
3997 WORD
3998 NTAPI
3999 RtlCaptureStackBackTrace(
4000 IN DWORD FramesToSkip,
4001 IN DWORD FramesToCapture,
4002 OUT PVOID *BackTrace,
4003 OUT PDWORD BackTraceHash OPTIONAL
4004 );
4005
4006 NTSYSAPI
4007 VOID
4008 NTAPI
4009 RtlCaptureContext(
4010 _Out_ PCONTEXT ContextRecord
4011 );
4012
4013 NTSYSAPI
4014 PVOID
4015 NTAPI
4016 RtlPcToFileHeader(
4017 _In_ PVOID PcValue,
4018 _Out_ PVOID* BaseOfImage);
4019
4020 NTSYSAPI
4021 VOID
4022 NTAPI
4023 RtlUnwind(
4024 _In_opt_ PVOID TargetFrame,
4025 _In_opt_ PVOID TargetIp,
4026 _In_opt_ PEXCEPTION_RECORD ExceptionRecord,
4027 _In_ PVOID ReturnValue);
4028
4029 #define RTL_SRWLOCK_INIT {0}
4030
4031 typedef struct _RTL_SRWLOCK {
4032 PVOID Ptr;
4033 } RTL_SRWLOCK, *PRTL_SRWLOCK;
4034
4035 typedef LONG
4036 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
4037 struct _EXCEPTION_POINTERS *ExceptionInfo
4038 );
4039
4040 typedef struct _PROCESSOR_NUMBER {
4041 WORD Group;
4042 BYTE Number;
4043 BYTE Reserved;
4044 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
4045
4046 typedef struct _GROUP_AFFINITY {
4047 KAFFINITY Mask;
4048 WORD Group;
4049 WORD Reserved[3];
4050 } GROUP_AFFINITY, *PGROUP_AFFINITY;
4051
4052 typedef struct _EVENTLOGRECORD {
4053 DWORD Length;
4054 DWORD Reserved;
4055 DWORD RecordNumber;
4056 DWORD TimeGenerated;
4057 DWORD TimeWritten;
4058 DWORD EventID;
4059 WORD EventType;
4060 WORD NumStrings;
4061 WORD EventCategory;
4062 WORD ReservedFlags;
4063 DWORD ClosingRecordNumber;
4064 DWORD StringOffset;
4065 DWORD UserSidLength;
4066 DWORD UserSidOffset;
4067 DWORD DataLength;
4068 DWORD DataOffset;
4069 } EVENTLOGRECORD, *PEVENTLOGRECORD;
4070
4071 typedef struct _OSVERSIONINFOA {
4072 DWORD dwOSVersionInfoSize;
4073 DWORD dwMajorVersion;
4074 DWORD dwMinorVersion;
4075 DWORD dwBuildNumber;
4076 DWORD dwPlatformId;
4077 CHAR szCSDVersion[128];
4078 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
4079
4080 typedef struct _OSVERSIONINFOW {
4081 DWORD dwOSVersionInfoSize;
4082 DWORD dwMajorVersion;
4083 DWORD dwMinorVersion;
4084 DWORD dwBuildNumber;
4085 DWORD dwPlatformId;
4086 WCHAR szCSDVersion[128];
4087 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
4088
4089 typedef struct _OSVERSIONINFOEXA {
4090 DWORD dwOSVersionInfoSize;
4091 DWORD dwMajorVersion;
4092 DWORD dwMinorVersion;
4093 DWORD dwBuildNumber;
4094 DWORD dwPlatformId;
4095 CHAR szCSDVersion[128];
4096 WORD wServicePackMajor;
4097 WORD wServicePackMinor;
4098 WORD wSuiteMask;
4099 BYTE wProductType;
4100 BYTE wReserved;
4101 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
4102
4103 typedef struct _OSVERSIONINFOEXW {
4104 DWORD dwOSVersionInfoSize;
4105 DWORD dwMajorVersion;
4106 DWORD dwMinorVersion;
4107 DWORD dwBuildNumber;
4108 DWORD dwPlatformId;
4109 WCHAR szCSDVersion[128];
4110 WORD wServicePackMajor;
4111 WORD wServicePackMinor;
4112 WORD wSuiteMask;
4113 BYTE wProductType;
4114 BYTE wReserved;
4115 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
4116
4117 #include <pshpack2.h>
4118
4119 typedef struct _IMAGE_VXD_HEADER {
4120 WORD e32_magic;
4121 BYTE e32_border;
4122 BYTE e32_worder;
4123 DWORD e32_level;
4124 WORD e32_cpu;
4125 WORD e32_os;
4126 DWORD e32_ver;
4127 DWORD e32_mflags;
4128 DWORD e32_mpages;
4129 DWORD e32_startobj;
4130 DWORD e32_eip;
4131 DWORD e32_stackobj;
4132 DWORD e32_esp;
4133 DWORD e32_pagesize;
4134 DWORD e32_lastpagesize;
4135 DWORD e32_fixupsize;
4136 DWORD e32_fixupsum;
4137 DWORD e32_ldrsize;
4138 DWORD e32_ldrsum;
4139 DWORD e32_objtab;
4140 DWORD e32_objcnt;
4141 DWORD e32_objmap;
4142 DWORD e32_itermap;
4143 DWORD e32_rsrctab;
4144 DWORD e32_rsrccnt;
4145 DWORD e32_restab;
4146 DWORD e32_enttab;
4147 DWORD e32_dirtab;
4148 DWORD e32_dircnt;
4149 DWORD e32_fpagetab;
4150 DWORD e32_frectab;
4151 DWORD e32_impmod;
4152 DWORD e32_impmodcnt;
4153 DWORD e32_impproc;
4154 DWORD e32_pagesum;
4155 DWORD e32_datapage;
4156 DWORD e32_preload;
4157 DWORD e32_nrestab;
4158 DWORD e32_cbnrestab;
4159 DWORD e32_nressum;
4160 DWORD e32_autodata;
4161 DWORD e32_debuginfo;
4162 DWORD e32_debuglen;
4163 DWORD e32_instpreload;
4164 DWORD e32_instdemand;
4165 DWORD e32_heapsize;
4166 BYTE e32_res3[12];
4167 DWORD e32_winresoff;
4168 DWORD e32_winreslen;
4169 WORD e32_devid;
4170 WORD e32_ddkver;
4171 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
4172
4173 typedef struct _IMAGE_DOS_HEADER {
4174 WORD e_magic;
4175 WORD e_cblp;
4176 WORD e_cp;
4177 WORD e_crlc;
4178 WORD e_cparhdr;
4179 WORD e_minalloc;
4180 WORD e_maxalloc;
4181 WORD e_ss;
4182 WORD e_sp;
4183 WORD e_csum;
4184 WORD e_ip;
4185 WORD e_cs;
4186 WORD e_lfarlc;
4187 WORD e_ovno;
4188 WORD e_res[4];
4189 WORD e_oemid;
4190 WORD e_oeminfo;
4191 WORD e_res2[10];
4192 LONG e_lfanew;
4193 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
4194
4195 typedef struct _IMAGE_OS2_HEADER {
4196 WORD ne_magic;
4197 CHAR ne_ver;
4198 CHAR ne_rev;
4199 WORD ne_enttab;
4200 WORD ne_cbenttab;
4201 LONG ne_crc;
4202 WORD ne_flags;
4203 WORD ne_autodata;
4204 WORD ne_heap;
4205 WORD ne_stack;
4206 LONG ne_csip;
4207 LONG ne_sssp;
4208 WORD ne_cseg;
4209 WORD ne_cmod;
4210 WORD ne_cbnrestab;
4211 WORD ne_segtab;
4212 WORD ne_rsrctab;
4213 WORD ne_restab;
4214 WORD ne_modtab;
4215 WORD ne_imptab;
4216 LONG ne_nrestab;
4217 WORD ne_cmovent;
4218 WORD ne_align;
4219 WORD ne_cres;
4220 BYTE ne_exetyp;
4221 BYTE ne_flagsothers;
4222 WORD ne_pretthunks;
4223 WORD ne_psegrefbytes;
4224 WORD ne_swaparea;
4225 WORD ne_expver;
4226 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
4227
4228 #include <poppack.h>
4229
4230 typedef struct _IMAGE_FILE_HEADER {
4231 WORD Machine;
4232 WORD NumberOfSections;
4233 DWORD TimeDateStamp;
4234 DWORD PointerToSymbolTable;
4235 DWORD NumberOfSymbols;
4236 WORD SizeOfOptionalHeader;
4237 WORD Characteristics;
4238 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
4239
4240 typedef struct _IMAGE_DATA_DIRECTORY {
4241 DWORD VirtualAddress;
4242 DWORD Size;
4243 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
4244
4245 typedef struct _IMAGE_OPTIONAL_HEADER32 {
4246 WORD Magic;
4247 BYTE MajorLinkerVersion;
4248 BYTE MinorLinkerVersion;
4249 DWORD SizeOfCode;
4250 DWORD SizeOfInitializedData;
4251 DWORD SizeOfUninitializedData;
4252 DWORD AddressOfEntryPoint;
4253 DWORD BaseOfCode;
4254 DWORD BaseOfData;
4255 DWORD ImageBase;
4256 DWORD SectionAlignment;
4257 DWORD FileAlignment;
4258 WORD MajorOperatingSystemVersion;
4259 WORD MinorOperatingSystemVersion;
4260 WORD MajorImageVersion;
4261 WORD MinorImageVersion;
4262 WORD MajorSubsystemVersion;
4263 WORD MinorSubsystemVersion;
4264 DWORD Win32VersionValue;
4265 DWORD SizeOfImage;
4266 DWORD SizeOfHeaders;
4267 DWORD CheckSum;
4268 WORD Subsystem;
4269 WORD DllCharacteristics;
4270 DWORD SizeOfStackReserve;
4271 DWORD SizeOfStackCommit;
4272 DWORD SizeOfHeapReserve;
4273 DWORD SizeOfHeapCommit;
4274 DWORD LoaderFlags;
4275 DWORD NumberOfRvaAndSizes;
4276 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
4277 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
4278
4279 typedef struct _IMAGE_OPTIONAL_HEADER64 {
4280 WORD Magic;
4281 BYTE MajorLinkerVersion;
4282 BYTE MinorLinkerVersion;
4283 DWORD SizeOfCode;
4284 DWORD SizeOfInitializedData;
4285 DWORD SizeOfUninitializedData;
4286 DWORD AddressOfEntryPoint;
4287 DWORD BaseOfCode;
4288 ULONGLONG ImageBase;
4289 DWORD SectionAlignment;
4290 DWORD FileAlignment;
4291 WORD MajorOperatingSystemVersion;
4292 WORD MinorOperatingSystemVersion;
4293 WORD MajorImageVersion;
4294 WORD MinorImageVersion;
4295 WORD MajorSubsystemVersion;
4296 WORD MinorSubsystemVersion;
4297 DWORD Win32VersionValue;
4298 DWORD SizeOfImage;
4299 DWORD SizeOfHeaders;
4300 DWORD CheckSum;
4301 WORD Subsystem;
4302 WORD DllCharacteristics;
4303 ULONGLONG SizeOfStackReserve;
4304 ULONGLONG SizeOfStackCommit;
4305 ULONGLONG SizeOfHeapReserve;
4306 ULONGLONG SizeOfHeapCommit;
4307 DWORD LoaderFlags;
4308 DWORD NumberOfRvaAndSizes;
4309 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
4310 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
4311
4312 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
4313 WORD Magic;
4314 BYTE MajorLinkerVersion;
4315 BYTE MinorLinkerVersion;
4316 DWORD SizeOfCode;
4317 DWORD SizeOfInitializedData;
4318 DWORD SizeOfUninitializedData;
4319 DWORD AddressOfEntryPoint;
4320 DWORD BaseOfCode;
4321 DWORD BaseOfData;
4322 DWORD BaseOfBss;
4323 DWORD GprMask;
4324 DWORD CprMask[4];
4325 DWORD GpValue;
4326 } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
4327
4328 typedef struct _IMAGE_NT_HEADERS32 {
4329 DWORD Signature;
4330 IMAGE_FILE_HEADER FileHeader;
4331 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
4332 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
4333
4334 typedef struct _IMAGE_NT_HEADERS64 {
4335 DWORD Signature;
4336 IMAGE_FILE_HEADER FileHeader;
4337 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
4338 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
4339
4340 #ifdef _WIN64
4341 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
4342 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
4343 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
4344 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
4345 #else
4346 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
4347 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
4348 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
4349 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
4350 #endif
4351
4352 typedef struct _IMAGE_ROM_HEADERS {
4353 IMAGE_FILE_HEADER FileHeader;
4354 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
4355 } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
4356
4357 typedef struct _IMAGE_SECTION_HEADER {
4358 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
4359 union {
4360 DWORD PhysicalAddress;
4361 DWORD VirtualSize;
4362 } Misc;
4363 DWORD VirtualAddress;
4364 DWORD SizeOfRawData;
4365 DWORD PointerToRawData;
4366 DWORD PointerToRelocations;
4367 DWORD PointerToLinenumbers;
4368 WORD NumberOfRelocations;
4369 WORD NumberOfLinenumbers;
4370 DWORD Characteristics;
4371 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
4372
4373 #include <pshpack2.h>
4374
4375 typedef struct _IMAGE_SYMBOL {
4376 union {
4377 BYTE ShortName[8];
4378 struct {
4379 DWORD Short;
4380 DWORD Long;
4381 } Name;
4382 PBYTE LongName[2];
4383 } N;
4384 DWORD Value;
4385 SHORT SectionNumber;
4386 WORD Type;
4387 BYTE StorageClass;
4388 BYTE NumberOfAuxSymbols;
4389 } IMAGE_SYMBOL, *PIMAGE_SYMBOL;
4390
4391 typedef struct _IMAGE_LINENUMBER {
4392 union {
4393 DWORD SymbolTableIndex;
4394 DWORD VirtualAddress;
4395 } Type;
4396 WORD Linenumber;
4397 } IMAGE_LINENUMBER, UNALIGNED *PIMAGE_LINENUMBER;
4398
4399 typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF {
4400 BYTE bAuxType;
4401 BYTE bReserved;
4402 DWORD SymbolTableIndex;
4403 BYTE rgbReserved[12];
4404 } IMAGE_AUX_SYMBOL_TOKEN_DEF, UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF;
4405
4406 typedef union _IMAGE_AUX_SYMBOL {
4407 struct {
4408 DWORD TagIndex;
4409 union {
4410 struct {
4411 WORD Linenumber;
4412 WORD Size;
4413 } LnSz;
4414 DWORD TotalSize;
4415 } Misc;
4416 union {
4417 struct {
4418 DWORD PointerToLinenumber;