4 * Windows NT WDM Driver Developer Kit
6 * This file is part of the ReactOS DDK package.
10 * Timo Kreuzer (timo.kreuzer@reactos.org)
12 * THIS SOFTWARE IS NOT COPYRIGHTED
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAIMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 /* Included via ntddk.h? */
31 #define _WDM_INCLUDED_
33 #define NO_INTERLOCKED_INTRINSICS
48 typedef GUID UOW
, *PUOW
;
53 #if (NTDDI_VERSION >= NTDDI_WINXP)
63 #if !defined(_NTHALDLL_) && !defined(_BLDR_)
64 #define NTHALAPI DECLSPEC_IMPORT
70 #if !defined(_NTOSKRNL_) && !defined(_BLDR_)
71 #define NTKERNELAPI DECLSPEC_IMPORT
76 #if defined(_X86_) && !defined(_NTHAL_)
77 #define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
79 #define _DECL_HAL_KE_IMPORT
81 #define _DECL_HAL_KE_IMPORT NTKERNELAPI
85 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
87 #define POINTER_ALIGNMENT
90 /* Helper macro to enable gcc's extension. */
91 #ifndef __GNU_EXTENSION
93 #define __GNU_EXTENSION __extension__
95 #define __GNU_EXTENSION
101 /* Indicate if #pragma alloc_text() is supported */
102 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
103 #define ALLOC_PRAGMA 1
106 /* Indicate if #pragma data_seg() is supported */
107 #if defined(_M_IX86) || defined(_M_AMD64)
108 #define ALLOC_DATA_PRAGMA 1
113 /* Forward declarations */
120 struct _DEVICE_OBJECT
;
121 struct _DRIVER_OBJECT
;
122 struct _IO_STATUS_BLOCK
;
123 struct _DEVICE_DESCRIPTION
;
124 struct _SCATTER_GATHER_LIST
;
125 struct _DRIVE_LAYOUT_INFORMATION
;
126 struct _COMPRESSED_DATA_INFO
;
127 struct _IO_RESOURCE_DESCRIPTOR
;
129 /* Structures not exposed to drivers */
130 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
131 typedef struct _HAL_DISPATCH_TABLE
*PHAL_DISPATCH_TABLE
;
132 typedef struct _HAL_PRIVATE_DISPATCH_TABLE
*PHAL_PRIVATE_DISPATCH_TABLE
;
133 typedef struct _CALLBACK_OBJECT
*PCALLBACK_OBJECT
;
134 typedef struct _EPROCESS
*PEPROCESS
;
135 typedef struct _ETHREAD
*PETHREAD
;
136 typedef struct _IO_TIMER
*PIO_TIMER
;
137 typedef struct _KINTERRUPT
*PKINTERRUPT
;
138 typedef struct _KPROCESS
*PKPROCESS
;
139 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
140 typedef struct _CONTEXT
*PCONTEXT
;
142 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && ( defined(_NTDDK_) || defined(_NTDRIVER_) || defined(_NTOSP_))
143 typedef struct _DMA_ADAPTER
*PADAPTER_OBJECT
;
144 #elif defined(_WDM_INCLUDED_)
145 typedef struct _DMA_ADAPTER
*PADAPTER_OBJECT
;
147 typedef struct _ADAPTER_OBJECT
*PADAPTER_OBJECT
;
152 $
include (interlocked
.h
)
153 $
include (rtltypes
.h
)
163 $
include (wmitypes
.h
)
167 #elif defined(_M_AMD64)
169 #elif defined(_M_IA64)
171 #elif defined(_M_PPC)
173 #elif defined(_M_MIPS)
175 #elif defined(_M_ARM)
178 #error Unknown Architecture
181 $
include (rtlfuncs
.h
)
191 $
include (wmifuncs
.h
)
193 $
include (halfuncs
.h
)
197 /******************************************************************************
199 ******************************************************************************/
211 #ifndef DEFINE_GUIDEX
213 #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
215 #define DEFINE_GUIDEX(name) EXTERN_C const GUID name
217 #endif /* DEFINE_GUIDEX */
220 #define STATICGUIDOF(guid) STATIC_##guid
223 /* GUID Comparison */
224 #ifndef __IID_ALIGNED__
225 #define __IID_ALIGNED__
227 inline int IsEqualGUIDAligned(REFGUID guid1
, REFGUID guid2
)
229 return ( (*(PLONGLONG
)(&guid1
) == *(PLONGLONG
)(&guid2
)) &&
230 (*((PLONGLONG
)(&guid1
) + 1) == *((PLONGLONG
)(&guid2
) + 1)) );
233 #define IsEqualGUIDAligned(guid1, guid2) \
234 ( (*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && \
235 (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)) )
236 #endif /* __cplusplus */
237 #endif /* !__IID_ALIGNED__ */
239 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
241 #define MAXIMUM_FILENAME_LENGTH 256
243 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
245 #define OBJECT_TYPE_CREATE (0x0001)
246 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
248 #define DIRECTORY_QUERY (0x0001)
249 #define DIRECTORY_TRAVERSE (0x0002)
250 #define DIRECTORY_CREATE_OBJECT (0x0004)
251 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
252 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
254 #define SYMBOLIC_LINK_QUERY 0x0001
255 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
257 #define DUPLICATE_CLOSE_SOURCE 0x00000001
258 #define DUPLICATE_SAME_ACCESS 0x00000002
259 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
261 /* Global debug flag */
263 extern ULONG NtGlobalFlag
;
264 #define IF_NTOS_DEBUG(FlagName) if (NtGlobalFlag & (FLG_ ## FlagName))
266 #define IF_NTOS_DEBUG(FlagName) if(FALSE)
269 #ifndef _TRACEHANDLE_DEFINED
270 #define _TRACEHANDLE_DEFINED
271 typedef ULONG64 TRACEHANDLE
, *PTRACEHANDLE
;
274 extern PBOOLEAN Mm64BitPhysicalAddress
;
276 extern PVOID MmBadPointer
;
282 #endif /* !_WDMDDK_ */