ReactOS 0.4.15-dev-7788-g1ad9096
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/* Default to strict */
42#ifndef NO_STRICT
43#ifndef STRICT
44#define STRICT 1
45#endif
46#endif
47
48/* Pseudo Modifiers for Input Parameters */
49
50#ifndef IN
51#define IN
52#endif
53
54#ifndef OUT
55#define OUT
56#endif
57
58#ifndef OPTIONAL
59#define OPTIONAL
60#endif
61
62#ifndef NOTHING
63#define NOTHING
64#endif
65
66#ifndef CRITICAL
67#define CRITICAL
68#endif
69
70/* Constant modifier */
71#ifndef CONST
72#define CONST const
73#endif
74
75/* TRUE/FALSE */
76#define FALSE 0
77#define TRUE 1
78
79/* NULL/NULL64 */
80#ifndef NULL
81#ifdef __cplusplus
82#define NULL 0
83#define NULL64 0
84#else
85#define NULL ((void *)0)
86#define NULL64 ((void * POINTER_64)0)
87#endif
88#endif /* NULL */
89
90#define ARGUMENT_PRESENT(ArgumentPointer) \
91 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
92
93#if defined(_MANAGED)
94 #define FASTCALL __stdcall
95#elif defined(_M_IX86)
96 #define FASTCALL __fastcall
97#else
98 #define FASTCALL
99#endif /* _MANAGED */
100
101/* min/max helper macros */
102#ifndef NOMINMAX
103# ifndef min
104# define min(a,b) (((a) < (b)) ? (a) : (b))
105# endif
106# ifndef max
107# define max(a,b) (((a) > (b)) ? (a) : (b))
108# endif
109#endif /* NOMINMAX */
110
111/* Tell windef.h that we have defined some basic types */
112#define BASETYPES
113
118$include(ntbasedef.h)
119
120typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
122
123#ifndef __SECSTATUS_DEFINED__
124typedef long SECURITY_STATUS;
125#define __SECSTATUS_DEFINED__
126#endif
127
128/* Physical Addresses are always treated as 64-bit wide */
130
131#define TIME LARGE_INTEGER
132#define _TIME _LARGE_INTEGER
133#define PTIME PLARGE_INTEGER
134#define LowTime LowPart
135#define HighTime HighPart
136
137/* Used to store a non-float 8 byte aligned structure */
138typedef struct _QUAD
139{
140 _ANONYMOUS_UNION union
141 {
146
147#if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
148typedef CONST UCHAR *PCUCHAR;
149typedef CONST USHORT *PCUSHORT;
150typedef CONST ULONG *PCULONG;
151typedef CONST UQUAD *PCUQUAD;
152typedef CONST SCHAR *PCSCHAR;
153#endif /* (/_WIN32_WINNT >= 0x0600) */
154#if (_WIN32_WINNT >= 0x0600)
155typedef CONST NTSTATUS *PCNTSTATUS;
156#endif /* (/_WIN32_WINNT >= 0x0600) */
157
158/* String Types */
159typedef struct _STRING {
162#ifdef MIDL_PASS
163 [size_is(MaximumLength), length_is(Length) ]
164#endif
169
173
174typedef struct _STRING32 {
177 $ULONG Buffer;
181
182typedef struct _STRING64 {
189
190typedef struct _CSTRING {
195
196typedef struct _UNICODE_STRING {
199#ifdef MIDL_PASS
200 [size_is(MaximumLength / 2), length_is((Length) / 2)] PUSHORT Buffer;
201#else
203#endif
206
208
209#ifdef __cplusplus
210extern "C++" template<typename _Type> struct _RTL_remove_const_template;
211extern "C++" template<typename _Type> struct _RTL_remove_const_template<const _Type&> { typedef _Type type; };
212#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
213 (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
214extern "C++" template<class _Ty> struct _RTL_CONSTANT_STRING_type_check_template;
215extern "C++" template<class _Ty, int _Count> struct _RTL_CONSTANT_STRING_type_check_template<const _Ty (&)[_Count]> { typedef char type; };
216#define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
217#else
218# define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
220#endif
221#define RTL_CONSTANT_STRING(s) { \
222 sizeof(s)-sizeof((s)[0]), \
223 sizeof(s) / (sizeof(_RTL_CONSTANT_STRING_type_check(s))), \
224 _RTL_CONSTANT_STRING_remove_const_macro(s) }
225
226#ifdef _MSC_VER
227#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
228 WCHAR _var ## _buffer[_size]; \
229 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
230 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
231 __pragma(warning(pop))
232
233#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
234 const WCHAR _var##_buffer[] = _string; \
235 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
236 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
237 __pragma(warning(pop))
238#else
239#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
240 WCHAR _var ## _buffer[_size]; \
241 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer }
242
243#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
244 const WCHAR _var##_buffer[] = _string; \
245 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer }
246#endif
247
248#define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
249 extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
250
251/* Object Attributes */
252typedef struct _OBJECT_ATTRIBUTES {
261
262typedef struct _OBJECT_ATTRIBUTES32 {
271
272typedef struct _OBJECT_ATTRIBUTES64 {
281
282#define OBJ_HANDLE_TAGBITS 0x00000003L
283
284/* Values for the Attributes member */
285#define OBJ_INHERIT 0x00000002L
286#define OBJ_PERMANENT 0x00000010L
287#define OBJ_EXCLUSIVE 0x00000020L
288#define OBJ_CASE_INSENSITIVE 0x00000040L
289#define OBJ_OPENIF 0x00000080L
290#define OBJ_OPENLINK 0x00000100L
291#define OBJ_KERNEL_HANDLE 0x00000200L
292#define OBJ_FORCE_ACCESS_CHECK 0x00000400L
293#define OBJ_VALID_ATTRIBUTES 0x000007F2L
294
295/* Helper Macro */
296#define InitializeObjectAttributes(p,n,a,r,s) { \
297 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
298 (p)->RootDirectory = (r); \
299 (p)->ObjectName = (n); \
300 (p)->Attributes = (a); \
301 (p)->SecurityDescriptor = (s); \
302 (p)->SecurityQualityOfService = NULL; \
303}
304
305#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n,a) { \
306 sizeof(OBJECT_ATTRIBUTES), \
307 NULL, \
308 RTL_CONST_CAST(PUNICODE_STRING)(n), \
309 a, \
310 NULL, \
311 NULL \
312}
313
314#define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
315 RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
316
317#ifdef _MSC_VER
318 #pragma warning(push)
319 #pragma warning(disable:4214) /* Bit fields of other types than int */
320#endif /* _MSC_VER */
321typedef struct _RTL_BALANCED_NODE
322{
323 _ANONYMOUS_UNION union
324 {
326 _ANONYMOUS_STRUCT struct
327 {
332 _ANONYMOUS_UNION union
333 {
339#ifdef _MSC_VER
340 #pragma warning(pop)
341#endif /* _MSC_VER */
342
343#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
344#define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
345 ((PRTL_BALANCED_NODE)((Node)->ParentValue & \
346 ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
347
348/* Product Types */
349typedef enum _NT_PRODUCT_TYPE {
354
355typedef enum _EVENT_TYPE {
359
360typedef enum _TIMER_TYPE {
364
365typedef enum _WAIT_TYPE {
367 WaitAny
369
370#ifndef MIDL_PASS
372VOID
374 _In_ PLIST_ENTRY32 ListEntry32,
375 _Out_ PLIST_ENTRY64 ListEntry64)
376{
377 ListEntry64->Flink = ListEntry32->Flink;
378 ListEntry64->Blink = ListEntry32->Blink;
379}
380
382VOID
384 _In_ PLIST_ENTRY64 ListEntry64,
385 _Out_ PLIST_ENTRY32 ListEntry32)
386{
387 /* ASSERT without ASSERT or intrinsics ... */
388 if (((ListEntry64->Flink >> 32) != 0) ||
389 ((ListEntry64->Blink >> 32) != 0))
390 {
391 (VOID)*(volatile LONG*)(LONG_PTR)-1;
392 }
393 ListEntry32->Flink = ListEntry64->Flink & 0xFFFFFFFF;
394 ListEntry32->Blink = ListEntry64->Blink & 0xFFFFFFFF;
395}
396#endif /* !MIDL_PASS */
397
398#ifdef __cplusplus
399} // extern "C"
400#endif
401
402#endif /* _NTDEF_ */
#define __GNU_EXTENSION
Definition: _mingw_mac.h:135
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
#define __int64
Definition: basetyps.h:16
Definition: bufpool.h:45
#define NTSTATUS
Definition: precomp.h:21
_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
_Check_return_ _Ret_maybenull_ _In_ size_t _Count
Definition: malloc.h:108
unsigned __int64 ULONG64
Definition: imports.h:198
#define _Return_type_success_(expr)
Definition: ms_sal.h:263
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
WCHAR * PWCH
Definition: ntbasedef.h:410
#define _ANONYMOUS_UNION
Definition: ntbasedef.h:30
#define _ANONYMOUS_STRUCT
Definition: ntbasedef.h:56
$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
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:158
CONST CHAR * Buffer
Definition: umtypes.h:159
USHORT Length
Definition: umtypes.h:157
ULONG64 SecurityQualityOfService
HANDLE RootDirectory
Definition: umtypes.h:184
PVOID SecurityQualityOfService
Definition: umtypes.h:188
PUNICODE_STRING ObjectName
Definition: umtypes.h:185
PVOID SecurityDescriptor
Definition: umtypes.h:187
_ANONYMOUS_UNION union _QUAD::@4136 DUMMYUNIONNAME
__GNU_EXTENSION __int64 UseThisFieldToCopy
double DoNotUseThisField
struct _RTL_BALANCED_NODE * Children[2]
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4137 DUMMYUNIONNAME
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4138 DUMMYUNIONNAME2
_ANONYMOUS_STRUCT struct _RTL_BALANCED_NODE::@4137::@4139 DUMMYSTRUCTNAME
struct _RTL_BALANCED_NODE * Right
struct _RTL_BALANCED_NODE * Left
USHORT MaximumLength
Definition: umtypes.h:166
$ULONG Buffer
USHORT Length
Definition: umtypes.h:165
ULONGLONG Buffer
Definition: umtypes.h:175
USHORT MaximumLength
Definition: umtypes.h:174
USHORT Length
Definition: umtypes.h:173
_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