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