ReactOS 0.4.16-dev-1873-g416c3a5
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)
43#define DECLSPEC_NOINITALL __pragma(warning(push)) __pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
44#else
45#define DECLSPEC_NOINITALL
46#endif
47#endif
48
49/* Default to strict */
50#ifndef NO_STRICT
51#ifndef STRICT
52#define STRICT 1
53#endif
54#endif
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/* Constant modifier */
79#ifndef CONST
80#define CONST const
81#endif
82
83/* TRUE/FALSE */
84#define FALSE 0
85#define TRUE 1
86
87/* NULL/NULL64 */
88#ifndef NULL
89#ifdef __cplusplus
90#define NULL 0
91#define NULL64 0
92#else
93#define NULL ((void *)0)
94#define NULL64 ((void * POINTER_64)0)
95#endif
96#endif /* NULL */
97
98#define ARGUMENT_PRESENT(ArgumentPointer) \
99 ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
100
101#if defined(_MANAGED)
102 #define FASTCALL __stdcall
103#elif defined(_M_IX86)
104 #define FASTCALL __fastcall
105#else
106 #define FASTCALL
107#endif /* _MANAGED */
108
109/* min/max helper macros */
110#ifndef NOMINMAX
111# ifndef min
112# define min(a,b) (((a) < (b)) ? (a) : (b))
113# endif
114# ifndef max
115# define max(a,b) (((a) > (b)) ? (a) : (b))
116# endif
117#endif /* NOMINMAX */
118
119/* Tell windef.h that we have defined some basic types */
120#define BASETYPES
121
126$include(ntbasedef.h)
127
128typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
130
131#ifndef __SECSTATUS_DEFINED__
132typedef long SECURITY_STATUS;
133#define __SECSTATUS_DEFINED__
134#endif
135
136/* Physical Addresses are always treated as 64-bit wide */
138
139#define TIME LARGE_INTEGER
140#define _TIME _LARGE_INTEGER
141#define PTIME PLARGE_INTEGER
142#define LowTime LowPart
143#define HighTime HighPart
144
145/* Used to store a non-float 8 byte aligned structure */
146typedef struct _QUAD
147{
148 _ANONYMOUS_UNION union
149 {
154
155#if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
156typedef CONST UCHAR *PCUCHAR;
157typedef CONST USHORT *PCUSHORT;
158typedef CONST ULONG *PCULONG;
159typedef CONST UQUAD *PCUQUAD;
160typedef CONST SCHAR *PCSCHAR;
161#endif /* (/_WIN32_WINNT >= 0x0600) */
162#if (_WIN32_WINNT >= 0x0600)
163typedef CONST NTSTATUS *PCNTSTATUS;
164#endif /* (/_WIN32_WINNT >= 0x0600) */
165
166/* String Types */
167typedef struct _STRING {
170#ifdef MIDL_PASS
171 [size_is(MaximumLength), length_is(Length) ]
172#endif
177
181
182typedef struct _STRING32 {
185 $ULONG Buffer;
189
190typedef struct _STRING64 {
197
198typedef struct _CSTRING {
203
204typedef struct _UNICODE_STRING {
207#ifdef MIDL_PASS
208 [size_is(MaximumLength / 2), length_is((Length) / 2)] PUSHORT Buffer;
209#else
211#endif
214
216
217#ifdef __cplusplus
218extern "C++" template<typename _Type> struct _RTL_remove_const_template;
219extern "C++" template<typename _Type> struct _RTL_remove_const_template<const _Type&> { typedef _Type type; };
220#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
221 (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
222extern "C++" template<class _Ty> struct _RTL_CONSTANT_STRING_type_check_template;
223extern "C++" template<class _Ty, int _Count> struct _RTL_CONSTANT_STRING_type_check_template<const _Ty (&)[_Count]> { typedef char type; };
224#define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
225#else
226# define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
228#endif
229#define RTL_CONSTANT_STRING(s) { \
230 sizeof(s)-sizeof((s)[0]), \
231 sizeof(s) / (sizeof(_RTL_CONSTANT_STRING_type_check(s))), \
232 _RTL_CONSTANT_STRING_remove_const_macro(s) }
233
234#ifdef _MSC_VER
235#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
236 WCHAR _var ## _buffer[_size]; \
237 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
238 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
239 __pragma(warning(pop))
240
241#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
242 const WCHAR _var##_buffer[] = _string; \
243 __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
244 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
245 __pragma(warning(pop))
246#else
247#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
248 WCHAR _var ## _buffer[_size]; \
249 UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer }
250
251#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
252 const WCHAR _var##_buffer[] = _string; \
253 const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer }
254#endif
255
256#define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
257 extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
258
259/* Object Attributes */
260typedef struct _OBJECT_ATTRIBUTES {
269
270typedef struct _OBJECT_ATTRIBUTES32 {
279
280typedef struct _OBJECT_ATTRIBUTES64 {
289
290#define OBJ_HANDLE_TAGBITS 0x00000003L
291
292/* Values for the Attributes member */
293#define OBJ_INHERIT 0x00000002L
294#define OBJ_PERMANENT 0x00000010L
295#define OBJ_EXCLUSIVE 0x00000020L
296#define OBJ_CASE_INSENSITIVE 0x00000040L
297#define OBJ_OPENIF 0x00000080L
298#define OBJ_OPENLINK 0x00000100L
299#define OBJ_KERNEL_HANDLE 0x00000200L
300#define OBJ_FORCE_ACCESS_CHECK 0x00000400L
301#define OBJ_VALID_ATTRIBUTES 0x000007F2L
302
303/* Helper Macro */
304#define InitializeObjectAttributes(p,n,a,r,s) { \
305 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
306 (p)->RootDirectory = (r); \
307 (p)->ObjectName = (n); \
308 (p)->Attributes = (a); \
309 (p)->SecurityDescriptor = (s); \
310 (p)->SecurityQualityOfService = NULL; \
311}
312
313#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n,a) { \
314 sizeof(OBJECT_ATTRIBUTES), \
315 NULL, \
316 RTL_CONST_CAST(PUNICODE_STRING)(n), \
317 a, \
318 NULL, \
319 NULL \
320}
321
322#define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
323 RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
324
325#ifdef _MSC_VER
326 #pragma warning(push)
327 #pragma warning(disable:4214) /* Bit fields of other types than int */
328#endif /* _MSC_VER */
329typedef struct _RTL_BALANCED_NODE
330{
331 _ANONYMOUS_UNION union
332 {
334 _ANONYMOUS_STRUCT struct
335 {
340 _ANONYMOUS_UNION union
341 {
347#ifdef _MSC_VER
348 #pragma warning(pop)
349#endif /* _MSC_VER */
350
351#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
352#define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
353 ((PRTL_BALANCED_NODE)((Node)->ParentValue & \
354 ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
355
356/* Product Types */
357typedef enum _NT_PRODUCT_TYPE {
362
363typedef enum _EVENT_TYPE {
367
368typedef enum _TIMER_TYPE {
372
373typedef enum _WAIT_TYPE {
375 WaitAny
377
378#ifndef MIDL_PASS
380VOID
382 _In_ PLIST_ENTRY32 ListEntry32,
383 _Out_ PLIST_ENTRY64 ListEntry64)
384{
385 ListEntry64->Flink = ListEntry32->Flink;
386 ListEntry64->Blink = ListEntry32->Blink;
387}
388
390VOID
392 _In_ PLIST_ENTRY64 ListEntry64,
393 _Out_ PLIST_ENTRY32 ListEntry32)
394{
395 /* ASSERT without ASSERT or intrinsics ... */
396 if (((ListEntry64->Flink >> 32) != 0) ||
397 ((ListEntry64->Blink >> 32) != 0))
398 {
399 (VOID)*(volatile LONG*)(LONG_PTR)-1;
400 }
401 ListEntry32->Flink = ListEntry64->Flink & 0xFFFFFFFF;
402 ListEntry32->Blink = ListEntry64->Blink & 0xFFFFFFFF;
403}
404#endif /* !MIDL_PASS */
405
406#ifdef __cplusplus
407} // extern "C"
408#endif
409
410#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 _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
#define __GNU_EXTENSION
Definition: ddraw.h:56
$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
_ANONYMOUS_UNION union _QUAD::@4427 DUMMYUNIONNAME
__GNU_EXTENSION __int64 UseThisFieldToCopy
double DoNotUseThisField
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4428 DUMMYUNIONNAME
struct _RTL_BALANCED_NODE * Children[2]
_ANONYMOUS_UNION union _RTL_BALANCED_NODE::@4429 DUMMYUNIONNAME2
_ANONYMOUS_STRUCT struct _RTL_BALANCED_NODE::@4428::@4430 DUMMYSTRUCTNAME
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