1 /* 2 * PROJECT: ReactOS DDK 3 * COPYRIGHT: This file is in the Public Domain. 4 * FILE: include/psdk/driverspecs.h 5 * ABSTRACT: This header stubs out Driver Verifier annotations to 6 * allow drivers using them to compile with our header set. 7 */ 8 9 #pragma once 10 #define DRIVERSPECS_H 11 12 #ifndef SPECSTRINGS_H 13 #include <specstrings.h> 14 #endif 15 16 //#include "sdv_driverspecs.h" 17 #include <concurrencysal.h> 18 19 #ifdef _PREFAST_ 20 21 /* IRQL annotations are only valid when included from kernelspecs.h */ 22 #define _IRQL_always_function_max_(irql) 23 #define _IRQL_always_function_min_(irql) 24 #define _IRQL_is_cancel_ 25 #define _IRQL_raises_(irql) 26 #define _IRQL_requires_(irql) 27 #define _IRQL_requires_max_(irql) 28 #define _IRQL_requires_max_defined 29 #define _IRQL_requires_min_(irql) 30 #define _IRQL_requires_same_ 31 #define _IRQL_restores_ 32 #define _IRQL_restores_global_(kind,param) 33 #define _IRQL_saves_ 34 #define _IRQL_saves_global_(kind,param) 35 #define _IRQL_uses_cancel_ 36 #define __drv_setsIRQL(irql) 37 38 #define _Dispatch_type_(x) _Function_class_(x) 39 #define _Kernel_clear_do_init_(yesNo) _Post_ _SA_annotes1(SAL_clearDoInit,yesNo) 40 #define _Kernel_float_restored_ _Post_ _SA_annotes0(SAL_floatRestored) 41 #define _Kernel_float_saved_ _Post_ _SA_annotes0(SAL_floatSaved) 42 #define _Kernel_float_used_ _Post_ _SA_annotes0(SAL_floatUsed) 43 #define _Kernel_IoGetDmaAdapter_ _Post_ _SA_annotes0(SAL_IoGetDmaAdapter) 44 #define _Kernel_releases_resource_(kind) _Post_ _SA_annotes1(SAL_release, #kind) 45 #define _Kernel_requires_resource_held_(kind) _Pre_ _SA_annotes1(SAL_mustHold, #kind) 46 #define _Kernel_requires_resource_not_held_(kind) _Pre_ _SA_annotes1(SAL_neverHold, #kind) 47 #define _Kernel_acquires_resource_(kind) _Post_ _SA_annotes1(SAL_acquire, #kind) 48 #define _Landmark_(name) 49 #define __drv_acquiresCancelSpinLock _Acquires_nonreentrant_lock_(_Global_cancel_spin_lock_) 50 #define __drv_acquiresCriticalRegion _Acquires_lock_(_Global_critical_region_) 51 #define __drv_acquiresExclusiveResource(kind) _Acquires_nonreentrant_lock_(_Curr_) 52 #define __drv_acquiresExclusiveResourceGlobal(kind,param) _Acquires_nonreentrant_lock_(param) 53 #define __drv_acquiresPriorityRegion _Acquires_lock_(_Global_priority_region_) 54 #define __drv_acquiresResource(kind) _Acquires_lock_(_Curr_) 55 #define __drv_acquiresResourceGlobal(kind,param) _Acquires_lock_(param) 56 #define __drv_aliasesMem _Post_ _SA_annotes0(SAL_IsAliased) 57 #define __drv_allocatesMem(kind) _Post_ _SA_annotes1(SAL_NeedsRelease,__yes) 58 #define __drv_arg(expr,annotes) _At_(expr,annotes) 59 #define __drv_at(expr,annotes) _At_(expr,annotes) 60 #define __drv_callbackType(kind) _SA_annotes1(SAL_callbackType, #kind) 61 #define __drv_clearDoInit _Kernel_clear_do_init_ 62 #define __drv_completionType(kindlist) _SA_annotes1(SAL_completionType, #kindlist) 63 #define __drv_constant _Literal_ 64 #define __drv_defined(x) _Macro_defined_(#x) 65 #define __drv_deref(annotes) __deref _Group_(annotes) 66 #define __drv_dispatchType_other _Dispatch_type_(IRP_MJ_OTHER) 67 #define __drv_dispatchType(x) _Dispatch_type_(x) 68 #define __drv_floatRestored _Kernel_float_restored_ 69 #define __drv_floatSaved _Kernel_float_saved_ 70 #define __drv_floatUsed _Kernel_float_used_ 71 #define __drv_formatString(kind) _SA_annotes1(SAL_IsFormatString, #kind) 72 #define __drv_freesMem(kind) _Post_ _SA_annotes1(SAL_NeedsRelease,__no) 73 #define __drv_fun(annotes) _At_(return, annotes) 74 #define __drv_functionClass(x) _Function_class_(x) 75 #define __drv_holdsCancelSpinLock() _Holds_resource_global_("CancelSpinLock",) 76 #define __drv_holdsCriticalRegion() _Holds_resource_global_("CriticalRegion",) 77 #define __drv_holdsPriorityRegion() _Holds_resource_global_("PriorityRegion",) 78 #define __drv_in_deref(annotes) _Pre_ __deref _Group_(annotes) 79 #define __drv_in(annotes) _Pre_ _Group_(annotes) 80 #define __drv_innerAcquiresGlobal(kind,param) _Post_ _SA_annotes2(SAL_acquireGlobal, #kind, param\t) 81 #define __drv_innerMustHoldGlobal(kind,param) 82 #define __drv_innerNeverHoldGlobal(kind,param) 83 #define __drv_innerReleasesGlobal(kind,param) 84 #define __drv_interlocked 85 #define __drv_inTry 86 #define __drv_IoGetDmaAdapter 87 #define __drv_isCancelIRQL _IRQL_is_cancel_ 88 #define __drv_isObjectPointer 89 #define __drv_KMDF 90 #define __drv_maxFunctionIRQL(irql) 91 #define __drv_maxIRQL(irql) 92 #define __drv_minFunctionIRQL(irql) 93 #define __drv_minIRQL(irql) 94 #define __drv_Mode_impl(x) 95 #define __drv_mustHold(kind) 96 #define __drv_mustHoldCancelSpinLock 97 #define __drv_mustHoldCriticalRegion 98 #define __drv_mustHoldGlobal(kind,param) 99 #define __drv_mustHoldPriorityRegion 100 #define __drv_NDIS 101 #define __drv_neverHold(kind) 102 #define __drv_neverHoldCancelSpinLock 103 #define __drv_neverHoldCriticalRegion 104 #define __drv_neverHoldGlobal(kind,param) 105 #define __drv_neverHoldPriorityRegion 106 #define __drv_nonConstant 107 #define __drv_notInTry 108 #define __drv_notPointer 109 #define __drv_out_deref(annotes) 110 #define __drv_out(annotes) 111 #define __drv_preferredFunction(func,why) 112 #define __drv_raisesIRQL(irql) 113 #define __drv_releasesCancelSpinLock 114 #define __drv_releasesCriticalRegion 115 #define __drv_releasesExclusiveResource(kind) 116 #define __drv_releasesExclusiveResourceGlobal(kind,param) 117 #define __drv_releasesPriorityRegion 118 #define __drv_releasesResource(kind) 119 #define __drv_releasesResourceGlobal(kind,param) 120 #define __drv_reportError(why) 121 #define __drv_requiresIRQL(irql) 122 #define __drv_restoresIRQL 123 #define __drv_restoresIRQLGlobal(kind,param) 124 #define __drv_ret(annotes) 125 #define __drv_sameIRQL 126 #define __drv_savesIRQL 127 #define __drv_savesIRQLGlobal 128 #define __drv_strictType(typename,mode) 129 #define __drv_strictTypeMatch(mode) 130 #define __drv_unit(p) 131 #define __drv_useCancelIRQL 132 #define __drv_valueIs(arglist) 133 #define __drv_WDM 134 #define __drv_when(cond,annotes) 135 #define __internal_kernel_driver 136 #define __kernel_code 137 #define __kernel_driver 138 #define __prefast_operator_new_null \ 139 void* __cdecl operator new(size_t size) throw(); \ 140 void* __cdecl operator new[](size_t size) throw(); \ 141 _Analysis_mode_(_Analysis_operator_new_null_) 142 #define __prefast_operator_new_throws \ 143 void* __cdecl operator new(size_t size) throw(std::bad_alloc); \ 144 void* __cdecl operator new[](size_t size) throw(std::bad_alloc); \ 145 _Analysis_mode_(_Analysis_operator_new_throw_) 146 #define __user_code 147 #define __user_driver 148 #define ___drv_unit_internal_kernel_driver 149 #define ___drv_unit_kernel_code 150 #define ___drv_unit_kernel_driver 151 #define ___drv_unit_user_code 152 #define ___drv_unit_user_driver 153 154 #define __drv_typeConst 0 155 #define __drv_typeCond 1 156 #define __drv_typeBitset 2 157 #define __drv_typeExpr 3 158 159 #ifdef __cplusplus 160 extern "C" { 161 #endif 162 163 __ANNOTATION(SAL_neverHold(_In_ char *);) 164 __ANNOTATION(SAL_neverHoldGlobal(__In_impl_ char *, ...);) 165 __ANNOTATION(SAL_acquire(_In_ char *);) 166 __ANNOTATION(SAL_acquireGlobal(__In_impl_ char *, ...);) 167 __ANNOTATION(SAL_floatUsed(void);) 168 __ANNOTATION(SAL_floatSaved(void);) 169 __ANNOTATION(SAL_floatRestored(void);) 170 __ANNOTATION(SAL_clearDoInit(enum __SAL_YesNo);) 171 __ANNOTATION(SAL_maxIRQL(__int64);) 172 __ANNOTATION(SAL_IsAliased(void);) 173 __ANNOTATION(SAL_NeedsRelease(enum __SAL_YesNo);) 174 __ANNOTATION(SAL_mustHold(_In_ char *);) 175 __ANNOTATION(SAL_mustHoldGlobal(__In_impl_ char *, ...);) 176 __ANNOTATION(SAL_release(_In_ char *);) 177 __ANNOTATION(SAL_releaseGlobal(__In_impl_ char *, ...);) 178 __ANNOTATION(SAL_IoGetDmaAdapter(void);) 179 __ANNOTATION(SAL_kernel();) 180 __ANNOTATION(SAL_nokernel();) 181 __ANNOTATION(SAL_driver();) 182 __ANNOTATION(SAL_nodriver();) 183 __ANNOTATION(SAL_internal_kernel_driver();) 184 __ANNOTATION(SAL_landmark(__In_impl_ char *);) 185 __ANNOTATION(SAL_return(__In_impl_ __AuToQuOtE char *);) 186 __ANNOTATION(SAL_strictType(__In_impl_ __AuToQuOtE char *);) 187 __ANNOTATION(SAL_strictTypeMatch(__int64);) 188 __ANNOTATION(SAL_preferredFunction(__In_impl_ __AuToQuOtE char *, __In_impl_ __AuToQuOtE char *);) 189 __ANNOTATION(SAL_preferredFunction3(__In_impl_ __AuToQuOtE char *, __In_impl_ __AuToQuOtE char *, __In_impl_ __int64);) 190 __ANNOTATION(SAL_error(__In_impl_ __AuToQuOtE char *);) 191 __ANNOTATION(SAL_error2(__In_impl_ __AuToQuOtE char *, __In_impl_ __int64);) 192 __ANNOTATION(SAL_IsFormatString(__In_impl_ char *);) 193 __ANNOTATION(SAL_completionType(__In_impl_ __AuToQuOtE char *);) 194 __ANNOTATION(SAL_callbackType(__In_impl_ __AuToQuOtE char *);) 195 //__PRIMOP(int, _Holds_resource_(__In_impl_ __deferTypecheck char *,__In_impl_ char *);) 196 //__PRIMOP(int, _Holds_resource_global_(__In_impl_ char *, ...);) 197 //__PRIMOP(int, _Is_kernel_(void);) 198 //__PRIMOP(int, _Is_driver_(void);) 199 200 #ifdef __cplusplus 201 } 202 #endif 203 204 #else 205 206 /* Dummys */ 207 #define _Dispatch_type_(type) 208 #define _IRQL_always_function_max_(irql) 209 #define _IRQL_always_function_min_(irql) 210 #define _IRQL_is_cancel_ 211 #define _IRQL_raises_(irql) 212 #define _IRQL_requires_(irql) 213 #define _IRQL_requires_max_(irql) 214 #define _IRQL_requires_min_(irql) 215 #define _IRQL_requires_same_ 216 #define _IRQL_restores_ 217 #define _IRQL_restores_global_(kind,param) 218 #define _IRQL_saves_ 219 #define _IRQL_saves_global_(kind,param) 220 #define _IRQL_uses_cancel_ 221 #define _Kernel_clear_do_init_(yesNo) 222 #define _Kernel_float_restored_ 223 #define _Kernel_float_saved_ 224 #define _Kernel_float_used_ 225 #define _Kernel_IoGetDmaAdapter_ 226 #define _Kernel_releases_resource_(kind) 227 #define _Kernel_requires_resource_held_(kind) 228 #define _Kernel_requires_resource_not_held_(kind) 229 #define _Kernel_acquires_resource_(kind) 230 #define _Landmark_(name) 231 #define __drv_acquiresCancelSpinLock 232 #define __drv_acquiresCriticalRegion 233 #define __drv_acquiresExclusiveResource(kind) 234 #define __drv_acquiresExclusiveResourceGlobal(kind,param) 235 #define __drv_acquiresPriorityRegion 236 #define __drv_acquiresResource(kind) 237 #define __drv_acquiresResourceGlobal(kind,param) 238 #define __drv_aliasesMem 239 #define __drv_allocatesMem(kind) 240 #define __drv_arg(expr,annotes) 241 #define __drv_at(expr,annotes) 242 #define __drv_callbackType(kind) 243 #define __drv_clearDoInit 244 #define __drv_completionType(kindlist) 245 #define __drv_constant 246 #define __drv_defined(x) 247 #define __drv_deref(annotes) 248 #define __drv_dispatchType_other 249 #define __drv_dispatchType(x) 250 #define __drv_floatRestored 251 #define __drv_floatSaved 252 #define __drv_floatUsed 253 #define __drv_formatString(kind) 254 #define __drv_freesMem(kind) 255 #define __drv_fun(annotes) 256 #define __drv_functionClass(x) 257 #define __drv_holdsCancelSpinLock() 258 #define __drv_holdsCriticalRegion() 259 #define __drv_holdsPriorityRegion() 260 #define __drv_in_deref(annotes) 261 #define __drv_in(annotes) 262 #define __drv_innerAcquiresGlobal(kind,param) 263 #define __drv_innerMustHoldGlobal(kind,param) 264 #define __drv_innerNeverHoldGlobal(kind,param) 265 #define __drv_innerReleasesGlobal(kind,param) 266 #define __drv_interlocked 267 #define __drv_inTry 268 #define __drv_IoGetDmaAdapter 269 #define __drv_isCancelIRQL 270 #define __drv_isObjectPointer 271 #define __drv_KMDF 272 #define __drv_maxFunctionIRQL(irql) 273 #define __drv_maxIRQL(irql) 274 #define __drv_minFunctionIRQL(irql) 275 #define __drv_minIRQL(irql) 276 #define __drv_Mode_impl(x) 277 #define __drv_mustHold(kind) 278 #define __drv_mustHoldCancelSpinLock 279 #define __drv_mustHoldCriticalRegion 280 #define __drv_mustHoldGlobal(kind,param) 281 #define __drv_mustHoldPriorityRegion 282 #define __drv_NDIS 283 #define __drv_neverHold(kind) 284 #define __drv_neverHoldCancelSpinLock 285 #define __drv_neverHoldCriticalRegion 286 #define __drv_neverHoldGlobal(kind,param) 287 #define __drv_neverHoldPriorityRegion 288 #define __drv_nonConstant 289 #define __drv_notInTry 290 #define __drv_notPointer 291 #define __drv_out_deref(annotes) 292 #define __drv_out(annotes) 293 #define __drv_preferredFunction(func,why) 294 #define __drv_raisesIRQL(irql) 295 #define __drv_releasesCancelSpinLock 296 #define __drv_releasesCriticalRegion 297 #define __drv_releasesExclusiveResource(kind) 298 #define __drv_releasesExclusiveResourceGlobal(kind,param) 299 #define __drv_releasesPriorityRegion 300 #define __drv_releasesResource(kind) 301 #define __drv_releasesResourceGlobal(kind,param) 302 #define __drv_reportError(why) 303 #define __drv_requiresIRQL(irql) 304 #define __drv_restoresIRQL 305 #define __drv_restoresIRQLGlobal(kind,param) 306 #define __drv_ret(annotes) 307 #define __drv_sameIRQL 308 #define __drv_savesIRQL 309 #define __drv_savesIRQLGlobal 310 #define __drv_setsIRQL(irql) 311 #define __drv_strictType(typename,mode) 312 #define __drv_strictTypeMatch(mode) 313 #define __drv_unit(p) 314 #define __drv_useCancelIRQL 315 #define __drv_valueIs(arglist) 316 #define __drv_WDM 317 #define __drv_when(cond,annotes) 318 #define __internal_kernel_driver 319 #define __kernel_code 320 #define __kernel_driver 321 #define __prefast_operator_new_null 322 #define __prefast_operator_new_throws 323 #define __user_code 324 #define __user_driver 325 #define ___drv_unit_internal_kernel_driver 326 #define ___drv_unit_kernel_code 327 #define ___drv_unit_kernel_driver 328 #define ___drv_unit_user_code 329 #define ___drv_unit_user_driver 330 331 #endif 332 333