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