WdfObjectAcquireLock function (wdfsync.h)

[Applies to KMDF and UMDF]

The WdfObjectAcquireLock method acquires an object's synchronization lock.

Syntax

VOID WdfObjectAcquireLock(
  _In_ WDFOBJECT Object
);

Parameters

[in] Object

A handle to a framework device object or a framework queue object.

Remarks

A bug check occurs if the driver supplies an invalid object handle.

A driver can call the WdfObjectAcquireLock method to acquire the synchronization lock that is associated with a specified framework device object or framework queue object. The method does not return until the lock has been acquired.

When the driver no longer needs the object's synchronization lock, it must call WdfObjectReleaseLock.

If the driver specified WdfExecutionLevelPassive for the ExecutionLevel member of the specified object's WDF_OBJECT_ATTRIBUTES structure, the driver must call WdfObjectAcquireLock at IRQL <= APC_LEVEL. WdfObjectAcquireLock acquires a fast mutex and returns at the caller's IRQL. (In this case, WdfObjectAcquireLock also calls KeEnterCriticalRegion before returning so that normal kernel APCs are disabled.)

If the driver did not specify WdfExecutionLevelPassive for the ExecutionLevel member of the specified object's WDF_OBJECT_ATTRIBUTES structure, the driver must call WdfObjectAcquireLock at IRQL <= DISPATCH_LEVEL. WdfObjectAcquireLock acquires a spin lock and returns at IRQL = DISPATCH_LEVEL.

For more information about synchronization locks, see Synchronization Techniques for Framework-Based Drivers.

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfsync.h (include Wdf.h)
IRQL See Remarks section.
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WDF_OBJECT_ATTRIBUTES

KeEnterCriticalRegion

WdfObjectReleaseLock