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