ReactOS  0.4.15-dev-2977-ge996662
driverspecs.h
Go to the documentation of this file.
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_min_(irql)
29 #define _IRQL_requires_same_
30 #define _IRQL_restores_
31 #define _IRQL_restores_global_(kind,param)
32 #define _IRQL_saves_
33 #define _IRQL_saves_global_(kind,param)
34 #define _IRQL_uses_cancel_
35 #define __drv_setsIRQL(irql)
36 
37 #undef _IRQL_inout_
38 #define _IRQL_inout_ _IRQL_saves_ _IRQL_restores_
39 #define _IRQL_limited_to_(level) ASSERT(KeGetCurrentIrql() <= level); \
40  _Analysis_assume_(KeGetCurrentIrql() <= level);
41 
42 #define _Analysis_assume_section_locked_(name) __AnalysisAssumeLockedSection(name)
43 #define _Analysis_assume_section_unlocked_(name) __AnalysisAssumeUnlockedSection(name)
44 #define _Dispatch_type_(x) _Function_class_(x)
45 #define _Kernel_clear_do_init_(yesNo) _Post_ _SA_annotes1(SAL_clearDoInit,yesNo)
46 #define _Kernel_float_restored_ _Post_ _SA_annotes0(SAL_floatRestored)
47 #define _Kernel_float_saved_ _Post_ _SA_annotes0(SAL_floatSaved)
48 #define _Kernel_float_used_ _Post_ _SA_annotes0(SAL_floatUsed)
49 #define _Kernel_IoGetDmaAdapter_ _Post_ _SA_annotes0(SAL_IoGetDmaAdapter)
50 #define _Kernel_releases_resource_(kind) _Post_ _SA_annotes1(SAL_release, #kind)
51 #define _Kernel_requires_resource_held_(kind) _Pre_ _SA_annotes1(SAL_mustHold, #kind)
52 #define _Kernel_requires_resource_not_held_(kind) _Pre_ _SA_annotes1(SAL_neverHold, #kind)
53 #define _Kernel_acquires_resource_(kind) _Post_ _SA_annotes1(SAL_acquire, #kind)
54 #define _Landmark_(name) _SA_annotes1(SAL_landmark, #name)
55 #define __drv_acquiresCancelSpinLock _Acquires_nonreentrant_lock_(_Global_cancel_spin_lock_)
56 #define __drv_acquiresCriticalRegion _Acquires_lock_(_Global_critical_region_)
57 #define __drv_acquiresExclusiveResource(kind) _Acquires_nonreentrant_lock_(_Curr_)
58 #define __drv_acquiresExclusiveResourceGlobal(kind,param) _Acquires_nonreentrant_lock_(param)
59 #define __drv_acquiresPriorityRegion _Acquires_lock_(_Global_priority_region_)
60 #define __drv_acquiresResource(kind) _Acquires_lock_(_Curr_)
61 #define __drv_acquiresResourceGlobal(kind,param) _Acquires_lock_(param)
62 #define __drv_aliasesMem _Post_ _SA_annotes0(SAL_IsAliased)
63 #define __drv_allocatesMem(kind) _Post_ _SA_annotes1(SAL_NeedsRelease,__yes)
64 #define __drv_arg(expr,annotes) _At_(expr,annotes)
65 #define __drv_at(expr,annotes) _At_(expr,annotes)
66 #define __drv_callbackType(kind) _SA_annotes1(SAL_callbackType, #kind)
67 #define __drv_clearDoInit _Kernel_clear_do_init_
68 #define __drv_completionType(kindlist) _SA_annotes1(SAL_completionType, #kindlist)
69 #define __drv_constant _Literal_
70 #define __drv_defined(x) _Macro_defined_(#x)
71 #define __drv_deref(annotes) __deref _Group_(annotes)
72 #define __drv_dispatchType_other _Dispatch_type_(IRP_MJ_OTHER)
73 #define __drv_dispatchType(x) _Dispatch_type_(x)
74 #define __drv_floatRestored _Kernel_float_restored_
75 #define __drv_floatSaved _Kernel_float_saved_
76 #define __drv_floatUsed _Kernel_float_used_
77 #define __drv_formatString(kind) _SA_annotes1(SAL_IsFormatString, #kind)
78 #define __drv_freesMem(kind) _Post_ _SA_annotes1(SAL_NeedsRelease,__no)
79 #define __drv_fun(annotes) _At_(return, annotes)
80 #define __drv_functionClass(x) _Function_class_(x)
81 #define __drv_holdsCancelSpinLock() _Holds_resource_global_("CancelSpinLock",)
82 #define __drv_holdsCriticalRegion() _Holds_resource_global_("CriticalRegion",)
83 #define __drv_holdsPriorityRegion() _Holds_resource_global_("PriorityRegion",)
84 #define __drv_in_deref(annotes) _Pre_ __deref _Group_(annotes)
85 #define __drv_in(annotes) _Pre_ _Group_(annotes)
86 #define __drv_innerAcquiresGlobal(kind,param) _Post_ _SA_annotes2(SAL_acquireGlobal, #kind, param\t)
87 #define __drv_innerMustHoldGlobal(kind,param) _Pre_ _SA_annotes2(SAL_mustHoldGlobal, #kind, param\t)
88 #define __drv_innerNeverHoldGlobal(kind,param) _Pre_ _SA_annotes2(SAL_neverHoldGlobal, #kind, param\t)
89 #define __drv_innerReleasesGlobal(kind,param) _Post_ _SA_annotes2(SAL_releaseGlobal,#kind, param\t)
90 #define __drv_interlocked _Interlocked_operand_
91 #define __drv_inTry _Pre_ _SA_annotes1(SAL_inTry,__yes)
92 #define __drv_IoGetDmaAdapter _Kernel_IoGetDmaAdapter_
93 #define __drv_isCancelIRQL _IRQL_is_cancel_
94 #define __drv_isObjectPointer _Points_to_data_
95 #define __drv_KMDF __drv_Mode_impl(KMDF)
96 #define __drv_maxFunctionIRQL(irql) _IRQL_always_function_max_(irql)
97 #define __drv_maxIRQL(irql) _IRQL_requires_max_(irql)
98 #define __drv_minFunctionIRQL(irql) _IRQL_always_function_min_(irql)
99 #define __drv_minIRQL(irql) _IRQL_requires_min_(irql)
100 #define __drv_Mode_impl(x) _Landmark_(x) __inline void __GENSYM(__SAL_dummy_)(void){}
101 #define __drv_mustHold(kind) _When_(!_Arg_comp_(#kind,"Memory"), _Requires_lock_held_(_Curr_)) \
102  _When_(_Arg_comp_(#kind,"Memory"), _Kernel_requires_resource_held_(kind))
103 #define __drv_mustHoldCancelSpinLock _Requires_lock_held_(_Global_cancel_spin_lock_)
104 #define __drv_mustHoldCriticalRegion _Requires_lock_held_(_Global_critical_region_)
105 #define __drv_mustHoldGlobal(kind,param) _Requires_lock_held_(param)
106 #define __drv_mustHoldPriorityRegion _Requires_lock_held_(_Global_priority_region_)
107 #define __drv_NDIS __drv_Mode_impl(NDIS)
108 #define __drv_neverHold(kind) _Requires_lock_not_held_(_Curr_)
109 #define __drv_neverHoldCancelSpinLock _Requires_lock_not_held_(_Global_cancel_spin_lock_)
110 #define __drv_neverHoldCriticalRegion _Requires_lock_not_held_(_Global_critical_region_)
111 #define __drv_neverHoldGlobal(kind,param) _Requires_lock_not_held_(param)
112 #define __drv_neverHoldPriorityRegion _Requires_lock_not_held_(_Global_priority_region_)
113 #define __drv_nonConstant _Notliteral_
114 #define __drv_notInTry _Pre_ _SA_annotes1(SAL_inTry,__no)
115 #define __drv_notPointer _Pre_ _SA_annotes1(SAL_mayBePointer,__no)
116 #define __drv_out_deref(annotes) _Post_ __deref _Group_(annotes)
117 #define __drv_out(annotes) _Post_ _Group_(annotes)
118 #define __drv_preferredFunction(func,why) _Pre_ _SA_annotes2(SAL_preferredFunction, func, why)
119 #define __drv_raisesIRQL _IRQL_raises_
120 #define __drv_releasesCancelSpinLock _Releases_nonreentrant_lock_(_Global_cancel_spin_lock_)
121 #define __drv_releasesCriticalRegion _Releases_lock_(_Global_critical_region_)
122 #define __drv_releasesExclusiveResource(kind) _Releases_nonreentrant_lock_(_Curr_)
123 #define __drv_releasesExclusiveResourceGlobal(kind, param) _Releases_nonreentrant_lock_(param)
124 #define __drv_releasesPriorityRegion _Releases_lock_(_Global_priority_region_)
125 #define __drv_releasesResource(kind) _Releases_lock_(_Curr_)
126 #define __drv_releasesResourceGlobal(kind, param) _Releases_lock_(param)
127 #define __drv_reportError(why) _Pre_ _SA_annotes1(SAL_error,why)
128 #define __drv_requiresIRQL(irql) _IRQL_requires_(irql)
129 #define __drv_restoresIRQL _IRQL_restores_
130 #define __drv_restoresIRQLGlobal(kind,param) _IRQL_restores_global_(kind,param)
131 #define __drv_ret(annotes) _At_(return,annotes)
132 #define __drv_sameIRQL _IRQL_requires_same_
133 #define __drv_savesIRQL _IRQL_saves_
134 #define __drv_savesIRQLGlobal(kind,param) _IRQL_saves_global_(kind,param)
135 #define __drv_strictType(typename,mode) _Pre_ _SA_annotes2(SAL_strictType, typename, mode)
136 #define __drv_strictTypeMatch(mode) _Pre_ _SA_annotes1(SAL_strictTypeMatch,mode)
137 #define __drv_unit(p) typedef int ___drv_unit_##p __GENSYM(__prefast_flag_kernel_driver_mode);
138 #define __drv_useCancelIRQL _IRQL_uses_cancel_
139 #define __drv_valueIs(arglist) _Post_ _SA_annotes1(SAL_return,arglist)
140 #define __drv_WDM __drv_Mode_impl(WDM)
141 #define __drv_when(cond, annotes) _When_(cond, annotes)
142 #define __internal_kernel_driver _Analysis_mode_(_Analysis_internal_kernel_driver_) \
143  _Analysis_mode_(_Analysis_local_leak_checks_)
144 #define __kernel_code _Analysis_mode_(_Analysis_code_type_kernel_code_) \
145  _Analysis_mode_(_Analysis_local_leak_checks_)
146 #define __kernel_driver _Analysis_mode_(_Analysis_code_type_kernel_driver_) \
147  _Analysis_mode_(_Analysis_local_leak_checks_)
148 #define __prefast_operator_new_null \
149  void* __cdecl operator new(size_t size) throw(); \
150  void* __cdecl operator new[](size_t size) throw(); \
151  _Analysis_mode_(_Analysis_operator_new_null_)
152 #define __prefast_operator_new_throws \
153  void* __cdecl operator new(size_t size) throw(std::bad_alloc); \
154  void* __cdecl operator new[](size_t size) throw(std::bad_alloc); \
155  _Analysis_mode_(_Analysis_operator_new_throw_)
156 #define __user_code _Analysis_mode_(_Analysis_code_type_user_code_) \
157  _Analysis_mode_(_Analysis_local_leak_checks_)
158 #define __user_driver _Analysis_mode_(_Analysis_code_type_user_driver_) \
159  _Analysis_mode_(_Analysis_local_leak_checks_)
160 #define ___drv_unit_internal_kernel_driver _SA_annotes0(SAL_internal_kernel_driver)
161 #define ___drv_unit_kernel_code _SA_annotes0(SAL_kernel) _SA_annotes0(SAL_nodriver)
162 #define ___drv_unit_kernel_driver _SA_annotes0(SAL_kernel) _SA_annotes0(SAL_driver)
163 #define ___drv_unit_user_code _SA_annotes0(SAL_nokernel) _SA_annotes0(SAL_nodriver)
164 #define ___drv_unit_user_driver _SA_annotes0(SAL_nokernel) _SA_annotes0(SAL_driver)
165 
166 #define __drv_typeConst 0
167 #define __drv_typeCond 1
168 #define __drv_typeBitset 2
169 #define __drv_typeExpr 3
170 
171 #ifdef __cplusplus
172 extern "C" {
173 #endif
174 
175 extern int _Global_priority_region_;
176 __inline __nothrow void __AnalysisAssumeLockedSection(__In_impl_ char *p);
177 __inline __nothrow void __AnalysisAssumeUnlockedSection(__In_impl_ char *p);
178 
179 __ANNOTATION(SAL_neverHold(_In_ char *);)
180 __ANNOTATION(SAL_neverHoldGlobal(__In_impl_ char *, ...);)
181 __ANNOTATION(SAL_acquire(_In_ char *);)
182 __ANNOTATION(SAL_acquireGlobal(__In_impl_ char *, ...);)
183 __ANNOTATION(SAL_floatUsed(void);)
184 __ANNOTATION(SAL_floatSaved(void);)
185 __ANNOTATION(SAL_floatRestored(void);)
186 __ANNOTATION(SAL_clearDoInit(enum __SAL_YesNo);)
187 __ANNOTATION(SAL_IsAliased(void);)
188 __ANNOTATION(SAL_NeedsRelease(enum __SAL_YesNo);)
189 __ANNOTATION(SAL_mustHold(_In_ char *);)
190 __ANNOTATION(SAL_mustHoldGlobal(__In_impl_ char *, ...);)
191 __ANNOTATION(SAL_release(_In_ char *);)
192 __ANNOTATION(SAL_releaseGlobal(__In_impl_ char *, ...);)
193 __ANNOTATION(SAL_IoGetDmaAdapter(void);)
194 __ANNOTATION(SAL_kernel();)
195 __ANNOTATION(SAL_nokernel();)
196 __ANNOTATION(SAL_driver();)
197 __ANNOTATION(SAL_nodriver();)
198 __ANNOTATION(SAL_internal_kernel_driver();)
199 __ANNOTATION(SAL_landmark(__In_impl_ char *);)
200 __ANNOTATION(SAL_return(__In_impl_ __AuToQuOtE char *);)
201 __ANNOTATION(SAL_strictType(__In_impl_ __AuToQuOtE char *);)
202 __ANNOTATION(SAL_strictTypeMatch(__int64);)
203 __ANNOTATION(SAL_preferredFunction(__In_impl_ __AuToQuOtE char *, __In_impl_ __AuToQuOtE char *);)
204 __ANNOTATION(SAL_preferredFunction3(__In_impl_ __AuToQuOtE char *, __In_impl_ __AuToQuOtE char *, __In_impl_ __int64);)
205 __ANNOTATION(SAL_error(__In_impl_ __AuToQuOtE char *);)
206 __ANNOTATION(SAL_error2(__In_impl_ __AuToQuOtE char *, __In_impl_ __int64);)
207 __ANNOTATION(SAL_IsFormatString(__In_impl_ char *);)
208 __ANNOTATION(SAL_completionType(__In_impl_ __AuToQuOtE char *);)
209 __ANNOTATION(SAL_callbackType(__In_impl_ __AuToQuOtE char *);)
210 __PRIMOP(int, _Holds_resource_(__In_impl_ __deferTypecheck char *,__In_impl_ char *);)
211 __PRIMOP(int, _Holds_resource_global_(__In_impl_ char *, ...);)
212 __PRIMOP(int, _Is_kernel_(void);)
213 __PRIMOP(int, _Is_driver_(void);)
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #else
220 
221 /* Dummys */
222 #define _Analysis_assume_section_locked_(name)
223 #define _Analysis_assume_section_unlocked_(name)
224 #define _Dispatch_type_(type)
225 #define _IRQL_always_function_max_(irql)
226 #define _IRQL_always_function_min_(irql)
227 #define _IRQL_is_cancel_
228 #define _IRQL_raises_(irql)
229 #define _IRQL_requires_(irql)
230 #define _IRQL_requires_max_(irql)
231 #define _IRQL_requires_min_(irql)
232 #define _IRQL_requires_same_
233 #define _IRQL_restores_
234 #define _IRQL_restores_global_(kind,param)
235 #define _IRQL_saves_
236 #define _IRQL_saves_global_(kind,param)
237 #define _IRQL_uses_cancel_
238 #define _Kernel_clear_do_init_(yesNo)
239 #define _Kernel_float_restored_
240 #define _Kernel_float_saved_
241 #define _Kernel_float_used_
242 #define _Kernel_IoGetDmaAdapter_
243 #define _Kernel_releases_resource_(kind)
244 #define _Kernel_requires_resource_held_(kind)
245 #define _Kernel_requires_resource_not_held_(kind)
246 #define _Kernel_acquires_resource_(kind)
247 #define _Landmark_(name)
248 #define __drv_acquiresCancelSpinLock
249 #define __drv_acquiresCriticalRegion
250 #define __drv_acquiresExclusiveResource(kind)
251 #define __drv_acquiresExclusiveResourceGlobal(kind,param)
252 #define __drv_acquiresPriorityRegion
253 #define __drv_acquiresResource(kind)
254 #define __drv_acquiresResourceGlobal(kind,param)
255 #define __drv_aliasesMem
256 #define __drv_allocatesMem(kind)
257 #define __drv_arg(expr,annotes)
258 #define __drv_at(expr,annotes)
259 #define __drv_callbackType(kind)
260 #define __drv_clearDoInit
261 #define __drv_completionType(kindlist)
262 #define __drv_constant
263 #define __drv_defined(x)
264 #define __drv_deref(annotes)
265 #define __drv_dispatchType_other
266 #define __drv_dispatchType(x)
267 #define __drv_floatRestored
268 #define __drv_floatSaved
269 #define __drv_floatUsed
270 #define __drv_formatString(kind)
271 #define __drv_freesMem(kind)
272 #define __drv_fun(annotes)
273 #define __drv_functionClass(x)
274 #define __drv_holdsCancelSpinLock()
275 #define __drv_holdsCriticalRegion()
276 #define __drv_holdsPriorityRegion()
277 #define __drv_in_deref(annotes)
278 #define __drv_in(annotes)
279 #define __drv_innerAcquiresGlobal(kind,param)
280 #define __drv_innerMustHoldGlobal(kind,param)
281 #define __drv_innerNeverHoldGlobal(kind,param)
282 #define __drv_innerReleasesGlobal(kind,param)
283 #define __drv_interlocked
284 #define __drv_inTry
285 #define __drv_IoGetDmaAdapter
286 #define __drv_isCancelIRQL
287 #define __drv_isObjectPointer
288 #define __drv_KMDF
289 #define __drv_maxFunctionIRQL(irql)
290 #define __drv_maxIRQL(irql)
291 #define __drv_minFunctionIRQL(irql)
292 #define __drv_minIRQL(irql)
293 #define __drv_Mode_impl(x)
294 #define __drv_mustHold(kind)
295 #define __drv_mustHoldCancelSpinLock
296 #define __drv_mustHoldCriticalRegion
297 #define __drv_mustHoldGlobal(kind,param)
298 #define __drv_mustHoldPriorityRegion
299 #define __drv_NDIS
300 #define __drv_neverHold(kind)
301 #define __drv_neverHoldCancelSpinLock
302 #define __drv_neverHoldCriticalRegion
303 #define __drv_neverHoldGlobal(kind,param)
304 #define __drv_neverHoldPriorityRegion
305 #define __drv_nonConstant
306 #define __drv_notInTry
307 #define __drv_notPointer
308 #define __drv_out_deref(annotes)
309 #define __drv_out(annotes)
310 #define __drv_preferredFunction(func,why)
311 #define __drv_raisesIRQL(irql)
312 #define __drv_releasesCancelSpinLock
313 #define __drv_releasesCriticalRegion
314 #define __drv_releasesExclusiveResource(kind)
315 #define __drv_releasesExclusiveResourceGlobal(kind,param)
316 #define __drv_releasesPriorityRegion
317 #define __drv_releasesResource(kind)
318 #define __drv_releasesResourceGlobal(kind,param)
319 #define __drv_reportError(why)
320 #define __drv_requiresIRQL(irql)
321 #define __drv_restoresIRQL
322 #define __drv_restoresIRQLGlobal(kind,param)
323 #define __drv_ret(annotes)
324 #define __drv_sameIRQL
325 #define __drv_savesIRQL
326 #define __drv_savesIRQLGlobal(kind,param)
327 #define __drv_setsIRQL(irql)
328 #define __drv_strictType(typename,mode)
329 #define __drv_strictTypeMatch(mode)
330 #define __drv_unit(p)
331 #define __drv_useCancelIRQL
332 #define __drv_valueIs(arglist)
333 #define __drv_WDM
334 #define __drv_when(cond,annotes)
335 #define __internal_kernel_driver
336 #define __kernel_code
337 #define __kernel_driver
338 #define __prefast_operator_new_null
339 #define __prefast_operator_new_throws
340 #define __user_code
341 #define __user_driver
342 #define ___drv_unit_internal_kernel_driver
343 #define ___drv_unit_kernel_code
344 #define ___drv_unit_kernel_driver
345 #define ___drv_unit_user_code
346 #define ___drv_unit_user_driver
347 
348 #endif
349 
#define __nothrow
Definition: _mingw.h:207
#define _In_
Definition: ms_sal.h:308
#define __ANNOTATION(fun)
Definition: ms_sal.h:1622
#define __PRIMOP(type, fun)
Definition: ms_sal.h:1623
GLfloat GLfloat p
Definition: glext.h:8902
#define __int64
Definition: basetyps.h:16