[CMAKE]
[reactos.git] / include / psdk / ntdef.h
1 /*
2 * ntdef.h
3 *
4 * This file is part of the ReactOS PSDK package.
5 *
6 * Contributors:
7 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
8 *
9 * THIS SOFTWARE IS NOT COPYRIGHTED
10 *
11 * This source code is offered for use in the public domain. You may
12 * use, modify or distribute it freely.
13 *
14 * This code is distributed in the hope that it will be useful but
15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16 * DISCLAIMED. This includes but is not limited to warranties of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 */
20
21 #ifndef _NTDEF_
22 #define _NTDEF_
23
24 /* Dependencies */
25 #include <ctype.h>
26 #include <basetsd.h>
27 #include <excpt.h>
28 #include <sdkddkver.h>
29
30 // FIXME: Shouldn't be included!
31 #include <stdarg.h>
32 #include <string.h>
33
34 /* Helper macro to enable gcc's extension. */
35 #ifndef __GNU_EXTENSION
36 #ifdef __GNUC__
37 #define __GNU_EXTENSION __extension__
38 #else
39 #define __GNU_EXTENSION
40 #endif
41 #endif
42
43 /* Pseudo Modifiers for Input Parameters */
44
45 #ifndef IN
46 #define IN
47 #endif
48
49 #ifndef OUT
50 #define OUT
51 #endif
52
53 #ifndef OPTIONAL
54 #define OPTIONAL
55 #endif
56
57 #ifndef NOTHING
58 #define NOTHING
59 #endif
60
61 #ifndef CRITICAL
62 #define CRITICAL
63 #endif
64
65 #ifndef FAR
66 #define FAR
67 #endif
68
69
70 /* Defines the "size" of an any-size array */
71 #ifndef ANYSIZE_ARRAY
72 #define ANYSIZE_ARRAY 1
73 #endif
74
75 /* Constant modifier */
76 #ifndef CONST
77 #define CONST const
78 #endif
79
80 /* TRUE/FALSE */
81 #define FALSE 0
82 #define TRUE 1
83
84 /* NULL/NULL64 */
85 #ifndef NULL
86 #ifdef __cplusplus
87 #define NULL 0
88 #define NULL64 0
89 #else
90 #define NULL ((void *)0)
91 #define NULL64 ((void * POINTER_64)0)
92 #endif
93 #endif /* NULL */
94
95
96 //
97 // FIXME
98 // We should use the -fms-extensions compiler flag for gcc,
99 // and clean up the mess.
100 //
101 #ifndef __ANONYMOUS_DEFINED
102 #define __ANONYMOUS_DEFINED
103
104 #ifndef NONAMELESSUNION
105 #ifdef __GNUC__
106 #define _ANONYMOUS_UNION __GNU_EXTENSION
107 #define _ANONYMOUS_STRUCT __GNU_EXTENSION
108 #elif defined(__WATCOMC__) || defined(_MSC_VER)
109 #define _ANONYMOUS_UNION
110 #define _ANONYMOUS_STRUCT
111 #endif /* __GNUC__/__WATCOMC__ */
112 #endif /* NONAMELESSUNION */
113
114 #ifndef _ANONYMOUS_UNION
115 #define _ANONYMOUS_UNION
116 #define _UNION_NAME(x) x
117 #define DUMMYUNIONNAME u
118 #define DUMMYUNIONNAME2 u2
119 #define DUMMYUNIONNAME3 u3
120 #define DUMMYUNIONNAME4 u4
121 #define DUMMYUNIONNAME5 u5
122 #define DUMMYUNIONNAME6 u6
123 #define DUMMYUNIONNAME7 u7
124 #define DUMMYUNIONNAME8 u8
125 #else
126 #define _UNION_NAME(x)
127 #define DUMMYUNIONNAME
128 #define DUMMYUNIONNAME2
129 #define DUMMYUNIONNAME3
130 #define DUMMYUNIONNAME4
131 #define DUMMYUNIONNAME5
132 #define DUMMYUNIONNAME6
133 #define DUMMYUNIONNAME7
134 #define DUMMYUNIONNAME8
135 #endif
136
137 #ifndef _ANONYMOUS_STRUCT
138 #define _ANONYMOUS_STRUCT
139 #define _STRUCT_NAME(x) x
140 #define DUMMYSTRUCTNAME s
141 #define DUMMYSTRUCTNAME2 s2
142 #define DUMMYSTRUCTNAME3 s3
143 #define DUMMYSTRUCTNAME4 s4
144 #define DUMMYSTRUCTNAME5 s5
145 #else
146 #define _STRUCT_NAME(x)
147 #define DUMMYSTRUCTNAME
148 #define DUMMYSTRUCTNAME2
149 #define DUMMYSTRUCTNAME3
150 #define DUMMYSTRUCTNAME4
151 #define DUMMYSTRUCTNAME5
152 #endif
153
154 #endif /* __ANONYMOUS_DEFINED */
155
156 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
157 #define ALIGNMENT_MACHINE
158 #define UNALIGNED __unaligned
159 #if defined(_WIN64)
160 #define UNALIGNED64 __unaligned
161 #else
162 #define UNALIGNED64
163 #endif
164 #else
165 #undef ALIGNMENT_MACHINE
166 #define UNALIGNED
167 #define UNALIGNED64
168 #endif
169
170 #if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
171 #define RESTRICTED_POINTER __restrict
172 #else
173 #define RESTRICTED_POINTER
174 #endif
175
176
177 #define ARGUMENT_PRESENT(ArgumentPointer) \
178 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
179
180 /* Returns the base address of a structure from a structure member */
181 #ifndef CONTAINING_RECORD
182 #define CONTAINING_RECORD(address, type, field) \
183 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
184 #endif
185
186 /* Returns the byte offset of the specified structure's member */
187 #ifndef __GNUC__
188 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
189 #else
190 #define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field)
191 #endif
192
193 /* Returns the type's alignment */
194 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
195 #define TYPE_ALIGNMENT(t) __alignof(t)
196 #else
197 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
198 #endif
199
200 /* Calling Conventions */
201 #if defined(_M_IX86)
202 #define FASTCALL __fastcall
203 #else
204 #define FASTCALL
205 #endif
206
207 #define NTAPI __stdcall
208
209
210 /* Import and Export Specifiers */
211
212 /* Done the same way as in windef.h for now */
213 #define DECLSPEC_IMPORT __declspec(dllimport)
214 #define DECLSPEC_NORETURN __declspec(noreturn)
215
216 #ifndef DECLSPEC_ADDRSAFE
217 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
218 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
219 #else
220 #define DECLSPEC_ADDRSAFE
221 #endif
222 #endif /* DECLSPEC_ADDRSAFE */
223
224 #if !defined(_NTSYSTEM_)
225 #define NTSYSAPI DECLSPEC_IMPORT
226 #define NTSYSCALLAPI DECLSPEC_IMPORT
227 #else
228 #define NTSYSAPI
229 #if defined(_NTDLLBUILD_)
230 #define NTSYSCALLAPI
231 #else
232 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
233 #endif
234 #endif
235
236 /* Inlines */
237 #ifndef FORCEINLINE
238 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
239 #define FORCEINLINE __forceinline
240 #elif defined(_MSC_VER)
241 #define FORCEINLINE __inline
242 #else /* __GNUC__ */
243 #define FORCEINLINE extern __inline__ __attribute__((always_inline))
244 #endif
245 #endif /* FORCEINLINE */
246
247 #ifndef DECLSPEC_NOINLINE
248 #if (_MSC_VER >= 1300)
249 #define DECLSPEC_NOINLINE __declspec(noinline)
250 #elif defined(__GNUC__)
251 #define DECLSPEC_NOINLINE __attribute__((noinline))
252 #else
253 #define DECLSPEC_NOINLINE
254 #endif
255 #endif /* DECLSPEC_NOINLINE */
256
257 #if !defined(_M_CEE_PURE)
258 #define NTAPI_INLINE NTAPI
259 #else
260 #define NTAPI_INLINE
261 #endif
262
263 /* Use to specify structure alignment */
264 #ifndef DECLSPEC_ALIGN
265 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
266 #define DECLSPEC_ALIGN(x) __declspec(align(x))
267 #elif defined(__GNUC__)
268 #define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__ (x)))
269 #else
270 #define DECLSPEC_ALIGN(x)
271 #endif
272 #endif /* DECLSPEC_ALIGN */
273
274 /* Use to silence unused variable warnings when it is intentional */
275 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
276 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
277 #define DBG_UNREFERENCED_PARAMETER(P)
278 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
279
280 /* min/max helper macros */
281 #ifndef NOMINMAX
282
283 #ifndef min
284 #define min(a,b) (((a) < (b)) ? (a) : (b))
285 #endif
286
287 #ifndef max
288 #define max(a,b) (((a) > (b)) ? (a) : (b))
289 #endif
290
291 #endif /* NOMINMAX */
292
293 /* Tell windef.h that we have defined some basic types */
294 #define BASETYPES
295
296 /* Void Pointers */
297 typedef void *PVOID;
298 //typedef void * POINTER_64 PVOID64;
299 typedef PVOID PVOID64; // FIXME!
300
301 /* Handle Type */
302 #ifdef STRICT
303 typedef void *HANDLE;
304 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
305 #else
306 typedef PVOID HANDLE;
307 #define DECLARE_HANDLE(n) typedef HANDLE n
308 #endif
309 typedef HANDLE *PHANDLE;
310
311 /* Upper-Case Versions of Some Standard C Types */
312 #ifndef VOID
313 #define VOID void
314 typedef char CHAR;
315 typedef short SHORT;
316 typedef long LONG;
317 #if !defined(MIDL_PASS)
318 typedef int INT;
319 #endif
320 #endif
321 typedef double DOUBLE;
322
323 /* Unsigned Types */
324 typedef unsigned char UCHAR, *PUCHAR;
325 typedef unsigned short USHORT, *PUSHORT;
326 typedef unsigned long ULONG, *PULONG;
327 typedef CONST UCHAR *PCUCHAR;
328 typedef CONST USHORT *PCUSHORT;
329 typedef CONST ULONG *PCULONG;
330 typedef UCHAR FCHAR;
331 typedef USHORT FSHORT;
332 typedef ULONG FLONG;
333 typedef UCHAR BOOLEAN, *PBOOLEAN;
334 typedef ULONG LOGICAL;
335 typedef ULONG *PLOGICAL;
336
337 /* Signed Types */
338 typedef SHORT *PSHORT;
339 typedef LONG *PLONG;
340 typedef LONG NTSTATUS;
341 typedef NTSTATUS *PNTSTATUS;
342 typedef signed char SCHAR;
343 typedef SCHAR *PSCHAR;
344
345 #ifndef _HRESULT_DEFINED
346 #define _HRESULT_DEFINED
347 typedef LONG HRESULT;
348 #endif
349
350 /* 64-bit types */
351 __GNU_EXTENSION typedef __int64 LONGLONG, *PLONGLONG;
352 __GNU_EXTENSION typedef unsigned __int64 ULONGLONG, *PULONGLONG;
353 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
354
355 /* Update Sequence Number */
356 typedef LONGLONG USN;
357
358 /* ANSI (Multi-byte Character) types */
359 typedef CHAR *PCHAR, *LPCH, *PCH;
360 typedef CONST CHAR *LPCCH, *PCCH;
361 typedef CHAR *NPSTR, *LPSTR, *PSTR;
362 typedef PSTR *PZPSTR;
363 typedef CONST PSTR *PCZPSTR;
364 typedef CONST CHAR *LPCSTR, *PCSTR;
365 typedef PCSTR *PZPCSTR;
366
367 /* Pointer to an Asciiz string */
368 typedef CHAR *PSZ;
369 typedef CONST char *PCSZ;
370
371 /* UNICODE (Wide Character) types */
372 typedef wchar_t WCHAR;
373 typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
374 typedef CONST WCHAR *LPCWCH, *PCWCH;
375 typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
376 typedef PWSTR *PZPWSTR;
377 typedef CONST PWSTR *PCZPWSTR;
378 typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
379 typedef CONST WCHAR *LPCWSTR, *PCWSTR;
380 typedef PCWSTR *PZPCWSTR;
381 typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
382
383 /* Cardinal Data Types */
384 typedef char CCHAR, *PCCHAR;
385 typedef short CSHORT, *PCSHORT;
386 typedef ULONG CLONG, *PCLONG;
387
388 /* NLS basics (Locale and Language Ids) */
389 typedef ULONG LCID;
390 typedef PULONG PLCID;
391 typedef USHORT LANGID;
392
393 /* Used to store a non-float 8 byte aligned structure */
394 typedef struct _QUAD
395 {
396 _ANONYMOUS_UNION union
397 {
398 __GNU_EXTENSION __int64 UseThisFieldToCopy;
399 double DoNotUseThisField;
400 } DUMMYUNIONNAME;
401 } QUAD, *PQUAD, UQUAD, *PUQUAD;
402
403 /* Large Integer Unions */
404 #if defined(MIDL_PASS)
405 typedef struct _LARGE_INTEGER {
406 #else
407 typedef union _LARGE_INTEGER {
408 _ANONYMOUS_STRUCT struct
409 {
410 ULONG LowPart;
411 LONG HighPart;
412 } DUMMYSTRUCTNAME;
413 struct
414 {
415 ULONG LowPart;
416 LONG HighPart;
417 } u;
418 #endif /* MIDL_PASS */
419 LONGLONG QuadPart;
420 } LARGE_INTEGER, *PLARGE_INTEGER;
421
422 #if defined(MIDL_PASS)
423 typedef struct _ULARGE_INTEGER {
424 #else
425 typedef union _ULARGE_INTEGER {
426 _ANONYMOUS_STRUCT struct
427 {
428 ULONG LowPart;
429 ULONG HighPart;
430 } DUMMYSTRUCTNAME;
431 struct
432 {
433 ULONG LowPart;
434 ULONG HighPart;
435 } u;
436 #endif /* MIDL_PASS */
437 ULONGLONG QuadPart;
438 } ULARGE_INTEGER, *PULARGE_INTEGER;
439
440 /* Physical Addresses are always treated as 64-bit wide */
441 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
442
443 /* Locally Unique Identifier */
444 typedef struct _LUID {
445 ULONG LowPart;
446 LONG HighPart;
447 } LUID, *PLUID;
448
449 /* Native API Return Value Macros */
450 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
451 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
452 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
453 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
454
455 /* String Types */
456 typedef struct _UNICODE_STRING {
457 USHORT Length;
458 USHORT MaximumLength;
459 PWSTR Buffer;
460 } UNICODE_STRING, *PUNICODE_STRING;
461 typedef const UNICODE_STRING* PCUNICODE_STRING;
462 #define UNICODE_NULL ((WCHAR)0)
463
464 typedef struct _CSTRING {
465 USHORT Length;
466 USHORT MaximumLength;
467 CONST CHAR *Buffer;
468 } CSTRING, *PCSTRING;
469 #define ANSI_NULL ((CHAR)0)
470
471 typedef struct _STRING {
472 USHORT Length;
473 USHORT MaximumLength;
474 PCHAR Buffer;
475 } STRING, *PSTRING;
476
477 typedef STRING ANSI_STRING;
478 typedef PSTRING PANSI_STRING;
479 typedef STRING OEM_STRING;
480 typedef PSTRING POEM_STRING;
481 typedef CONST STRING* PCOEM_STRING;
482 typedef STRING CANSI_STRING;
483 typedef PSTRING PCANSI_STRING;
484
485 typedef struct _STRING32 {
486 USHORT Length;
487 USHORT MaximumLength;
488 ULONG Buffer;
489 } STRING32, *PSTRING32,
490 UNICODE_STRING32, *PUNICODE_STRING32,
491 ANSI_STRING32, *PANSI_STRING32;
492
493 typedef struct _STRING64 {
494 USHORT Length;
495 USHORT MaximumLength;
496 ULONGLONG Buffer;
497 } STRING64, *PSTRING64,
498 UNICODE_STRING64, *PUNICODE_STRING64,
499 ANSI_STRING64, *PANSI_STRING64;
500
501 /* LangID and NLS */
502 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
503 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
504 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
505
506 #define NLS_VALID_LOCALE_MASK 0x000fffff
507
508 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
509 ((ULONG)((USHORT)(lgid)))))
510 #define MAKESORTLCID(lgid, srtid, ver) \
511 ((ULONG)((MAKELCID(lgid, srtid)) | \
512 (((ULONG)((USHORT)(ver))) << 20)))
513 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
514 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
515 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
516
517
518 /* Object Attributes */
519 typedef struct _OBJECT_ATTRIBUTES {
520 ULONG Length;
521 HANDLE RootDirectory;
522 PUNICODE_STRING ObjectName;
523 ULONG Attributes;
524 PVOID SecurityDescriptor;
525 PVOID SecurityQualityOfService;
526 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
527 typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
528
529 /* Values for the Attributes member */
530 #define OBJ_INHERIT 0x00000002
531 #define OBJ_PERMANENT 0x00000010
532 #define OBJ_EXCLUSIVE 0x00000020
533 #define OBJ_CASE_INSENSITIVE 0x00000040
534 #define OBJ_OPENIF 0x00000080
535 #define OBJ_OPENLINK 0x00000100
536 #define OBJ_KERNEL_HANDLE 0x00000200
537 #define OBJ_FORCE_ACCESS_CHECK 0x00000400
538 #define OBJ_VALID_ATTRIBUTES 0x000007F2
539
540 /* Helper Macro */
541 #define InitializeObjectAttributes(p,n,a,r,s) { \
542 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
543 (p)->RootDirectory = (r); \
544 (p)->Attributes = (a); \
545 (p)->ObjectName = (n); \
546 (p)->SecurityDescriptor = (s); \
547 (p)->SecurityQualityOfService = NULL; \
548 }
549
550 /* Product Types */
551 typedef enum _NT_PRODUCT_TYPE {
552 NtProductWinNt = 1,
553 NtProductLanManNt,
554 NtProductServer
555 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
556
557 typedef enum _EVENT_TYPE {
558 NotificationEvent,
559 SynchronizationEvent
560 } EVENT_TYPE;
561
562 typedef enum _TIMER_TYPE {
563 NotificationTimer,
564 SynchronizationTimer
565 } TIMER_TYPE;
566
567 typedef enum _WAIT_TYPE {
568 WaitAll,
569 WaitAny
570 } WAIT_TYPE;
571
572 /* Doubly Linked Lists */
573 typedef struct _LIST_ENTRY {
574 struct _LIST_ENTRY *Flink;
575 struct _LIST_ENTRY *Blink;
576 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
577
578 typedef struct LIST_ENTRY32 {
579 ULONG Flink;
580 ULONG Blink;
581 } LIST_ENTRY32, *PLIST_ENTRY32;
582
583 typedef struct LIST_ENTRY64 {
584 ULONGLONG Flink;
585 ULONGLONG Blink;
586 } LIST_ENTRY64, *PLIST_ENTRY64;
587
588 /* Singly Linked Lists */
589 typedef struct _SINGLE_LIST_ENTRY {
590 struct _SINGLE_LIST_ENTRY *Next;
591 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
592
593 typedef struct _PROCESSOR_NUMBER {
594 USHORT Group;
595 UCHAR Number;
596 UCHAR Reserved;
597 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
598
599 struct _CONTEXT;
600 struct _EXCEPTION_RECORD;
601
602 typedef EXCEPTION_DISPOSITION
603 (NTAPI *PEXCEPTION_ROUTINE)(
604 struct _EXCEPTION_RECORD *ExceptionRecord,
605 PVOID EstablisherFrame,
606 struct _CONTEXT *ContextRecord,
607 PVOID DispatcherContext);
608
609 typedef struct _GROUP_AFFINITY {
610 KAFFINITY Mask;
611 USHORT Group;
612 USHORT Reserved[3];
613 } GROUP_AFFINITY, *PGROUP_AFFINITY;
614
615 /* Helper Macros */
616 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
617
618 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
619
620 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
621 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
622
623 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
624 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
625
626 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
627 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
628 #ifdef ENABLE_RTL_NUMBER_OF_V2
629 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
630 #else
631 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
632 #endif
633 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
634
635 /* Type Limits */
636 #define MINCHAR 0x80
637 #define MAXCHAR 0x7f
638 #define MINSHORT 0x8000
639 #define MAXSHORT 0x7fff
640 #define MINLONG 0x80000000
641 #define MAXLONG 0x7fffffff
642 #define MAXUCHAR 0xff
643 #define MAXUSHORT 0xffff
644 #define MAXULONG 0xffffffff
645 #define MAXLONGLONG (0x7fffffffffffffffLL)
646
647 /* Multiplication and Shift Operations */
648 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
649 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
650 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
651 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
652 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
653
654 /* C_ASSERT Definition */
655 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
656
657 #define VER_WORKSTATION_NT 0x40000000
658 #define VER_SERVER_NT 0x80000000
659 #define VER_SUITE_SMALLBUSINESS 0x00000001
660 #define VER_SUITE_ENTERPRISE 0x00000002
661 #define VER_SUITE_BACKOFFICE 0x00000004
662 #define VER_SUITE_COMMUNICATIONS 0x00000008
663 #define VER_SUITE_TERMINAL 0x00000010
664 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
665 #define VER_SUITE_EMBEDDEDNT 0x00000040
666 #define VER_SUITE_DATACENTER 0x00000080
667 #define VER_SUITE_SINGLEUSERTS 0x00000100
668 #define VER_SUITE_PERSONAL 0x00000200
669 #define VER_SUITE_BLADE 0x00000400
670 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
671 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
672 #define VER_SUITE_STORAGE_SERVER 0x00002000
673 #define VER_SUITE_COMPUTE_SERVER 0x00004000
674 #define VER_SUITE_WH_SERVER 0x00008000
675
676 /* Primary language IDs. */
677 #define LANG_NEUTRAL 0x00
678 #define LANG_INVARIANT 0x7f
679
680 #define LANG_AFRIKAANS 0x36
681 #define LANG_ALBANIAN 0x1c
682 #define LANG_ALSATIAN 0x84
683 #define LANG_AMHARIC 0x5e
684 #define LANG_ARABIC 0x01
685 #define LANG_ARMENIAN 0x2b
686 #define LANG_ASSAMESE 0x4d
687 #define LANG_AZERI 0x2c
688 #define LANG_BASHKIR 0x6d
689 #define LANG_BASQUE 0x2d
690 #define LANG_BELARUSIAN 0x23
691 #define LANG_BENGALI 0x45
692 #define LANG_BRETON 0x7e
693 #define LANG_BOSNIAN 0x1a
694 #define LANG_BOSNIAN_NEUTRAL 0x781a
695 #define LANG_BULGARIAN 0x02
696 #define LANG_CATALAN 0x03
697 #define LANG_CHINESE 0x04
698 #define LANG_CHINESE_SIMPLIFIED 0x04
699 #define LANG_CHINESE_TRADITIONAL 0x7c04
700 #define LANG_CORSICAN 0x83
701 #define LANG_CROATIAN 0x1a
702 #define LANG_CZECH 0x05
703 #define LANG_DANISH 0x06
704 #define LANG_DARI 0x8c
705 #define LANG_DIVEHI 0x65
706 #define LANG_DUTCH 0x13
707 #define LANG_ENGLISH 0x09
708 #define LANG_ESTONIAN 0x25
709 #define LANG_FAEROESE 0x38
710 #define LANG_FARSI 0x29
711 #define LANG_FILIPINO 0x64
712 #define LANG_FINNISH 0x0b
713 #define LANG_FRENCH 0x0c
714 #define LANG_FRISIAN 0x62
715 #define LANG_GALICIAN 0x56
716 #define LANG_GEORGIAN 0x37
717 #define LANG_GERMAN 0x07
718 #define LANG_GREEK 0x08
719 #define LANG_GREENLANDIC 0x6f
720 #define LANG_GUJARATI 0x47
721 #define LANG_HAUSA 0x68
722 #define LANG_HEBREW 0x0d
723 #define LANG_HINDI 0x39
724 #define LANG_HUNGARIAN 0x0e
725 #define LANG_ICELANDIC 0x0f
726 #define LANG_IGBO 0x70
727 #define LANG_INDONESIAN 0x21
728 #define LANG_INUKTITUT 0x5d
729 #define LANG_IRISH 0x3c
730 #define LANG_ITALIAN 0x10
731 #define LANG_JAPANESE 0x11
732 #define LANG_KANNADA 0x4b
733 #define LANG_KASHMIRI 0x60
734 #define LANG_KAZAK 0x3f
735 #define LANG_KHMER 0x53
736 #define LANG_KICHE 0x86
737 #define LANG_KINYARWANDA 0x87
738 #define LANG_KONKANI 0x57
739 #define LANG_KOREAN 0x12
740 #define LANG_KYRGYZ 0x40
741 #define LANG_LAO 0x54
742 #define LANG_LATVIAN 0x26
743 #define LANG_LITHUANIAN 0x27
744 #define LANG_LOWER_SORBIAN 0x2e
745 #define LANG_LUXEMBOURGISH 0x6e
746 #define LANG_MACEDONIAN 0x2f
747 #define LANG_MALAY 0x3e
748 #define LANG_MALAYALAM 0x4c
749 #define LANG_MALTESE 0x3a
750 #define LANG_MANIPURI 0x58
751 #define LANG_MAORI 0x81
752 #define LANG_MAPUDUNGUN 0x7a
753 #define LANG_MARATHI 0x4e
754 #define LANG_MOHAWK 0x7c
755 #define LANG_MONGOLIAN 0x50
756 #define LANG_NEPALI 0x61
757 #define LANG_NORWEGIAN 0x14
758 #define LANG_OCCITAN 0x82
759 #define LANG_ORIYA 0x48
760 #define LANG_PASHTO 0x63
761 #define LANG_PERSIAN 0x29
762 #define LANG_POLISH 0x15
763 #define LANG_PORTUGUESE 0x16
764 #define LANG_PUNJABI 0x46
765 #define LANG_QUECHUA 0x6b
766 #define LANG_ROMANIAN 0x18
767 #define LANG_ROMANSH 0x17
768 #define LANG_RUSSIAN 0x19
769 #define LANG_SAMI 0x3b
770 #define LANG_SANSKRIT 0x4f
771 #define LANG_SERBIAN 0x1a
772 #define LANG_SERBIAN_NEUTRAL 0x7c1a
773 #define LANG_SINDHI 0x59
774 #define LANG_SINHALESE 0x5b
775 #define LANG_SLOVAK 0x1b
776 #define LANG_SLOVENIAN 0x24
777 #define LANG_SOTHO 0x6c
778 #define LANG_SPANISH 0x0a
779 #define LANG_SWAHILI 0x41
780 #define LANG_SWEDISH 0x1d
781 #define LANG_SYRIAC 0x5a
782 #define LANG_TAJIK 0x28
783 #define LANG_TAMAZIGHT 0x5f
784 #define LANG_TAMIL 0x49
785 #define LANG_TATAR 0x44
786 #define LANG_TELUGU 0x4a
787 #define LANG_THAI 0x1e
788 #define LANG_TIBETAN 0x51
789 #define LANG_TIGRIGNA 0x73
790 #define LANG_TSWANA 0x32
791 #define LANG_TURKISH 0x1f
792 #define LANG_TURKMEN 0x42
793 #define LANG_UIGHUR 0x80
794 #define LANG_UKRAINIAN 0x22
795 #define LANG_UPPER_SORBIAN 0x2e
796 #define LANG_URDU 0x20
797 #define LANG_UZBEK 0x43
798 #define LANG_VIETNAMESE 0x2a
799 #define LANG_WELSH 0x52
800 #define LANG_WOLOF 0x88
801 #define LANG_XHOSA 0x34
802 #define LANG_YAKUT 0x85
803 #define LANG_YI 0x78
804 #define LANG_YORUBA 0x6a
805 #define LANG_ZULU 0x35
806
807 #endif /* _NTDEF_ */