source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ntdef.h@ 1167

Last change on this file since 1167 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

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