Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenntdef.h
Go to the documentation of this file.
00001 /* 00002 * ntdef.h 00003 * 00004 * This file is part of the ReactOS PSDK package. 00005 * 00006 * Contributors: 00007 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net> 00008 * 00009 * THIS SOFTWARE IS NOT COPYRIGHTED 00010 * 00011 * This source code is offered for use in the public domain. You may 00012 * use, modify or distribute it freely. 00013 * 00014 * This code is distributed in the hope that it will be useful but 00015 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 00016 * DISCLAIMED. This includes but is not limited to warranties of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 * 00019 */ 00020 00021 #ifndef _NTDEF_ 00022 #define _NTDEF_ 00023 00024 /* Dependencies */ 00025 #include <ctype.h> 00026 #include <basetsd.h> 00027 #include <excpt.h> 00028 #include <sdkddkver.h> 00029 #include <specstrings.h> 00030 00031 // FIXME: Shouldn't be included! 00032 #include <stdarg.h> 00033 #include <string.h> 00034 00035 /* Helper macro to enable gcc's extension. */ 00036 #ifndef __GNU_EXTENSION 00037 #ifdef __GNUC__ 00038 #define __GNU_EXTENSION __extension__ 00039 #else 00040 #define __GNU_EXTENSION 00041 #endif 00042 #endif 00043 00044 /* Pseudo Modifiers for Input Parameters */ 00045 00046 #ifndef IN 00047 #define IN 00048 #endif 00049 00050 #ifndef OUT 00051 #define OUT 00052 #endif 00053 00054 #ifndef OPTIONAL 00055 #define OPTIONAL 00056 #endif 00057 00058 #ifndef NOTHING 00059 #define NOTHING 00060 #endif 00061 00062 #ifndef CRITICAL 00063 #define CRITICAL 00064 #endif 00065 00066 #ifndef FAR 00067 #define FAR 00068 #endif 00069 00070 00071 /* Defines the "size" of an any-size array */ 00072 #ifndef ANYSIZE_ARRAY 00073 #define ANYSIZE_ARRAY 1 00074 #endif 00075 00076 /* Constant modifier */ 00077 #ifndef CONST 00078 #define CONST const 00079 #endif 00080 00081 /* TRUE/FALSE */ 00082 #define FALSE 0 00083 #define TRUE 1 00084 00085 /* NULL/NULL64 */ 00086 #ifndef NULL 00087 #ifdef __cplusplus 00088 #define NULL 0 00089 #define NULL64 0 00090 #else 00091 #define NULL ((void *)0) 00092 #define NULL64 ((void * POINTER_64)0) 00093 #endif 00094 #endif /* NULL */ 00095 00096 00097 // 00098 // FIXME 00099 // We should use the -fms-extensions compiler flag for gcc, 00100 // and clean up the mess. 00101 // 00102 #ifndef __ANONYMOUS_DEFINED 00103 #define __ANONYMOUS_DEFINED 00104 00105 #ifndef NONAMELESSUNION 00106 #ifdef __GNUC__ 00107 #define _ANONYMOUS_UNION __GNU_EXTENSION 00108 #define _ANONYMOUS_STRUCT __GNU_EXTENSION 00109 #elif defined(__WATCOMC__) || defined(_MSC_VER) 00110 #define _ANONYMOUS_UNION 00111 #define _ANONYMOUS_STRUCT 00112 #endif /* __GNUC__/__WATCOMC__ */ 00113 #endif /* NONAMELESSUNION */ 00114 00115 #ifndef _ANONYMOUS_UNION 00116 #define _ANONYMOUS_UNION 00117 #define _UNION_NAME(x) x 00118 #define DUMMYUNIONNAME u 00119 #define DUMMYUNIONNAME2 u2 00120 #define DUMMYUNIONNAME3 u3 00121 #define DUMMYUNIONNAME4 u4 00122 #define DUMMYUNIONNAME5 u5 00123 #define DUMMYUNIONNAME6 u6 00124 #define DUMMYUNIONNAME7 u7 00125 #define DUMMYUNIONNAME8 u8 00126 #else 00127 #define _UNION_NAME(x) 00128 #define DUMMYUNIONNAME 00129 #define DUMMYUNIONNAME2 00130 #define DUMMYUNIONNAME3 00131 #define DUMMYUNIONNAME4 00132 #define DUMMYUNIONNAME5 00133 #define DUMMYUNIONNAME6 00134 #define DUMMYUNIONNAME7 00135 #define DUMMYUNIONNAME8 00136 #endif 00137 00138 #ifndef _ANONYMOUS_STRUCT 00139 #define _ANONYMOUS_STRUCT 00140 #define _STRUCT_NAME(x) x 00141 #define DUMMYSTRUCTNAME s 00142 #define DUMMYSTRUCTNAME2 s2 00143 #define DUMMYSTRUCTNAME3 s3 00144 #define DUMMYSTRUCTNAME4 s4 00145 #define DUMMYSTRUCTNAME5 s5 00146 #else 00147 #define _STRUCT_NAME(x) 00148 #define DUMMYSTRUCTNAME 00149 #define DUMMYSTRUCTNAME2 00150 #define DUMMYSTRUCTNAME3 00151 #define DUMMYSTRUCTNAME4 00152 #define DUMMYSTRUCTNAME5 00153 #endif 00154 00155 #endif /* __ANONYMOUS_DEFINED */ 00156 00157 #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) 00158 #define ALIGNMENT_MACHINE 00159 #define UNALIGNED __unaligned 00160 #if defined(_WIN64) 00161 #define UNALIGNED64 __unaligned 00162 #else 00163 #define UNALIGNED64 00164 #endif 00165 #else 00166 #undef ALIGNMENT_MACHINE 00167 #define UNALIGNED 00168 #define UNALIGNED64 00169 #endif 00170 00171 #if defined(_WIN64) || defined(_M_ALPHA) 00172 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) 00173 #define MEMORY_ALLOCATION_ALIGNMENT 16 00174 #else 00175 #define MAX_NATURAL_ALIGNMENT sizeof(ULONG) 00176 #define MEMORY_ALLOCATION_ALIGNMENT 8 00177 #endif 00178 00179 #if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED) 00180 #define RESTRICTED_POINTER __restrict 00181 #else 00182 #define RESTRICTED_POINTER 00183 #endif 00184 00185 #define ARGUMENT_PRESENT(ArgumentPointer) \ 00186 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL) 00187 00188 /* Returns the base address of a structure from a structure member */ 00189 #ifndef CONTAINING_RECORD 00190 #define CONTAINING_RECORD(address, type, field) \ 00191 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field)))) 00192 #endif 00193 00194 /* Returns the byte offset of the specified structure's member */ 00195 #ifndef __GNUC__ 00196 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field)) 00197 #else 00198 #define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field) 00199 #endif 00200 00201 /* Returns the type's alignment */ 00202 #if defined(_MSC_VER) && (_MSC_VER >= 1300) 00203 #define TYPE_ALIGNMENT(t) __alignof(t) 00204 #else 00205 #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test) 00206 #endif 00207 00208 #if defined(_AMD64_) || defined(_X86_) 00209 #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG) 00210 #elif defined(_IA64_) || defined(_ARM_) 00211 #define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG)) 00212 #else 00213 #error "unknown architecture" 00214 #endif 00215 00216 /* Calling Conventions */ 00217 #if defined(_M_IX86) 00218 #define FASTCALL __fastcall 00219 #else 00220 #define FASTCALL 00221 #endif 00222 00223 #define NTAPI __stdcall 00224 00225 00226 /* Import and Export Specifiers */ 00227 00228 /* Done the same way as in windef.h for now */ 00229 #define DECLSPEC_IMPORT __declspec(dllimport) 00230 #define DECLSPEC_NORETURN __declspec(noreturn) 00231 00232 #ifndef DECLSPEC_ADDRSAFE 00233 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64)) 00234 #define DECLSPEC_ADDRSAFE __declspec(address_safe) 00235 #else 00236 #define DECLSPEC_ADDRSAFE 00237 #endif 00238 #endif /* DECLSPEC_ADDRSAFE */ 00239 00240 #ifndef NOP_FUNCTION 00241 #if (_MSC_VER >= 1210) 00242 #define NOP_FUNCTION __noop 00243 #else 00244 #define NOP_FUNCTION (void)0 00245 #endif 00246 #endif 00247 00248 #if !defined(_NTSYSTEM_) 00249 #define NTSYSAPI DECLSPEC_IMPORT 00250 #define NTSYSCALLAPI DECLSPEC_IMPORT 00251 #else 00252 #define NTSYSAPI 00253 #if defined(_NTDLLBUILD_) 00254 #define NTSYSCALLAPI 00255 #else 00256 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE 00257 #endif 00258 #endif 00259 00260 /* Inlines */ 00261 #ifndef FORCEINLINE 00262 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00263 #define FORCEINLINE __forceinline 00264 #elif defined(_MSC_VER) 00265 #define FORCEINLINE __inline 00266 #else /* __GNUC__ */ 00267 #define FORCEINLINE extern __inline__ __attribute__((always_inline)) 00268 #endif 00269 #endif /* FORCEINLINE */ 00270 00271 #ifndef DECLSPEC_NOINLINE 00272 #if (_MSC_VER >= 1300) 00273 #define DECLSPEC_NOINLINE __declspec(noinline) 00274 #elif defined(__GNUC__) 00275 #define DECLSPEC_NOINLINE __attribute__((noinline)) 00276 #else 00277 #define DECLSPEC_NOINLINE 00278 #endif 00279 #endif /* DECLSPEC_NOINLINE */ 00280 00281 #if !defined(_M_CEE_PURE) 00282 #define NTAPI_INLINE NTAPI 00283 #else 00284 #define NTAPI_INLINE 00285 #endif 00286 00287 /* Use to specify structure alignment */ 00288 #ifndef DECLSPEC_ALIGN 00289 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) 00290 #define DECLSPEC_ALIGN(x) __declspec(align(x)) 00291 #elif defined(__GNUC__) 00292 #define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__ (x))) 00293 #else 00294 #define DECLSPEC_ALIGN(x) 00295 #endif 00296 #endif /* DECLSPEC_ALIGN */ 00297 00298 /* Use to silence unused variable warnings when it is intentional */ 00299 #define UNREFERENCED_PARAMETER(P) {(P)=(P);} 00300 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} 00301 #define DBG_UNREFERENCED_PARAMETER(P) 00302 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) 00303 00304 /* min/max helper macros */ 00305 #ifndef NOMINMAX 00306 00307 #ifndef min 00308 #define min(a,b) (((a) < (b)) ? (a) : (b)) 00309 #endif 00310 00311 #ifndef max 00312 #define max(a,b) (((a) > (b)) ? (a) : (b)) 00313 #endif 00314 00315 #endif /* NOMINMAX */ 00316 00317 /* Tell windef.h that we have defined some basic types */ 00318 #define BASETYPES 00319 00320 /* Void Pointers */ 00321 typedef void *PVOID; 00322 //typedef void * POINTER_64 PVOID64; 00323 typedef PVOID PVOID64; // FIXME! 00324 00325 /* Handle Type */ 00326 #ifdef STRICT 00327 typedef void *HANDLE; 00328 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n 00329 #else 00330 typedef PVOID HANDLE; 00331 #define DECLARE_HANDLE(n) typedef HANDLE n 00332 #endif 00333 typedef HANDLE *PHANDLE; 00334 00335 /* Upper-Case Versions of Some Standard C Types */ 00336 #ifndef VOID 00337 #define VOID void 00338 typedef char CHAR; 00339 typedef short SHORT; 00340 typedef long LONG; 00341 #if !defined(MIDL_PASS) 00342 typedef int INT; 00343 #endif 00344 #endif 00345 typedef double DOUBLE; 00346 00347 /* Unsigned Types */ 00348 typedef unsigned char UCHAR, *PUCHAR; 00349 typedef unsigned short USHORT, *PUSHORT; 00350 typedef unsigned long ULONG, *PULONG; 00351 typedef CONST UCHAR *PCUCHAR; 00352 typedef CONST USHORT *PCUSHORT; 00353 typedef CONST ULONG *PCULONG; 00354 typedef UCHAR FCHAR; 00355 typedef USHORT FSHORT; 00356 typedef ULONG FLONG; 00357 typedef UCHAR BOOLEAN, *PBOOLEAN; 00358 typedef ULONG LOGICAL; 00359 typedef ULONG *PLOGICAL; 00360 00361 /* Signed Types */ 00362 typedef SHORT *PSHORT; 00363 typedef LONG *PLONG; 00364 typedef _Return_type_success_(return >= 0) LONG NTSTATUS; 00365 typedef NTSTATUS *PNTSTATUS; 00366 typedef signed char SCHAR; 00367 typedef SCHAR *PSCHAR; 00368 00369 #ifndef _HRESULT_DEFINED 00370 #define _HRESULT_DEFINED 00371 typedef LONG HRESULT; 00372 #endif 00373 00374 /* 64-bit types */ 00375 __GNU_EXTENSION typedef __int64 LONGLONG, *PLONGLONG; 00376 __GNU_EXTENSION typedef unsigned __int64 ULONGLONG, *PULONGLONG; 00377 typedef ULONGLONG DWORDLONG, *PDWORDLONG; 00378 00379 /* Update Sequence Number */ 00380 typedef LONGLONG USN; 00381 00382 /* ANSI (Multi-byte Character) types */ 00383 typedef CHAR *PCHAR, *LPCH, *PCH; 00384 typedef CONST CHAR *LPCCH, *PCCH; 00385 typedef _Null_terminated_ CHAR *NPSTR, *LPSTR, *PSTR; 00386 typedef _Null_terminated_ PSTR *PZPSTR; 00387 typedef _Null_terminated_ CONST PSTR *PCZPSTR; 00388 typedef _Null_terminated_ CONST CHAR *LPCSTR, *PCSTR; 00389 typedef _Null_terminated_ PCSTR *PZPCSTR; 00390 00391 /* Pointer to an Asciiz string */ 00392 typedef _Null_terminated_ CHAR *PSZ; 00393 typedef _Null_terminated_ CONST char *PCSZ; 00394 00395 /* UNICODE (Wide Character) types */ 00396 typedef wchar_t WCHAR; 00397 typedef WCHAR *PWCHAR, *LPWCH, *PWCH; 00398 typedef CONST WCHAR *LPCWCH, *PCWCH; 00399 typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR; 00400 typedef _Null_terminated_ PWSTR *PZPWSTR; 00401 typedef _Null_terminated_ CONST PWSTR *PCZPWSTR; 00402 typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR; 00403 typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR; 00404 typedef _Null_terminated_ PCWSTR *PZPCWSTR; 00405 typedef _Null_terminated_ CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR; 00406 typedef _NullNull_terminated_ WCHAR *PZZWSTR; 00407 00408 /* Cardinal Data Types */ 00409 typedef char CCHAR, *PCCHAR; 00410 typedef short CSHORT, *PCSHORT; 00411 typedef ULONG CLONG, *PCLONG; 00412 00413 /* NLS basics (Locale and Language Ids) */ 00414 typedef ULONG LCID; 00415 typedef PULONG PLCID; 00416 typedef USHORT LANGID; 00417 00418 typedef enum { 00419 UNSPECIFIED_COMPARTMENT_ID = 0, 00420 DEFAULT_COMPARTMENT_ID 00421 } COMPARTMENT_ID, *PCOMPARTMENT_ID; 00422 00423 /* Used to store a non-float 8 byte aligned structure */ 00424 typedef struct _QUAD 00425 { 00426 _ANONYMOUS_UNION union 00427 { 00428 __GNU_EXTENSION __int64 UseThisFieldToCopy; 00429 double DoNotUseThisField; 00430 } DUMMYUNIONNAME; 00431 } QUAD, *PQUAD, UQUAD, *PUQUAD; 00432 00433 /* Large Integer Unions */ 00434 #if defined(MIDL_PASS) 00435 typedef struct _LARGE_INTEGER { 00436 #else 00437 typedef union _LARGE_INTEGER { 00438 _ANONYMOUS_STRUCT struct 00439 { 00440 ULONG LowPart; 00441 LONG HighPart; 00442 } DUMMYSTRUCTNAME; 00443 struct 00444 { 00445 ULONG LowPart; 00446 LONG HighPart; 00447 } u; 00448 #endif /* MIDL_PASS */ 00449 LONGLONG QuadPart; 00450 } LARGE_INTEGER, *PLARGE_INTEGER; 00451 00452 #if defined(MIDL_PASS) 00453 typedef struct _ULARGE_INTEGER { 00454 #else 00455 typedef union _ULARGE_INTEGER { 00456 _ANONYMOUS_STRUCT struct 00457 { 00458 ULONG LowPart; 00459 ULONG HighPart; 00460 } DUMMYSTRUCTNAME; 00461 struct 00462 { 00463 ULONG LowPart; 00464 ULONG HighPart; 00465 } u; 00466 #endif /* MIDL_PASS */ 00467 ULONGLONG QuadPart; 00468 } ULARGE_INTEGER, *PULARGE_INTEGER; 00469 00470 /* Physical Addresses are always treated as 64-bit wide */ 00471 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; 00472 00473 /* Locally Unique Identifier */ 00474 typedef struct _LUID { 00475 ULONG LowPart; 00476 LONG HighPart; 00477 } LUID, *PLUID; 00478 00479 /* Native API Return Value Macros */ 00480 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) 00481 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1) 00482 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2) 00483 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3) 00484 00485 /* String Types */ 00486 typedef struct _UNICODE_STRING { 00487 USHORT Length; 00488 USHORT MaximumLength; 00489 PWSTR Buffer; 00490 } UNICODE_STRING, *PUNICODE_STRING; 00491 typedef const UNICODE_STRING* PCUNICODE_STRING; 00492 #define UNICODE_NULL ((WCHAR)0) 00493 #define UNICODE_STRING_MAX_BYTES ((USHORT) 65534) 00494 #define UNICODE_STRING_MAX_CHARS (32767) 00495 00496 typedef struct _CSTRING { 00497 USHORT Length; 00498 USHORT MaximumLength; 00499 CONST CHAR *Buffer; 00500 } CSTRING, *PCSTRING; 00501 #define ANSI_NULL ((CHAR)0) 00502 00503 typedef struct _STRING { 00504 USHORT Length; 00505 USHORT MaximumLength; 00506 #ifdef MIDL_PASS 00507 [size_is(MaximumLength), length_is(Length) ] 00508 #endif 00509 _Field_size_bytes_part_opt_(MaximumLength, Length) PCHAR Buffer; 00510 } STRING, *PSTRING; 00511 00512 typedef STRING ANSI_STRING; 00513 typedef PSTRING PANSI_STRING; 00514 typedef STRING OEM_STRING; 00515 typedef PSTRING POEM_STRING; 00516 typedef CONST STRING* PCOEM_STRING; 00517 typedef STRING CANSI_STRING; 00518 typedef PSTRING PCANSI_STRING; 00519 00520 typedef struct _STRING32 { 00521 USHORT Length; 00522 USHORT MaximumLength; 00523 ULONG Buffer; 00524 } STRING32, *PSTRING32, 00525 UNICODE_STRING32, *PUNICODE_STRING32, 00526 ANSI_STRING32, *PANSI_STRING32; 00527 00528 typedef struct _STRING64 { 00529 USHORT Length; 00530 USHORT MaximumLength; 00531 ULONGLONG Buffer; 00532 } STRING64, *PSTRING64, 00533 UNICODE_STRING64, *PUNICODE_STRING64, 00534 ANSI_STRING64, *PANSI_STRING64; 00535 00536 /* LangID and NLS */ 00537 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p)) 00538 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff) 00539 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10) 00540 00541 #define NLS_VALID_LOCALE_MASK 0x000fffff 00542 00543 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \ 00544 ((ULONG)((USHORT)(lgid))))) 00545 #define MAKESORTLCID(lgid, srtid, ver) \ 00546 ((ULONG)((MAKELCID(lgid, srtid)) | \ 00547 (((ULONG)((USHORT)(ver))) << 20))) 00548 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid)) 00549 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf)) 00550 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf)) 00551 00552 00553 /* Object Attributes */ 00554 typedef struct _OBJECT_ATTRIBUTES { 00555 ULONG Length; 00556 HANDLE RootDirectory; 00557 PUNICODE_STRING ObjectName; 00558 ULONG Attributes; 00559 PVOID SecurityDescriptor; 00560 PVOID SecurityQualityOfService; 00561 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; 00562 typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES; 00563 00564 /* Values for the Attributes member */ 00565 #define OBJ_INHERIT 0x00000002 00566 #define OBJ_PERMANENT 0x00000010 00567 #define OBJ_EXCLUSIVE 0x00000020 00568 #define OBJ_CASE_INSENSITIVE 0x00000040 00569 #define OBJ_OPENIF 0x00000080 00570 #define OBJ_OPENLINK 0x00000100 00571 #define OBJ_KERNEL_HANDLE 0x00000200 00572 #define OBJ_FORCE_ACCESS_CHECK 0x00000400 00573 #define OBJ_VALID_ATTRIBUTES 0x000007F2 00574 00575 /* Helper Macro */ 00576 #define InitializeObjectAttributes(p,n,a,r,s) { \ 00577 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \ 00578 (p)->RootDirectory = (r); \ 00579 (p)->Attributes = (a); \ 00580 (p)->ObjectName = (n); \ 00581 (p)->SecurityDescriptor = (s); \ 00582 (p)->SecurityQualityOfService = NULL; \ 00583 } 00584 00585 /* Product Types */ 00586 typedef enum _NT_PRODUCT_TYPE { 00587 NtProductWinNt = 1, 00588 NtProductLanManNt, 00589 NtProductServer 00590 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE; 00591 00592 typedef enum _EVENT_TYPE { 00593 NotificationEvent, 00594 SynchronizationEvent 00595 } EVENT_TYPE; 00596 00597 typedef enum _TIMER_TYPE { 00598 NotificationTimer, 00599 SynchronizationTimer 00600 } TIMER_TYPE; 00601 00602 typedef enum _WAIT_TYPE { 00603 WaitAll, 00604 WaitAny 00605 } WAIT_TYPE; 00606 00607 /* Doubly Linked Lists */ 00608 typedef struct _LIST_ENTRY { 00609 struct _LIST_ENTRY *Flink; 00610 struct _LIST_ENTRY *Blink; 00611 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY; 00612 00613 typedef struct LIST_ENTRY32 { 00614 ULONG Flink; 00615 ULONG Blink; 00616 } LIST_ENTRY32, *PLIST_ENTRY32; 00617 00618 typedef struct LIST_ENTRY64 { 00619 ULONGLONG Flink; 00620 ULONGLONG Blink; 00621 } LIST_ENTRY64, *PLIST_ENTRY64; 00622 00623 /* Singly Linked Lists */ 00624 typedef struct _SINGLE_LIST_ENTRY { 00625 struct _SINGLE_LIST_ENTRY *Next; 00626 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; 00627 00628 typedef struct _PROCESSOR_NUMBER { 00629 USHORT Group; 00630 UCHAR Number; 00631 UCHAR Reserved; 00632 } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER; 00633 00634 struct _CONTEXT; 00635 struct _EXCEPTION_RECORD; 00636 00637 _IRQL_requires_same_ 00638 _Function_class_(EXCEPTION_ROUTINE) 00639 typedef EXCEPTION_DISPOSITION 00640 (NTAPI *PEXCEPTION_ROUTINE)( 00641 _Inout_ struct _EXCEPTION_RECORD *ExceptionRecord, 00642 _In_ PVOID EstablisherFrame, 00643 _Inout_ struct _CONTEXT *ContextRecord, 00644 _In_ PVOID DispatcherContext); 00645 00646 typedef struct _GROUP_AFFINITY { 00647 KAFFINITY Mask; 00648 USHORT Group; 00649 USHORT Reserved[3]; 00650 } GROUP_AFFINITY, *PGROUP_AFFINITY; 00651 00652 /* Helper Macros */ 00653 00654 #define RTL_FIELD_TYPE(type, field) (((type*)0)->field) 00655 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8) 00656 #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field))) 00657 00658 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s } 00659 00660 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) 00661 00662 #define RTL_SIZEOF_THROUGH_FIELD(type, field) \ 00663 (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field)) 00664 00665 #define RTL_CONTAINS_FIELD(Struct, Size, Field) \ 00666 ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) ) 00667 00668 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) 00669 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) 00670 #ifdef ENABLE_RTL_NUMBER_OF_V2 00671 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) 00672 #else 00673 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) 00674 #endif 00675 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) 00676 00677 /* Type Limits */ 00678 #define MINCHAR 0x80 00679 #define MAXCHAR 0x7f 00680 #define MINSHORT 0x8000 00681 #define MAXSHORT 0x7fff 00682 #define MINLONG 0x80000000 00683 #define MAXLONG 0x7fffffff 00684 #define MAXUCHAR 0xff 00685 #define MAXUSHORT 0xffff 00686 #define MAXULONG 0xffffffff 00687 #define MAXLONGLONG (0x7fffffffffffffffLL) 00688 00689 /* Multiplication and Shift Operations */ 00690 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b)) 00691 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b)) 00692 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b)) 00693 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b)) 00694 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) 00695 00696 /* C_ASSERT Definition */ 00697 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1] 00698 00699 #define VER_WORKSTATION_NT 0x40000000 00700 #define VER_SERVER_NT 0x80000000 00701 #define VER_SUITE_SMALLBUSINESS 0x00000001 00702 #define VER_SUITE_ENTERPRISE 0x00000002 00703 #define VER_SUITE_BACKOFFICE 0x00000004 00704 #define VER_SUITE_COMMUNICATIONS 0x00000008 00705 #define VER_SUITE_TERMINAL 0x00000010 00706 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 00707 #define VER_SUITE_EMBEDDEDNT 0x00000040 00708 #define VER_SUITE_DATACENTER 0x00000080 00709 #define VER_SUITE_SINGLEUSERTS 0x00000100 00710 #define VER_SUITE_PERSONAL 0x00000200 00711 #define VER_SUITE_BLADE 0x00000400 00712 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800 00713 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000 00714 #define VER_SUITE_STORAGE_SERVER 0x00002000 00715 #define VER_SUITE_COMPUTE_SERVER 0x00004000 00716 #define VER_SUITE_WH_SERVER 0x00008000 00717 00718 /* Primary language IDs. */ 00719 #define LANG_NEUTRAL 0x00 00720 #define LANG_INVARIANT 0x7f 00721 00722 #define LANG_AFRIKAANS 0x36 00723 #define LANG_ALBANIAN 0x1c 00724 #define LANG_ALSATIAN 0x84 00725 #define LANG_AMHARIC 0x5e 00726 #define LANG_ARABIC 0x01 00727 #define LANG_ARMENIAN 0x2b 00728 #define LANG_ASSAMESE 0x4d 00729 #define LANG_AZERI 0x2c 00730 #define LANG_BASHKIR 0x6d 00731 #define LANG_BASQUE 0x2d 00732 #define LANG_BELARUSIAN 0x23 00733 #define LANG_BENGALI 0x45 00734 #define LANG_BRETON 0x7e 00735 #define LANG_BOSNIAN 0x1a 00736 #define LANG_BOSNIAN_NEUTRAL 0x781a 00737 #define LANG_BULGARIAN 0x02 00738 #define LANG_CATALAN 0x03 00739 #define LANG_CHINESE 0x04 00740 #define LANG_CHINESE_SIMPLIFIED 0x04 00741 #define LANG_CHINESE_TRADITIONAL 0x7c04 00742 #define LANG_CORSICAN 0x83 00743 #define LANG_CROATIAN 0x1a 00744 #define LANG_CZECH 0x05 00745 #define LANG_DANISH 0x06 00746 #define LANG_DARI 0x8c 00747 #define LANG_DIVEHI 0x65 00748 #define LANG_DUTCH 0x13 00749 #define LANG_ENGLISH 0x09 00750 #define LANG_ESTONIAN 0x25 00751 #define LANG_FAEROESE 0x38 00752 #define LANG_FARSI 0x29 00753 #define LANG_FILIPINO 0x64 00754 #define LANG_FINNISH 0x0b 00755 #define LANG_FRENCH 0x0c 00756 #define LANG_FRISIAN 0x62 00757 #define LANG_GALICIAN 0x56 00758 #define LANG_GEORGIAN 0x37 00759 #define LANG_GERMAN 0x07 00760 #define LANG_GREEK 0x08 00761 #define LANG_GREENLANDIC 0x6f 00762 #define LANG_GUJARATI 0x47 00763 #define LANG_HAUSA 0x68 00764 #define LANG_HEBREW 0x0d 00765 #define LANG_HINDI 0x39 00766 #define LANG_HUNGARIAN 0x0e 00767 #define LANG_ICELANDIC 0x0f 00768 #define LANG_IGBO 0x70 00769 #define LANG_INDONESIAN 0x21 00770 #define LANG_INUKTITUT 0x5d 00771 #define LANG_IRISH 0x3c 00772 #define LANG_ITALIAN 0x10 00773 #define LANG_JAPANESE 0x11 00774 #define LANG_KANNADA 0x4b 00775 #define LANG_KASHMIRI 0x60 00776 #define LANG_KAZAK 0x3f 00777 #define LANG_KHMER 0x53 00778 #define LANG_KICHE 0x86 00779 #define LANG_KINYARWANDA 0x87 00780 #define LANG_KONKANI 0x57 00781 #define LANG_KOREAN 0x12 00782 #define LANG_KYRGYZ 0x40 00783 #define LANG_LAO 0x54 00784 #define LANG_LATVIAN 0x26 00785 #define LANG_LITHUANIAN 0x27 00786 #define LANG_LOWER_SORBIAN 0x2e 00787 #define LANG_LUXEMBOURGISH 0x6e 00788 #define LANG_MACEDONIAN 0x2f 00789 #define LANG_MALAY 0x3e 00790 #define LANG_MALAYALAM 0x4c 00791 #define LANG_MALTESE 0x3a 00792 #define LANG_MANIPURI 0x58 00793 #define LANG_MAORI 0x81 00794 #define LANG_MAPUDUNGUN 0x7a 00795 #define LANG_MARATHI 0x4e 00796 #define LANG_MOHAWK 0x7c 00797 #define LANG_MONGOLIAN 0x50 00798 #define LANG_NEPALI 0x61 00799 #define LANG_NORWEGIAN 0x14 00800 #define LANG_OCCITAN 0x82 00801 #define LANG_ORIYA 0x48 00802 #define LANG_PASHTO 0x63 00803 #define LANG_PERSIAN 0x29 00804 #define LANG_POLISH 0x15 00805 #define LANG_PORTUGUESE 0x16 00806 #define LANG_PUNJABI 0x46 00807 #define LANG_QUECHUA 0x6b 00808 #define LANG_ROMANIAN 0x18 00809 #define LANG_ROMANSH 0x17 00810 #define LANG_RUSSIAN 0x19 00811 #define LANG_SAMI 0x3b 00812 #define LANG_SANSKRIT 0x4f 00813 #define LANG_SERBIAN 0x1a 00814 #define LANG_SERBIAN_NEUTRAL 0x7c1a 00815 #define LANG_SINDHI 0x59 00816 #define LANG_SINHALESE 0x5b 00817 #define LANG_SLOVAK 0x1b 00818 #define LANG_SLOVENIAN 0x24 00819 #define LANG_SOTHO 0x6c 00820 #define LANG_SPANISH 0x0a 00821 #define LANG_SWAHILI 0x41 00822 #define LANG_SWEDISH 0x1d 00823 #define LANG_SYRIAC 0x5a 00824 #define LANG_TAJIK 0x28 00825 #define LANG_TAMAZIGHT 0x5f 00826 #define LANG_TAMIL 0x49 00827 #define LANG_TATAR 0x44 00828 #define LANG_TELUGU 0x4a 00829 #define LANG_THAI 0x1e 00830 #define LANG_TIBETAN 0x51 00831 #define LANG_TIGRIGNA 0x73 00832 #define LANG_TSWANA 0x32 00833 #define LANG_TURKISH 0x1f 00834 #define LANG_TURKMEN 0x42 00835 #define LANG_UIGHUR 0x80 00836 #define LANG_UKRAINIAN 0x22 00837 #define LANG_UPPER_SORBIAN 0x2e 00838 #define LANG_URDU 0x20 00839 #define LANG_UZBEK 0x43 00840 #define LANG_VIETNAMESE 0x2a 00841 #define LANG_WELSH 0x52 00842 #define LANG_WOLOF 0x88 00843 #define LANG_XHOSA 0x34 00844 #define LANG_YAKUT 0x85 00845 #define LANG_YI 0x78 00846 #define LANG_YORUBA 0x6a 00847 #define LANG_ZULU 0x35 00848 00849 #endif /* _NTDEF_ */ Generated on Wed May 23 2012 04:30:04 for ReactOS by
1.7.6.1
|