ReactOS 0.4.15-dev-7681-g776c3a3
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
172extern "C" {
173#endif
174
175extern 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 _IRQL_limited_to_(level)
239#define _Kernel_clear_do_init_(yesNo)
240#define _Kernel_float_restored_
241#define _Kernel_float_saved_
242#define _Kernel_float_used_
243#define _Kernel_IoGetDmaAdapter_
244#define _Kernel_releases_resource_(kind)
245#define _Kernel_requires_resource_held_(kind)
246#define _Kernel_requires_resource_not_held_(kind)
247#define _Kernel_acquires_resource_(kind)
248#define _Landmark_(name)
249#define __drv_acquiresCancelSpinLock
250#define __drv_acquiresCriticalRegion
251#define __drv_acquiresExclusiveResource(kind)
252#define __drv_acquiresExclusiveResourceGlobal(kind,param)
253#define __drv_acquiresPriorityRegion
254#define __drv_acquiresResource(kind)
255#define __drv_acquiresResourceGlobal(kind,param)
256#define __drv_aliasesMem
257#define __drv_allocatesMem(kind)
258#define __drv_arg(expr,annotes)
259#define __drv_at(expr,annotes)
260#define __drv_callbackType(kind)
261#define __drv_clearDoInit
262#define __drv_completionType(kindlist)
263#define __drv_constant
264#define __drv_defined(x)
265#define __drv_deref(annotes)
266#define __drv_dispatchType_other
267#define __drv_dispatchType(x)
268#define __drv_floatRestored
269#define __drv_floatSaved
270#define __drv_floatUsed
271#define __drv_formatString(kind)
272#define __drv_freesMem(kind)
273#define __drv_fun(annotes)
274#define __drv_functionClass(x)
275#define __drv_holdsCancelSpinLock()
276#define __drv_holdsCriticalRegion()
277#define __drv_holdsPriorityRegion()
278#define __drv_in_deref(annotes)
279#define __drv_in(annotes)
280#define __drv_innerAcquiresGlobal(kind,param)
281#define __drv_innerMustHoldGlobal(kind,param)
282#define __drv_innerNeverHoldGlobal(kind,param)
283#define __drv_innerReleasesGlobal(kind,param)
284#define __drv_interlocked
285#define __drv_inTry
286#define __drv_IoGetDmaAdapter
287#define __drv_isCancelIRQL
288#define __drv_isObjectPointer
289#define __drv_KMDF
290#define __drv_maxFunctionIRQL(irql)
291#define __drv_maxIRQL(irql)
292#define __drv_minFunctionIRQL(irql)
293#define __drv_minIRQL(irql)
294#define __drv_Mode_impl(x)
295#define __drv_mustHold(kind)
296#define __drv_mustHoldCancelSpinLock
297#define __drv_mustHoldCriticalRegion
298#define __drv_mustHoldGlobal(kind,param)
299#define __drv_mustHoldPriorityRegion
300#define __drv_NDIS
301#define __drv_neverHold(kind)
302#define __drv_neverHoldCancelSpinLock
303#define __drv_neverHoldCriticalRegion
304#define __drv_neverHoldGlobal(kind,param)
305#define __drv_neverHoldPriorityRegion
306#define __drv_nonConstant
307#define __drv_notInTry
308#define __drv_notPointer
309#define __drv_out_deref(annotes)
310#define __drv_out(annotes)
311#define __drv_preferredFunction(func,why)
312#define __drv_raisesIRQL(irql)
313#define __drv_releasesCancelSpinLock
314#define __drv_releasesCriticalRegion
315#define __drv_releasesExclusiveResource(kind)
316#define __drv_releasesExclusiveResourceGlobal(kind,param)
317#define __drv_releasesPriorityRegion
318#define __drv_releasesResource(kind)
319#define __drv_releasesResourceGlobal(kind,param)
320#define __drv_reportError(why)
321#define __drv_requiresIRQL(irql)
322#define __drv_restoresIRQL
323#define __drv_restoresIRQLGlobal(kind,param)
324#define __drv_ret(annotes)
325#define __drv_sameIRQL
326#define __drv_savesIRQL
327#define __drv_savesIRQLGlobal(kind,param)
328#define __drv_setsIRQL(irql)
329#define __drv_strictType(typename,mode)
330#define __drv_strictTypeMatch(mode)
331#define __drv_unit(p)
332#define __drv_useCancelIRQL
333#define __drv_valueIs(arglist)
334#define __drv_WDM
335#define __drv_when(cond,annotes)
336#define __internal_kernel_driver
337#define __kernel_code
338#define __kernel_driver
339#define __prefast_operator_new_null
340#define __prefast_operator_new_throws
341#define __user_code
342#define __user_driver
343#define ___drv_unit_internal_kernel_driver
344#define ___drv_unit_kernel_code
345#define ___drv_unit_kernel_driver
346#define ___drv_unit_user_code
347#define ___drv_unit_user_driver
348
349#endif
350
#define __nothrow
Definition: _mingw.h:207
#define __int64
Definition: basetyps.h:16
GLfloat GLfloat p
Definition: glext.h:8902
#define __ANNOTATION(fun)
Definition: ms_sal.h:1622
#define __PRIMOP(type, fun)
Definition: ms_sal.h:1623
#define _In_
Definition: ms_sal.h:308