[XDK][DDK]
[reactos.git] / reactos / 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 (amine.khaldi@reactos.org)
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 #define WDM_MAJORVERSION 0x06
29 #define WDM_MINORVERSION 0x00
30
31 /* Included via ntddk.h? */
32 #ifndef _NTDDK_
33 #define _NTDDK_
34 #define _WDM_INCLUDED_
35 #define _DDK_DRIVER_
36 #define NO_INTERLOCKED_INTRINSICS
37 #endif /* _NTDDK_ */
38
39 /* Dependencies */
40 #define NT_INCLUDED
41 #include <excpt.h>
42 #include <ntdef.h>
43 #include <ntstatus.h>
44 #include <kernelspecs.h>
45 #include <ntiologc.h>
46
47 #ifndef GUID_DEFINED
48 #include <guiddef.h>
49 #endif
50
51 #ifdef _MAC
52 #ifndef _INC_STRING
53 #include <string.h>
54 #endif /* _INC_STRING */
55 #else
56 #include <string.h>
57 #endif /* _MAC */
58
59 #ifndef _KTMTYPES_
60 typedef GUID UOW, *PUOW;
61 #endif
62
63 typedef GUID *PGUID;
64
65 #if (NTDDI_VERSION >= NTDDI_WINXP)
66 #include <dpfilter.h>
67 #endif
68
69 #include "intrin.h"
70
71 __internal_kernel_driver
72 __drv_Mode_impl(WDM_INCLUDED)
73
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77
78 #if !defined(_NTHALDLL_) && !defined(_BLDR_)
79 #define NTHALAPI DECLSPEC_IMPORT
80 #else
81 #define NTHALAPI
82 #endif
83
84 /* For ReactOS */
85 #if !defined(_NTOSKRNL_) && !defined(_BLDR_) && !defined(_NTSYSTEM_)
86 #define NTKERNELAPI DECLSPEC_IMPORT
87 #else
88 #define NTKERNELAPI
89 #ifndef _NTSYSTEM_
90 #define _NTSYSTEM_
91 #endif
92 #endif
93
94 #if defined(_X86_) && !defined(_NTHAL_)
95 #define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
96 #elif defined(_X86_)
97 #define _DECL_HAL_KE_IMPORT
98 #else
99 #define _DECL_HAL_KE_IMPORT NTKERNELAPI
100 #endif
101
102 #if defined(_WIN64)
103 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
104 #else
105 #define POINTER_ALIGNMENT
106 #endif
107
108 /* Helper macro to enable gcc's extension. */
109 #ifndef __GNU_EXTENSION
110 #ifdef __GNUC__
111 #define __GNU_EXTENSION __extension__
112 #else
113 #define __GNU_EXTENSION
114 #endif
115 #endif
116
117 #if defined(_MSC_VER)
118
119 /* Disable some warnings */
120 #pragma warning(disable:4115) /* Named type definition in parentheses */
121 #pragma warning(disable:4201) /* Nameless unions and structs */
122 #pragma warning(disable:4214) /* Bit fields of other types than int */
123 #pragma warning(disable:4820) /* Padding added, due to alignment requirement */
124
125 /* Indicate if #pragma alloc_text() is supported */
126 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
127 #define ALLOC_PRAGMA 1
128 #endif
129
130 /* Indicate if #pragma data_seg() is supported */
131 #if defined(_M_IX86) || defined(_M_AMD64)
132 #define ALLOC_DATA_PRAGMA 1
133 #endif
134
135 #endif /* _MSC_VER */
136
137 /* These macros are used to create aliases for imported data. We need to do
138 this to have declarations that are compatible with MS DDK */
139 #ifdef _M_IX86
140 #define __SYMBOL(_Name) "_"#_Name
141 #define __IMPORTSYMBOL(_Name) "__imp__"#_Name
142 #define __IMPORTNAME(_Name) __imp__##_Name
143 #else
144 #define __SYMBOL(_Name) #_Name
145 #define __IMPORTSYMBOL(_Name) "__imp_"#_Name
146 #define __IMPORTNAME(_Name) __imp_##_Name
147 #endif
148 #ifdef _MSC_VER
149 #define __CREATE_NTOS_DATA_IMPORT_ALIAS(_Name) \
150 __pragma(comment(linker, "/alternatename:"__SYMBOL(_Name) "=" __IMPORTSYMBOL(_Name)))
151 #else /* !_MSC_VER */
152 #ifndef __STRINGIFY
153 #define __STRINGIFY(_exp) #_exp
154 #endif
155 #define _Pragma_redefine_extname(_Name, _Target) _Pragma(__STRINGIFY(redefine_extname _Name _Target))
156 #define __CREATE_NTOS_DATA_IMPORT_ALIAS(_Name) \
157 _Pragma_redefine_extname(_Name,__IMPORTNAME(_Name))
158 #endif
159
160 #if defined(_WIN64)
161 #if !defined(USE_DMA_MACROS) && !defined(_NTHAL_)
162 #define USE_DMA_MACROS
163 #endif
164 #if !defined(NO_LEGACY_DRIVERS) && !defined(__REACTOS__)
165 #define NO_LEGACY_DRIVERS
166 #endif
167 #endif /* defined(_WIN64) */
168
169 /* Forward declarations */
170 struct _IRP;
171 struct _MDL;
172 struct _KAPC;
173 struct _KDPC;
174 struct _FILE_OBJECT;
175 struct _DMA_ADAPTER;
176 struct _DEVICE_OBJECT;
177 struct _DRIVER_OBJECT;
178 struct _IO_STATUS_BLOCK;
179 struct _DEVICE_DESCRIPTION;
180 struct _SCATTER_GATHER_LIST;
181 struct _DRIVE_LAYOUT_INFORMATION;
182 struct _COMPRESSED_DATA_INFO;
183 struct _IO_RESOURCE_DESCRIPTOR;
184
185 /* Structures not exposed to drivers */
186 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
187 typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
188 typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
189 typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
190 typedef struct _EPROCESS *PEPROCESS;
191 typedef struct _ETHREAD *PETHREAD;
192 typedef struct _IO_TIMER *PIO_TIMER;
193 typedef struct _KINTERRUPT *PKINTERRUPT;
194 typedef struct _KPROCESS *PKPROCESS;
195 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
196 typedef struct _CONTEXT *PCONTEXT;
197
198 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_)
199 typedef struct _DMA_ADAPTER *PADAPTER_OBJECT;
200 #elif defined(_WDM_INCLUDED_)
201 typedef struct _DMA_ADAPTER *PADAPTER_OBJECT;
202 #else
203 typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT;
204 #endif
205
206 #ifndef DEFINE_GUIDEX
207 #ifdef _MSC_VER
208 #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
209 #else
210 #define DEFINE_GUIDEX(name) EXTERN_C const GUID name
211 #endif
212 #endif /* DEFINE_GUIDEX */
213
214 #ifndef STATICGUIDOF
215 #define STATICGUIDOF(guid) STATIC_##guid
216 #endif
217
218 /* GUID Comparison */
219 #ifndef __IID_ALIGNED__
220 #define __IID_ALIGNED__
221 #ifdef __cplusplus
222 inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
223 {
224 return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) &&
225 (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)) );
226 }
227 #else
228 #define IsEqualGUIDAligned(guid1, guid2) \
229 ( (*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && \
230 (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)) )
231 #endif /* __cplusplus */
232 #endif /* !__IID_ALIGNED__ */
233
234
235 $define (_WDMDDK_)
236 $include (interlocked.h)
237 $include (rtltypes.h)
238 $include (ketypes.h)
239 $include (mmtypes.h)
240 $include (extypes.h)
241 $include (setypes.h)
242 $include (potypes.h)
243 $include (cmtypes.h)
244 $include (iotypes.h)
245 $include (obtypes.h)
246 $include (pstypes.h)
247 $include (wmitypes.h)
248
249 $include (kefuncs.h)
250 $include (rtlfuncs.h)
251 $include (mmfuncs.h)
252 $include (sefuncs.h)
253 $include (cmfuncs.h)
254 $include (iofuncs.h)
255 $include (pofuncs.h)
256 $include (exfuncs.h)
257 $include (obfuncs.h)
258 $include (psfuncs.h)
259 $include (wmifuncs.h)
260 $include (kdfuncs.h)
261 $include (halfuncs.h)
262 $include (nttmapi.h)
263 $include (zwfuncs.h)
264
265 #ifdef __cplusplus
266 }
267 #endif
268
269 #endif /* !_WDMDDK_ */