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