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