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