- Update to r53061
[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 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
464 #define UNICODE_STRING_MAX_CHARS (32767)
465
466 typedef struct _CSTRING {
467 USHORT Length;
468 USHORT MaximumLength;
469 CONST CHAR *Buffer;
470 } CSTRING, *PCSTRING;
471 #define ANSI_NULL ((CHAR)0)
472
473 typedef struct _STRING {
474 USHORT Length;
475 USHORT MaximumLength;
476 PCHAR Buffer;
477 } STRING, *PSTRING;
478
479 typedef STRING ANSI_STRING;
480 typedef PSTRING PANSI_STRING;
481 typedef STRING OEM_STRING;
482 typedef PSTRING POEM_STRING;
483 typedef CONST STRING* PCOEM_STRING;
484 typedef STRING CANSI_STRING;
485 typedef PSTRING PCANSI_STRING;
486
487 typedef struct _STRING32 {
488 USHORT Length;
489 USHORT MaximumLength;
490 ULONG Buffer;
491 } STRING32, *PSTRING32,
492 UNICODE_STRING32, *PUNICODE_STRING32,
493 ANSI_STRING32, *PANSI_STRING32;
494
495 typedef struct _STRING64 {
496 USHORT Length;
497 USHORT MaximumLength;
498 ULONGLONG Buffer;
499 } STRING64, *PSTRING64,
500 UNICODE_STRING64, *PUNICODE_STRING64,
501 ANSI_STRING64, *PANSI_STRING64;
502
503 /* LangID and NLS */
504 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
505 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
506 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
507
508 #define NLS_VALID_LOCALE_MASK 0x000fffff
509
510 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
511 ((ULONG)((USHORT)(lgid)))))
512 #define MAKESORTLCID(lgid, srtid, ver) \
513 ((ULONG)((MAKELCID(lgid, srtid)) | \
514 (((ULONG)((USHORT)(ver))) << 20)))
515 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
516 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
517 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
518
519
520 /* Object Attributes */
521 typedef struct _OBJECT_ATTRIBUTES {
522 ULONG Length;
523 HANDLE RootDirectory;
524 PUNICODE_STRING ObjectName;
525 ULONG Attributes;
526 PVOID SecurityDescriptor;
527 PVOID SecurityQualityOfService;
528 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
529 typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
530
531 /* Values for the Attributes member */
532 #define OBJ_INHERIT 0x00000002
533 #define OBJ_PERMANENT 0x00000010
534 #define OBJ_EXCLUSIVE 0x00000020
535 #define OBJ_CASE_INSENSITIVE 0x00000040
536 #define OBJ_OPENIF 0x00000080
537 #define OBJ_OPENLINK 0x00000100
538 #define OBJ_KERNEL_HANDLE 0x00000200
539 #define OBJ_FORCE_ACCESS_CHECK 0x00000400
540 #define OBJ_VALID_ATTRIBUTES 0x000007F2
541
542 /* Helper Macro */
543 #define InitializeObjectAttributes(p,n,a,r,s) { \
544 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
545 (p)->RootDirectory = (r); \
546 (p)->Attributes = (a); \
547 (p)->ObjectName = (n); \
548 (p)->SecurityDescriptor = (s); \
549 (p)->SecurityQualityOfService = NULL; \
550 }
551
552 /* Product Types */
553 typedef enum _NT_PRODUCT_TYPE {
554 NtProductWinNt = 1,
555 NtProductLanManNt,
556 NtProductServer
557 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
558
559 typedef enum _EVENT_TYPE {
560 NotificationEvent,
561 SynchronizationEvent
562 } EVENT_TYPE;
563
564 typedef enum _TIMER_TYPE {
565 NotificationTimer,
566 SynchronizationTimer
567 } TIMER_TYPE;
568
569 typedef enum _WAIT_TYPE {
570 WaitAll,
571 WaitAny
572 } WAIT_TYPE;
573
574 /* Doubly Linked Lists */
575 typedef struct _LIST_ENTRY {
576 struct _LIST_ENTRY *Flink;
577 struct _LIST_ENTRY *Blink;
578 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
579
580 typedef struct LIST_ENTRY32 {
581 ULONG Flink;
582 ULONG Blink;
583 } LIST_ENTRY32, *PLIST_ENTRY32;
584
585 typedef struct LIST_ENTRY64 {
586 ULONGLONG Flink;
587 ULONGLONG Blink;
588 } LIST_ENTRY64, *PLIST_ENTRY64;
589
590 /* Singly Linked Lists */
591 typedef struct _SINGLE_LIST_ENTRY {
592 struct _SINGLE_LIST_ENTRY *Next;
593 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
594
595 typedef struct _PROCESSOR_NUMBER {
596 USHORT Group;
597 UCHAR Number;
598 UCHAR Reserved;
599 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
600
601 struct _CONTEXT;
602 struct _EXCEPTION_RECORD;
603
604 typedef EXCEPTION_DISPOSITION
605 (NTAPI *PEXCEPTION_ROUTINE)(
606 struct _EXCEPTION_RECORD *ExceptionRecord,
607 PVOID EstablisherFrame,
608 struct _CONTEXT *ContextRecord,
609 PVOID DispatcherContext);
610
611 typedef struct _GROUP_AFFINITY {
612 KAFFINITY Mask;
613 USHORT Group;
614 USHORT Reserved[3];
615 } GROUP_AFFINITY, *PGROUP_AFFINITY;
616
617 /* Helper Macros */
618 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
619
620 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
621
622 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
623 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
624
625 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
626 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
627
628 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
629 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
630 #ifdef ENABLE_RTL_NUMBER_OF_V2
631 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
632 #else
633 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
634 #endif
635 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
636
637 /* Type Limits */
638 #define MINCHAR 0x80
639 #define MAXCHAR 0x7f
640 #define MINSHORT 0x8000
641 #define MAXSHORT 0x7fff
642 #define MINLONG 0x80000000
643 #define MAXLONG 0x7fffffff
644 #define MAXUCHAR 0xff
645 #define MAXUSHORT 0xffff
646 #define MAXULONG 0xffffffff
647 #define MAXLONGLONG (0x7fffffffffffffffLL)
648
649 /* Multiplication and Shift Operations */
650 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
651 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
652 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
653 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
654 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
655
656 /* C_ASSERT Definition */
657 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
658
659 #define VER_WORKSTATION_NT 0x40000000
660 #define VER_SERVER_NT 0x80000000
661 #define VER_SUITE_SMALLBUSINESS 0x00000001
662 #define VER_SUITE_ENTERPRISE 0x00000002
663 #define VER_SUITE_BACKOFFICE 0x00000004
664 #define VER_SUITE_COMMUNICATIONS 0x00000008
665 #define VER_SUITE_TERMINAL 0x00000010
666 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
667 #define VER_SUITE_EMBEDDEDNT 0x00000040
668 #define VER_SUITE_DATACENTER 0x00000080
669 #define VER_SUITE_SINGLEUSERTS 0x00000100
670 #define VER_SUITE_PERSONAL 0x00000200
671 #define VER_SUITE_BLADE 0x00000400
672 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
673 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
674 #define VER_SUITE_STORAGE_SERVER 0x00002000
675 #define VER_SUITE_COMPUTE_SERVER 0x00004000
676 #define VER_SUITE_WH_SERVER 0x00008000
677
678 /* Primary language IDs. */
679 #define LANG_NEUTRAL 0x00
680 #define LANG_INVARIANT 0x7f
681
682 #define LANG_AFRIKAANS 0x36
683 #define LANG_ALBANIAN 0x1c
684 #define LANG_ALSATIAN 0x84
685 #define LANG_AMHARIC 0x5e
686 #define LANG_ARABIC 0x01
687 #define LANG_ARMENIAN 0x2b
688 #define LANG_ASSAMESE 0x4d
689 #define LANG_AZERI 0x2c
690 #define LANG_BASHKIR 0x6d
691 #define LANG_BASQUE 0x2d
692 #define LANG_BELARUSIAN 0x23
693 #define LANG_BENGALI 0x45
694 #define LANG_BRETON 0x7e
695 #define LANG_BOSNIAN 0x1a
696 #define LANG_BOSNIAN_NEUTRAL 0x781a
697 #define LANG_BULGARIAN 0x02
698 #define LANG_CATALAN 0x03
699 #define LANG_CHINESE 0x04
700 #define LANG_CHINESE_SIMPLIFIED 0x04
701 #define LANG_CHINESE_TRADITIONAL 0x7c04
702 #define LANG_CORSICAN 0x83
703 #define LANG_CROATIAN 0x1a
704 #define LANG_CZECH 0x05
705 #define LANG_DANISH 0x06
706 #define LANG_DARI 0x8c
707 #define LANG_DIVEHI 0x65
708 #define LANG_DUTCH 0x13
709 #define LANG_ENGLISH 0x09
710 #define LANG_ESTONIAN 0x25
711 #define LANG_FAEROESE 0x38
712 #define LANG_FARSI 0x29
713 #define LANG_FILIPINO 0x64
714 #define LANG_FINNISH 0x0b
715 #define LANG_FRENCH 0x0c
716 #define LANG_FRISIAN 0x62
717 #define LANG_GALICIAN 0x56
718 #define LANG_GEORGIAN 0x37
719 #define LANG_GERMAN 0x07
720 #define LANG_GREEK 0x08
721 #define LANG_GREENLANDIC 0x6f
722 #define LANG_GUJARATI 0x47
723 #define LANG_HAUSA 0x68
724 #define LANG_HEBREW 0x0d
725 #define LANG_HINDI 0x39
726 #define LANG_HUNGARIAN 0x0e
727 #define LANG_ICELANDIC 0x0f
728 #define LANG_IGBO 0x70
729 #define LANG_INDONESIAN 0x21
730 #define LANG_INUKTITUT 0x5d
731 #define LANG_IRISH 0x3c
732 #define LANG_ITALIAN 0x10
733 #define LANG_JAPANESE 0x11
734 #define LANG_KANNADA 0x4b
735 #define LANG_KASHMIRI 0x60
736 #define LANG_KAZAK 0x3f
737 #define LANG_KHMER 0x53
738 #define LANG_KICHE 0x86
739 #define LANG_KINYARWANDA 0x87
740 #define LANG_KONKANI 0x57
741 #define LANG_KOREAN 0x12
742 #define LANG_KYRGYZ 0x40
743 #define LANG_LAO 0x54
744 #define LANG_LATVIAN 0x26
745 #define LANG_LITHUANIAN 0x27
746 #define LANG_LOWER_SORBIAN 0x2e
747 #define LANG_LUXEMBOURGISH 0x6e
748 #define LANG_MACEDONIAN 0x2f
749 #define LANG_MALAY 0x3e
750 #define LANG_MALAYALAM 0x4c
751 #define LANG_MALTESE 0x3a
752 #define LANG_MANIPURI 0x58
753 #define LANG_MAORI 0x81
754 #define LANG_MAPUDUNGUN 0x7a
755 #define LANG_MARATHI 0x4e
756 #define LANG_MOHAWK 0x7c
757 #define LANG_MONGOLIAN 0x50
758 #define LANG_NEPALI 0x61
759 #define LANG_NORWEGIAN 0x14
760 #define LANG_OCCITAN 0x82
761 #define LANG_ORIYA 0x48
762 #define LANG_PASHTO 0x63
763 #define LANG_PERSIAN 0x29
764 #define LANG_POLISH 0x15
765 #define LANG_PORTUGUESE 0x16
766 #define LANG_PUNJABI 0x46
767 #define LANG_QUECHUA 0x6b
768 #define LANG_ROMANIAN 0x18
769 #define LANG_ROMANSH 0x17
770 #define LANG_RUSSIAN 0x19
771 #define LANG_SAMI 0x3b
772 #define LANG_SANSKRIT 0x4f
773 #define LANG_SERBIAN 0x1a
774 #define LANG_SERBIAN_NEUTRAL 0x7c1a
775 #define LANG_SINDHI 0x59
776 #define LANG_SINHALESE 0x5b
777 #define LANG_SLOVAK 0x1b
778 #define LANG_SLOVENIAN 0x24
779 #define LANG_SOTHO 0x6c
780 #define LANG_SPANISH 0x0a
781 #define LANG_SWAHILI 0x41
782 #define LANG_SWEDISH 0x1d
783 #define LANG_SYRIAC 0x5a
784 #define LANG_TAJIK 0x28
785 #define LANG_TAMAZIGHT 0x5f
786 #define LANG_TAMIL 0x49
787 #define LANG_TATAR 0x44
788 #define LANG_TELUGU 0x4a
789 #define LANG_THAI 0x1e
790 #define LANG_TIBETAN 0x51
791 #define LANG_TIGRIGNA 0x73
792 #define LANG_TSWANA 0x32
793 #define LANG_TURKISH 0x1f
794 #define LANG_TURKMEN 0x42
795 #define LANG_UIGHUR 0x80
796 #define LANG_UKRAINIAN 0x22
797 #define LANG_UPPER_SORBIAN 0x2e
798 #define LANG_URDU 0x20
799 #define LANG_UZBEK 0x43
800 #define LANG_VIETNAMESE 0x2a
801 #define LANG_WELSH 0x52
802 #define LANG_WOLOF 0x88
803 #define LANG_XHOSA 0x34
804 #define LANG_YAKUT 0x85
805 #define LANG_YI 0x78
806 #define LANG_YORUBA 0x6a
807 #define LANG_ZULU 0x35
808
809 #endif /* _NTDEF_ */