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