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