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