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>
38 /* Default to strict */
45 /* Pseudo Modifiers for Input Parameters */
67 /* Constant modifier */
82 #define NULL ((void *)0)
83 #define NULL64 ((void * POINTER_64)0)
87 #define ARGUMENT_PRESENT(ArgumentPointer) \
88 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
91 #define FASTCALL __stdcall
92 #elif defined(_M_IX86)
93 #define FASTCALL __fastcall
98 /* min/max helper macros */
101 # define min(a,b) (((a) < (b)) ? (a) : (b))
104 # define max(a,b) (((a) > (b)) ? (a) : (b))
106 #endif /* NOMINMAX */
108 /* Tell windef.h that we have defined some basic types */
111 /* Defines the "size" of an any-size array */
112 #ifndef ANYSIZE_ARRAY
113 #define ANYSIZE_ARRAY 1
116 /* Helper macro to enable gcc's extension. */
117 #ifndef __GNU_EXTENSION
119 #define __GNU_EXTENSION __extension__
121 #define __GNU_EXTENSION
123 #endif /* __GNU_EXTENSION */
125 #ifndef DUMMYUNIONNAME
126 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
127 #define _ANONYMOUS_UNION
128 #define _UNION_NAME(x) x
129 #define DUMMYUNIONNAME u
130 #define DUMMYUNIONNAME1 u1
131 #define DUMMYUNIONNAME2 u2
132 #define DUMMYUNIONNAME3 u3
133 #define DUMMYUNIONNAME4 u4
134 #define DUMMYUNIONNAME5 u5
135 #define DUMMYUNIONNAME6 u6
136 #define DUMMYUNIONNAME7 u7
137 #define DUMMYUNIONNAME8 u8
138 #define DUMMYUNIONNAME9 u9
140 #define _ANONYMOUS_UNION __GNU_EXTENSION
141 #define _UNION_NAME(x)
142 #define DUMMYUNIONNAME
143 #define DUMMYUNIONNAME1
144 #define DUMMYUNIONNAME2
145 #define DUMMYUNIONNAME3
146 #define DUMMYUNIONNAME4
147 #define DUMMYUNIONNAME5
148 #define DUMMYUNIONNAME6
149 #define DUMMYUNIONNAME7
150 #define DUMMYUNIONNAME8
151 #define DUMMYUNIONNAME9
152 #endif /* NONAMELESSUNION */
153 #endif /* !DUMMYUNIONNAME */
155 #ifndef DUMMYSTRUCTNAME
156 #if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
157 #define _ANONYMOUS_STRUCT
158 #define _STRUCT_NAME(x) x
159 #define DUMMYSTRUCTNAME s
160 #define DUMMYSTRUCTNAME1 s1
161 #define DUMMYSTRUCTNAME2 s2
162 #define DUMMYSTRUCTNAME3 s3
163 #define DUMMYSTRUCTNAME4 s4
164 #define DUMMYSTRUCTNAME5 s5
166 #define _ANONYMOUS_STRUCT __GNU_EXTENSION
167 #define _STRUCT_NAME(x)
168 #define DUMMYSTRUCTNAME
169 #define DUMMYSTRUCTNAME1
170 #define DUMMYSTRUCTNAME2
171 #define DUMMYSTRUCTNAME3
172 #define DUMMYSTRUCTNAME4
173 #define DUMMYSTRUCTNAME5
174 #endif /* NONAMELESSUNION */
175 #endif /* DUMMYSTRUCTNAME */
177 #if defined(STRICT_GS_ENABLED)
178 #pragma strict_gs_check(push, on)
181 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
182 #define ALIGNMENT_MACHINE
183 #define UNALIGNED __unaligned
185 #define UNALIGNED64 __unaligned
190 #undef ALIGNMENT_MACHINE
195 #if defined(_WIN64) || defined(_M_ALPHA)
196 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
197 #define MEMORY_ALLOCATION_ALIGNMENT 16
199 #define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
200 #define MEMORY_ALLOCATION_ALIGNMENT 8
203 /* C99 restrict support */
204 #if defined(ENABLE_RESTRICTED) && defined(_M_MRX000) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
205 #define RESTRICTED_POINTER __restrict
207 #define RESTRICTED_POINTER
210 /* Returns the base address of a structure from a structure member */
211 #ifndef CONTAINING_RECORD
212 #define CONTAINING_RECORD(address, type, field) \
213 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
216 /* Returns the byte offset of the specified structure's member */
218 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
220 #define FIELD_OFFSET(Type, Field) ((LONG)__builtin_offsetof(Type, Field))
221 #endif /* __GNUC__ */
223 /* Returns the type's alignment */
224 #if defined(_MSC_VER)
225 #define TYPE_ALIGNMENT(t) __alignof(t)
227 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
228 #endif /* _MSC_VER */
230 #if defined(_AMD64_) || defined(_X86_)
231 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG)
232 #elif defined(_IA64_) || defined(_ARM_)
233 #define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG))
235 #error "unknown architecture"
239 #define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(ULONG)
243 #define EXTERN_C extern "C"
245 #define EXTERN_C extern
246 #endif /* __cplusplus */
248 #define NTAPI __stdcall
250 #ifndef STDMETHODCALLTYPE
251 #define STDMETHODCALLTYPE __stdcall
252 #define STDMETHODVCALLTYPE __cdecl
253 #define STDAPICALLTYPE __stdcall
254 #define STDAPIVCALLTYPE __cdecl
255 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
256 #define STDAPI_(t) EXTERN_C t STDAPICALLTYPE
257 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
258 #define STDMETHODIMP_(t) t STDMETHODCALLTYPE
259 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
260 #define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE
261 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
262 #define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE
263 #endif /* !STDMETHODCALLTYPE */
265 #define STDOVERRIDEMETHODIMP __override STDMETHODIMP
266 #define STDOVERRIDEMETHODIMP_(t) __override STDMETHODIMP_(t)
267 #define IFACEMETHODIMP __override STDMETHODIMP
268 #define IFACEMETHODIMP_(t) __override STDMETHODIMP_(t)
269 #define STDOVERRIDEMETHODIMPV __override STDMETHODIMPV
270 #define STDOVERRIDEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
271 #define IFACEMETHODIMPV __override STDMETHODIMPV
272 #define IFACEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
274 /* Import and Export Specifiers */
276 /* Done the same way as in windef.h for now */
277 #define DECLSPEC_IMPORT __declspec(dllimport) // MIDL?
278 #define DECLSPEC_NORETURN __declspec(noreturn)
280 #ifndef DECLSPEC_ADDRSAFE
281 #if defined(_MSC_VER) && (defined(_M_ALPHA) || defined(_M_AXP64))
282 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
284 #define DECLSPEC_ADDRSAFE
286 #endif /* DECLSPEC_ADDRSAFE */
288 #ifndef DECLSPEC_NOTHROW
289 #if !defined(MIDL_PASS)
290 #define DECLSPEC_NOTHROW __declspec(nothrow)
292 #define DECLSPEC_NOTHROW
294 #endif /* DECLSPEC_NOTHROW */
297 #if defined(_MSC_VER)
298 #define NOP_FUNCTION __noop
300 #define NOP_FUNCTION (void)0
302 #endif /* NOP_FUNCTION */
304 #if !defined(_NTSYSTEM_)
305 #define NTSYSAPI DECLSPEC_IMPORT
306 #define NTSYSCALLAPI DECLSPEC_IMPORT
309 #if defined(_NTDLLBUILD_)
312 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
314 #endif /* _NTSYSTEM_ */
318 #if defined(_MSC_VER)
319 #define FORCEINLINE __forceinline
320 #elif ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
321 #define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
323 #define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
325 #endif /* FORCEINLINE */
327 #ifndef DECLSPEC_NOINLINE
328 #if (_MSC_VER >= 1300)
329 #define DECLSPEC_NOINLINE __declspec(noinline)
330 #elif defined(__GNUC__)
331 #define DECLSPEC_NOINLINE __attribute__((noinline))
333 #define DECLSPEC_NOINLINE
335 #endif /* DECLSPEC_NOINLINE */
337 #if !defined(_M_CEE_PURE)
338 #define NTAPI_INLINE NTAPI
341 #endif /* _M_CEE_PURE */
343 /* Use to specify structure alignment. Note: VS and GCC behave slightly
344 different. Therefore it is important to stick to the following rules:
345 - If you want a struct to be aligned, put DECLSPEC_ALIGN after "struct":
346 "typedef struct DECLSPEC_ALIGN(16) _FOO { ... } FOO, *PFOO;"
347 _alignof(PFOO) is sizeof(void*) here as usual.
348 - If you don't want the struct, but only the typedef to be aligned,
349 use an extra typedef.
351 typedef DECLSPEC_ALIGN(16) struct _BAR BAR, *ALIGNEDPBAR;
352 _alignof(ALIGNEDPBAR) is 16 now! */
353 #ifndef DECLSPEC_ALIGN
354 #if defined(_MSC_VER) && !defined(MIDL_PASS)
355 #define DECLSPEC_ALIGN(x) __declspec(align(x))
356 #elif defined(__GNUC__)
357 #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
359 #define DECLSPEC_ALIGN(x)
361 #endif /* DECLSPEC_ALIGN */
363 #ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
364 #if defined(_AMD64_) || defined(_X86_)
365 #define SYSTEM_CACHE_ALIGNMENT_SIZE 64
367 #define SYSTEM_CACHE_ALIGNMENT_SIZE 128
369 #endif /* SYSTEM_CACHE_ALIGNMENT_SIZE */
371 #ifndef DECLSPEC_CACHEALIGN
372 #define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
373 #endif /* DECLSPEC_CACHEALIGN */
375 #ifndef DECLSPEC_UUID
376 #if defined(_MSC_VER) && defined(__cplusplus)
377 #define DECLSPEC_UUID(x) __declspec(uuid(x))
379 #define DECLSPEC_UUID(x)
381 #endif /* DECLSPEC_UUID */
383 #ifndef DECLSPEC_NOVTABLE
384 #if defined(_MSC_VER) && defined(__cplusplus)
385 #define DECLSPEC_NOVTABLE __declspec(novtable)
387 #define DECLSPEC_NOVTABLE
389 #endif /* DECLSPEC_NOVTABLE */
391 #ifndef DECLSPEC_SELECTANY
392 #if defined(_MSC_VER) || defined(__GNUC__)
393 #define DECLSPEC_SELECTANY __declspec(selectany)
395 #define DECLSPEC_SELECTANY
397 #endif /* DECLSPEC_SELECTANY */
399 #ifndef DECLSPEC_DEPRECATED
400 #if (defined(_MSC_VER) || defined(__GNUC__)) && !defined(MIDL_PASS)
401 #define DECLSPEC_DEPRECATED __declspec(deprecated)
402 #define DEPRECATE_SUPPORTED
404 #define DECLSPEC_DEPRECATED
405 #undef DEPRECATE_SUPPORTED
407 #endif /* DECLSPEC_DEPRECATED */
409 #ifdef DEPRECATE_DDK_FUNCTIONS
411 #define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
412 #ifdef DEPRECATE_SUPPORTED
413 #define PRAGMA_DEPRECATED_DDK 1
416 #define DECLSPEC_DEPRECATED_DDK
417 #define PRAGMA_DEPRECATED_DDK 1
420 #define DECLSPEC_DEPRECATED_DDK
421 #define PRAGMA_DEPRECATED_DDK 0
422 #endif /* DEPRECATE_DDK_FUNCTIONS */
424 /* Use to silence unused variable warnings when it is intentional */
425 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
426 #define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
427 #define DBG_UNREFERENCED_PARAMETER(P) {(P)=(P);}
428 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
432 typedef void * POINTER_64 PVOID64
;
435 typedef void *HANDLE
, **PHANDLE
;;
437 #define DECLARE_HANDLE(n) typedef struct n##__{int unused;} *n
439 #define DECLARE_HANDLE(n) typedef HANDLE n
442 /* Upper-Case Versions of Some Standard C Types */
448 #if defined(__ROS_LONG64__) && !defined(_M_AMD64)
454 #if !defined(MIDL_PASS)
456 #endif /* !MIDL_PASS */
460 typedef unsigned char UCHAR
, *PUCHAR
;
461 typedef unsigned short USHORT
, *PUSHORT
;
462 typedef unsigned long ULONG
, *PULONG
;
464 typedef double DOUBLE
;
467 typedef SHORT
*PSHORT
;
471 typedef unsigned char FCHAR
;
472 typedef unsigned short FSHORT
;
473 typedef unsigned long FLONG
;
475 typedef unsigned char BOOLEAN
, *PBOOLEAN
;
476 typedef ULONG LOGICAL
, *PLOGICAL
;
477 typedef _Return_type_success_(return >= 0) LONG NTSTATUS
, *PNTSTATUS
;;
478 typedef signed char SCHAR
, *PSCHAR
;
480 #ifndef _HRESULT_DEFINED
481 #define _HRESULT_DEFINED
482 typedef _Return_type_success_(return >= 0) LONG HRESULT
;
483 #endif /* _HRESULT_DEFINED */
487 __GNU_EXTENSION
typedef __int64 LONGLONG
, *PLONGLONG
;
488 __GNU_EXTENSION
typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
490 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
492 /* Update Sequence Number */
493 typedef LONGLONG USN
;
495 /* ANSI (Multi-byte Character) types */
496 typedef CHAR
*PCHAR
, *LPCH
, *PCH
, *PNZCH
;
497 typedef CONST CHAR
*LPCCH
, *PCCH
, *PCNZCH
;
498 typedef _Null_terminated_ CHAR
*NPSTR
, *LPSTR
, *PSTR
;
499 typedef _Null_terminated_ PSTR
*PZPSTR
;
500 typedef _Null_terminated_ CONST PSTR
*PCZPSTR
;
501 typedef _Null_terminated_ CONST CHAR
*LPCSTR
, *PCSTR
;
502 typedef _Null_terminated_ PCSTR
*PZPCSTR
;
504 typedef _NullNull_terminated_ CHAR
*PZZSTR
;
505 typedef _NullNull_terminated_ CONST CHAR
*PCZZSTR
;
507 /* Pointer to an Asciiz string */
508 typedef _Null_terminated_ CHAR
*PSZ
;
509 typedef _Null_terminated_ CONST
char *PCSZ
;
511 /* UNICODE (Wide Character) types */
512 typedef wchar_t WCHAR
;
513 typedef WCHAR
*PWCHAR
, *LPWCH
, *PWCH
;
514 typedef CONST WCHAR
*LPCWCH
, *PCWCH
;
515 typedef _Null_terminated_ WCHAR
*NWPSTR
, *LPWSTR
, *PWSTR
;
516 typedef _Null_terminated_ PWSTR
*PZPWSTR
;
517 typedef _Null_terminated_ CONST PWSTR
*PCZPWSTR
;
518 typedef _Null_terminated_ WCHAR UNALIGNED
*LPUWSTR
, *PUWSTR
;
519 typedef _Null_terminated_ CONST WCHAR
*LPCWSTR
, *PCWSTR
;
520 typedef _Null_terminated_ PCWSTR
*PZPCWSTR
;
521 typedef _Null_terminated_ CONST WCHAR UNALIGNED
*LPCUWSTR
, *PCUWSTR
;
523 typedef _NullNull_terminated_ WCHAR
*PZZWSTR
;
524 typedef _NullNull_terminated_ CONST WCHAR
*PCZZWSTR
;
525 typedef _NullNull_terminated_ WCHAR UNALIGNED
*PUZZWSTR
;
526 typedef _NullNull_terminated_ CONST WCHAR UNALIGNED
*PCUZZWSTR
;
528 typedef WCHAR
*PNZWCH
;
529 typedef CONST WCHAR
*PCNZWCH
;
530 typedef WCHAR UNALIGNED
*PUNZWCH
;
531 typedef CONST WCHAR UNALIGNED
*PCUNZWCH
;
533 #if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
534 typedef CONST WCHAR
*LPCWCHAR
, *PCWCHAR
;
535 typedef CONST WCHAR UNALIGNED
*LPCUWCHAR
, *PCUWCHAR
;
536 typedef unsigned long UCSCHAR
, *PUCSCHAR
, *PUCSSTR
;
537 typedef const UCSCHAR
*PCUCSCHAR
, *PCUCSSTR
;
538 typedef UCSCHAR UNALIGNED
*PUUCSCHAR
, *PUUCSSTR
;
539 typedef const UCSCHAR UNALIGNED
*PCUUCSCHAR
, *PCUUCSSTR
;
540 #define UCSCHAR_INVALID_CHARACTER (0xffffffff)
541 #define MIN_UCSCHAR (0)
542 #define MAX_UCSCHAR (0x0010FFFF)
543 #endif /* _WIN32_WINNT >= 0x0600 */
547 #ifndef _TCHAR_DEFINED
548 typedef WCHAR TCHAR
, *PTCHAR
;
549 typedef WCHAR TUCHAR
, *PTUCHAR
;
550 #define _TCHAR_DEFINED
551 #endif /* !_TCHAR_DEFINED */
553 typedef LPWCH LPTCH
, PTCH
;
554 typedef LPCWCH LPCTCH
, PCTCH
;
555 typedef LPWSTR PTSTR
, LPTSTR
;
556 typedef LPCWSTR PCTSTR
, LPCTSTR
;
557 typedef LPUWSTR PUTSTR
, LPUTSTR
;
558 typedef LPCUWSTR PCUTSTR
, LPCUTSTR
;
560 typedef PZZWSTR PZZTSTR
;
561 typedef PCZZWSTR PCZZTSTR
;
562 typedef PUZZWSTR PUZZTSTR
;
563 typedef PCUZZWSTR PCUZZTSTR
;
564 typedef PZPWSTR PZPTSTR
;
565 typedef PNZWCH PNZTCH
;
566 typedef PCNZWCH PCNZTCH
;
567 typedef PUNZWCH PUNZTCH
;
568 typedef PCUNZWCH PCUNZTCH
;
569 #define __TEXT(quote) L##quote
573 #ifndef _TCHAR_DEFINED
574 typedef char TCHAR
, *PTCHAR
;
575 typedef unsigned char TUCHAR
, *PTUCHAR
;
576 #define _TCHAR_DEFINED
577 #endif /* !_TCHAR_DEFINED */
578 typedef LPCH LPTCH
, PTCH
;
579 typedef LPCCH LPCTCH
, PCTCH
;
580 typedef LPSTR PTSTR
, LPTSTR
, PUTSTR
, LPUTSTR
;
581 typedef LPCSTR PCTSTR
, LPCTSTR
, PCUTSTR
, LPCUTSTR
;
582 typedef PZZSTR PZZTSTR
, PUZZTSTR
;
583 typedef PCZZSTR PCZZTSTR
, PCUZZTSTR
;
584 typedef PZPSTR PZPTSTR
;
585 typedef PNZCH PNZTCH
, PUNZTCH
;
586 typedef PCNZCH PCNZTCH
, PCUNZTCH
;
587 #define __TEXT(quote) quote
591 #define TEXT(quote) __TEXT(quote)
593 /* Cardinal Data Types */
595 typedef CCHAR
*PCCHAR
;
596 typedef short CSHORT
, *PCSHORT
;
597 typedef ULONG CLONG
, *PCLONG
;
599 /* NLS basics (Locale and Language Ids) */
600 typedef ULONG LCID
, *PLCID
;
601 typedef USHORT LANGID
;
603 #ifndef __COMPARTMENT_ID_DEFINED__
604 #define __COMPARTMENT_ID_DEFINED__
607 UNSPECIFIED_COMPARTMENT_ID
= 0,
608 DEFAULT_COMPARTMENT_ID
609 } COMPARTMENT_ID
, *PCOMPARTMENT_ID
;
610 #endif /* __COMPARTMENT_ID_DEFINED__ */
612 #ifndef __OBJECTID_DEFINED
613 #define __OBJECTID_DEFINED
614 typedef struct _OBJECTID
{
618 #endif /* __OBJECTID_DEFINED */
621 #pragma warning(push)
622 #pragma warning(disable:4201) // nameless struct / union
633 typedef FLOAT128
*PFLOAT128
;
635 /* Large Integer Unions */
636 #if defined(MIDL_PASS)
637 typedef struct _LARGE_INTEGER
{
639 typedef union _LARGE_INTEGER
{
640 _ANONYMOUS_STRUCT
struct
650 #endif /* MIDL_PASS */
652 } LARGE_INTEGER
, *PLARGE_INTEGER
;
654 #if defined(MIDL_PASS)
655 typedef struct _ULARGE_INTEGER
{
657 typedef union _ULARGE_INTEGER
{
658 _ANONYMOUS_STRUCT
struct
668 #endif /* MIDL_PASS */
670 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
673 #pragma warning(pop) /* disable:4201 */
676 /* Locally Unique Identifier */
683 #define APPLICATION_ERROR_MASK 0x20000000
684 #define ERROR_SEVERITY_SUCCESS 0x00000000
685 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
686 #define ERROR_SEVERITY_WARNING 0x80000000
687 #define ERROR_SEVERITY_ERROR 0xC0000000
689 /* Native API Return Value Macros */
690 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
691 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
692 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
693 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
695 #define ANSI_NULL ((CHAR)0)
696 #define UNICODE_NULL ((WCHAR)0)
697 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
698 #define UNICODE_STRING_MAX_CHARS (32767)
700 /* Doubly Linked Lists */
701 typedef struct _LIST_ENTRY
{
702 struct _LIST_ENTRY
*Flink
;
703 struct _LIST_ENTRY
*Blink
;
704 } LIST_ENTRY
, *PLIST_ENTRY
, *RESTRICTED_POINTER PRLIST_ENTRY
;
706 typedef struct LIST_ENTRY32
{
709 } LIST_ENTRY32
, *PLIST_ENTRY32
;
711 typedef struct LIST_ENTRY64
{
714 } LIST_ENTRY64
, *PLIST_ENTRY64
;
716 /* Singly Linked Lists */
717 typedef struct _SINGLE_LIST_ENTRY
{
718 struct _SINGLE_LIST_ENTRY
*Next
;
719 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
721 typedef struct _SINGLE_LIST_ENTRY32
{
723 } SINGLE_LIST_ENTRY32
, *PSINGLE_LIST_ENTRY32
;
725 typedef struct _PROCESSOR_NUMBER
{
729 } PROCESSOR_NUMBER
, *PPROCESSOR_NUMBER
;
731 #define ALL_PROCESSOR_GROUPS 0xffff
735 _Function_class_(EXCEPTION_ROUTINE
)
736 EXCEPTION_DISPOSITION
739 _Inout_
struct _EXCEPTION_RECORD
*ExceptionRecord
,
740 _In_ PVOID EstablisherFrame
,
741 _Inout_
struct _CONTEXT
*ContextRecord
,
742 _In_ PVOID DispatcherContext
);
744 typedef EXCEPTION_ROUTINE
*PEXCEPTION_ROUTINE
;
746 typedef struct _GROUP_AFFINITY
{
750 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
754 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
755 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
756 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
757 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
759 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
760 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
762 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
763 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
765 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
768 #define RTL_NUMBER_OF_V2(A) \
769 (({ int _check_array_type[__builtin_types_compatible_p(typeof(A), typeof(&A[0])) ? -1 : 1]; (void)_check_array_type; }), \
771 #elif defined(__cplusplus)
773 template <typename T
, size_t N
>
774 static char (& SAFE_RTL_NUMBER_OF(T (&)[N
]))[N
];
776 #define RTL_NUMBER_OF_V2(A) sizeof(SAFE_RTL_NUMBER_OF(A))
778 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
781 #ifdef ENABLE_RTL_NUMBER_OF_V2
782 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
784 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
787 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
788 #define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
790 #define RTL_NUMBER_OF_FIELD(type, field) \
791 (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))
793 #define RTL_PADDING_BETWEEN_FIELDS(type, field1, field2) \
794 ((FIELD_OFFSET(type, field2) > FIELD_OFFSET(type, field1)) \
795 ? (FIELD_OFFSET(type, field2) - FIELD_OFFSET(type, field1) - RTL_FIELD_SIZE(type, field1)) \
796 : (FIELD_OFFSET(type, field1) - FIELD_OFFSET(type, field2) - RTL_FIELD_SIZE(type, field2)))
798 #if defined(__cplusplus)
799 #define RTL_CONST_CAST(type) const_cast<type>
801 #define RTL_CONST_CAST(type) (type)
805 #define DEFINE_ENUM_FLAG_OPERATORS(_ENUMTYPE) \
807 inline _ENUMTYPE operator|(_ENUMTYPE a, _ENUMTYPE b) { return _ENUMTYPE(((int)a) | ((int)b)); } \
808 inline _ENUMTYPE &operator|=(_ENUMTYPE &a, _ENUMTYPE b) { return (_ENUMTYPE &)(((int &)a) |= ((int)b)); } \
809 inline _ENUMTYPE operator&(_ENUMTYPE a, _ENUMTYPE b) { return _ENUMTYPE(((int)a) & ((int)b)); } \
810 inline _ENUMTYPE &operator&=(_ENUMTYPE &a, _ENUMTYPE b) { return (_ENUMTYPE &)(((int &)a) &= ((int)b)); } \
811 inline _ENUMTYPE operator~(_ENUMTYPE a) { return _ENUMTYPE(~((int)a)); } \
812 inline _ENUMTYPE operator^(_ENUMTYPE a, _ENUMTYPE b) { return _ENUMTYPE(((int)a) ^ ((int)b)); } \
813 inline _ENUMTYPE &operator^=(_ENUMTYPE &a, _ENUMTYPE b) { return (_ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
816 #define DEFINE_ENUM_FLAG_OPERATORS(_ENUMTYPE)
819 #define COMPILETIME_OR_2FLAGS(a,b) ((UINT)(a)|(UINT)(b))
820 #define COMPILETIME_OR_3FLAGS(a,b,c) ((UINT)(a)|(UINT)(b)|(UINT)(c))
821 #define COMPILETIME_OR_4FLAGS(a,b,c,d) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d))
822 #define COMPILETIME_OR_5FLAGS(a,b,c,d,e) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)|(UINT)(e))
827 #define MINSHORT 0x8000
828 #define MAXSHORT 0x7fff
829 #define MINLONG 0x80000000
830 #define MAXLONG 0x7fffffff
831 #define MAXUCHAR 0xff
832 #define MAXUSHORT 0xffff
833 #define MAXULONG 0xffffffff
834 #define MAXLONGLONG (0x7fffffffffffffffLL)
836 /* 32 to 64 bit multiplication. GCC is really bad at optimizing the native math */
837 #if defined(_M_IX86) && defined(__GNUC__) && \
838 !defined(MIDL_PASS)&& !defined(RC_INVOKED) && !defined(_M_CEE_PURE)
839 #define Int32x32To64(a,b) __emul(a,b)
840 #define UInt32x32To64(a,b) __emulu(a,b)
842 #define Int32x32To64(a,b) (((__int64)(long)(a))*((__int64)(long)(b)))
843 #define UInt32x32To64(a,b) ((unsigned __int64)(unsigned int)(a)*(unsigned __int64)(unsigned int)(b))
846 #if defined(MIDL_PASS)|| defined(RC_INVOKED) || defined(_M_CEE_PURE) || defined(_M_ARM)
847 /* Use native math */
848 #define Int64ShllMod32(a,b) ((unsigned __int64)(a)<<(b))
849 #define Int64ShraMod32(a,b) (((__int64)(a))>>(b))
850 #define Int64ShrlMod32(a,b) (((unsigned __int64)(a))>>(b))
853 #define Int64ShllMod32(a,b) __ll_lshift(a,b)
854 #define Int64ShraMod32(a,b) __ll_rshift(a,b)
855 #define Int64ShrlMod32(a,b) __ull_rshift(a,b)
858 #define RotateLeft32 _rotl
859 #define RotateLeft64 _rotl64
860 #define RotateRight32 _rotr
861 #define RotateRight64 _rotr64
863 #if defined(_M_AMD64)
864 #define RotateLeft8 _rotl8
865 #define RotateLeft16 _rotl16
866 #define RotateRight8 _rotr8
867 #define RotateRight16 _rotr16
868 #endif /* _M_AMD64 */
870 /* C_ASSERT Definition */
871 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
873 /* Eliminate Microsoft C/C++ compiler warning 4715 */
874 #if defined(_MSC_VER)
875 #define DEFAULT_UNREACHABLE default: __assume(0)
876 #elif defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
877 #define DEFAULT_UNREACHABLE default: __builtin_unreachable()
879 #define DEFAULT_UNREACHABLE default: break
882 #define VER_WORKSTATION_NT 0x40000000
883 #define VER_SERVER_NT 0x80000000
884 #define VER_SUITE_SMALLBUSINESS 0x00000001
885 #define VER_SUITE_ENTERPRISE 0x00000002
886 #define VER_SUITE_BACKOFFICE 0x00000004
887 #define VER_SUITE_COMMUNICATIONS 0x00000008
888 #define VER_SUITE_TERMINAL 0x00000010
889 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
890 #define VER_SUITE_EMBEDDEDNT 0x00000040
891 #define VER_SUITE_DATACENTER 0x00000080
892 #define VER_SUITE_SINGLEUSERTS 0x00000100
893 #define VER_SUITE_PERSONAL 0x00000200
894 #define VER_SUITE_BLADE 0x00000400
895 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
896 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
897 #define VER_SUITE_STORAGE_SERVER 0x00002000
898 #define VER_SUITE_COMPUTE_SERVER 0x00004000
899 #define VER_SUITE_WH_SERVER 0x00008000
902 #define PRODUCT_UNDEFINED 0x00000000
903 #define PRODUCT_ULTIMATE 0x00000001
904 #define PRODUCT_HOME_BASIC 0x00000002
905 #define PRODUCT_HOME_PREMIUM 0x00000003
906 #define PRODUCT_ENTERPRISE 0x00000004
907 #define PRODUCT_HOME_BASIC_N 0x00000005
908 #define PRODUCT_BUSINESS 0x00000006
909 #define PRODUCT_STANDARD_SERVER 0x00000007
910 #define PRODUCT_DATACENTER_SERVER 0x00000008
911 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
912 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
913 #define PRODUCT_STARTER 0x0000000B
914 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
915 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
916 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
917 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
918 #define PRODUCT_BUSINESS_N 0x00000010
919 #define PRODUCT_WEB_SERVER 0x00000011
920 #define PRODUCT_CLUSTER_SERVER 0x00000012
921 #define PRODUCT_HOME_SERVER 0x00000013
922 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
923 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
924 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
925 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
926 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
927 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019
928 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
929 #define PRODUCT_ENTERPRISE_N 0x0000001B
930 #define PRODUCT_ULTIMATE_N 0x0000001C
931 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
932 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
933 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
934 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
935 #define PRODUCT_SERVER_FOUNDATION 0x00000021
936 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
937 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
938 #define PRODUCT_STANDARD_SERVER_V 0x00000024
939 #define PRODUCT_DATACENTER_SERVER_V 0x00000025
940 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
941 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
942 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
943 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
944 #define PRODUCT_HYPERV 0x0000002A
945 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
946 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
947 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
948 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
949 #define PRODUCT_STARTER_N 0x0000002F
950 #define PRODUCT_PROFESSIONAL 0x00000030
951 #define PRODUCT_PROFESSIONAL_N 0x00000031
952 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
953 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
954 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
955 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
956 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
957 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
958 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
959 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
960 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
961 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
962 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
963 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
964 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
965 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
966 #define PRODUCT_EMBEDDED 0x00000041
967 #define PRODUCT_STARTER_E 0x00000042
968 #define PRODUCT_HOME_BASIC_E 0x00000043
969 #define PRODUCT_HOME_PREMIUM_E 0x00000044
970 #define PRODUCT_PROFESSIONAL_E 0x00000045
971 #define PRODUCT_ENTERPRISE_E 0x00000046
972 #define PRODUCT_ULTIMATE_E 0x00000047
973 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
974 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
975 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
976 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
977 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
978 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
979 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
980 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
981 #define PRODUCT_THINPC 0x00000057
982 #define PRODUCT_EMBEDDED_A 0x00000058
983 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
984 #define PRODUCT_EMBEDDED_E 0x0000005A
985 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
986 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
987 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
988 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
989 #define PRODUCT_CORE_ARM 0x00000061
990 #define PRODUCT_CORE_N 0x00000062
991 #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063
992 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064
993 #define PRODUCT_CORE 0x00000065
994 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
995 #define PRODUCT_UNLICENSED 0xABCDABCD
998 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
999 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
1000 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
1001 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
1002 ((ULONG)((USHORT)(lgid)))))
1003 #define MAKESORTLCID(lgid, srtid, ver) \
1004 ((ULONG)((MAKELCID(lgid, srtid)) | \
1005 (((ULONG)((USHORT)(ver))) << 20)))
1006 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
1007 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
1008 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
1010 #define NLS_VALID_LOCALE_MASK 0x000fffff
1011 #define LOCALE_NAME_MAX_LENGTH 85
1013 /* Primary language IDs. */
1014 #define LANG_NEUTRAL 0x00
1015 #define LANG_INVARIANT 0x7f
1016 #define LANG_AFRIKAANS 0x36
1017 #define LANG_ALBANIAN 0x1c
1018 #define LANG_ALSATIAN 0x84
1019 #define LANG_AMHARIC 0x5e
1020 #define LANG_ARABIC 0x01
1021 #define LANG_ARMENIAN 0x2b
1022 #define LANG_ASSAMESE 0x4d
1023 #define LANG_AZERI 0x2c
1024 #define LANG_AZERBAIJANI 0x2c
1025 #define LANG_BANGLA 0x45
1026 #define LANG_BASHKIR 0x6d
1027 #define LANG_BASQUE 0x2d
1028 #define LANG_BELARUSIAN 0x23
1029 #define LANG_BENGALI 0x45
1030 #define LANG_BOSNIAN 0x1a
1031 #define LANG_BOSNIAN_NEUTRAL 0x781a
1032 #define LANG_BRETON 0x7e
1033 #define LANG_BULGARIAN 0x02
1034 #define LANG_CATALAN 0x03
1035 #define LANG_CENTRAL_KURDISH 0x92
1036 #define LANG_CHEROKEE 0x5c
1037 #define LANG_CHINESE 0x04
1038 #define LANG_CHINESE_SIMPLIFIED 0x04
1039 #define LANG_CHINESE_TRADITIONAL 0x7c04
1040 #define LANG_CORSICAN 0x83
1041 #define LANG_CROATIAN 0x1a
1042 #define LANG_CZECH 0x05
1043 #define LANG_DANISH 0x06
1044 #define LANG_DARI 0x8c
1045 #define LANG_DIVEHI 0x65
1046 #define LANG_DUTCH 0x13
1047 #define LANG_ENGLISH 0x09
1048 #define LANG_ESTONIAN 0x25
1049 #define LANG_FAEROESE 0x38
1050 #define LANG_FARSI 0x29
1051 #define LANG_FILIPINO 0x64
1052 #define LANG_FINNISH 0x0b
1053 #define LANG_FRENCH 0x0c
1054 #define LANG_FRISIAN 0x62
1055 #define LANG_FULAH 0x67
1056 #define LANG_GALICIAN 0x56
1057 #define LANG_GEORGIAN 0x37
1058 #define LANG_GERMAN 0x07
1059 #define LANG_GREEK 0x08
1060 #define LANG_GREENLANDIC 0x6f
1061 #define LANG_GUJARATI 0x47
1062 #define LANG_HAUSA 0x68
1063 #define LANG_HAWAIIAN 0x75
1064 #define LANG_HEBREW 0x0d
1065 #define LANG_HINDI 0x39
1066 #define LANG_HUNGARIAN 0x0e
1067 #define LANG_ICELANDIC 0x0f
1068 #define LANG_IGBO 0x70
1069 #define LANG_INDONESIAN 0x21
1070 #define LANG_INUKTITUT 0x5d
1071 #define LANG_IRISH 0x3c
1072 #define LANG_ITALIAN 0x10
1073 #define LANG_JAPANESE 0x11
1074 #define LANG_KANNADA 0x4b
1075 #define LANG_KASHMIRI 0x60
1076 #define LANG_KAZAK 0x3f
1077 #define LANG_KHMER 0x53
1078 #define LANG_KICHE 0x86
1079 #define LANG_KINYARWANDA 0x87
1080 #define LANG_KONKANI 0x57
1081 #define LANG_KOREAN 0x12
1082 #define LANG_KYRGYZ 0x40
1083 #define LANG_LAO 0x54
1084 #define LANG_LATVIAN 0x26
1085 #define LANG_LITHUANIAN 0x27
1086 #define LANG_LOWER_SORBIAN 0x2e
1087 #define LANG_LUXEMBOURGISH 0x6e
1088 #define LANG_MACEDONIAN 0x2f
1089 #define LANG_MALAY 0x3e
1090 #define LANG_MALAYALAM 0x4c
1091 #define LANG_MALTESE 0x3a
1092 #define LANG_MANIPURI 0x58
1093 #define LANG_MAORI 0x81
1094 #define LANG_MAPUDUNGUN 0x7a
1095 #define LANG_MARATHI 0x4e
1096 #define LANG_MOHAWK 0x7c
1097 #define LANG_MONGOLIAN 0x50
1098 #define LANG_NEPALI 0x61
1099 #define LANG_NORWEGIAN 0x14
1100 #define LANG_OCCITAN 0x82
1101 #define LANG_ODIA 0x48
1102 #define LANG_ORIYA 0x48
1103 #define LANG_PASHTO 0x63
1104 #define LANG_PERSIAN 0x29
1105 #define LANG_POLISH 0x15
1106 #define LANG_PORTUGUESE 0x16
1107 #define LANG_PULAR 0x67
1108 #define LANG_PUNJABI 0x46
1109 #define LANG_QUECHUA 0x6b
1110 #define LANG_ROMANIAN 0x18
1111 #define LANG_ROMANSH 0x17
1112 #define LANG_RUSSIAN 0x19
1113 #define LANG_SAKHA 0x85
1114 #define LANG_SAMI 0x3b
1115 #define LANG_SANSKRIT 0x4f
1116 #define LANG_SCOTTISH_GAELIC 0x91
1117 #define LANG_SERBIAN 0x1a
1118 #define LANG_SERBIAN_NEUTRAL 0x7c1a
1119 #define LANG_SINDHI 0x59
1120 #define LANG_SINHALESE 0x5b
1121 #define LANG_SLOVAK 0x1b
1122 #define LANG_SLOVENIAN 0x24
1123 #define LANG_SOTHO 0x6c
1124 #define LANG_SPANISH 0x0a
1125 #define LANG_SWAHILI 0x41
1126 #define LANG_SWEDISH 0x1d
1127 #define LANG_SYRIAC 0x5a
1128 #define LANG_TAJIK 0x28
1129 #define LANG_TAMAZIGHT 0x5f
1130 #define LANG_TAMIL 0x49
1131 #define LANG_TATAR 0x44
1132 #define LANG_TELUGU 0x4a
1133 #define LANG_THAI 0x1e
1134 #define LANG_TIBETAN 0x51
1135 #define LANG_TIGRIGNA 0x73
1136 #define LANG_TIGRINYA 0x73
1137 #define LANG_TSWANA 0x32
1138 #define LANG_TURKISH 0x1f
1139 #define LANG_TURKMEN 0x42
1140 #define LANG_UIGHUR 0x80
1141 #define LANG_UKRAINIAN 0x22
1142 #define LANG_UPPER_SORBIAN 0x2e
1143 #define LANG_URDU 0x20
1144 #define LANG_UZBEK 0x43
1145 #define LANG_VALENCIAN 0x03
1146 #define LANG_VIETNAMESE 0x2a
1147 #define LANG_WELSH 0x52
1148 #define LANG_WOLOF 0x88
1149 #define LANG_XHOSA 0x34
1150 #define LANG_YAKUT 0x85
1151 #define LANG_YI 0x78
1152 #define LANG_YORUBA 0x6a
1153 #define LANG_ZULU 0x35
1155 #define SUBLANG_NEUTRAL 0x00
1156 #define SUBLANG_DEFAULT 0x01
1157 #define SUBLANG_SYS_DEFAULT 0x02
1158 #define SUBLANG_CUSTOM_DEFAULT 0x03
1159 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1160 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1161 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1162 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1163 #define SUBLANG_ALSATIAN_FRANCE 0x01
1164 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1165 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1166 #define SUBLANG_ARABIC_IRAQ 0x02
1167 #define SUBLANG_ARABIC_EGYPT 0x03
1168 #define SUBLANG_ARABIC_LIBYA 0x04
1169 #define SUBLANG_ARABIC_ALGERIA 0x05
1170 #define SUBLANG_ARABIC_MOROCCO 0x06
1171 #define SUBLANG_ARABIC_TUNISIA 0x07
1172 #define SUBLANG_ARABIC_OMAN 0x08
1173 #define SUBLANG_ARABIC_YEMEN 0x09
1174 #define SUBLANG_ARABIC_SYRIA 0x0a
1175 #define SUBLANG_ARABIC_JORDAN 0x0b
1176 #define SUBLANG_ARABIC_LEBANON 0x0c
1177 #define SUBLANG_ARABIC_KUWAIT 0x0d
1178 #define SUBLANG_ARABIC_UAE 0x0e
1179 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1180 #define SUBLANG_ARABIC_QATAR 0x10
1181 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1182 #define SUBLANG_ASSAMESE_INDIA 0x01
1183 #define SUBLANG_AZERI_LATIN 0x01
1184 #define SUBLANG_AZERI_CYRILLIC 0x02
1185 #define SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN 0x01
1186 #define SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC 0x02
1187 #define SUBLANG_BANGLA_INDIA 0x01
1188 #define SUBLANG_BANGLA_BANGLADESH 0x02
1189 #define SUBLANG_BASHKIR_RUSSIA 0x01
1190 #define SUBLANG_BASQUE_BASQUE 0x01
1191 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1192 #define SUBLANG_BENGALI_INDIA 0x01
1193 #define SUBLANG_BENGALI_BANGLADESH 0x02
1194 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1195 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1196 #define SUBLANG_BRETON_FRANCE 0x01
1197 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1198 #define SUBLANG_CATALAN_CATALAN 0x01
1199 #define SUBLANG_CENTRAL_KURDISH_IRAQ 0x01
1200 #define SUBLANG_CHEROKEE_CHEROKEE 0x01
1201 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1202 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1203 #define SUBLANG_CHINESE_HONGKONG 0x03
1204 #define SUBLANG_CHINESE_SINGAPORE 0x04
1205 #define SUBLANG_CHINESE_MACAU 0x05
1206 #define SUBLANG_CORSICAN_FRANCE 0x01
1207 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1208 #define SUBLANG_CROATIAN_CROATIA 0x01
1209 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1210 #define SUBLANG_DANISH_DENMARK 0x01
1211 #define SUBLANG_DARI_AFGHANISTAN 0x01
1212 #define SUBLANG_DIVEHI_MALDIVES 0x01
1213 #define SUBLANG_DUTCH 0x01
1214 #define SUBLANG_DUTCH_BELGIAN 0x02
1215 #define SUBLANG_ENGLISH_US 0x01
1216 #define SUBLANG_ENGLISH_UK 0x02
1217 #define SUBLANG_ENGLISH_AUS 0x03
1218 #define SUBLANG_ENGLISH_CAN 0x04
1219 #define SUBLANG_ENGLISH_NZ 0x05
1220 #define SUBLANG_ENGLISH_EIRE 0x06
1221 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1222 #define SUBLANG_ENGLISH_JAMAICA 0x08
1223 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1224 #define SUBLANG_ENGLISH_BELIZE 0x0a
1225 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1226 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1227 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1228 #define SUBLANG_ENGLISH_INDIA 0x10
1229 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1230 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1231 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1232 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1233 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
1234 #define SUBLANG_FINNISH_FINLAND 0x01
1235 #define SUBLANG_FRENCH 0x01
1236 #define SUBLANG_FRENCH_BELGIAN 0x02
1237 #define SUBLANG_FRENCH_CANADIAN 0x03
1238 #define SUBLANG_FRENCH_SWISS 0x04
1239 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1240 #define SUBLANG_FRENCH_MONACO 0x06
1241 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
1242 #define SUBLANG_FULAH_SENEGAL 0x02
1243 #define SUBLANG_GALICIAN_GALICIAN 0x01
1244 #define SUBLANG_GEORGIAN_GEORGIA 0x01
1245 #define SUBLANG_GERMAN 0x01
1246 #define SUBLANG_GERMAN_SWISS 0x02
1247 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1248 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1249 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1250 #define SUBLANG_GREEK_GREECE 0x01
1251 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
1252 #define SUBLANG_GUJARATI_INDIA 0x01
1253 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
1254 #define SUBLANG_HAWAIIAN_US 0x01
1255 #define SUBLANG_HEBREW_ISRAEL 0x01
1256 #define SUBLANG_HINDI_INDIA 0x01
1257 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
1258 #define SUBLANG_ICELANDIC_ICELAND 0x01
1259 #define SUBLANG_IGBO_NIGERIA 0x01
1260 #define SUBLANG_INDONESIAN_INDONESIA 0x01
1261 #define SUBLANG_INUKTITUT_CANADA 0x01
1262 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
1263 #define SUBLANG_IRISH_IRELAND 0x02
1264 #define SUBLANG_ITALIAN 0x01
1265 #define SUBLANG_ITALIAN_SWISS 0x02
1266 #define SUBLANG_JAPANESE_JAPAN 0x01
1267 #define SUBLANG_KANNADA_INDIA 0x01
1268 #define SUBLANG_KASHMIRI_SASIA 0x02
1269 #define SUBLANG_KASHMIRI_INDIA 0x02
1270 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
1271 #define SUBLANG_KHMER_CAMBODIA 0x01
1272 #define SUBLANG_KICHE_GUATEMALA 0x01
1273 #define SUBLANG_KINYARWANDA_RWANDA 0x01
1274 #define SUBLANG_KONKANI_INDIA 0x01
1275 #define SUBLANG_KOREAN 0x01
1276 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
1277 #define SUBLANG_LAO_LAO 0x01
1278 #define SUBLANG_LATVIAN_LATVIA 0x01
1279 #define SUBLANG_LITHUANIAN 0x01
1280 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
1281 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
1282 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
1283 #define SUBLANG_MALAY_MALAYSIA 0x01
1284 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1285 #define SUBLANG_MALAYALAM_INDIA 0x01
1286 #define SUBLANG_MALTESE_MALTA 0x01
1287 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1288 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1289 #define SUBLANG_MARATHI_INDIA 0x01
1290 #define SUBLANG_MOHAWK_MOHAWK 0x01
1291 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1292 #define SUBLANG_MONGOLIAN_PRC 0x02
1293 #define SUBLANG_NEPALI_INDIA 0x02
1294 #define SUBLANG_NEPALI_NEPAL 0x01
1295 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1296 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1297 #define SUBLANG_OCCITAN_FRANCE 0x01
1298 #define SUBLANG_ODIA_INDIA 0x01
1299 #define SUBLANG_ORIYA_INDIA 0x01
1300 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1301 #define SUBLANG_PERSIAN_IRAN 0x01
1302 #define SUBLANG_POLISH_POLAND 0x01
1303 #define SUBLANG_PORTUGUESE 0x02
1304 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1305 #define SUBLANG_PULAR_SENEGAL 0x02
1306 #define SUBLANG_PUNJABI_INDIA 0x01
1307 #define SUBLANG_PUNJABI_PAKISTAN 0x02
1308 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1309 #define SUBLANG_QUECHUA_ECUADOR 0x02
1310 #define SUBLANG_QUECHUA_PERU 0x03
1311 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1312 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1313 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1314 #define SUBLANG_SAKHA_RUSSIA 0x01
1315 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1316 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1317 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1318 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1319 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1320 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1321 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1322 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1323 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1324 #define SUBLANG_SANSKRIT_INDIA 0x01
1325 #define SUBLANG_SCOTTISH_GAELIC 0x01
1326 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1327 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1328 #define SUBLANG_SERBIAN_MONTENEGRO_LATIN 0x0b
1329 #define SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC 0x0c
1330 #define SUBLANG_SERBIAN_SERBIA_LATIN 0x09
1331 #define SUBLANG_SERBIAN_SERBIA_CYRILLIC 0x0a
1332 #define SUBLANG_SERBIAN_CROATIA 0x01
1333 #define SUBLANG_SERBIAN_LATIN 0x02
1334 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1335 #define SUBLANG_SINDHI_INDIA 0x01
1336 #define SUBLANG_SINDHI_PAKISTAN 0x02
1337 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1338 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1339 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1340 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1341 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1342 #define SUBLANG_SPANISH 0x01
1343 #define SUBLANG_SPANISH_MEXICAN 0x02
1344 #define SUBLANG_SPANISH_MODERN 0x03
1345 #define SUBLANG_SPANISH_GUATEMALA 0x04
1346 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1347 #define SUBLANG_SPANISH_PANAMA 0x06
1348 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1349 #define SUBLANG_SPANISH_VENEZUELA 0x08
1350 #define SUBLANG_SPANISH_COLOMBIA 0x09
1351 #define SUBLANG_SPANISH_PERU 0x0a
1352 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1353 #define SUBLANG_SPANISH_ECUADOR 0x0c
1354 #define SUBLANG_SPANISH_CHILE 0x0d
1355 #define SUBLANG_SPANISH_URUGUAY 0x0e
1356 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1357 #define SUBLANG_SPANISH_BOLIVIA 0x10
1358 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1359 #define SUBLANG_SPANISH_HONDURAS 0x12
1360 #define SUBLANG_SPANISH_NICARAGUA 0x13
1361 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1362 #define SUBLANG_SPANISH_US 0x15
1363 #define SUBLANG_SWAHILI_KENYA 0x01
1364 #define SUBLANG_SWEDISH 0x01
1365 #define SUBLANG_SWEDISH_FINLAND 0x02
1366 #define SUBLANG_SYRIAC_SYRIA 0x01
1367 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1368 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1369 #define SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH 0x04
1370 #define SUBLANG_TAMIL_INDIA 0x01
1371 #define SUBLANG_TAMIL_SRI_LANKA 0x02
1372 #define SUBLANG_TATAR_RUSSIA 0x01
1373 #define SUBLANG_TELUGU_INDIA 0x01
1374 #define SUBLANG_THAI_THAILAND 0x01
1375 #define SUBLANG_TIBETAN_PRC 0x01
1376 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1377 #define SUBLANG_TIGRINYA_ERITREA 0x02
1378 #define SUBLANG_TIGRINYA_ETHIOPIA 0x01
1379 #define SUBLANG_TSWANA_BOTSWANA 0x02
1380 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1381 #define SUBLANG_TURKISH_TURKEY 0x01
1382 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1383 #define SUBLANG_UIGHUR_PRC 0x01
1384 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1385 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1386 #define SUBLANG_URDU_PAKISTAN 0x01
1387 #define SUBLANG_URDU_INDIA 0x02
1388 #define SUBLANG_UZBEK_LATIN 0x01
1389 #define SUBLANG_UZBEK_CYRILLIC 0x02
1390 #define SUBLANG_VALENCIAN_VALENCIA 0x02
1391 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1392 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1393 #define SUBLANG_WOLOF_SENEGAL 0x01
1394 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1395 #define SUBLANG_YAKUT_RUSSIA 0x01
1396 #define SUBLANG_YI_PRC 0x01
1397 #define SUBLANG_YORUBA_NIGERIA 0x01
1398 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1400 #define SORT_DEFAULT 0x0
1401 #define SORT_INVARIANT_MATH 0x1
1402 #define SORT_JAPANESE_XJIS 0x0
1403 #define SORT_JAPANESE_UNICODE 0x1
1404 #define SORT_JAPANESE_RADICALSTROKE 0x4
1405 #define SORT_CHINESE_BIG5 0x0
1406 #define SORT_CHINESE_PRCP 0x0
1407 #define SORT_CHINESE_UNICODE 0x1
1408 #define SORT_CHINESE_PRC 0x2
1409 #define SORT_CHINESE_BOPOMOFO 0x3
1410 #define SORT_CHINESE_RADICALSTROKE 0x4
1411 #define SORT_KOREAN_KSC 0x0
1412 #define SORT_KOREAN_UNICODE 0x1
1413 #define SORT_GERMAN_PHONE_BOOK 0x1
1414 #define SORT_HUNGARIAN_DEFAULT 0x0
1415 #define SORT_HUNGARIAN_TECHNICAL 0x1
1416 #define SORT_GEORGIAN_TRADITIONAL 0x0
1417 #define SORT_GEORGIAN_MODERN 0x1
1419 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT)
1420 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
1422 #define LOCALE_SYSTEM_DEFAULT MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)
1423 #define LOCALE_USER_DEFAULT MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)
1424 #define LOCALE_CUSTOM_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)
1425 #define LOCALE_CUSTOM_UNSPECIFIED MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)
1426 #define LOCALE_CUSTOM_UI_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)
1427 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT)
1428 #define LOCALE_INVARIANT MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
1430 typedef _Return_type_success_(return >= 0) LONG NTSTATUS
;
1431 typedef NTSTATUS
*PNTSTATUS
;
1433 #ifndef __SECSTATUS_DEFINED__
1434 typedef long SECURITY_STATUS
;
1435 #define __SECSTATUS_DEFINED__
1438 /* Physical Addresses are always treated as 64-bit wide */
1439 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
1441 #define TIME LARGE_INTEGER
1442 #define _TIME _LARGE_INTEGER
1443 #define PTIME PLARGE_INTEGER
1444 #define LowTime LowPart
1445 #define HighTime HighPart
1447 /* Used to store a non-float 8 byte aligned structure */
1448 typedef struct _QUAD
1450 _ANONYMOUS_UNION
union
1452 __GNU_EXTENSION __int64 UseThisFieldToCopy
;
1453 double DoNotUseThisField
;
1455 } QUAD
, *PQUAD
, UQUAD
, *PUQUAD
;
1457 #if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
1458 typedef CONST UCHAR
*PCUCHAR
;
1459 typedef CONST USHORT
*PCUSHORT
;
1460 typedef CONST ULONG
*PCULONG
;
1461 typedef CONST UQUAD
*PCUQUAD
;
1462 typedef CONST SCHAR
*PCSCHAR
;
1463 #endif /* (/_WIN32_WINNT >= 0x0600) */
1464 #if (_WIN32_WINNT >= 0x0600)
1465 typedef CONST NTSTATUS
*PCNTSTATUS
;
1466 #endif /* (/_WIN32_WINNT >= 0x0600) */
1469 typedef struct _STRING
{
1471 USHORT MaximumLength
;
1473 [size_is(MaximumLength
), length_is(Length
) ]
1475 _Field_size_bytes_part_opt_(MaximumLength
, Length
) PCHAR Buffer
;
1477 ANSI_STRING
, *PANSI_STRING
,
1478 OEM_STRING
, *POEM_STRING
;
1480 typedef CONST STRING
* PCOEM_STRING
;
1481 typedef STRING CANSI_STRING
;
1482 typedef PSTRING PCANSI_STRING
;
1484 typedef struct _STRING32
{
1486 USHORT MaximumLength
;
1488 } STRING32
, *PSTRING32
,
1489 UNICODE_STRING32
, *PUNICODE_STRING32
,
1490 ANSI_STRING32
, *PANSI_STRING32
;
1492 typedef struct _STRING64
{
1494 USHORT MaximumLength
;
1496 } STRING64
, *PSTRING64
,
1497 UNICODE_STRING64
, *PUNICODE_STRING64
,
1498 ANSI_STRING64
, *PANSI_STRING64
;
1500 typedef struct _CSTRING
{
1502 USHORT MaximumLength
;
1504 } CSTRING
, *PCSTRING
;
1506 typedef struct _UNICODE_STRING
{
1508 USHORT MaximumLength
;
1510 [size_is(MaximumLength
/ 2), length_is((Length
) / 2)] PUSHORT Buffer
;
1512 _Field_size_bytes_part_(MaximumLength
, Length
) PWCH Buffer
;
1514 } UNICODE_STRING
, *PUNICODE_STRING
;
1515 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
1517 typedef USHORT RTL_STRING_LENGTH_TYPE
;
1520 extern "C++" template<typename _Type
> struct _RTL_remove_const_template
;
1521 extern "C++" template<typename _Type
> struct _RTL_remove_const_template
<const _Type
&> { typedef _Type type
; };
1522 #define _RTL_CONSTANT_STRING_remove_const_macro(s) \
1523 (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
1524 extern "C++" template<class _Ty
> struct _RTL_CONSTANT_STRING_type_check_template
;
1525 extern "C++" template<class _Ty
, int _Count
> struct _RTL_CONSTANT_STRING_type_check_template
<const _Ty (&)[_Count
]> { typedef char type
; };
1526 #define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
1528 # define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
1529 char _RTL_CONSTANT_STRING_type_check(const void *s
);
1531 #define RTL_CONSTANT_STRING(s) { \
1532 sizeof(s)-sizeof((s)[0]), \
1533 sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
1534 _RTL_CONSTANT_STRING_remove_const_macro(s) }
1536 #define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
1537 WCHAR _var ## _buffer[_size]; \
1538 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
1539 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
1540 __pragma(warning(pop))
1542 #define DECLARE_CONST_UNICODE_STRING(_var, _string) \
1543 const WCHAR _var##_buffer[] = _string; \
1544 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
1545 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
1546 __pragma(warning(pop))
1548 #define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
1549 extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
1551 /* Object Attributes */
1552 typedef struct _OBJECT_ATTRIBUTES
{
1554 HANDLE RootDirectory
;
1555 PUNICODE_STRING ObjectName
;
1557 PVOID SecurityDescriptor
;
1558 PVOID SecurityQualityOfService
;
1559 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
1560 typedef CONST OBJECT_ATTRIBUTES
*PCOBJECT_ATTRIBUTES
;
1562 typedef struct _OBJECT_ATTRIBUTES32
{
1564 ULONG RootDirectory
;
1567 ULONG SecurityDescriptor
;
1568 ULONG SecurityQualityOfService
;
1569 } OBJECT_ATTRIBUTES32
, *POBJECT_ATTRIBUTES32
;
1570 typedef CONST OBJECT_ATTRIBUTES32
*PCOBJECT_ATTRIBUTES32
;
1572 typedef struct _OBJECT_ATTRIBUTES64
{
1574 ULONG64 RootDirectory
;
1577 ULONG64 SecurityDescriptor
;
1578 ULONG64 SecurityQualityOfService
;
1579 } OBJECT_ATTRIBUTES64
, *POBJECT_ATTRIBUTES64
;
1580 typedef CONST OBJECT_ATTRIBUTES64
*PCOBJECT_ATTRIBUTES64
;
1582 #define OBJ_HANDLE_TAGBITS 0x00000003L
1584 /* Values for the Attributes member */
1585 #define OBJ_INHERIT 0x00000002L
1586 #define OBJ_PERMANENT 0x00000010L
1587 #define OBJ_EXCLUSIVE 0x00000020L
1588 #define OBJ_CASE_INSENSITIVE 0x00000040L
1589 #define OBJ_OPENIF 0x00000080L
1590 #define OBJ_OPENLINK 0x00000100L
1591 #define OBJ_KERNEL_HANDLE 0x00000200L
1592 #define OBJ_FORCE_ACCESS_CHECK 0x00000400L
1593 #define OBJ_VALID_ATTRIBUTES 0x000007F2L
1596 #define InitializeObjectAttributes(p,n,a,r,s) { \
1597 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
1598 (p)->RootDirectory = (r); \
1599 (p)->ObjectName = (n); \
1600 (p)->Attributes = (a); \
1601 (p)->SecurityDescriptor = (s); \
1602 (p)->SecurityQualityOfService = NULL; \
1605 #define RTL_CONSTANT_OBJECT_ATTRIBUTES(n,a) { \
1606 sizeof(OBJECT_ATTRIBUTES), \
1608 RTL_CONST_CAST(PUNICODE_STRING)(n), \
1614 #define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
1615 RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
1618 #pragma warning(push)
1619 #pragma warning(disable:4214) /* Bit fields of other types than int */
1620 #endif /* _MSC_VER */
1621 typedef struct _RTL_BALANCED_NODE
1623 _ANONYMOUS_UNION
union
1625 struct _RTL_BALANCED_NODE
*Children
[2];
1626 _ANONYMOUS_STRUCT
struct
1628 struct _RTL_BALANCED_NODE
*Left
;
1629 struct _RTL_BALANCED_NODE
*Right
;
1632 _ANONYMOUS_UNION
union
1636 ULONG_PTR ParentValue
;
1638 } RTL_BALANCED_NODE
, *PRTL_BALANCED_NODE
;
1640 #pragma warning(pop)
1641 #endif /* _MSC_VER */
1643 #define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
1644 #define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
1645 ((PRTL_BALANCED_NODE)((Node)->ParentValue & \
1646 ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
1649 typedef enum _NT_PRODUCT_TYPE
{
1653 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1655 typedef enum _EVENT_TYPE
{
1657 SynchronizationEvent
1660 typedef enum _TIMER_TYPE
{
1662 SynchronizationTimer
1665 typedef enum _WAIT_TYPE
{
1674 _In_ PLIST_ENTRY32 ListEntry32
,
1675 _Out_ PLIST_ENTRY64 ListEntry64
)
1677 ListEntry64
->Flink
= ListEntry32
->Flink
;
1678 ListEntry64
->Blink
= ListEntry32
->Blink
;
1684 _In_ PLIST_ENTRY64 ListEntry64
,
1685 _Out_ PLIST_ENTRY32 ListEntry32
)
1687 /* ASSERT without ASSERT or intrinsics ... */
1688 if (((ListEntry64
->Flink
>> 32) != 0) ||
1689 ((ListEntry64
->Blink
>> 32) != 0))
1691 (VOID
)*(volatile LONG
*)(LONG_PTR
)-1;
1693 ListEntry32
->Flink
= ListEntry64
->Flink
& 0xFFFFFFFF;
1694 ListEntry32
->Blink
= ListEntry64
->Blink
& 0xFFFFFFFF;
1696 #endif /* !MIDL_PASS */
1702 #endif /* _NTDEF_ */