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