[EXT2FSD]
[reactos.git] / include / xdk / wdm.template.h
1 /*
2 * wdm.h
3 *
4 * Windows NT WDM Driver Developer Kit
5 *
6 * This file is part of the ReactOS DDK package.
7 *
8 * Contributors:
9 * Amine Khaldi
10 * Timo Kreuzer (timo.kreuzer@reactos.org)
11 *
12 * THIS SOFTWARE IS NOT COPYRIGHTED
13 *
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
16 *
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.
21 *
22 */
23 #pragma once
24
25 #ifndef _WDMDDK_
26 #define _WDMDDK_
27
28 /* Included via ntddk.h? */
29 #ifndef _NTDDK_
30 #define _NTDDK_
31 #define _WDM_INCLUDED_
32 #define _DDK_DRIVER_
33 #define NO_INTERLOCKED_INTRINSICS
34 #endif /* _NTDDK_ */
35
36 /* Dependencies */
37 #define NT_INCLUDED
38 #include <excpt.h>
39 #include <ntdef.h>
40 #include <ntstatus.h>
41 #include <ntiologc.h>
42
43 #ifndef GUID_DEFINED
44 #include <guiddef.h>
45 #endif
46
47 #if (NTDDI_VERSION >= NTDDI_WINXP)
48 #include <dpfilter.h>
49 #endif
50
51 #include "intrin.h"
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 #if !defined(_NTHALDLL_) && !defined(_BLDR_)
58 #define NTHALAPI DECLSPEC_IMPORT
59 #else
60 #define NTHALAPI
61 #endif
62
63 /* For ReactOS */
64 #if !defined(_NTOSKRNL_) && !defined(_BLDR_)
65 #define NTKERNELAPI DECLSPEC_IMPORT
66 #else
67 #define NTKERNELAPI
68 #endif
69
70 #if defined(_X86_) && !defined(_NTHAL_)
71 #define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
72 #elif defined(_X86_)
73 #define _DECL_HAL_KE_IMPORT
74 #else
75 #define _DECL_HAL_KE_IMPORT NTKERNELAPI
76 #endif
77
78 #if defined(_WIN64)
79 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
80 #else
81 #define POINTER_ALIGNMENT
82 #endif
83
84 /* Helper macro to enable gcc's extension. */
85 #ifndef __GNU_EXTENSION
86 #ifdef __GNUC__
87 #define __GNU_EXTENSION __extension__
88 #else
89 #define __GNU_EXTENSION
90 #endif
91 #endif
92
93 #if defined(_MSC_VER)
94
95 /* Indicate if #pragma alloc_text() is supported */
96 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
97 #define ALLOC_PRAGMA 1
98 #endif
99
100 /* Indicate if #pragma data_seg() is supported */
101 #if defined(_M_IX86) || defined(_M_AMD64)
102 #define ALLOC_DATA_PRAGMA 1
103 #endif
104
105 #endif
106
107 /* Forward declarations */
108 struct _IRP;
109 struct _MDL;
110 struct _KAPC;
111 struct _KDPC;
112 struct _FILE_OBJECT;
113 struct _DMA_ADAPTER;
114 struct _DEVICE_OBJECT;
115 struct _DRIVER_OBJECT;
116 struct _IO_STATUS_BLOCK;
117 struct _DEVICE_DESCRIPTION;
118 struct _SCATTER_GATHER_LIST;
119 struct _DRIVE_LAYOUT_INFORMATION;
120 struct _COMPRESSED_DATA_INFO;
121 struct _IO_RESOURCE_DESCRIPTOR;
122
123 /* Structures not exposed to drivers */
124 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
125 typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
126 typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
127 typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT;
128 typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
129 typedef struct _EPROCESS *PEPROCESS;
130 typedef struct _ETHREAD *PETHREAD;
131 typedef struct _IO_TIMER *PIO_TIMER;
132 typedef struct _KINTERRUPT *PKINTERRUPT;
133 typedef struct _KPROCESS *PKPROCESS;
134 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
135 typedef struct _CONTEXT *PCONTEXT;
136
137
138 $define (_WDMDDK_)
139 $include (interlocked.h)
140 $include (rtltypes.h)
141 $include (ketypes.h)
142 $include (mmtypes.h)
143 $include (extypes.h)
144 $include (setypes.h)
145 $include (potypes.h)
146 $include (cmtypes.h)
147 $include (iotypes.h)
148 $include (obtypes.h)
149 $include (pstypes.h)
150
151 #if defined(_M_IX86)
152 $include(x86/ke.h)
153 #elif defined(_M_AMD64)
154 $include(amd64/ke.h)
155 #elif defined(_M_IA64)
156 $include(ia64/ke.h)
157 #elif defined(_M_PPC)
158 $include(ppc/ke.h)
159 #elif defined(_M_MIPS)
160 $include(mips/ke.h)
161 #elif defined(_M_ARM)
162 $include(arm/ke.h)
163 #else
164 #error Unknown Architecture
165 #endif
166
167 $include (rtlfuncs.h)
168 $include (kefuncs.h)
169 $include (mmfuncs.h)
170 $include (sefuncs.h)
171 $include (cmfuncs.h)
172 $include (iofuncs.h)
173 $include (pofuncs.h)
174 $include (exfuncs.h)
175 $include (obfuncs.h)
176 $include (psfuncs.h)
177 $include (wmifuncs.h)
178 $include (kdfuncs.h)
179 $include (halfuncs.h)
180 $include (nttmapi.h)
181 $include (zwfuncs.h)
182
183 /******************************************************************************
184 * Unsorted *
185 ******************************************************************************/
186
187 #ifdef _MAC
188
189 #ifndef _INC_STRING
190 #include <string.h>
191 #endif
192
193 #else
194 #include <string.h>
195 #endif /* _MAC */
196
197 #ifndef DEFINE_GUIDEX
198 #ifdef _MSC_VER
199 #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
200 #else
201 #define DEFINE_GUIDEX(name) EXTERN_C const GUID name
202 #endif
203 #endif /* DEFINE_GUIDEX */
204
205 #ifndef STATICGUIDOF
206 #define STATICGUIDOF(guid) STATIC_##guid
207 #endif
208
209 /* GUID Comparison */
210 #ifndef __IID_ALIGNED__
211 #define __IID_ALIGNED__
212 #ifdef __cplusplus
213 inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
214 {
215 return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) &&
216 (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)) );
217 }
218 #else
219 #define IsEqualGUIDAligned(guid1, guid2) \
220 ( (*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && \
221 (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)) )
222 #endif /* __cplusplus */
223 #endif /* !__IID_ALIGNED__ */
224
225 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
226
227 #define MAXIMUM_FILENAME_LENGTH 256
228
229 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
230
231 #define OBJECT_TYPE_CREATE (0x0001)
232 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
233
234 #define DIRECTORY_QUERY (0x0001)
235 #define DIRECTORY_TRAVERSE (0x0002)
236 #define DIRECTORY_CREATE_OBJECT (0x0004)
237 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
238 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
239
240 #define EVENT_QUERY_STATE (0x0001)
241 #define EVENT_MODIFY_STATE (0x0002)
242 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
243
244 #define SEMAPHORE_QUERY_STATE (0x0001)
245 #define SEMAPHORE_MODIFY_STATE (0x0002)
246 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
247
248 #define SYMBOLIC_LINK_QUERY 0x0001
249 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
250
251 #define DUPLICATE_CLOSE_SOURCE 0x00000001
252 #define DUPLICATE_SAME_ACCESS 0x00000002
253 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
254
255 /* Global debug flag */
256 extern ULONG NtGlobalFlag;
257
258 #ifndef _TRACEHANDLE_DEFINED
259 #define _TRACEHANDLE_DEFINED
260 typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
261 #endif
262
263
264
265 #ifdef __cplusplus
266 }
267 #endif
268
269 #endif /* !_WDMDDK_ */