4 * This file is part of the ReactOS PSDK package.
7 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
9 * THIS SOFTWARE IS NOT COPYRIGHTED
11 * This source code is offered for use in the public domain. You may
12 * use, modify or distribute it freely.
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.
30 #include <sdkddkver.h>
31 #include <specstrings.h>
32 #include <kernelspecs.h>
34 // FIXME: Shouldn't be included!
42 /* Pseudo Modifiers for Input Parameters */
69 /* Constant modifier */
84 #define NULL ((void *)0)
85 #define NULL64 ((void * POINTER_64)0)
89 /* Defines the "size" of an any-size array */
91 #define ANYSIZE_ARRAY 1
94 /* Helper macro to enable gcc's extension. */
95 #ifndef __GNU_EXTENSION
97 #define __GNU_EXTENSION __extension__
99 #define __GNU_EXTENSION
103 #ifndef DUMMYUNIONNAME
104 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
105 #define _ANONYMOUS_UNION
106 #define _UNION_NAME(x) x
107 #define DUMMYUNIONNAME u
108 #define DUMMYUNIONNAME1 u1
109 #define DUMMYUNIONNAME2 u2
110 #define DUMMYUNIONNAME3 u3
111 #define DUMMYUNIONNAME4 u4
112 #define DUMMYUNIONNAME5 u5
113 #define DUMMYUNIONNAME6 u6
114 #define DUMMYUNIONNAME7 u7
115 #define DUMMYUNIONNAME8 u8
116 #define DUMMYUNIONNAME9 u9
118 #define _ANONYMOUS_UNION __GNU_EXTENSION
119 #define _UNION_NAME(x)
120 #define DUMMYUNIONNAME
121 #define DUMMYUNIONNAME1
122 #define DUMMYUNIONNAME2
123 #define DUMMYUNIONNAME3
124 #define DUMMYUNIONNAME4
125 #define DUMMYUNIONNAME5
126 #define DUMMYUNIONNAME6
127 #define DUMMYUNIONNAME7
128 #define DUMMYUNIONNAME8
129 #define DUMMYUNIONNAME9
130 #endif /* NONAMELESSUNION */
131 #endif /* !DUMMYUNIONNAME */
133 #ifndef DUMMYSTRUCTNAME
134 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
135 #define _ANONYMOUS_STRUCT
136 #define _STRUCT_NAME(x) x
137 #define DUMMYSTRUCTNAME s
138 #define DUMMYSTRUCTNAME1 s1
139 #define DUMMYSTRUCTNAME2 s2
140 #define DUMMYSTRUCTNAME3 s3
141 #define DUMMYSTRUCTNAME4 s4
142 #define DUMMYSTRUCTNAME5 s5
144 #define _ANONYMOUS_STRUCT __GNU_EXTENSION
145 #define _STRUCT_NAME(x)
146 #define DUMMYSTRUCTNAME
147 #define DUMMYSTRUCTNAME1
148 #define DUMMYSTRUCTNAME2
149 #define DUMMYSTRUCTNAME3
150 #define DUMMYSTRUCTNAME4
151 #define DUMMYSTRUCTNAME5
152 #endif /* NONAMELESSUNION */
153 #endif /* DUMMYSTRUCTNAME */
155 #if defined(STRICT_GS_ENABLED)
156 #pragma strict_gs_check(push, on)
159 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
160 #define ALIGNMENT_MACHINE
161 #define UNALIGNED __unaligned
163 #define UNALIGNED64 __unaligned
168 #undef ALIGNMENT_MACHINE
173 #if defined(_WIN64) || defined(_M_ALPHA)
174 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
175 #define MEMORY_ALLOCATION_ALIGNMENT 16
177 #define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
178 #define MEMORY_ALLOCATION_ALIGNMENT 8
181 #if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
182 #define RESTRICTED_POINTER __restrict
184 #define RESTRICTED_POINTER
187 #define ARGUMENT_PRESENT(ArgumentPointer) \
188 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
190 /* Returns the base address of a structure from a structure member */
191 #ifndef CONTAINING_RECORD
192 #define CONTAINING_RECORD(address, type, field) \
193 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
196 /* Returns the byte offset of the specified structure's member */
198 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
200 #define FIELD_OFFSET(Type, Field) ((LONG)__builtin_offsetof(Type, Field))
203 /* Returns the type's alignment */
204 #if defined(_MSC_VER)
205 #define TYPE_ALIGNMENT(t) __alignof(t)
207 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
210 #if defined(_AMD64_) || defined(_X86_)
211 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG)
212 #elif defined(_IA64_) || defined(_ARM_)
213 #define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG))
215 #error "unknown architecture"
219 #define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(ULONG)
222 /* Calling Conventions */
223 #if defined(_MANAGED)
224 #define FASTCALL __stdcall
225 #elif defined(_M_IX86)
226 #define FASTCALL __fastcall
231 #define NTAPI __stdcall
234 /* Import and Export Specifiers */
236 /* Done the same way as in windef.h for now */
237 #define DECLSPEC_IMPORT __declspec(dllimport)
238 #define DECLSPEC_NORETURN __declspec(noreturn)
240 #ifndef DECLSPEC_ADDRSAFE
241 #if defined(_MSC_VER) && (defined(_M_ALPHA) || defined(_M_AXP64))
242 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
244 #define DECLSPEC_ADDRSAFE
246 #endif /* DECLSPEC_ADDRSAFE */
248 #ifndef DECLSPEC_NOTHROW
249 #if !defined(MIDL_PASS)
250 #define DECLSPEC_NOTHROW __declspec(nothrow)
252 #define DECLSPEC_NOTHROW
257 #if defined(_MSC_VER)
258 #define NOP_FUNCTION __noop
260 #define NOP_FUNCTION (void)0
264 #if !defined(_NTSYSTEM_)
265 #define NTSYSAPI DECLSPEC_IMPORT
266 #define NTSYSCALLAPI DECLSPEC_IMPORT
269 #if defined(_NTDLLBUILD_)
272 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
278 #if defined(_MSC_VER)
279 #define FORCEINLINE __forceinline
280 #elif ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
281 # define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
283 # define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
285 #endif /* FORCEINLINE */
287 #ifndef DECLSPEC_NOINLINE
288 #if (_MSC_VER >= 1300)
289 #define DECLSPEC_NOINLINE __declspec(noinline)
290 #elif defined(__GNUC__)
291 #define DECLSPEC_NOINLINE __attribute__((noinline))
293 #define DECLSPEC_NOINLINE
295 #endif /* DECLSPEC_NOINLINE */
297 #if !defined(_M_CEE_PURE)
298 #define NTAPI_INLINE NTAPI
303 /* Use to specify structure alignment */
304 #ifndef DECLSPEC_ALIGN
305 #if defined(_MSC_VER) && !defined(MIDL_PASS)
306 #define DECLSPEC_ALIGN(x) __declspec(align(x))
307 #elif defined(__GNUC__)
308 #define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__(x)))
310 #define DECLSPEC_ALIGN(x)
312 #endif /* DECLSPEC_ALIGN */
314 #ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
315 #if defined(_AMD64_) || defined(_X86_)
316 #define SYSTEM_CACHE_ALIGNMENT_SIZE 64
318 #define SYSTEM_CACHE_ALIGNMENT_SIZE 128
322 #ifndef DECLSPEC_CACHEALIGN
323 #define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
326 #ifndef DECLSPEC_UUID
327 #if defined(_MSC_VER) && defined(__cplusplus)
328 #define DECLSPEC_UUID(x) __declspec(uuid(x))
330 #define DECLSPEC_UUID(x)
334 #ifndef DECLSPEC_NOVTABLE
335 #if defined(_MSC_VER) && defined(__cplusplus)
336 #define DECLSPEC_NOVTABLE __declspec(novtable)
338 #define DECLSPEC_NOVTABLE
342 #ifndef DECLSPEC_SELECTANY
343 #if defined(_MSC_VER) || defined(__GNUC__)
344 #define DECLSPEC_SELECTANY __declspec(selectany)
346 #define DECLSPEC_SELECTANY
350 #ifndef DECLSPEC_DEPRECATED
351 #if (defined(_MSC_VER) || defined(__GNUC__)) && !defined(MIDL_PASS)
352 #define DECLSPEC_DEPRECATED __declspec(deprecated)
353 #define DEPRECATE_SUPPORTED
355 #define DECLSPEC_DEPRECATED
356 #undef DEPRECATE_SUPPORTED
360 #ifdef DEPRECATE_DDK_FUNCTIONS
362 #define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
363 #ifdef DEPRECATE_SUPPORTED
364 #define PRAGMA_DEPRECATED_DDK 1
367 #define DECLSPEC_DEPRECATED_DDK
368 #define PRAGMA_DEPRECATED_DDK 1
371 #define DECLSPEC_DEPRECATED_DDK
372 #define PRAGMA_DEPRECATED_DDK 0
375 /* Use to silence unused variable warnings when it is intentional */
376 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
377 #define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
378 #define DBG_UNREFERENCED_PARAMETER(P) {(P)=(P);}
379 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
381 /* min/max helper macros */
385 #define min(a,b) (((a) < (b)) ? (a) : (b))
389 #define max(a,b) (((a) > (b)) ? (a) : (b))
392 #endif /* NOMINMAX */
394 /* Tell windef.h that we have defined some basic types */
399 typedef void * POINTER_64 PVOID64
;
402 typedef void *HANDLE
, **PHANDLE
;;
404 #define DECLARE_HANDLE(n) typedef struct n##__{int unused;} *n
406 #define DECLARE_HANDLE(n) typedef HANDLE n
409 /* Upper-Case Versions of Some Standard C Types */
415 #if !defined(MIDL_PASS)
419 typedef double DOUBLE
;
422 typedef unsigned char UCHAR
, *PUCHAR
;
423 typedef unsigned short USHORT
, *PUSHORT
;
424 typedef unsigned long ULONG
, *PULONG
;
425 typedef CONST UCHAR
*PCUCHAR
;
426 typedef CONST USHORT
*PCUSHORT
;
427 typedef CONST ULONG
*PCULONG
;
429 typedef USHORT FSHORT
;
431 typedef UCHAR BOOLEAN
, *PBOOLEAN
;
432 typedef ULONG LOGICAL
;
433 typedef ULONG
*PLOGICAL
;
436 typedef SHORT
*PSHORT
;
438 typedef _Return_type_success_(return >= 0) LONG NTSTATUS
;
439 typedef NTSTATUS
*PNTSTATUS
;
440 typedef signed char SCHAR
;
441 typedef SCHAR
*PSCHAR
;
443 #ifndef _HRESULT_DEFINED
444 #define _HRESULT_DEFINED
445 typedef LONG HRESULT
;
449 __GNU_EXTENSION
typedef __int64 LONGLONG
, *PLONGLONG
;
450 __GNU_EXTENSION
typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
451 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
453 /* Update Sequence Number */
454 typedef LONGLONG USN
;
456 /* ANSI (Multi-byte Character) types */
457 typedef CHAR
*PCHAR
, *LPCH
, *PCH
;
458 typedef CONST CHAR
*LPCCH
, *PCCH
;
459 typedef _Null_terminated_ CHAR
*NPSTR
, *LPSTR
, *PSTR
;
460 typedef _Null_terminated_ PSTR
*PZPSTR
;
461 typedef _Null_terminated_ CONST PSTR
*PCZPSTR
;
462 typedef _Null_terminated_ CONST CHAR
*LPCSTR
, *PCSTR
;
463 typedef _Null_terminated_ PCSTR
*PZPCSTR
;
465 /* Pointer to an Asciiz string */
466 typedef _Null_terminated_ CHAR
*PSZ
;
467 typedef _Null_terminated_ CONST
char *PCSZ
;
469 /* UNICODE (Wide Character) types */
470 typedef wchar_t WCHAR
;
471 typedef WCHAR
*PWCHAR
, *LPWCH
, *PWCH
;
472 typedef CONST WCHAR
*LPCWCH
, *PCWCH
;
473 typedef _Null_terminated_ WCHAR
*NWPSTR
, *LPWSTR
, *PWSTR
;
474 typedef _Null_terminated_ PWSTR
*PZPWSTR
;
475 typedef _Null_terminated_ CONST PWSTR
*PCZPWSTR
;
476 typedef _Null_terminated_ WCHAR UNALIGNED
*LPUWSTR
, *PUWSTR
;
477 typedef _Null_terminated_ CONST WCHAR
*LPCWSTR
, *PCWSTR
;
478 typedef _Null_terminated_ PCWSTR
*PZPCWSTR
;
479 typedef _Null_terminated_ CONST WCHAR UNALIGNED
*LPCUWSTR
, *PCUWSTR
;
480 typedef _NullNull_terminated_ WCHAR
*PZZWSTR
;
482 /* Cardinal Data Types */
483 typedef char CCHAR
, *PCCHAR
;
484 typedef short CSHORT
, *PCSHORT
;
485 typedef ULONG CLONG
, *PCLONG
;
487 /* NLS basics (Locale and Language Ids) */
489 typedef PULONG PLCID
;
490 typedef USHORT LANGID
;
493 UNSPECIFIED_COMPARTMENT_ID
= 0,
494 DEFAULT_COMPARTMENT_ID
495 } COMPARTMENT_ID
, *PCOMPARTMENT_ID
;
498 #pragma warning(push)
499 #pragma warning(disable:4201)
501 /* Used to store a non-float 8 byte aligned structure */
504 _ANONYMOUS_UNION
union
506 __GNU_EXTENSION __int64 UseThisFieldToCopy
;
507 double DoNotUseThisField
;
509 } QUAD
, *PQUAD
, UQUAD
, *PUQUAD
;
511 /* Large Integer Unions */
512 #if defined(MIDL_PASS)
513 typedef struct _LARGE_INTEGER
{
515 typedef union _LARGE_INTEGER
{
516 _ANONYMOUS_STRUCT
struct
526 #endif /* MIDL_PASS */
528 } LARGE_INTEGER
, *PLARGE_INTEGER
;
530 #if defined(MIDL_PASS)
531 typedef struct _ULARGE_INTEGER
{
533 typedef union _ULARGE_INTEGER
{
534 _ANONYMOUS_STRUCT
struct
544 #endif /* MIDL_PASS */
546 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
549 #pragma warning(pop) /* disable:4201 */
552 /* Physical Addresses are always treated as 64-bit wide */
553 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
555 /* Locally Unique Identifier */
556 typedef struct _LUID
{
561 /* Native API Return Value Macros */
562 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
563 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
564 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
565 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
568 typedef struct _UNICODE_STRING
{
570 USHORT MaximumLength
;
572 } UNICODE_STRING
, *PUNICODE_STRING
;
573 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
574 #define UNICODE_NULL ((WCHAR)0)
575 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
576 #define UNICODE_STRING_MAX_CHARS (32767)
578 typedef struct _CSTRING
{
580 USHORT MaximumLength
;
582 } CSTRING
, *PCSTRING
;
583 #define ANSI_NULL ((CHAR)0)
585 typedef struct _STRING
{
587 USHORT MaximumLength
;
589 [size_is(MaximumLength
), length_is(Length
) ]
591 _Field_size_bytes_part_opt_(MaximumLength
, Length
) PCHAR Buffer
;
594 typedef STRING ANSI_STRING
;
595 typedef PSTRING PANSI_STRING
;
596 typedef STRING OEM_STRING
;
597 typedef PSTRING POEM_STRING
;
598 typedef CONST STRING
* PCOEM_STRING
;
599 typedef STRING CANSI_STRING
;
600 typedef PSTRING PCANSI_STRING
;
602 typedef struct _STRING32
{
604 USHORT MaximumLength
;
606 } STRING32
, *PSTRING32
,
607 UNICODE_STRING32
, *PUNICODE_STRING32
,
608 ANSI_STRING32
, *PANSI_STRING32
;
610 typedef struct _STRING64
{
612 USHORT MaximumLength
;
614 } STRING64
, *PSTRING64
,
615 UNICODE_STRING64
, *PUNICODE_STRING64
,
616 ANSI_STRING64
, *PANSI_STRING64
;
619 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
620 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
621 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
623 #define NLS_VALID_LOCALE_MASK 0x000fffff
625 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
626 ((ULONG)((USHORT)(lgid)))))
627 #define MAKESORTLCID(lgid, srtid, ver) \
628 ((ULONG)((MAKELCID(lgid, srtid)) | \
629 (((ULONG)((USHORT)(ver))) << 20)))
630 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
631 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
632 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
635 /* Object Attributes */
636 typedef struct _OBJECT_ATTRIBUTES
{
638 HANDLE RootDirectory
;
639 PUNICODE_STRING ObjectName
;
641 PVOID SecurityDescriptor
;
642 PVOID SecurityQualityOfService
;
643 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
644 typedef CONST OBJECT_ATTRIBUTES
*PCOBJECT_ATTRIBUTES
;
646 /* Values for the Attributes member */
647 #define OBJ_INHERIT 0x00000002
648 #define OBJ_PERMANENT 0x00000010
649 #define OBJ_EXCLUSIVE 0x00000020
650 #define OBJ_CASE_INSENSITIVE 0x00000040
651 #define OBJ_OPENIF 0x00000080
652 #define OBJ_OPENLINK 0x00000100
653 #define OBJ_KERNEL_HANDLE 0x00000200
654 #define OBJ_FORCE_ACCESS_CHECK 0x00000400
655 #define OBJ_VALID_ATTRIBUTES 0x000007F2
658 #define InitializeObjectAttributes(p,n,a,r,s) { \
659 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
660 (p)->RootDirectory = (r); \
661 (p)->Attributes = (a); \
662 (p)->ObjectName = (n); \
663 (p)->SecurityDescriptor = (s); \
664 (p)->SecurityQualityOfService = NULL; \
668 typedef enum _NT_PRODUCT_TYPE
{
672 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
674 typedef enum _EVENT_TYPE
{
679 typedef enum _TIMER_TYPE
{
684 typedef enum _WAIT_TYPE
{
689 /* Doubly Linked Lists */
690 typedef struct _LIST_ENTRY
{
691 struct _LIST_ENTRY
*Flink
;
692 struct _LIST_ENTRY
*Blink
;
693 } LIST_ENTRY
, *PLIST_ENTRY
, *RESTRICTED_POINTER PRLIST_ENTRY
;
695 typedef struct LIST_ENTRY32
{
698 } LIST_ENTRY32
, *PLIST_ENTRY32
;
700 typedef struct LIST_ENTRY64
{
703 } LIST_ENTRY64
, *PLIST_ENTRY64
;
705 /* Singly Linked Lists */
706 typedef struct _SINGLE_LIST_ENTRY
{
707 struct _SINGLE_LIST_ENTRY
*Next
;
708 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
710 typedef struct _PROCESSOR_NUMBER
{
714 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
717 struct _EXCEPTION_RECORD
;
720 _Function_class_(EXCEPTION_ROUTINE
)
721 typedef EXCEPTION_DISPOSITION
722 (NTAPI
*PEXCEPTION_ROUTINE
)(
723 _Inout_
struct _EXCEPTION_RECORD
*ExceptionRecord
,
724 _In_ PVOID EstablisherFrame
,
725 _Inout_
struct _CONTEXT
*ContextRecord
,
726 _In_ PVOID DispatcherContext
);
728 typedef struct _GROUP_AFFINITY
{
732 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
736 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
737 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
738 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
740 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
742 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
744 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
745 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
747 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
748 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
750 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
751 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
752 #ifdef ENABLE_RTL_NUMBER_OF_V2
753 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
755 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
757 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
762 #define MINSHORT 0x8000
763 #define MAXSHORT 0x7fff
764 #define MINLONG 0x80000000
765 #define MAXLONG 0x7fffffff
766 #define MAXUCHAR 0xff
767 #define MAXUSHORT 0xffff
768 #define MAXULONG 0xffffffff
769 #define MAXLONGLONG (0x7fffffffffffffffLL)
771 /* Multiplication and Shift Operations */
772 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
773 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
774 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
775 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
776 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
778 /* C_ASSERT Definition */
779 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
781 /* Eliminate Microsoft C/C++ compiler warning 4715 */
782 #if defined(_MSC_VER) && (_MSC_VER > 1200)
783 # define DEFAULT_UNREACHABLE default: __assume(0)
784 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
785 # define DEFAULT_UNREACHABLE default: __builtin_unreachable()
787 # define DEFAULT_UNREACHABLE default: break
790 #define VER_WORKSTATION_NT 0x40000000
791 #define VER_SERVER_NT 0x80000000
792 #define VER_SUITE_SMALLBUSINESS 0x00000001
793 #define VER_SUITE_ENTERPRISE 0x00000002
794 #define VER_SUITE_BACKOFFICE 0x00000004
795 #define VER_SUITE_COMMUNICATIONS 0x00000008
796 #define VER_SUITE_TERMINAL 0x00000010
797 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
798 #define VER_SUITE_EMBEDDEDNT 0x00000040
799 #define VER_SUITE_DATACENTER 0x00000080
800 #define VER_SUITE_SINGLEUSERTS 0x00000100
801 #define VER_SUITE_PERSONAL 0x00000200
802 #define VER_SUITE_BLADE 0x00000400
803 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
804 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
805 #define VER_SUITE_STORAGE_SERVER 0x00002000
806 #define VER_SUITE_COMPUTE_SERVER 0x00004000
807 #define VER_SUITE_WH_SERVER 0x00008000
809 /* Primary language IDs. */
810 #define LANG_NEUTRAL 0x00
811 #define LANG_INVARIANT 0x7f
813 #define LANG_AFRIKAANS 0x36
814 #define LANG_ALBANIAN 0x1c
815 #define LANG_ALSATIAN 0x84
816 #define LANG_AMHARIC 0x5e
817 #define LANG_ARABIC 0x01
818 #define LANG_ARMENIAN 0x2b
819 #define LANG_ASSAMESE 0x4d
820 #define LANG_AZERI 0x2c
821 #define LANG_BASHKIR 0x6d
822 #define LANG_BASQUE 0x2d
823 #define LANG_BELARUSIAN 0x23
824 #define LANG_BENGALI 0x45
825 #define LANG_BRETON 0x7e
826 #define LANG_BOSNIAN 0x1a
827 #define LANG_BOSNIAN_NEUTRAL 0x781a
828 #define LANG_BULGARIAN 0x02
829 #define LANG_CATALAN 0x03
830 #define LANG_CHINESE 0x04
831 #define LANG_CHINESE_SIMPLIFIED 0x04
832 #define LANG_CHINESE_TRADITIONAL 0x7c04
833 #define LANG_CORSICAN 0x83
834 #define LANG_CROATIAN 0x1a
835 #define LANG_CZECH 0x05
836 #define LANG_DANISH 0x06
837 #define LANG_DARI 0x8c
838 #define LANG_DIVEHI 0x65
839 #define LANG_DUTCH 0x13
840 #define LANG_ENGLISH 0x09
841 #define LANG_ESTONIAN 0x25
842 #define LANG_FAEROESE 0x38
843 #define LANG_FARSI 0x29
844 #define LANG_FILIPINO 0x64
845 #define LANG_FINNISH 0x0b
846 #define LANG_FRENCH 0x0c
847 #define LANG_FRISIAN 0x62
848 #define LANG_GALICIAN 0x56
849 #define LANG_GEORGIAN 0x37
850 #define LANG_GERMAN 0x07
851 #define LANG_GREEK 0x08
852 #define LANG_GREENLANDIC 0x6f
853 #define LANG_GUJARATI 0x47
854 #define LANG_HAUSA 0x68
855 #define LANG_HEBREW 0x0d
856 #define LANG_HINDI 0x39
857 #define LANG_HUNGARIAN 0x0e
858 #define LANG_ICELANDIC 0x0f
859 #define LANG_IGBO 0x70
860 #define LANG_INDONESIAN 0x21
861 #define LANG_INUKTITUT 0x5d
862 #define LANG_IRISH 0x3c
863 #define LANG_ITALIAN 0x10
864 #define LANG_JAPANESE 0x11
865 #define LANG_KANNADA 0x4b
866 #define LANG_KASHMIRI 0x60
867 #define LANG_KAZAK 0x3f
868 #define LANG_KHMER 0x53
869 #define LANG_KICHE 0x86
870 #define LANG_KINYARWANDA 0x87
871 #define LANG_KONKANI 0x57
872 #define LANG_KOREAN 0x12
873 #define LANG_KYRGYZ 0x40
874 #define LANG_LAO 0x54
875 #define LANG_LATVIAN 0x26
876 #define LANG_LITHUANIAN 0x27
877 #define LANG_LOWER_SORBIAN 0x2e
878 #define LANG_LUXEMBOURGISH 0x6e
879 #define LANG_MACEDONIAN 0x2f
880 #define LANG_MALAY 0x3e
881 #define LANG_MALAYALAM 0x4c
882 #define LANG_MALTESE 0x3a
883 #define LANG_MANIPURI 0x58
884 #define LANG_MAORI 0x81
885 #define LANG_MAPUDUNGUN 0x7a
886 #define LANG_MARATHI 0x4e
887 #define LANG_MOHAWK 0x7c
888 #define LANG_MONGOLIAN 0x50
889 #define LANG_NEPALI 0x61
890 #define LANG_NORWEGIAN 0x14
891 #define LANG_OCCITAN 0x82
892 #define LANG_ORIYA 0x48
893 #define LANG_PASHTO 0x63
894 #define LANG_PERSIAN 0x29
895 #define LANG_POLISH 0x15
896 #define LANG_PORTUGUESE 0x16
897 #define LANG_PUNJABI 0x46
898 #define LANG_QUECHUA 0x6b
899 #define LANG_ROMANIAN 0x18
900 #define LANG_ROMANSH 0x17
901 #define LANG_RUSSIAN 0x19
902 #define LANG_SAMI 0x3b
903 #define LANG_SANSKRIT 0x4f
904 #define LANG_SERBIAN 0x1a
905 #define LANG_SERBIAN_NEUTRAL 0x7c1a
906 #define LANG_SINDHI 0x59
907 #define LANG_SINHALESE 0x5b
908 #define LANG_SLOVAK 0x1b
909 #define LANG_SLOVENIAN 0x24
910 #define LANG_SOTHO 0x6c
911 #define LANG_SPANISH 0x0a
912 #define LANG_SWAHILI 0x41
913 #define LANG_SWEDISH 0x1d
914 #define LANG_SYRIAC 0x5a
915 #define LANG_TAJIK 0x28
916 #define LANG_TAMAZIGHT 0x5f
917 #define LANG_TAMIL 0x49
918 #define LANG_TATAR 0x44
919 #define LANG_TELUGU 0x4a
920 #define LANG_THAI 0x1e
921 #define LANG_TIBETAN 0x51
922 #define LANG_TIGRIGNA 0x73
923 #define LANG_TSWANA 0x32
924 #define LANG_TURKISH 0x1f
925 #define LANG_TURKMEN 0x42
926 #define LANG_UIGHUR 0x80
927 #define LANG_UKRAINIAN 0x22
928 #define LANG_UPPER_SORBIAN 0x2e
929 #define LANG_URDU 0x20
930 #define LANG_UZBEK 0x43
931 #define LANG_VIETNAMESE 0x2a
932 #define LANG_WELSH 0x52
933 #define LANG_WOLOF 0x88
934 #define LANG_XHOSA 0x34
935 #define LANG_YAKUT 0x85
937 #define LANG_YORUBA 0x6a
938 #define LANG_ZULU 0x35