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