1 /*++
2
3 Copyright (c) Microsoft Corporation. All rights reserved.
4
5 _WdfVersionBuild_
6
7 Module Name:
8
9 wdfsync.h
10
11 Abstract:
12
13 This module contains contains the Windows Driver Framework synchronization
14 DDIs.
15
16 Environment:
17
18 kernel mode only
19
20 Revision History:
21
22
23 --*/
24
25 //
26 // NOTE: This header is generated by stubwork. Please make any
27 // modifications to the corresponding template files
28 // (.x or .y) and use stubwork to regenerate the header
29 //
30
31 #ifndef _WDFSYNC_H_
32 #define _WDFSYNC_H_
33
34 #ifndef WDF_EXTERN_C
35 #ifdef __cplusplus
36 #define WDF_EXTERN_C extern "C"
37 #define WDF_EXTERN_C_START extern "C" {
38 #define WDF_EXTERN_C_END }
39 #else
40 #define WDF_EXTERN_C
41 #define WDF_EXTERN_C_START
42 #define WDF_EXTERN_C_END
43 #endif
44 #endif
45
46 WDF_EXTERN_C_START
47
48
49
50 #if (NTDDI_VERSION >= NTDDI_WIN2K)
51
52
53
54 //
55 // WDF Function: WdfObjectAcquireLock
56 //
57 typedef
58 _IRQL_requires_max_(DISPATCH_LEVEL)
59 WDFAPI
60 VOID
61 (STDCALL *PFN_WDFOBJECTACQUIRELOCK)(
62 _In_
63 PWDF_DRIVER_GLOBALS DriverGlobals,
64 _In_
65 _Requires_lock_not_held_(_Curr_)
66 _Acquires_lock_(_Curr_)
67 WDFOBJECT Object
68 );
69
_IRQL_requires_max_(DISPATCH_LEVEL)70 _IRQL_requires_max_(DISPATCH_LEVEL)
71 FORCEINLINE
72 VOID
73 WdfObjectAcquireLock(
74 _In_
75 _Requires_lock_not_held_(_Curr_)
76 _Acquires_lock_(_Curr_)
77 WDFOBJECT Object
78 )
79 {
80 ((PFN_WDFOBJECTACQUIRELOCK) WdfFunctions[WdfObjectAcquireLockTableIndex])(WdfDriverGlobals, Object);
81 }
82
83 //
84 // WDF Function: WdfObjectReleaseLock
85 //
86 typedef
87 _IRQL_requires_max_(DISPATCH_LEVEL)
88 WDFAPI
89 VOID
90 (STDCALL *PFN_WDFOBJECTRELEASELOCK)(
91 _In_
92 PWDF_DRIVER_GLOBALS DriverGlobals,
93 _In_
94 _Requires_lock_held_(_Curr_)
95 _Releases_lock_(_Curr_)
96 WDFOBJECT Object
97 );
98
_IRQL_requires_max_(DISPATCH_LEVEL)99 _IRQL_requires_max_(DISPATCH_LEVEL)
100 FORCEINLINE
101 VOID
102 WdfObjectReleaseLock(
103 _In_
104 _Requires_lock_held_(_Curr_)
105 _Releases_lock_(_Curr_)
106 WDFOBJECT Object
107 )
108 {
109 ((PFN_WDFOBJECTRELEASELOCK) WdfFunctions[WdfObjectReleaseLockTableIndex])(WdfDriverGlobals, Object);
110 }
111
112 //
113 // WDF Function: WdfWaitLockCreate
114 //
115 typedef
116 _Must_inspect_result_
117 _IRQL_requires_max_(DISPATCH_LEVEL)
118 WDFAPI
119 NTSTATUS
120 (STDCALL *PFN_WDFWAITLOCKCREATE)(
121 _In_
122 PWDF_DRIVER_GLOBALS DriverGlobals,
123 _In_opt_
124 PWDF_OBJECT_ATTRIBUTES LockAttributes,
125 _Out_
126 WDFWAITLOCK* Lock
127 );
128
129 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)130 _IRQL_requires_max_(DISPATCH_LEVEL)
131 FORCEINLINE
132 NTSTATUS
133 WdfWaitLockCreate(
134 _In_opt_
135 PWDF_OBJECT_ATTRIBUTES LockAttributes,
136 _Out_
137 WDFWAITLOCK* Lock
138 )
139 {
140 return ((PFN_WDFWAITLOCKCREATE) WdfFunctions[WdfWaitLockCreateTableIndex])(WdfDriverGlobals, LockAttributes, Lock);
141 }
142
143 //
144 // WDF Function: WdfWaitLockAcquire
145 //
146 typedef
147 _When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
148 _When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
149 _When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
150 _Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
151 _When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
152 _When_(Timeout != NULL, _Must_inspect_result_)
153 WDFAPI
154 NTSTATUS
155 (STDCALL *PFN_WDFWAITLOCKACQUIRE)(
156 _In_
157 PWDF_DRIVER_GLOBALS DriverGlobals,
158 _In_
159 _Requires_lock_not_held_(_Curr_)
160 WDFWAITLOCK Lock,
161 _In_opt_
162 PLONGLONG Timeout
163 );
164
165 _When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
166 _When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
167 _When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
168 _Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
169 _When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
170 _When_(Timeout != NULL, _Must_inspect_result_)
171 FORCEINLINE
172 NTSTATUS
WdfWaitLockAcquire(_In_ _Requires_lock_not_held_ (_Curr_)WDFWAITLOCK Lock,_In_opt_ PLONGLONG Timeout)173 WdfWaitLockAcquire(
174 _In_
175 _Requires_lock_not_held_(_Curr_)
176 WDFWAITLOCK Lock,
177 _In_opt_
178 PLONGLONG Timeout
179 )
180 {
181 return ((PFN_WDFWAITLOCKACQUIRE) WdfFunctions[WdfWaitLockAcquireTableIndex])(WdfDriverGlobals, Lock, Timeout);
182 }
183
184 //
185 // WDF Function: WdfWaitLockRelease
186 //
187 typedef
188 _IRQL_requires_max_(DISPATCH_LEVEL)
189 WDFAPI
190 VOID
191 (STDCALL *PFN_WDFWAITLOCKRELEASE)(
192 _In_
193 PWDF_DRIVER_GLOBALS DriverGlobals,
194 _In_
195 _Requires_lock_held_(_Curr_)
196 _Releases_lock_(_Curr_)
197 WDFWAITLOCK Lock
198 );
199
_IRQL_requires_max_(DISPATCH_LEVEL)200 _IRQL_requires_max_(DISPATCH_LEVEL)
201 FORCEINLINE
202 VOID
203 WdfWaitLockRelease(
204 _In_
205 _Requires_lock_held_(_Curr_)
206 _Releases_lock_(_Curr_)
207 WDFWAITLOCK Lock
208 )
209 {
210 ((PFN_WDFWAITLOCKRELEASE) WdfFunctions[WdfWaitLockReleaseTableIndex])(WdfDriverGlobals, Lock);
211 }
212
213 //
214 // WDF Function: WdfSpinLockCreate
215 //
216 typedef
217 _Must_inspect_result_
218 _IRQL_requires_max_(DISPATCH_LEVEL)
219 WDFAPI
220 NTSTATUS
221 (STDCALL *PFN_WDFSPINLOCKCREATE)(
222 _In_
223 PWDF_DRIVER_GLOBALS DriverGlobals,
224 _In_opt_
225 PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
226 _Out_
227 WDFSPINLOCK* SpinLock
228 );
229
230 _Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)231 _IRQL_requires_max_(DISPATCH_LEVEL)
232 FORCEINLINE
233 NTSTATUS
234 WdfSpinLockCreate(
235 _In_opt_
236 PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
237 _Out_
238 WDFSPINLOCK* SpinLock
239 )
240 {
241 return ((PFN_WDFSPINLOCKCREATE) WdfFunctions[WdfSpinLockCreateTableIndex])(WdfDriverGlobals, SpinLockAttributes, SpinLock);
242 }
243
244 //
245 // WDF Function: WdfSpinLockAcquire
246 //
247 typedef
248 _IRQL_requires_max_(DISPATCH_LEVEL)
249 _IRQL_raises_(DISPATCH_LEVEL)
250 WDFAPI
251 VOID
252 (STDCALL *PFN_WDFSPINLOCKACQUIRE)(
253 _In_
254 PWDF_DRIVER_GLOBALS DriverGlobals,
255 _In_
256 _Requires_lock_not_held_(_Curr_)
257 _Acquires_lock_(_Curr_)
258 _IRQL_saves_
259 WDFSPINLOCK SpinLock
260 );
261
262 _IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_raises_(DISPATCH_LEVEL)263 _IRQL_raises_(DISPATCH_LEVEL)
264 FORCEINLINE
265 VOID
266 WdfSpinLockAcquire(
267 _In_
268 _Requires_lock_not_held_(_Curr_)
269 _Acquires_lock_(_Curr_)
270 _IRQL_saves_
271 WDFSPINLOCK SpinLock
272 )
273 {
274 ((PFN_WDFSPINLOCKACQUIRE) WdfFunctions[WdfSpinLockAcquireTableIndex])(WdfDriverGlobals, SpinLock);
275 }
276
277 //
278 // WDF Function: WdfSpinLockRelease
279 //
280 typedef
281 _IRQL_requires_max_(DISPATCH_LEVEL)
282 _IRQL_requires_min_(DISPATCH_LEVEL)
283 WDFAPI
284 VOID
285 (STDCALL *PFN_WDFSPINLOCKRELEASE)(
286 _In_
287 PWDF_DRIVER_GLOBALS DriverGlobals,
288 _In_
289 _Requires_lock_held_(_Curr_)
290 _Releases_lock_(_Curr_)
291 _IRQL_restores_
292 WDFSPINLOCK SpinLock
293 );
294
295 _IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_requires_min_(DISPATCH_LEVEL)296 _IRQL_requires_min_(DISPATCH_LEVEL)
297 FORCEINLINE
298 VOID
299 WdfSpinLockRelease(
300 _In_
301 _Requires_lock_held_(_Curr_)
302 _Releases_lock_(_Curr_)
303 _IRQL_restores_
304 WDFSPINLOCK SpinLock
305 )
306 {
307 ((PFN_WDFSPINLOCKRELEASE) WdfFunctions[WdfSpinLockReleaseTableIndex])(WdfDriverGlobals, SpinLock);
308 }
309
310
311
312 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
313
314
315 WDF_EXTERN_C_END
316
317 #endif // _WDFSYNC_H_
318
319