2020-09-24 20:41:01 +00:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
|
|
|
_WdfVersionBuild_
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
|
|
|
wdfsync.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
This module contains contains the Windows Driver Framework synchronization
|
|
|
|
DDIs.
|
|
|
|
|
|
|
|
Environment:
|
|
|
|
|
|
|
|
kernel mode only
|
|
|
|
|
|
|
|
Revision History:
|
|
|
|
|
|
|
|
|
|
|
|
--*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// NOTE: This header is generated by stubwork. Please make any
|
|
|
|
// modifications to the corresponding template files
|
|
|
|
// (.x or .y) and use stubwork to regenerate the header
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _WDFSYNC_H_
|
|
|
|
#define _WDFSYNC_H_
|
|
|
|
|
|
|
|
#ifndef WDF_EXTERN_C
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define WDF_EXTERN_C extern "C"
|
|
|
|
#define WDF_EXTERN_C_START extern "C" {
|
|
|
|
#define WDF_EXTERN_C_END }
|
|
|
|
#else
|
|
|
|
#define WDF_EXTERN_C
|
|
|
|
#define WDF_EXTERN_C_START
|
|
|
|
#define WDF_EXTERN_C_END
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
WDF_EXTERN_C_START
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_WIN2K)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfObjectAcquireLock
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFOBJECTACQUIRELOCK)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
_Acquires_lock_(_Curr_)
|
|
|
|
WDFOBJECT Object
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfObjectAcquireLock(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
_Acquires_lock_(_Curr_)
|
|
|
|
WDFOBJECT Object
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFOBJECTACQUIRELOCK) WdfFunctions[WdfObjectAcquireLockTableIndex])(WdfDriverGlobals, Object);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfObjectReleaseLock
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFOBJECTRELEASELOCK)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
WDFOBJECT Object
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfObjectReleaseLock(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
WDFOBJECT Object
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFOBJECTRELEASELOCK) WdfFunctions[WdfObjectReleaseLockTableIndex])(WdfDriverGlobals, Object);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfWaitLockCreate
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_Must_inspect_result_
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
NTSTATUS
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWAITLOCKCREATE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_opt_
|
|
|
|
PWDF_OBJECT_ATTRIBUTES LockAttributes,
|
|
|
|
_Out_
|
|
|
|
WDFWAITLOCK* Lock
|
|
|
|
);
|
|
|
|
|
|
|
|
_Must_inspect_result_
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
NTSTATUS
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWaitLockCreate(
|
|
|
|
_In_opt_
|
|
|
|
PWDF_OBJECT_ATTRIBUTES LockAttributes,
|
|
|
|
_Out_
|
|
|
|
WDFWAITLOCK* Lock
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return ((PFN_WDFWAITLOCKCREATE) WdfFunctions[WdfWaitLockCreateTableIndex])(WdfDriverGlobals, LockAttributes, Lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfWaitLockAcquire
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
|
|
|
|
_When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
|
|
|
|
_When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
|
|
|
|
_Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
|
|
|
|
_When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
|
|
|
|
_When_(Timeout != NULL, _Must_inspect_result_)
|
|
|
|
WDFAPI
|
|
|
|
NTSTATUS
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWAITLOCKACQUIRE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
WDFWAITLOCK Lock,
|
|
|
|
_In_opt_
|
|
|
|
PLONGLONG Timeout
|
|
|
|
);
|
|
|
|
|
|
|
|
_When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
|
|
|
|
_When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
|
|
|
|
_When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
|
|
|
|
_Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
|
|
|
|
_When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
|
|
|
|
_When_(Timeout != NULL, _Must_inspect_result_)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
NTSTATUS
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWaitLockAcquire(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
WDFWAITLOCK Lock,
|
|
|
|
_In_opt_
|
|
|
|
PLONGLONG Timeout
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return ((PFN_WDFWAITLOCKACQUIRE) WdfFunctions[WdfWaitLockAcquireTableIndex])(WdfDriverGlobals, Lock, Timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfWaitLockRelease
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWAITLOCKRELEASE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
WDFWAITLOCK Lock
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWaitLockRelease(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
WDFWAITLOCK Lock
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFWAITLOCKRELEASE) WdfFunctions[WdfWaitLockReleaseTableIndex])(WdfDriverGlobals, Lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfSpinLockCreate
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_Must_inspect_result_
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
NTSTATUS
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFSPINLOCKCREATE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_opt_
|
|
|
|
PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
|
|
|
|
_Out_
|
|
|
|
WDFSPINLOCK* SpinLock
|
|
|
|
);
|
|
|
|
|
|
|
|
_Must_inspect_result_
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
NTSTATUS
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfSpinLockCreate(
|
|
|
|
_In_opt_
|
|
|
|
PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
|
|
|
|
_Out_
|
|
|
|
WDFSPINLOCK* SpinLock
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return ((PFN_WDFSPINLOCKCREATE) WdfFunctions[WdfSpinLockCreateTableIndex])(WdfDriverGlobals, SpinLockAttributes, SpinLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfSpinLockAcquire
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
_IRQL_raises_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFSPINLOCKACQUIRE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
_Acquires_lock_(_Curr_)
|
|
|
|
_IRQL_saves_
|
|
|
|
WDFSPINLOCK SpinLock
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
_IRQL_raises_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfSpinLockAcquire(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_not_held_(_Curr_)
|
|
|
|
_Acquires_lock_(_Curr_)
|
|
|
|
_IRQL_saves_
|
|
|
|
WDFSPINLOCK SpinLock
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFSPINLOCKACQUIRE) WdfFunctions[WdfSpinLockAcquireTableIndex])(WdfDriverGlobals, SpinLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfSpinLockRelease
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
_IRQL_requires_min_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFSPINLOCKRELEASE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
_IRQL_restores_
|
|
|
|
WDFSPINLOCK SpinLock
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
_IRQL_requires_min_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfSpinLockRelease(
|
|
|
|
_In_
|
|
|
|
_Requires_lock_held_(_Curr_)
|
|
|
|
_Releases_lock_(_Curr_)
|
|
|
|
_IRQL_restores_
|
|
|
|
WDFSPINLOCK SpinLock
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFSPINLOCKRELEASE) WdfFunctions[WdfSpinLockReleaseTableIndex])(WdfDriverGlobals, SpinLock);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
|
|
|
|
|
|
|
|
|
|
|
|
WDF_EXTERN_C_END
|
|
|
|
|
|
|
|
#endif // _WDFSYNC_H_
|
|
|
|
|