c7e179aeefe3ed71999626a05930ff545d8e17d5
[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 #if (NTDDI_VERSION >= NTDDI_WINXP)
44 #include <dpfilter.h>
45 #endif
46
47 #include "intrin.h"
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 #if !defined(_NTHALDLL_) && !defined(_BLDR_)
54 #define NTHALAPI DECLSPEC_IMPORT
55 #else
56 #define NTHALAPI
57 #endif
58
59 /* For ReactOS */
60 #if !defined(_NTOSKRNL_) && !defined(_BLDR_)
61 #define NTKERNELAPI DECLSPEC_IMPORT
62 #else
63 #define NTKERNELAPI
64 #endif
65
66 #if defined(_X86_) && !defined(_NTHAL_)
67 #define _DECL_HAL_KE_IMPORT DECLSPEC_IMPORT
68 #elif defined(_X86_)
69 #define _DECL_HAL_KE_IMPORT
70 #else
71 #define _DECL_HAL_KE_IMPORT NTKERNELAPI
72 #endif
73
74 #if defined(_WIN64)
75 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
76 #else
77 #define POINTER_ALIGNMENT
78 #endif
79
80 /* Helper macro to enable gcc's extension. */
81 #ifndef __GNU_EXTENSION
82 #ifdef __GNUC__
83 #define __GNU_EXTENSION __extension__
84 #else
85 #define __GNU_EXTENSION
86 #endif
87 #endif
88
89 #if defined(_MSC_VER)
90
91 /* Indicate if #pragma alloc_text() is supported */
92 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
93 #define ALLOC_PRAGMA 1
94 #endif
95
96 /* Indicate if #pragma data_seg() is supported */
97 #if defined(_M_IX86) || defined(_M_AMD64)
98 #define ALLOC_DATA_PRAGMA 1
99 #endif
100
101 #endif
102
103 /* Forward declarations */
104 struct _IRP;
105 struct _MDL;
106 struct _KAPC;
107 struct _KDPC;
108 struct _FILE_OBJECT;
109 struct _DMA_ADAPTER;
110 struct _DEVICE_OBJECT;
111 struct _DRIVER_OBJECT;
112 struct _IO_STATUS_BLOCK;
113 struct _DEVICE_DESCRIPTION;
114 struct _SCATTER_GATHER_LIST;
115 struct _DRIVE_LAYOUT_INFORMATION;
116 struct _COMPRESSED_DATA_INFO;
117 struct _IO_RESOURCE_DESCRIPTOR;
118
119 /* Structures not exposed to drivers */
120 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
121 typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
122 typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
123 typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT;
124 typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
125 typedef struct _EPROCESS *PEPROCESS;
126 typedef struct _ETHREAD *PETHREAD;
127 typedef struct _IO_TIMER *PIO_TIMER;
128 typedef struct _KINTERRUPT *PKINTERRUPT;
129 typedef struct _KPROCESS *PKPROCESS;
130 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
131 typedef struct _CONTEXT *PCONTEXT;
132
133
134 $define (_WDMDDK_)
135 $include (interlocked.h)
136 $include (rtltypes.h)
137 $include (ketypes.h)
138 $include (mmtypes.h)
139 $include (extypes.h)
140 $include (setypes.h)
141 $include (potypes.h)
142 $include (cmtypes.h)
143 $include (iotypes.h)
144 $include (obtypes.h)
145 $include (pstypes.h)
146
147 #if defined(_M_IX86)
148 $include(x86/ke.h)
149 #elif defined(_M_AMD64)
150 $include(amd64/ke.h)
151 #elif defined(_M_IA64)
152 $include(ia64/ke.h)
153 #elif defined(_M_PPC)
154 $include(ppc/ke.h)
155 #elif defined(_M_MIPS)
156 $include(mips/ke.h)
157 #elif defined(_M_ARM)
158 $include(arm/ke.h)
159 #else
160 #error Unknown Architecture
161 #endif
162
163 $include (rtlfuncs.h)
164 $include (kefuncs.h)
165 $include (mmfuncs.h)
166 $include (sefuncs.h)
167 $include (cmfuncs.h)
168 $include (iofuncs.h)
169 $include (pofuncs.h)
170 $include (exfuncs.h)
171 $include (obfuncs.h)
172 $include (psfuncs.h)
173 $include (wmifuncs.h)
174 $include (kdfuncs.h)
175 $include (halfuncs.h)
176 $include (nttmapi.h)
177 $include (zwfuncs.h)
178
179 /******************************************************************************
180 * Unsorted *
181 ******************************************************************************/
182
183 /* GUID Comparison */
184 #ifndef __IID_ALIGNED__
185 #define __IID_ALIGNED__
186 #ifdef __cplusplus
187 inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
188 {
189 return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) &&
190 (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)) );
191 }
192 #else
193 #define IsEqualGUIDAligned(guid1, guid2) \
194 ( (*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && \
195 (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)) )
196 #endif /* __cplusplus */
197 #endif /* !__IID_ALIGNED__ */
198
199 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
200
201 #define MAXIMUM_FILENAME_LENGTH 256
202
203 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
204
205 #define OBJECT_TYPE_CREATE (0x0001)
206 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
207
208 #define DIRECTORY_QUERY (0x0001)
209 #define DIRECTORY_TRAVERSE (0x0002)
210 #define DIRECTORY_CREATE_OBJECT (0x0004)
211 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
212 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
213
214 #define EVENT_QUERY_STATE (0x0001)
215 #define EVENT_MODIFY_STATE (0x0002)
216 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
217
218 #define SEMAPHORE_QUERY_STATE (0x0001)
219 #define SEMAPHORE_MODIFY_STATE (0x0002)
220 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
221
222 #define SYMBOLIC_LINK_QUERY 0x0001
223 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
224
225 #define DUPLICATE_CLOSE_SOURCE 0x00000001
226 #define DUPLICATE_SAME_ACCESS 0x00000002
227 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
228
229 /* Global debug flag */
230 extern ULONG NtGlobalFlag;
231
232 /* Service Start Types */
233 #define SERVICE_BOOT_START 0x00000000
234 #define SERVICE_SYSTEM_START 0x00000001
235 #define SERVICE_AUTO_START 0x00000002
236 #define SERVICE_DEMAND_START 0x00000003
237 #define SERVICE_DISABLED 0x00000004
238
239 #ifndef _TRACEHANDLE_DEFINED
240 #define _TRACEHANDLE_DEFINED
241 typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
242 #endif
243
244
245
246 #ifdef __cplusplus
247 }
248 #endif
249
250 #endif /* !_WDMDDK_ */