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
43 #if (NTDDI_VERSION >= NTDDI_WINXP)
53 #if !defined(_NTHALDLL_) && !defined(_BLDR_)
54 #define NTHALAPI DECLSPEC_IMPORT
60 #if !defined(_NTOSKRNL_) && !defined(_BLDR_)
61 #define NTKERNELAPI DECLSPEC_IMPORT
66 #if defined(_X86_) && !defined(_NTHAL_)
67 #define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
69 #define _DECL_HAL_KE_IMPORT
71 #define _DECL_HAL_KE_IMPORT NTKERNELAPI
75 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
77 #define POINTER_ALIGNMENT
80 /* Helper macro to enable gcc's extension. */
81 #ifndef __GNU_EXTENSION
83 #define __GNU_EXTENSION __extension__
85 #define __GNU_EXTENSION
91 /* Indicate if #pragma alloc_text() is supported */
92 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
93 #define ALLOC_PRAGMA 1
96 /* Indicate if #pragma data_seg() is supported */
97 #if defined(_M_IX86) || defined(_M_AMD64)
98 #define ALLOC_DATA_PRAGMA 1
103 /* Forward declarations */
110 struct _DEVICE_OBJECT
;
111 struct _DRIVER_OBJECT
;
112 struct _IO_STATUS_BLOCK
;
113 struct _DEVICE_DESCRIPTION
;
114 struct _SCATTER_GATHER_LIST
;
115 struct _DRIVE_LAYOUT_INFORMATION
;
116 struct _COMPRESSED_DATA_INFO
;
117 struct _IO_RESOURCE_DESCRIPTOR
;
119 /* Structures not exposed to drivers */
120 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
121 typedef struct _HAL_DISPATCH_TABLE
*PHAL_DISPATCH_TABLE
;
122 typedef struct _HAL_PRIVATE_DISPATCH_TABLE
*PHAL_PRIVATE_DISPATCH_TABLE
;
123 typedef struct _ADAPTER_OBJECT
*PADAPTER_OBJECT
;
124 typedef struct _CALLBACK_OBJECT
*PCALLBACK_OBJECT
;
125 typedef struct _EPROCESS
*PEPROCESS
;
126 typedef struct _ETHREAD
*PETHREAD
;
127 typedef struct _IO_TIMER
*PIO_TIMER
;
128 typedef struct _KINTERRUPT
*PKINTERRUPT
;
129 typedef struct _KPROCESS
*PKPROCESS
;
130 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
131 typedef struct _CONTEXT
*PCONTEXT
;
135 $
include (interlocked
.h
)
136 $
include (rtltypes
.h
)
149 #elif defined(_M_AMD64)
151 #elif defined(_M_IA64)
153 #elif defined(_M_PPC)
155 #elif defined(_M_MIPS)
157 #elif defined(_M_ARM)
160 #error Unknown Architecture
163 $
include (rtlfuncs
.h
)
173 $
include (wmifuncs
.h
)
175 $
include (halfuncs
.h
)
179 /******************************************************************************
181 ******************************************************************************/
183 /* GUID Comparison */
184 #ifndef __IID_ALIGNED__
185 #define __IID_ALIGNED__
187 inline int IsEqualGUIDAligned(REFGUID guid1
, REFGUID guid2
)
189 return ( (*(PLONGLONG
)(&guid1
) == *(PLONGLONG
)(&guid2
)) &&
190 (*((PLONGLONG
)(&guid1
) + 1) == *((PLONGLONG
)(&guid2
) + 1)) );
193 #define IsEqualGUIDAligned(guid1, guid2) \
194 ( (*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && \
195 (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)) )
196 #endif /* __cplusplus */
197 #endif /* !__IID_ALIGNED__ */
199 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
201 #define MAXIMUM_FILENAME_LENGTH 256
203 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
205 #define OBJECT_TYPE_CREATE (0x0001)
206 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
208 #define DIRECTORY_QUERY (0x0001)
209 #define DIRECTORY_TRAVERSE (0x0002)
210 #define DIRECTORY_CREATE_OBJECT (0x0004)
211 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
212 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
214 #define EVENT_QUERY_STATE (0x0001)
215 #define EVENT_MODIFY_STATE (0x0002)
216 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
218 #define SEMAPHORE_QUERY_STATE (0x0001)
219 #define SEMAPHORE_MODIFY_STATE (0x0002)
220 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
222 #define SYMBOLIC_LINK_QUERY 0x0001
223 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
225 #define DUPLICATE_CLOSE_SOURCE 0x00000001
226 #define DUPLICATE_SAME_ACCESS 0x00000002
227 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
229 /* Global debug flag */
230 extern ULONG NtGlobalFlag
;
232 /* Service Start Types */
233 #define SERVICE_BOOT_START 0x00000000
234 #define SERVICE_SYSTEM_START 0x00000001
235 #define SERVICE_AUTO_START 0x00000002
236 #define SERVICE_DEMAND_START 0x00000003
237 #define SERVICE_DISABLED 0x00000004
239 #ifndef _TRACEHANDLE_DEFINED
240 #define _TRACEHANDLE_DEFINED
241 typedef ULONG64 TRACEHANDLE
, *PTRACEHANDLE
;
250 #endif /* !_WDMDDK_ */