mirror of
https://github.com/reactos/reactos.git
synced 2024-08-29 22:58:34 +00:00
319 lines
6.4 KiB
C
319 lines
6.4 KiB
C
/*++
|
|
|
|
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
|
|
(STDCALL *PFN_WDFOBJECTACQUIRELOCK)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
_Requires_lock_not_held_(_Curr_)
|
|
_Acquires_lock_(_Curr_)
|
|
WDFOBJECT Object
|
|
);
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
FORCEINLINE
|
|
VOID
|
|
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
|
|
(STDCALL *PFN_WDFOBJECTRELEASELOCK)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
_Requires_lock_held_(_Curr_)
|
|
_Releases_lock_(_Curr_)
|
|
WDFOBJECT Object
|
|
);
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
FORCEINLINE
|
|
VOID
|
|
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
|
|
(STDCALL *PFN_WDFWAITLOCKCREATE)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_opt_
|
|
PWDF_OBJECT_ATTRIBUTES LockAttributes,
|
|
_Out_
|
|
WDFWAITLOCK* Lock
|
|
);
|
|
|
|
_Must_inspect_result_
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
FORCEINLINE
|
|
NTSTATUS
|
|
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
|
|
(STDCALL *PFN_WDFWAITLOCKACQUIRE)(
|
|
_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
|
|
NTSTATUS
|
|
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
|
|
(STDCALL *PFN_WDFWAITLOCKRELEASE)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
_Requires_lock_held_(_Curr_)
|
|
_Releases_lock_(_Curr_)
|
|
WDFWAITLOCK Lock
|
|
);
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
FORCEINLINE
|
|
VOID
|
|
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
|
|
(STDCALL *PFN_WDFSPINLOCKCREATE)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_opt_
|
|
PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
|
|
_Out_
|
|
WDFSPINLOCK* SpinLock
|
|
);
|
|
|
|
_Must_inspect_result_
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
FORCEINLINE
|
|
NTSTATUS
|
|
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
|
|
(STDCALL *PFN_WDFSPINLOCKACQUIRE)(
|
|
_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
|
|
VOID
|
|
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
|
|
(STDCALL *PFN_WDFSPINLOCKRELEASE)(
|
|
_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
|
|
VOID
|
|
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_
|
|
|