[PSDK/XDK]
[reactos.git] / reactos / include / xdk / ntbasedef.h
1 /* Defines the "size" of an any-size array */
2 #ifndef ANYSIZE_ARRAY
3 #define ANYSIZE_ARRAY 1
4 #endif
5
6 /* Helper macro to enable gcc's extension. */
7 #ifndef __GNU_EXTENSION
8 #ifdef __GNUC__
9 #define __GNU_EXTENSION __extension__
10 #else
11 #define __GNU_EXTENSION
12 #endif
13 #endif /* __GNU_EXTENSION */
14
15 #ifndef DUMMYUNIONNAME
16 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
17 #define _ANONYMOUS_UNION
18 #define _UNION_NAME(x) x
19 #define DUMMYUNIONNAME u
20 #define DUMMYUNIONNAME1 u1
21 #define DUMMYUNIONNAME2 u2
22 #define DUMMYUNIONNAME3 u3
23 #define DUMMYUNIONNAME4 u4
24 #define DUMMYUNIONNAME5 u5
25 #define DUMMYUNIONNAME6 u6
26 #define DUMMYUNIONNAME7 u7
27 #define DUMMYUNIONNAME8 u8
28 #define DUMMYUNIONNAME9 u9
29 #else
30 #define _ANONYMOUS_UNION __GNU_EXTENSION
31 #define _UNION_NAME(x)
32 #define DUMMYUNIONNAME
33 #define DUMMYUNIONNAME1
34 #define DUMMYUNIONNAME2
35 #define DUMMYUNIONNAME3
36 #define DUMMYUNIONNAME4
37 #define DUMMYUNIONNAME5
38 #define DUMMYUNIONNAME6
39 #define DUMMYUNIONNAME7
40 #define DUMMYUNIONNAME8
41 #define DUMMYUNIONNAME9
42 #endif /* NONAMELESSUNION */
43 #endif /* !DUMMYUNIONNAME */
44
45 #ifndef DUMMYSTRUCTNAME
46 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
47 #define _ANONYMOUS_STRUCT
48 #define _STRUCT_NAME(x) x
49 #define DUMMYSTRUCTNAME s
50 #define DUMMYSTRUCTNAME1 s1
51 #define DUMMYSTRUCTNAME2 s2
52 #define DUMMYSTRUCTNAME3 s3
53 #define DUMMYSTRUCTNAME4 s4
54 #define DUMMYSTRUCTNAME5 s5
55 #else
56 #define _ANONYMOUS_STRUCT __GNU_EXTENSION
57 #define _STRUCT_NAME(x)
58 #define DUMMYSTRUCTNAME
59 #define DUMMYSTRUCTNAME1
60 #define DUMMYSTRUCTNAME2
61 #define DUMMYSTRUCTNAME3
62 #define DUMMYSTRUCTNAME4
63 #define DUMMYSTRUCTNAME5
64 #endif /* NONAMELESSUNION */
65 #endif /* DUMMYSTRUCTNAME */
66
67 #if defined(STRICT_GS_ENABLED)
68 #pragma strict_gs_check(push, on)
69 #endif
70
71 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
72 #define ALIGNMENT_MACHINE
73 #define UNALIGNED __unaligned
74 #if defined(_WIN64)
75 #define UNALIGNED64 __unaligned
76 #else
77 #define UNALIGNED64
78 #endif
79 #else
80 #undef ALIGNMENT_MACHINE
81 #define UNALIGNED
82 #define UNALIGNED64
83 #endif
84
85 #if defined(_WIN64) || defined(_M_ALPHA)
86 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
87 #define MEMORY_ALLOCATION_ALIGNMENT 16
88 #else
89 #define MAX_NATURAL_ALIGNMENT sizeof($ULONG)
90 #define MEMORY_ALLOCATION_ALIGNMENT 8
91 #endif
92
93 /* C99 restrict support */
94 #if defined(ENABLE_RESTRICTED) && defined(_M_MRX000) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
95 #define RESTRICTED_POINTER __restrict
96 #else
97 #define RESTRICTED_POINTER
98 #endif
99
100 /* Returns the base address of a structure from a structure member */
101 #ifndef CONTAINING_RECORD
102 #define CONTAINING_RECORD(address, type, field) \
103 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
104 #endif
105
106 /* Returns the byte offset of the specified structure's member */
107 #ifndef __GNUC__
108 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
109 #else
110 #define FIELD_OFFSET(Type, Field) ((LONG)__builtin_offsetof(Type, Field))
111 #endif /* __GNUC__ */
112
113 /* Returns the type's alignment */
114 #if defined(_MSC_VER)
115 #define TYPE_ALIGNMENT(t) __alignof(t)
116 #else
117 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
118 #endif /* _MSC_VER */
119
120 #if defined(_AMD64_) || defined(_X86_)
121 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT($ULONG)
122 #elif defined(_IA64_) || defined(_ARM_)
123 #define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT($ULONG))
124 #else
125 #error "unknown architecture"
126 #endif
127
128 #if defined(_WIN64)
129 #define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT($ULONG)
130 #endif /* _WIN64 */
131
132 #ifdef __cplusplus
133 #define EXTERN_C extern "C"
134 #else
135 #define EXTERN_C extern
136 #endif /* __cplusplus */
137
138 #define NTAPI __stdcall
139
140 #ifndef STDMETHODCALLTYPE
141 #define STDMETHODCALLTYPE __stdcall
142 #define STDMETHODVCALLTYPE __cdecl
143 #define STDAPICALLTYPE __stdcall
144 #define STDAPIVCALLTYPE __cdecl
145 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
146 #define STDAPI_(t) EXTERN_C t STDAPICALLTYPE
147 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
148 #define STDMETHODIMP_(t) t STDMETHODCALLTYPE
149 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
150 #define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE
151 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
152 #define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE
153 #endif /* !STDMETHODCALLTYPE */
154
155 #define STDOVERRIDEMETHODIMP __override STDMETHODIMP
156 #define STDOVERRIDEMETHODIMP_(t) __override STDMETHODIMP_(t)
157 #define IFACEMETHODIMP __override STDMETHODIMP
158 #define IFACEMETHODIMP_(t) __override STDMETHODIMP_(t)
159 #define STDOVERRIDEMETHODIMPV __override STDMETHODIMPV
160 #define STDOVERRIDEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
161 #define IFACEMETHODIMPV __override STDMETHODIMPV
162 #define IFACEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
163
164 /* Import and Export Specifiers */
165
166 /* Done the same way as in windef.h for now */
167 #define DECLSPEC_IMPORT __declspec(dllimport) // MIDL?
168 #define DECLSPEC_NORETURN __declspec(noreturn)
169
170 #ifndef DECLSPEC_ADDRSAFE
171 #if defined(_MSC_VER) && (defined(_M_ALPHA) || defined(_M_AXP64))
172 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
173 #else
174 #define DECLSPEC_ADDRSAFE
175 #endif
176 #endif /* DECLSPEC_ADDRSAFE */
177
178 #ifndef DECLSPEC_NOTHROW
179 #if !defined(MIDL_PASS)
180 #define DECLSPEC_NOTHROW __declspec(nothrow)
181 #else
182 #define DECLSPEC_NOTHROW
183 #endif
184 #endif /* DECLSPEC_NOTHROW */
185
186 #ifndef NOP_FUNCTION
187 #if defined(_MSC_VER)
188 #define NOP_FUNCTION __noop
189 #else
190 #define NOP_FUNCTION (void)0
191 #endif
192 #endif /* NOP_FUNCTION */
193
194 #if !defined(_NTSYSTEM_)
195 #define NTSYSAPI DECLSPEC_IMPORT
196 #define NTSYSCALLAPI DECLSPEC_IMPORT
197 #else
198 #define NTSYSAPI
199 #if defined(_NTDLLBUILD_)
200 #define NTSYSCALLAPI
201 #else
202 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
203 #endif
204 #endif /* _NTSYSTEM_ */
205
206 /* Inlines */
207 #ifndef FORCEINLINE
208 #if defined(_MSC_VER)
209 #define FORCEINLINE __forceinline
210 #elif ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
211 #define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
212 #else
213 #define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
214 #endif
215 #endif /* FORCEINLINE */
216
217 #ifndef DECLSPEC_NOINLINE
218 #if (_MSC_VER >= 1300)
219 #define DECLSPEC_NOINLINE __declspec(noinline)
220 #elif defined(__GNUC__)
221 #define DECLSPEC_NOINLINE __attribute__((noinline))
222 #else
223 #define DECLSPEC_NOINLINE
224 #endif
225 #endif /* DECLSPEC_NOINLINE */
226
227 #if !defined(_M_CEE_PURE)
228 #define NTAPI_INLINE NTAPI
229 #else
230 #define NTAPI_INLINE
231 #endif /* _M_CEE_PURE */
232
233 /* Use to specify structure alignment. Note: VS and GCC behave slightly
234 different. Therefore it is important to stick to the following rules:
235 - If you want a struct to be aligned, put DECLSPEC_ALIGN after "struct":
236 "typedef struct DECLSPEC_ALIGN(16) _FOO { ... } FOO, *PFOO;"
237 _alignof(PFOO) is sizeof(void*) here as usual.
238 - If you don't want the struct, but only the typedef to be aligned,
239 use an extra typedef.
240 struct _BAR { ... };
241 typedef DECLSPEC_ALIGN(16) struct _BAR BAR, *ALIGNEDPBAR;
242 _alignof(ALIGNEDPBAR) is 16 now! */
243 #ifndef DECLSPEC_ALIGN
244 #if defined(_MSC_VER) && !defined(MIDL_PASS)
245 #define DECLSPEC_ALIGN(x) __declspec(align(x))
246 #elif defined(__GNUC__)
247 #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
248 #else
249 #define DECLSPEC_ALIGN(x)
250 #endif
251 #endif /* DECLSPEC_ALIGN */
252
253 #ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
254 #if defined(_AMD64_) || defined(_X86_)
255 #define SYSTEM_CACHE_ALIGNMENT_SIZE 64
256 #else
257 #define SYSTEM_CACHE_ALIGNMENT_SIZE 128
258 #endif
259 #endif /* SYSTEM_CACHE_ALIGNMENT_SIZE */
260
261 #ifndef DECLSPEC_CACHEALIGN
262 #define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
263 #endif /* DECLSPEC_CACHEALIGN */
264
265 #ifndef DECLSPEC_UUID
266 #if defined(_MSC_VER) && defined(__cplusplus)
267 #define DECLSPEC_UUID(x) __declspec(uuid(x))
268 #else
269 #define DECLSPEC_UUID(x)
270 #endif
271 #endif /* DECLSPEC_UUID */
272
273 #ifndef DECLSPEC_NOVTABLE
274 #if defined(_MSC_VER) && defined(__cplusplus)
275 #define DECLSPEC_NOVTABLE __declspec(novtable)
276 #else
277 #define DECLSPEC_NOVTABLE
278 #endif
279 #endif /* DECLSPEC_NOVTABLE */
280
281 #ifndef DECLSPEC_SELECTANY
282 #if defined(_MSC_VER) || defined(__GNUC__)
283 #define DECLSPEC_SELECTANY __declspec(selectany)
284 #else
285 #define DECLSPEC_SELECTANY
286 #endif
287 #endif /* DECLSPEC_SELECTANY */
288
289 #ifndef DECLSPEC_DEPRECATED
290 #if (defined(_MSC_VER) || defined(__GNUC__)) && !defined(MIDL_PASS)
291 #define DECLSPEC_DEPRECATED __declspec(deprecated)
292 #define DEPRECATE_SUPPORTED
293 #else
294 #define DECLSPEC_DEPRECATED
295 #undef DEPRECATE_SUPPORTED
296 #endif
297 #endif /* DECLSPEC_DEPRECATED */
298
299 #ifdef DEPRECATE_DDK_FUNCTIONS
300 #ifdef _NTDDK_
301 #define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
302 #ifdef DEPRECATE_SUPPORTED
303 #define PRAGMA_DEPRECATED_DDK 1
304 #endif
305 #else
306 #define DECLSPEC_DEPRECATED_DDK
307 #define PRAGMA_DEPRECATED_DDK 1
308 #endif
309 #else
310 #define DECLSPEC_DEPRECATED_DDK
311 #define PRAGMA_DEPRECATED_DDK 0
312 #endif /* DEPRECATE_DDK_FUNCTIONS */
313
314 /* Use to silence unused variable warnings when it is intentional */
315 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
316 #define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
317 #define DBG_UNREFERENCED_PARAMETER(P) {(P)=(P);}
318 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
319
320 /* Void Pointers */
321 typedef void *PVOID;
322 typedef void * POINTER_64 PVOID64;
323
324 /* Handle Type */
325 typedef void *HANDLE, **PHANDLE;;
326 #ifdef STRICT
327 #define DECLARE_HANDLE(n) typedef struct n##__{int unused;} *n
328 #else
329 #define DECLARE_HANDLE(n) typedef HANDLE n
330 #endif
331
332 /* Upper-Case Versions of Some Standard C Types */
333 #ifndef VOID
334 #define VOID void
335 typedef char CHAR;
336 typedef short SHORT;
337
338 #if defined(__ROS_LONG64__) && !defined(_M_AMD64)
339 typedef int LONG;
340 #else
341 typedef long LONG;
342 #endif
343
344 #if !defined(MIDL_PASS)
345 typedef int INT;
346 #endif /* !MIDL_PASS */
347 #endif /* VOID */
348
349 $if(_NTDEF_)
350 /* Unsigned Types */
351 typedef unsigned char UCHAR, *PUCHAR;
352 typedef unsigned short USHORT, *PUSHORT;
353 typedef unsigned long ULONG, *PULONG;
354
355 typedef CONST UCHAR *PCUCHAR;
356 typedef CONST USHORT *PCUSHORT;
357 typedef CONST ULONG *PCULONG;
358
359 typedef double DOUBLE;
360 $endif(_NTDEF_)
361
362 /* Signed Types */
363 typedef SHORT *PSHORT;
364 typedef LONG *PLONG;
365
366 /* Flag types */
367 typedef unsigned char FCHAR;
368 typedef unsigned short FSHORT;
369 typedef unsigned long FLONG;
370
371 typedef unsigned char BOOLEAN, *PBOOLEAN;
372 $if(_NTDEF_)
373 typedef ULONG LOGICAL, *PLOGICAL;
374 typedef _Return_type_success_(return >= 0) LONG NTSTATUS, *PNTSTATUS;;
375 typedef signed char SCHAR, *PSCHAR;
376 $endif(_NTDEF_)
377
378 #ifndef _HRESULT_DEFINED
379 #define _HRESULT_DEFINED
380 typedef _Return_type_success_(return >= 0) LONG HRESULT;
381 #endif /* _HRESULT_DEFINED */
382
383 /* 64-bit types */
384 #define _ULONGLONG_
385 __GNU_EXTENSION typedef __int64 LONGLONG, *PLONGLONG;
386 __GNU_EXTENSION typedef unsigned __int64 ULONGLONG, *PULONGLONG;
387 #define _DWORDLONG_
388 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
389
390 /* Update Sequence Number */
391 typedef LONGLONG USN;
392
393 /* ANSI (Multi-byte Character) types */
394 typedef CHAR *PCHAR, *LPCH, *PCH, *PNZCH;
395 typedef CONST CHAR *LPCCH, *PCCH, *PCNZCH;
396 typedef _Null_terminated_ CHAR *NPSTR, *LPSTR, *PSTR;
397 typedef _Null_terminated_ PSTR *PZPSTR;
398 typedef _Null_terminated_ CONST PSTR *PCZPSTR;
399 typedef _Null_terminated_ CONST CHAR *LPCSTR, *PCSTR;
400 typedef _Null_terminated_ PCSTR *PZPCSTR;
401
402 typedef _NullNull_terminated_ CHAR *PZZSTR;
403 typedef _NullNull_terminated_ CONST CHAR *PCZZSTR;
404
405 $if(_NTDEF_)
406 /* Pointer to an Asciiz string */
407 typedef _Null_terminated_ CHAR *PSZ;
408 typedef _Null_terminated_ CONST char *PCSZ;
409 $endif(_NTDEF_)
410
411 /* UNICODE (Wide Character) types */
412 typedef wchar_t WCHAR;
413 typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
414 typedef CONST WCHAR *LPCWCH, *PCWCH;
415 typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR;
416 typedef _Null_terminated_ PWSTR *PZPWSTR;
417 typedef _Null_terminated_ CONST PWSTR *PCZPWSTR;
418 typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
419 typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR;
420 typedef _Null_terminated_ PCWSTR *PZPCWSTR;
421 typedef _Null_terminated_ CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
422
423 typedef _NullNull_terminated_ WCHAR *PZZWSTR;
424 typedef _NullNull_terminated_ CONST WCHAR *PCZZWSTR;
425 typedef _NullNull_terminated_ WCHAR UNALIGNED *PUZZWSTR;
426 typedef _NullNull_terminated_ CONST WCHAR UNALIGNED *PCUZZWSTR;
427
428 typedef WCHAR *PNZWCH;
429 typedef CONST WCHAR *PCNZWCH;
430 typedef WCHAR UNALIGNED *PUNZWCH;
431 typedef CONST WCHAR UNALIGNED *PCUNZWCH;
432
433 #if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
434 typedef CONST WCHAR *LPCWCHAR, *PCWCHAR;
435 typedef CONST WCHAR UNALIGNED *LPCUWCHAR, *PCUWCHAR;
436 typedef unsigned long UCSCHAR, *PUCSCHAR, *PUCSSTR;
437 typedef const UCSCHAR *PCUCSCHAR, *PCUCSSTR;
438 typedef UCSCHAR UNALIGNED *PUUCSCHAR, *PUUCSSTR;
439 typedef const UCSCHAR UNALIGNED *PCUUCSCHAR, *PCUUCSSTR;
440 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
441 #define MIN_UCSCHAR (0)
442 #define MAX_UCSCHAR (0x0010FFFF)
443 #endif /* _WIN32_WINNT >= 0x0600 */
444
445 #ifdef UNICODE
446
447 #ifndef _TCHAR_DEFINED
448 typedef WCHAR TCHAR, *PTCHAR;
449 $if(_NTDEF_)
450 typedef WCHAR TUCHAR, *PTUCHAR;
451 $endif(_NTDEF_)
452 $if(_WINNT_)
453 typedef WCHAR TBYTE, *PTBYTE;
454 $endif(_WINNT_)
455 #define _TCHAR_DEFINED
456 #endif /* !_TCHAR_DEFINED */
457
458 typedef LPWCH LPTCH, PTCH;
459 typedef LPCWCH LPCTCH, PCTCH;
460 typedef LPWSTR PTSTR, LPTSTR;
461 typedef LPCWSTR PCTSTR, LPCTSTR;
462 typedef LPUWSTR PUTSTR, LPUTSTR;
463 typedef LPCUWSTR PCUTSTR, LPCUTSTR;
464 typedef LPWSTR LP;
465 typedef PZZWSTR PZZTSTR;
466 typedef PCZZWSTR PCZZTSTR;
467 typedef PUZZWSTR PUZZTSTR;
468 typedef PCUZZWSTR PCUZZTSTR;
469 typedef PZPWSTR PZPTSTR;
470 typedef PNZWCH PNZTCH;
471 typedef PCNZWCH PCNZTCH;
472 typedef PUNZWCH PUNZTCH;
473 typedef PCUNZWCH PCUNZTCH;
474 #define __TEXT(quote) L##quote
475
476 #else /* UNICODE */
477
478 #ifndef _TCHAR_DEFINED
479 typedef char TCHAR, *PTCHAR;
480 $if(_NTDEF_)
481 typedef unsigned char TUCHAR, *PTUCHAR;
482 $endif(_NTDEF_)
483 $if(_WINNT_)
484 typedef unsigned char TBYTE, *PTBYTE;
485 $endif(_WINNT_)
486 #define _TCHAR_DEFINED
487 #endif /* !_TCHAR_DEFINED */
488 typedef LPCH LPTCH, PTCH;
489 typedef LPCCH LPCTCH, PCTCH;
490 typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
491 typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
492 typedef PZZSTR PZZTSTR, PUZZTSTR;
493 typedef PCZZSTR PCZZTSTR, PCUZZTSTR;
494 typedef PZPSTR PZPTSTR;
495 typedef PNZCH PNZTCH, PUNZTCH;
496 typedef PCNZCH PCNZTCH, PCUNZTCH;
497 #define __TEXT(quote) quote
498
499 #endif /* UNICODE */
500
501 #define TEXT(quote) __TEXT(quote)
502
503 /* Cardinal Data Types */
504 typedef char CCHAR;
505 $if(_NTDEF_)
506 typedef CCHAR *PCCHAR;
507 typedef short CSHORT, *PCSHORT;
508 typedef ULONG CLONG, *PCLONG;
509 $endif(_NTDEF_)
510
511 /* NLS basics (Locale and Language Ids) */
512 typedef $ULONG LCID, *PLCID;
513 typedef $USHORT LANGID;
514
515 #ifndef __COMPARTMENT_ID_DEFINED__
516 #define __COMPARTMENT_ID_DEFINED__
517 typedef enum
518 {
519 UNSPECIFIED_COMPARTMENT_ID = 0,
520 DEFAULT_COMPARTMENT_ID
521 } COMPARTMENT_ID, *PCOMPARTMENT_ID;
522 #endif /* __COMPARTMENT_ID_DEFINED__ */
523
524 #ifndef __OBJECTID_DEFINED
525 #define __OBJECTID_DEFINED
526 typedef struct _OBJECTID {
527 GUID Lineage;
528 $ULONG Uniquifier;
529 } OBJECTID;
530 #endif /* __OBJECTID_DEFINED */
531
532 #ifdef _MSC_VER
533 #pragma warning(push)
534 #pragma warning(disable:4201) // nameless struct / union
535 #endif
536
537 typedef struct
538 #if defined(_M_IA64)
539 DECLSPEC_ALIGN(16)
540 #endif
541 _FLOAT128 {
542 __int64 LowPart;
543 __int64 HighPart;
544 } FLOAT128;
545 typedef FLOAT128 *PFLOAT128;
546
547 /* Large Integer Unions */
548 #if defined(MIDL_PASS)
549 typedef struct _LARGE_INTEGER {
550 #else
551 typedef union _LARGE_INTEGER {
552 _ANONYMOUS_STRUCT struct
553 {
554 $ULONG LowPart;
555 LONG HighPart;
556 } DUMMYSTRUCTNAME;
557 struct
558 {
559 $ULONG LowPart;
560 LONG HighPart;
561 } u;
562 #endif /* MIDL_PASS */
563 LONGLONG QuadPart;
564 } LARGE_INTEGER, *PLARGE_INTEGER;
565
566 #if defined(MIDL_PASS)
567 typedef struct _ULARGE_INTEGER {
568 #else
569 typedef union _ULARGE_INTEGER {
570 _ANONYMOUS_STRUCT struct
571 {
572 $ULONG LowPart;
573 $ULONG HighPart;
574 } DUMMYSTRUCTNAME;
575 struct
576 {
577 $ULONG LowPart;
578 $ULONG HighPart;
579 } u;
580 #endif /* MIDL_PASS */
581 ULONGLONG QuadPart;
582 } ULARGE_INTEGER, *PULARGE_INTEGER;
583
584 #ifdef _MSC_VER
585 #pragma warning(pop) /* disable:4201 */
586 #endif
587
588 /* Locally Unique Identifier */
589 typedef struct _LUID
590 {
591 $ULONG LowPart;
592 LONG HighPart;
593 } LUID, *PLUID;
594
595 #define APPLICATION_ERROR_MASK 0x20000000
596 #define ERROR_SEVERITY_SUCCESS 0x00000000
597 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
598 #define ERROR_SEVERITY_WARNING 0x80000000
599 #define ERROR_SEVERITY_ERROR 0xC0000000
600
601 $if(_NTDEF_)
602 /* Native API Return Value Macros */
603 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
604 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
605 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
606 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
607 $endif(_NTDEF_)
608
609 #define ANSI_NULL ((CHAR)0)
610 #define UNICODE_NULL ((WCHAR)0)
611 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
612 #define UNICODE_STRING_MAX_CHARS (32767)
613
614 /* Doubly Linked Lists */
615 typedef struct _LIST_ENTRY {
616 struct _LIST_ENTRY *Flink;
617 struct _LIST_ENTRY *Blink;
618 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
619
620 typedef struct LIST_ENTRY32 {
621 $ULONG Flink;
622 $ULONG Blink;
623 } LIST_ENTRY32, *PLIST_ENTRY32;
624
625 typedef struct LIST_ENTRY64 {
626 ULONGLONG Flink;
627 ULONGLONG Blink;
628 } LIST_ENTRY64, *PLIST_ENTRY64;
629
630 /* Singly Linked Lists */
631 typedef struct _SINGLE_LIST_ENTRY {
632 struct _SINGLE_LIST_ENTRY *Next;
633 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
634
635 $if(_NTDEF_)
636 typedef struct _SINGLE_LIST_ENTRY32 {
637 ULONG Next;
638 } SINGLE_LIST_ENTRY32, *PSINGLE_LIST_ENTRY32;
639 $endif(_NTDEF_)
640
641 typedef struct _PROCESSOR_NUMBER {
642 $USHORT Group;
643 $UCHAR Number;
644 $UCHAR Reserved;
645 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
646
647 #define ALL_PROCESSOR_GROUPS 0xffff
648
649 typedef
650 _IRQL_requires_same_
651 _Function_class_(EXCEPTION_ROUTINE)
652 EXCEPTION_DISPOSITION
653 NTAPI
654 EXCEPTION_ROUTINE(
655 _Inout_ struct _EXCEPTION_RECORD *ExceptionRecord,
656 _In_ PVOID EstablisherFrame,
657 _Inout_ struct _CONTEXT *ContextRecord,
658 _In_ PVOID DispatcherContext);
659
660 typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
661
662 typedef struct _GROUP_AFFINITY {
663 KAFFINITY Mask;
664 $USHORT Group;
665 $USHORT Reserved[3];
666 } GROUP_AFFINITY, *PGROUP_AFFINITY;
667
668 /* Helper Macros */
669
670 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
671 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
672 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
673 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
674
675 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
676 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
677
678 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
679 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
680
681 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
682
683 #ifdef __GNUC__
684 #define RTL_NUMBER_OF_V2(A) \
685 (({ int _check_array_type[__builtin_types_compatible_p(typeof(A), typeof(&A[0])) ? -1 : 1]; (void)_check_array_type; }), \
686 RTL_NUMBER_OF_V1(A))
687 #else
688 /// \todo implement security checks for cplusplus / MSVC
689 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
690 #endif
691
692 #ifdef ENABLE_RTL_NUMBER_OF_V2
693 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
694 #else
695 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
696 #endif
697
698 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
699 #define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
700
701 #define RTL_NUMBER_OF_FIELD(type, field) \
702 (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))
703
704 #define RTL_PADDING_BETWEEN_FIELDS(type, field1, field2) \
705 ((FIELD_OFFSET(type, field2) > FIELD_OFFSET(type, field1)) \
706 ? (FIELD_OFFSET(type, field2) - FIELD_OFFSET(type, field1) - RTL_FIELD_SIZE(type, field1)) \
707 : (FIELD_OFFSET(type, field1) - FIELD_OFFSET(type, field2) - RTL_FIELD_SIZE(type, field2)))
708
709 #if defined(__cplusplus)
710 #define RTL_CONST_CAST(type) const_cast<type>
711 #else
712 #define RTL_CONST_CAST(type) (type)
713 #endif
714
715 /* Type Limits */
716 #define MINCHAR 0x80
717 #define MAXCHAR 0x7f
718 #define MINSHORT 0x8000
719 #define MAXSHORT 0x7fff
720 #define MINLONG 0x80000000
721 #define MAXLONG 0x7fffffff
722 $if(_NTDEF_)
723 #define MAXUCHAR 0xff
724 #define MAXUSHORT 0xffff
725 #define MAXULONG 0xffffffff
726 $endif(_NTDEF_)
727 $if(_WINNT_)
728 #define MAXBYTE 0xff
729 #define MAXWORD 0xffff
730 #define MAXDWORD 0xffffffff
731 $endif(_WINNT_)
732 #define MAXLONGLONG (0x7fffffffffffffffLL)
733
734 /* Multiplication and Shift Operations. Note: we don't use inline
735 asm functions, the compiler can optimize this better. */
736 #define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b)))
737 #define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b))
738
739 #if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE)
740 /* Use native math */
741 #define Int64ShllMod32(a,b) ((unsigned __int64)(a)<<(b))
742 #define Int64ShraMod32(a,b) (((__int64)(a))>>(b))
743 #define Int64ShrlMod32(a,b) (((unsigned __int64)(a))>>(b))
744 #else
745 /* Use intrinsics */
746 #define Int64ShllMod32(a,b) __ll_lshift(a,b)
747 #define Int64ShraMod32(a,b) __ll_rshift(a,b)
748 #define Int64ShrlMod32(a,b) __ull_rshift(a,b)
749 #endif
750
751 #define RotateLeft32 _rotl
752 #define RotateLeft64 _rotl64
753 #define RotateRight32 _rotr
754 #define RotateRight64 _rotr64
755
756 #if defined(_M_AMD64)
757 #define RotateLeft8 _rotl8
758 #define RotateLeft16 _rotl16
759 #define RotateRight8 _rotr8
760 #define RotateRight16 _rotr16
761 #endif /* _M_AMD64 */
762
763 /* C_ASSERT Definition */
764 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
765
766 /* Eliminate Microsoft C/C++ compiler warning 4715 */
767 #if defined(_MSC_VER)
768 #define DEFAULT_UNREACHABLE default: __assume(0)
769 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
770 #define DEFAULT_UNREACHABLE default: __builtin_unreachable()
771 #else
772 #define DEFAULT_UNREACHABLE default: break
773 #endif
774
775 #define VER_WORKSTATION_NT 0x40000000
776 #define VER_SERVER_NT 0x80000000
777 #define VER_SUITE_SMALLBUSINESS 0x00000001
778 #define VER_SUITE_ENTERPRISE 0x00000002
779 #define VER_SUITE_BACKOFFICE 0x00000004
780 #define VER_SUITE_COMMUNICATIONS 0x00000008
781 #define VER_SUITE_TERMINAL 0x00000010
782 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
783 #define VER_SUITE_EMBEDDEDNT 0x00000040
784 #define VER_SUITE_DATACENTER 0x00000080
785 #define VER_SUITE_SINGLEUSERTS 0x00000100
786 #define VER_SUITE_PERSONAL 0x00000200
787 #define VER_SUITE_BLADE 0x00000400
788 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
789 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
790 #define VER_SUITE_STORAGE_SERVER 0x00002000
791 #define VER_SUITE_COMPUTE_SERVER 0x00004000
792 #define VER_SUITE_WH_SERVER 0x00008000
793
794 /* Product types */
795 #define PRODUCT_UNDEFINED 0x00000000
796 #define PRODUCT_ULTIMATE 0x00000001
797 #define PRODUCT_HOME_BASIC 0x00000002
798 #define PRODUCT_HOME_PREMIUM 0x00000003
799 #define PRODUCT_ENTERPRISE 0x00000004
800 #define PRODUCT_HOME_BASIC_N 0x00000005
801 #define PRODUCT_BUSINESS 0x00000006
802 #define PRODUCT_STANDARD_SERVER 0x00000007
803 #define PRODUCT_DATACENTER_SERVER 0x00000008
804 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
805 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
806 #define PRODUCT_STARTER 0x0000000B
807 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
808 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
809 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
810 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
811 #define PRODUCT_BUSINESS_N 0x00000010
812 #define PRODUCT_WEB_SERVER 0x00000011
813 #define PRODUCT_CLUSTER_SERVER 0x00000012
814 #define PRODUCT_HOME_SERVER 0x00000013
815 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
816 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
817 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
818 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
819 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
820 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
821 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
822 #define PRODUCT_ENTERPRISE_N 0x0000001B
823 #define PRODUCT_ULTIMATE_N 0x0000001C
824 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
825 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
826 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
827 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
828 #define PRODUCT_SERVER_FOUNDATION 0x00000021
829 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
830 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
831 #define PRODUCT_STANDARD_SERVER_V 0x00000024
832 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
833 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
834 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
835 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
836 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
837 #define PRODUCT_HYPERV 0x0000002A
838 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
839 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
840 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
841 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
842 #define PRODUCT_STARTER_N 0x0000002F
843 #define PRODUCT_PROFESSIONAL 0x00000030
844 #define PRODUCT_PROFESSIONAL_N 0x00000031
845 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
846 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
847 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
848 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
849 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
850 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
851 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
852 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
853 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
854 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
855 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
856 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
857 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
858 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
859 #define PRODUCT_EMBEDDED 0x00000041
860 #define PRODUCT_STARTER_E 0x00000042
861 #define PRODUCT_HOME_BASIC_E 0x00000043
862 #define PRODUCT_HOME_PREMIUM_E 0x00000044
863 #define PRODUCT_PROFESSIONAL_E 0x00000045
864 #define PRODUCT_ENTERPRISE_E 0x00000046
865 #define PRODUCT_ULTIMATE_E 0x00000047
866 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
867 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
868 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
869 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
870 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
871 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
872 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
873 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
874 #define PRODUCT_THINPC 0x00000057
875 #define PRODUCT_EMBEDDED_A 0x00000058
876 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
877 #define PRODUCT_EMBEDDED_E 0x0000005A
878 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
879 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
880 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
881 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
882 #define PRODUCT_CORE_ARM 0x00000061
883 #define PRODUCT_CORE_N 0x00000062
884 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
885 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
886 #define PRODUCT_CORE 0x00000065
887 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
888 #define PRODUCT_UNLICENSED 0xABCDABCD
889
890 /* LangID and NLS */
891 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
892 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
893 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
894 #define MAKELCID(lgid, srtid) (($ULONG)(((($ULONG)((USHORT)(srtid))) << 16) | \
895 (($ULONG)((USHORT)(lgid)))))
896 #define MAKESORTLCID(lgid, srtid, ver) \
897 (($ULONG)((MAKELCID(lgid, srtid)) | \
898 ((($ULONG)((USHORT)(ver))) << 20)))
899 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
900 #define SORTIDFROMLCID(lcid) ((USHORT)(((($ULONG)(lcid)) >> 16) & 0xf))
901 #define SORTVERSIONFROMLCID(lcid) ((USHORT)(((($ULONG)(lcid)) >> 20) & 0xf))
902
903 #define NLS_VALID_LOCALE_MASK 0x000fffff
904 #define LOCALE_NAME_MAX_LENGTH 85
905
906 /* Primary language IDs. */
907 #define LANG_NEUTRAL 0x00
908 #define LANG_INVARIANT 0x7f
909 #define LANG_AFRIKAANS 0x36
910 #define LANG_ALBANIAN 0x1c
911 #define LANG_ALSATIAN 0x84
912 #define LANG_AMHARIC 0x5e
913 #define LANG_ARABIC 0x01
914 #define LANG_ARMENIAN 0x2b
915 #define LANG_ASSAMESE 0x4d
916 #define LANG_AZERI 0x2c
917 #define LANG_AZERBAIJANI 0x2c
918 #define LANG_BANGLA 0x45
919 #define LANG_BASHKIR 0x6d
920 #define LANG_BASQUE 0x2d
921 #define LANG_BELARUSIAN 0x23
922 #define LANG_BENGALI 0x45
923 #define LANG_BOSNIAN 0x1a
924 #define LANG_BOSNIAN_NEUTRAL 0x781a
925 #define LANG_BRETON 0x7e
926 #define LANG_BULGARIAN 0x02
927 #define LANG_CATALAN 0x03
928 #define LANG_CENTRAL_KURDISH 0x92
929 #define LANG_CHEROKEE 0x5c
930 #define LANG_CHINESE 0x04
931 #define LANG_CHINESE_SIMPLIFIED 0x04
932 #define LANG_CHINESE_TRADITIONAL 0x7c04
933 #define LANG_CORSICAN 0x83
934 #define LANG_CROATIAN 0x1a
935 #define LANG_CZECH 0x05
936 #define LANG_DANISH 0x06
937 #define LANG_DARI 0x8c
938 #define LANG_DIVEHI 0x65
939 #define LANG_DUTCH 0x13
940 #define LANG_ENGLISH 0x09
941 #define LANG_ESTONIAN 0x25
942 #define LANG_FAEROESE 0x38
943 #define LANG_FARSI 0x29
944 #define LANG_FILIPINO 0x64
945 #define LANG_FINNISH 0x0b
946 #define LANG_FRENCH 0x0c
947 #define LANG_FRISIAN 0x62
948 #define LANG_FULAH 0x67
949 #define LANG_GALICIAN 0x56
950 #define LANG_GEORGIAN 0x37
951 #define LANG_GERMAN 0x07
952 #define LANG_GREEK 0x08
953 #define LANG_GREENLANDIC 0x6f
954 #define LANG_GUJARATI 0x47
955 #define LANG_HAUSA 0x68
956 #define LANG_HAWAIIAN 0x75
957 #define LANG_HEBREW 0x0d
958 #define LANG_HINDI 0x39
959 #define LANG_HUNGARIAN 0x0e
960 #define LANG_ICELANDIC 0x0f
961 #define LANG_IGBO 0x70
962 #define LANG_INDONESIAN 0x21
963 #define LANG_INUKTITUT 0x5d
964 #define LANG_IRISH 0x3c
965 #define LANG_ITALIAN 0x10
966 #define LANG_JAPANESE 0x11
967 #define LANG_KANNADA 0x4b
968 #define LANG_KASHMIRI 0x60
969 #define LANG_KAZAK 0x3f
970 #define LANG_KHMER 0x53
971 #define LANG_KICHE 0x86
972 #define LANG_KINYARWANDA 0x87
973 #define LANG_KONKANI 0x57
974 #define LANG_KOREAN 0x12
975 #define LANG_KYRGYZ 0x40
976 #define LANG_LAO 0x54
977 #define LANG_LATVIAN 0x26
978 #define LANG_LITHUANIAN 0x27
979 #define LANG_LOWER_SORBIAN 0x2e
980 #define LANG_LUXEMBOURGISH 0x6e
981 #define LANG_MACEDONIAN 0x2f
982 #define LANG_MALAY 0x3e
983 #define LANG_MALAYALAM 0x4c
984 #define LANG_MALTESE 0x3a
985 #define LANG_MANIPURI 0x58
986 #define LANG_MAORI 0x81
987 #define LANG_MAPUDUNGUN 0x7a
988 #define LANG_MARATHI 0x4e
989 #define LANG_MOHAWK 0x7c
990 #define LANG_MONGOLIAN 0x50
991 #define LANG_NEPALI 0x61
992 #define LANG_NORWEGIAN 0x14
993 #define LANG_OCCITAN 0x82
994 #define LANG_ODIA 0x48
995 #define LANG_ORIYA 0x48
996 #define LANG_PASHTO 0x63
997 #define LANG_PERSIAN 0x29
998 #define LANG_POLISH 0x15
999 #define LANG_PORTUGUESE 0x16
1000 #define LANG_PULAR 0x67
1001 #define LANG_PUNJABI 0x46
1002 #define LANG_QUECHUA 0x6b
1003 #define LANG_ROMANIAN 0x18
1004 #define LANG_ROMANSH 0x17
1005 #define LANG_RUSSIAN 0x19
1006 #define LANG_SAKHA 0x85
1007 #define LANG_SAMI 0x3b
1008 #define LANG_SANSKRIT 0x4f
1009 #define LANG_SCOTTISH_GAELIC 0x91
1010 #define LANG_SERBIAN 0x1a
1011 #define LANG_SERBIAN_NEUTRAL 0x7c1a
1012 #define LANG_SINDHI 0x59
1013 #define LANG_SINHALESE 0x5b
1014 #define LANG_SLOVAK 0x1b
1015 #define LANG_SLOVENIAN 0x24
1016 #define LANG_SOTHO 0x6c
1017 #define LANG_SPANISH 0x0a
1018 #define LANG_SWAHILI 0x41
1019 #define LANG_SWEDISH 0x1d
1020 #define LANG_SYRIAC 0x5a
1021 #define LANG_TAJIK 0x28
1022 #define LANG_TAMAZIGHT 0x5f
1023 #define LANG_TAMIL 0x49
1024 #define LANG_TATAR 0x44
1025 #define LANG_TELUGU 0x4a
1026 #define LANG_THAI 0x1e
1027 #define LANG_TIBETAN 0x51
1028 #define LANG_TIGRIGNA 0x73
1029 #define LANG_TIGRINYA 0x73
1030 #define LANG_TSWANA 0x32
1031 #define LANG_TURKISH 0x1f
1032 #define LANG_TURKMEN 0x42
1033 #define LANG_UIGHUR 0x80
1034 #define LANG_UKRAINIAN 0x22
1035 #define LANG_UPPER_SORBIAN 0x2e
1036 #define LANG_URDU 0x20
1037 #define LANG_UZBEK 0x43
1038 #define LANG_VALENCIAN 0x03
1039 #define LANG_VIETNAMESE 0x2a
1040 #define LANG_WELSH 0x52
1041 #define LANG_WOLOF 0x88
1042 #define LANG_XHOSA 0x34
1043 #define LANG_YAKUT 0x85
1044 #define LANG_YI 0x78
1045 #define LANG_YORUBA 0x6a
1046 #define LANG_ZULU 0x35
1047
1048 #define SUBLANG_NEUTRAL 0x00
1049 #define SUBLANG_DEFAULT 0x01
1050 #define SUBLANG_SYS_DEFAULT 0x02
1051 #define SUBLANG_CUSTOM_DEFAULT 0x03
1052 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1053 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1054 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1055 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1056 #define SUBLANG_ALSATIAN_FRANCE 0x01
1057 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1058 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1059 #define SUBLANG_ARABIC_IRAQ 0x02
1060 #define SUBLANG_ARABIC_EGYPT 0x03
1061 #define SUBLANG_ARABIC_LIBYA 0x04
1062 #define SUBLANG_ARABIC_ALGERIA 0x05
1063 #define SUBLANG_ARABIC_MOROCCO 0x06
1064 #define SUBLANG_ARABIC_TUNISIA 0x07
1065 #define SUBLANG_ARABIC_OMAN 0x08
1066 #define SUBLANG_ARABIC_YEMEN 0x09
1067 #define SUBLANG_ARABIC_SYRIA 0x0a
1068 #define SUBLANG_ARABIC_JORDAN 0x0b
1069 #define SUBLANG_ARABIC_LEBANON 0x0c
1070 #define SUBLANG_ARABIC_KUWAIT 0x0d
1071 #define SUBLANG_ARABIC_UAE 0x0e
1072 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1073 #define SUBLANG_ARABIC_QATAR 0x10
1074 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1075 #define SUBLANG_ASSAMESE_INDIA 0x01
1076 #define SUBLANG_AZERI_LATIN 0x01
1077 #define SUBLANG_AZERI_CYRILLIC 0x02
1078 #define SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN 0x01
1079 #define SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC 0x02
1080 #define SUBLANG_BANGLA_INDIA 0x01
1081 #define SUBLANG_BANGLA_BANGLADESH 0x02
1082 #define SUBLANG_BASHKIR_RUSSIA 0x01
1083 #define SUBLANG_BASQUE_BASQUE 0x01
1084 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1085 #define SUBLANG_BENGALI_INDIA 0x01
1086 #define SUBLANG_BENGALI_BANGLADESH 0x02
1087 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1088 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1089 #define SUBLANG_BRETON_FRANCE 0x01
1090 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1091 #define SUBLANG_CATALAN_CATALAN 0x01
1092 #define SUBLANG_CENTRAL_KURDISH_IRAQ 0x01
1093 #define SUBLANG_CHEROKEE_CHEROKEE 0x01
1094 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1095 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1096 #define SUBLANG_CHINESE_HONGKONG 0x03
1097 #define SUBLANG_CHINESE_SINGAPORE 0x04
1098 #define SUBLANG_CHINESE_MACAU 0x05
1099 #define SUBLANG_CORSICAN_FRANCE 0x01
1100 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1101 #define SUBLANG_CROATIAN_CROATIA 0x01
1102 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1103 #define SUBLANG_DANISH_DENMARK 0x01
1104 #define SUBLANG_DARI_AFGHANISTAN 0x01
1105 #define SUBLANG_DIVEHI_MALDIVES 0x01
1106 #define SUBLANG_DUTCH 0x01
1107 #define SUBLANG_DUTCH_BELGIAN 0x02
1108 #define SUBLANG_ENGLISH_US 0x01
1109 #define SUBLANG_ENGLISH_UK 0x02
1110 #define SUBLANG_ENGLISH_AUS 0x03
1111 #define SUBLANG_ENGLISH_CAN 0x04
1112 #define SUBLANG_ENGLISH_NZ 0x05
1113 #define SUBLANG_ENGLISH_EIRE 0x06
1114 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1115 #define SUBLANG_ENGLISH_JAMAICA 0x08
1116 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1117 #define SUBLANG_ENGLISH_BELIZE 0x0a
1118 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1119 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1120 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1121 #define SUBLANG_ENGLISH_INDIA 0x10
1122 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1123 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1124 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1125 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1126 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
1127 #define SUBLANG_FINNISH_FINLAND 0x01
1128 #define SUBLANG_FRENCH 0x01
1129 #define SUBLANG_FRENCH_BELGIAN 0x02
1130 #define SUBLANG_FRENCH_CANADIAN 0x03
1131 #define SUBLANG_FRENCH_SWISS 0x04
1132 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1133 #define SUBLANG_FRENCH_MONACO 0x06
1134 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
1135 #define SUBLANG_FULAH_SENEGAL 0x02
1136 #define SUBLANG_GALICIAN_GALICIAN 0x01
1137 #define SUBLANG_GEORGIAN_GEORGIA 0x01
1138 #define SUBLANG_GERMAN 0x01
1139 #define SUBLANG_GERMAN_SWISS 0x02
1140 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1141 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1142 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1143 #define SUBLANG_GREEK_GREECE 0x01
1144 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
1145 #define SUBLANG_GUJARATI_INDIA 0x01
1146 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
1147 #define SUBLANG_HAWAIIAN_US 0x01
1148 #define SUBLANG_HEBREW_ISRAEL 0x01
1149 #define SUBLANG_HINDI_INDIA 0x01
1150 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
1151 #define SUBLANG_ICELANDIC_ICELAND 0x01
1152 #define SUBLANG_IGBO_NIGERIA 0x01
1153 #define SUBLANG_INDONESIAN_INDONESIA 0x01
1154 #define SUBLANG_INUKTITUT_CANADA 0x01
1155 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
1156 #define SUBLANG_IRISH_IRELAND 0x02
1157 #define SUBLANG_ITALIAN 0x01
1158 #define SUBLANG_ITALIAN_SWISS 0x02
1159 #define SUBLANG_JAPANESE_JAPAN 0x01
1160 #define SUBLANG_KANNADA_INDIA 0x01
1161 #define SUBLANG_KASHMIRI_SASIA 0x02
1162 #define SUBLANG_KASHMIRI_INDIA 0x02
1163 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
1164 #define SUBLANG_KHMER_CAMBODIA 0x01
1165 #define SUBLANG_KICHE_GUATEMALA 0x01
1166 #define SUBLANG_KINYARWANDA_RWANDA 0x01
1167 #define SUBLANG_KONKANI_INDIA 0x01
1168 #define SUBLANG_KOREAN 0x01
1169 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
1170 #define SUBLANG_LAO_LAO 0x01
1171 #define SUBLANG_LATVIAN_LATVIA 0x01
1172 #define SUBLANG_LITHUANIAN 0x01
1173 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
1174 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
1175 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
1176 #define SUBLANG_MALAY_MALAYSIA 0x01
1177 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1178 #define SUBLANG_MALAYALAM_INDIA 0x01
1179 #define SUBLANG_MALTESE_MALTA 0x01
1180 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1181 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1182 #define SUBLANG_MARATHI_INDIA 0x01
1183 #define SUBLANG_MOHAWK_MOHAWK 0x01
1184 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1185 #define SUBLANG_MONGOLIAN_PRC 0x02
1186 #define SUBLANG_NEPALI_INDIA 0x02
1187 #define SUBLANG_NEPALI_NEPAL 0x01
1188 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1189 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1190 #define SUBLANG_OCCITAN_FRANCE 0x01
1191 #define SUBLANG_ODIA_INDIA 0x01
1192 #define SUBLANG_ORIYA_INDIA 0x01
1193 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1194 #define SUBLANG_PERSIAN_IRAN 0x01
1195 #define SUBLANG_POLISH_POLAND 0x01
1196 #define SUBLANG_PORTUGUESE 0x02
1197 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1198 #define SUBLANG_PULAR_SENEGAL 0x02
1199 #define SUBLANG_PUNJABI_INDIA 0x01
1200 #define SUBLANG_PUNJABI_PAKISTAN 0x02
1201 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1202 #define SUBLANG_QUECHUA_ECUADOR 0x02
1203 #define SUBLANG_QUECHUA_PERU 0x03
1204 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1205 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1206 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1207 #define SUBLANG_SAKHA_RUSSIA 0x01
1208 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1209 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1210 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1211 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1212 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1213 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1214 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1215 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1216 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1217 #define SUBLANG_SANSKRIT_INDIA 0x01
1218 #define SUBLANG_SCOTTISH_GAELIC 0x01
1219 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1220 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1221 #define SUBLANG_SERBIAN_MONTENEGRO_LATIN 0x0b
1222 #define SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC 0x0c
1223 #define SUBLANG_SERBIAN_SERBIA_LATIN 0x09
1224 #define SUBLANG_SERBIAN_SERBIA_CYRILLIC 0x0a
1225 #define SUBLANG_SERBIAN_CROATIA 0x01
1226 #define SUBLANG_SERBIAN_LATIN 0x02
1227 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1228 #define SUBLANG_SINDHI_INDIA 0x01
1229 #define SUBLANG_SINDHI_PAKISTAN 0x02
1230 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1231 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1232 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1233 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1234 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1235 #define SUBLANG_SPANISH 0x01
1236 #define SUBLANG_SPANISH_MEXICAN 0x02
1237 #define SUBLANG_SPANISH_MODERN 0x03
1238 #define SUBLANG_SPANISH_GUATEMALA 0x04
1239 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1240 #define SUBLANG_SPANISH_PANAMA 0x06
1241 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1242 #define SUBLANG_SPANISH_VENEZUELA 0x08
1243 #define SUBLANG_SPANISH_COLOMBIA 0x09
1244 #define SUBLANG_SPANISH_PERU 0x0a
1245 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1246 #define SUBLANG_SPANISH_ECUADOR 0x0c
1247 #define SUBLANG_SPANISH_CHILE 0x0d
1248 #define SUBLANG_SPANISH_URUGUAY 0x0e
1249 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1250 #define SUBLANG_SPANISH_BOLIVIA 0x10
1251 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1252 #define SUBLANG_SPANISH_HONDURAS 0x12
1253 #define SUBLANG_SPANISH_NICARAGUA 0x13
1254 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1255 #define SUBLANG_SPANISH_US 0x15
1256 #define SUBLANG_SWAHILI_KENYA 0x01
1257 #define SUBLANG_SWEDISH 0x01
1258 #define SUBLANG_SWEDISH_FINLAND 0x02
1259 #define SUBLANG_SYRIAC_SYRIA 0x01
1260 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1261 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1262 #define SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH 0x04
1263 #define SUBLANG_TAMIL_INDIA 0x01
1264 #define SUBLANG_TAMIL_SRI_LANKA 0x02
1265 #define SUBLANG_TATAR_RUSSIA 0x01
1266 #define SUBLANG_TELUGU_INDIA 0x01
1267 #define SUBLANG_THAI_THAILAND 0x01
1268 #define SUBLANG_TIBETAN_PRC 0x01
1269 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1270 #define SUBLANG_TIGRINYA_ERITREA 0x02
1271 #define SUBLANG_TIGRINYA_ETHIOPIA 0x01
1272 #define SUBLANG_TSWANA_BOTSWANA 0x02
1273 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1274 #define SUBLANG_TURKISH_TURKEY 0x01
1275 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1276 #define SUBLANG_UIGHUR_PRC 0x01
1277 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1278 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1279 #define SUBLANG_URDU_PAKISTAN 0x01
1280 #define SUBLANG_URDU_INDIA 0x02
1281 #define SUBLANG_UZBEK_LATIN 0x01
1282 #define SUBLANG_UZBEK_CYRILLIC 0x02
1283 #define SUBLANG_VALENCIAN_VALENCIA 0x02
1284 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1285 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1286 #define SUBLANG_WOLOF_SENEGAL 0x01
1287 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1288 #define SUBLANG_YAKUT_RUSSIA 0x01
1289 #define SUBLANG_YI_PRC 0x01
1290 #define SUBLANG_YORUBA_NIGERIA 0x01
1291 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1292
1293 #define SORT_DEFAULT 0x0
1294 #define SORT_INVARIANT_MATH 0x1
1295 #define SORT_JAPANESE_XJIS 0x0
1296 #define SORT_JAPANESE_UNICODE 0x1
1297 #define SORT_JAPANESE_RADICALSTROKE 0x4
1298 #define SORT_CHINESE_BIG5 0x0
1299 #define SORT_CHINESE_PRCP 0x0
1300 #define SORT_CHINESE_UNICODE 0x1
1301 #define SORT_CHINESE_PRC 0x2
1302 #define SORT_CHINESE_BOPOMOFO 0x3
1303 #define SORT_CHINESE_RADICALSTROKE 0x4
1304 #define SORT_KOREAN_KSC 0x0
1305 #define SORT_KOREAN_UNICODE 0x1
1306 #define SORT_GERMAN_PHONE_BOOK 0x1
1307 #define SORT_HUNGARIAN_DEFAULT 0x0
1308 #define SORT_HUNGARIAN_TECHNICAL 0x1
1309 #define SORT_GEORGIAN_TRADITIONAL 0x0
1310 #define SORT_GEORGIAN_MODERN 0x1
1311
1312 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT)
1313 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
1314
1315 #define LOCALE_SYSTEM_DEFAULT MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)
1316 #define LOCALE_USER_DEFAULT MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)
1317 #define LOCALE_CUSTOM_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)
1318 #define LOCALE_CUSTOM_UNSPECIFIED MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)
1319 #define LOCALE_CUSTOM_UI_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)
1320 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT)
1321 #define LOCALE_INVARIANT MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)