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