ReactOS 0.4.16-dev-1946-g52006dd
ntdef.template.h
Go to the documentation of this file.
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#pragma once
24
25/* Dependencies */
26#include <ctype.h>
28//#include <winapifamily.h>
29$endif()
30#include <basetsd.h>
31#include <guiddef.h>
32#include <excpt.h>
33#include <sdkddkver.h>
34#include <specstrings.h>
35#include <kernelspecs.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#ifndef DECLSPEC_NOINITALL
42#if defined(_MSC_VER) && (!defined(__clang__) || (__clang_major__ >= 22)) && \
43 (_MSC_VER >= 1915) && !defined(MIDL_PASS) && !defined(SORTPP_PASS) && !defined(RC_INVOKED)
44#define DECLSPEC_NOINITALL __pragma(warning(push)) __pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
45#else
46#define DECLSPEC_NOINITALL
47#endif
48#endif
49
50/* Default to strict */
51#ifndef NO_STRICT
52#ifndef STRICT
53#define STRICT 1
54#endif
55#endif
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/* Constant modifier */
80#ifndef CONST
81#define CONST const
82#endif
83
84/* TRUE/FALSE */
85#define FALSE 0
86#define TRUE 1
87
88/* NULL/NULL64 */
89#ifndef NULL
90#ifdef __cplusplus
91#define NULL 0
92#define NULL64 0
93#else
94#define NULL ((void *)0)
95#define NULL64 ((void * POINTER_64)0)
96#endif
97#endif /* NULL */
98
99#define ARGUMENT_PRESENT(ArgumentPointer) \
100 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
101
102#if defined(_MANAGED)
103 #define FASTCALL __stdcall
104#elif defined(_M_IX86)
105 #define FASTCALL __fastcall
106#else
107 #define FASTCALL
108#endif /* _MANAGED */
109
110/* min/max helper macros */
111#ifndef NOMINMAX
112# ifndef min
113# define min(a,b) (((a) < (b)) ? (a) : (b))
114# endif
115# ifndef max
116# define max(a,b) (((a) > (b)) ? (a) : (b))
117# endif
118#endif /* NOMINMAX */
119
120/* Tell windef.h that we have defined some basic types */
121#define BASETYPES
122
127$include(ntbasedef.h)
128
129typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
131
132#ifndef __SECSTATUS_DEFINED__
133typedef long SECURITY_STATUS;
134#define __SECSTATUS_DEFINED__
135#endif
136
137/* Physical Addresses are always treated as 64-bit wide */
139
140#define TIME LARGE_INTEGER
141#define _TIME _LARGE_INTEGER
142#define PTIME PLARGE_INTEGER
143#define LowTime LowPart
144#define HighTime HighPart
145
146/* Used to store a non-float 8 byte aligned structure */
147typedef struct _QUAD
148{
149 _ANONYMOUS_UNION union
150 {
155
156#if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
157typedef CONST UCHAR *PCUCHAR;
158typedef CONST USHORT *PCUSHORT;
159typedef CONST ULONG *PCULONG;
160typedef CONST UQUAD *PCUQUAD;
161typedef CONST SCHAR *PCSCHAR;
162#endif /* (/_WIN32_WINNT >= 0x0600) */
163#if (_WIN32_WINNT >= 0x0600)
164typedef CONST NTSTATUS *PCNTSTATUS;
165#endif /* (/_WIN32_WINNT >= 0x0600) */
166
167/* String Types */
168typedef struct _STRING {
171#ifdef MIDL_PASS
172 [size_is(MaximumLength), length_is(Length) ]
173#endif
178
182
183typedef struct _STRING32 {
186 $ULONG Buffer;
190
191typedef struct _STRING64 {
198
199typedef struct _CSTRING {
204
205typedef struct _UNICODE_STRING {
208#ifdef MIDL_PASS
209 [size_is(MaximumLength / 2), length_is((Length) / 2)] PUSHORT Buffer;
210#else
212#endif
215
217
218#ifdef __cplusplus
219extern "C++" template<typename _Type> struct _RTL_remove_const_template;
220extern "C++" template<typename _Type> struct _RTL_remove_const_template<const _Type&> { typedef _Type type; };
221#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
222 (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
223extern "C++" template<class _Ty> struct _RTL_CONSTANT_STRING_type_check_template;
224extern "C++" template<class _Ty, int _Count> struct _RTL_CONSTANT_STRING_type_check_template<const _Ty (&)[_Count]> { typedef char type; };
225#define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
226#else
227# define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
229#endif
230#define RTL_CONSTANT_STRING(s) { \
231 sizeof(s)-sizeof((s)[0]), \
232 sizeof(s) / (sizeof(_RTL_CONSTANT_STRING_type_check(s))), \
233 _RTL_CONSTANT_STRING_remove_const_macro(s) }
234
235#ifdef _MSC_VER
236#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
237 WCHAR _var ## _buffer[_size]; \
238 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
239 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
240 __pragma(warning(pop))
241
242#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
243 const WCHAR _var##_buffer[] = _string; \
244 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
245 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
246 __pragma(warning(pop))
247#else
248#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
249 WCHAR _var ## _buffer[_size]; \
250 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer }
251
252#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
253 const WCHAR _var##_buffer[] = _string; \
254 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer }
255#endif
256
257#define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
258 extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
259
260/* Object Attributes */
261typedef struct _OBJECT_ATTRIBUTES {
270
271typedef struct _OBJECT_ATTRIBUTES32 {
280
281typedef struct _OBJECT_ATTRIBUTES64 {
290
291#define OBJ_HANDLE_TAGBITS 0x00000003L
292
293/* Values for the Attributes member */
294#define OBJ_INHERIT 0x00000002L
295#define OBJ_PERMANENT 0x00000010L
296#define OBJ_EXCLUSIVE 0x00000020L
297#define OBJ_CASE_INSENSITIVE 0x00000040L
298#define OBJ_OPENIF 0x00000080L
299#define OBJ_OPENLINK 0x00000100L
300#define OBJ_KERNEL_HANDLE 0x00000200L
301#define OBJ_FORCE_ACCESS_CHECK 0x00000400L
302#define OBJ_VALID_ATTRIBUTES 0x000007F2L
303
304/* Helper Macro */
305#define InitializeObjectAttributes(p,n,a,r,s) { \
306 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
307 (p)->RootDirectory = (r); \
308 (p)->ObjectName = (n); \
309 (p)->Attributes = (a); \
310 (p)->SecurityDescriptor = (s); \
311 (p)->SecurityQualityOfService = NULL; \
312}
313
314#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n,a) { \
315 sizeof(OBJECT_ATTRIBUTES), \
316 NULL, \
317 RTL_CONST_CAST(PUNICODE_STRING)(n), \
318 a, \
319 NULL, \
320 NULL \
321}
322
323#define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
324 RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
325
326#ifdef _MSC_VER
327 #pragma warning(push)
328 #pragma warning(disable:4214) /* Bit fields of other types than int */
329#endif /* _MSC_VER */
330typedef struct _RTL_BALANCED_NODE
331{
332 _ANONYMOUS_UNION union
333 {
335 _ANONYMOUS_STRUCT struct
336 {
341 _ANONYMOUS_UNION union
342 {
348#ifdef _MSC_VER
349 #pragma warning(pop)
350#endif /* _MSC_VER */
351
352#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
353#define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
354 ((PRTL_BALANCED_NODE)((Node)->ParentValue & \
355 ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
356
357/* Product Types */
358typedef enum _NT_PRODUCT_TYPE {
363
364typedef enum _EVENT_TYPE {
368
369typedef enum _TIMER_TYPE {
373
374typedef enum _WAIT_TYPE {
376 WaitAny
378
379#ifndef MIDL_PASS
381VOID
383 _In_ PLIST_ENTRY32 ListEntry32,
384 _Out_ PLIST_ENTRY64 ListEntry64)
385{
386 ListEntry64->Flink = ListEntry32->Flink;
387 ListEntry64->Blink = ListEntry32->Blink;
388}
389
391VOID
393 _In_ PLIST_ENTRY64 ListEntry64,
394 _Out_ PLIST_ENTRY32 ListEntry32)
395{
396 /* ASSERT without ASSERT or intrinsics ... */
397 if (((ListEntry64->Flink >> 32) != 0) ||
398 ((ListEntry64->Blink >> 32) != 0))
399 {
400 (VOID)*(volatile LONG*)(LONG_PTR)-1;
401 }
402 ListEntry32->Flink = ListEntry64->Flink & 0xFFFFFFFF;
403 ListEntry32->Blink = ListEntry64->Blink & 0xFFFFFFFF;
404}
405#endif /* !MIDL_PASS */
406
407#ifdef __cplusplus
408} // extern "C"
409#endif
410
411#endif /* _NTDEF_ */
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
#define __int64
Definition: basetyps.h:16
Definition: bufpool.h:45
_Check_return_ _Ret_maybenull_ _In_ size_t _Count
Definition: malloc.h:108
#define NTSTATUS
Definition: precomp.h:19
_NT_PRODUCT_TYPE
Definition: shellpath.c:63
std::wstring STRING
Definition: fontsub.cpp:33
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
unsigned __int64 ULONG64
Definition: imports.h:198
#define _Return_type_success_(c)
Definition: no_sal2.h:86
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
WCHAR * PWCH
Definition: ntbasedef.h:422
$define(_NTDDK_) $include(extypes.h) $include(cmtypes.h) $include(iotypes.h) $include(haltypes.h) $include(ketypes.h) $include(kdtypes.h) $include(mmtypes.h) $include(pstypes.h) $include(rtltypes.h) $include(setypes.h) $include(exfuncs.h) $include(halfuncs.h) $include(iofuncs.h) $include(kdfuncs.h) $include(kefuncs.h) $include(mmfuncs.h) $include(psfuncs.h) $include(rtlfuncs.h) $include(sefuncs.h) $include(zwfuncs.h) NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(IN ULONGLONG ConditionMask
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
struct _OBJECT_ATTRIBUTES32 OBJECT_ATTRIBUTES32
#define CONST
struct _QUAD * PQUAD
enum _TIMER_TYPE TIMER_TYPE
struct _STRING * PSTRING
struct _OBJECT_ATTRIBUTES32 * POBJECT_ATTRIBUTES32
LARGE_INTEGER PHYSICAL_ADDRESS
struct _STRING64 * PANSI_STRING64
PSTRING PCANSI_STRING
struct _STRING OEM_STRING
struct _STRING64 * PUNICODE_STRING64
struct _RTL_BALANCED_NODE RTL_BALANCED_NODE
struct _CSTRING CSTRING
struct _STRING64 ANSI_STRING64
struct _STRING32 STRING32
long SECURITY_STATUS
_EVENT_TYPE
@ NotificationEvent
@ SynchronizationEvent
struct _CSTRING * PCSTRING
CONST STRING * PCOEM_STRING
_WAIT_TYPE
@ WaitAll
@ WaitAny
struct _OBJECT_ATTRIBUTES * POBJECT_ATTRIBUTES
struct _QUAD * PUQUAD
struct _STRING32 ANSI_STRING32
USHORT RTL_STRING_LENGTH_TYPE
$if(0) $endif() $define(_NTDEF_) $define(ULONG
enum _EVENT_TYPE EVENT_TYPE
CONST OBJECT_ATTRIBUTES32 * PCOBJECT_ATTRIBUTES32
struct _STRING32 * PUNICODE_STRING32
struct _STRING32 UNICODE_STRING32
struct _OBJECT_ATTRIBUTES64 * POBJECT_ATTRIBUTES64
struct _UNICODE_STRING * PUNICODE_STRING
struct _RTL_BALANCED_NODE * PRTL_BALANCED_NODE
struct _STRING64 UNICODE_STRING64
struct _STRING64 * PSTRING64
FORCEINLINE VOID ListEntry32To64(_In_ PLIST_ENTRY32 ListEntry32, _Out_ PLIST_ENTRY64 ListEntry64)
struct _OBJECT_ATTRIBUTES64 OBJECT_ATTRIBUTES64
char _RTL_CONSTANT_STRING_type_check(const void *s)
struct _QUAD QUAD
CONST OBJECT_ATTRIBUTES * PCOBJECT_ATTRIBUTES
struct _STRING32 * PANSI_STRING32
struct _UNICODE_STRING UNICODE_STRING
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
struct _STRING STRING
NTSTATUS * PNTSTATUS
struct _QUAD UQUAD
LARGE_INTEGER * PPHYSICAL_ADDRESS
struct _STRING ANSI_STRING
STRING CANSI_STRING
struct _STRING * PANSI_STRING
struct _STRING64 STRING64
enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
CONST OBJECT_ATTRIBUTES64 * PCOBJECT_ATTRIBUTES64
enum _NT_PRODUCT_TYPE * PNT_PRODUCT_TYPE
enum _WAIT_TYPE WAIT_TYPE
_TIMER_TYPE
@ SynchronizationTimer
@ NotificationTimer
struct _STRING * POEM_STRING
@ NtProductWinNt
@ NtProductLanManNt
@ NtProductServer
struct _STRING32 * PSTRING32
FORCEINLINE VOID ListEntry64To32(_In_ PLIST_ENTRY64 ListEntry64, _Out_ PLIST_ENTRY32 ListEntry32)
const UNICODE_STRING * PCUNICODE_STRING
$include(setypes.h) $include(obtypes.h) $include(rtltypes.h) $include(rtlfuncs.h) _IRQL_requires_max_(PASSIVE_LEVEL) __kernel_entry NTSYSCALLAPI NTSTATUS NTAPI NtQueryObject(_In_opt_ HANDLE Handle
#define _ANONYMOUS_UNION
Definition: pecoff.h:89
#define __GNU_EXTENSION
Definition: pecoff.h:69
#define _ANONYMOUS_STRUCT
Definition: pecoff.h:115
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
$endif(_WDMDDK_) $if(_NTDDK_) typedef struct _NEON128
Definition: ke.h:202
signed char SCHAR
Definition: sqltypes.h:14
USHORT MaximumLength
Definition: umtypes.h:160
CONST CHAR * Buffer
Definition: umtypes.h:161
USHORT Length
Definition: umtypes.h:159
ULONG64 SecurityQualityOfService
HANDLE RootDirectory
Definition: umtypes.h:186
PVOID SecurityQualityOfService
Definition: umtypes.h:190
PUNICODE_STRING ObjectName
Definition: umtypes.h:187
PVOID SecurityDescriptor
Definition: umtypes.h:189
__GNU_EXTENSION __int64 UseThisFieldToCopy
_ANONYMOUS_UNION union _QUAD::@4435 DUMMYUNIONNAME
double DoNotUseThisField
struct _RTL_BALANCED_NODE * Children[2]
_ANONYMOUS_STRUCT struct _RTL_BALANCED_NODE::@4436::@4438 DUMMYSTRUCTNAME
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4436 DUMMYUNIONNAME
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4437 DUMMYUNIONNAME2
struct _RTL_BALANCED_NODE * Right
struct _RTL_BALANCED_NODE * Left
USHORT MaximumLength
Definition: umtypes.h:168
$ULONG Buffer
USHORT Length
Definition: umtypes.h:167
ULONGLONG Buffer
Definition: umtypes.h:177
USHORT MaximumLength
Definition: umtypes.h:176
USHORT Length
Definition: umtypes.h:175
_Field_size_bytes_part_opt_(MaximumLength, Length) PCHAR Buffer
_Field_size_bytes_part_(MaximumLength, Length) PWCH Buffer
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define LONG_PTR
Definition: treelist.c:79
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
char * PCHAR
Definition: typedefs.h:51
#define _NTDEF_
Definition: umtypes.h:20
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
#define FORCEINLINE
Definition: wdftypes.h:67
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175
#define const
Definition: zconf.h:233