EVT_WDF_DEVICE_SET_LOCK callback function (wdfpdo.h)

[Applies to KMDF only]

A driver's EvtDeviceSetLock event callback function locks the specified device so that it cannot be ejected, or unlocks the device so that it can be ejected.

Syntax

EVT_WDF_DEVICE_SET_LOCK EvtWdfDeviceSetLock;

NTSTATUS EvtWdfDeviceSetLock(
  [in] WDFDEVICE Device,
  [in] BOOLEAN IsLocked
)
{...}

Parameters

[in] Device

A handle to a framework device object.

[in] IsLocked

A Boolean value that indicates whether the driver must lock or unlock the device. If TRUE, the driver must lock the device so that it cannot be ejected. If FALSE, the driver must unlock the device so that it can be ejected.

Return value

If the driver successfully locks or unlocks the device, it must return STATUS_SUCCESS. Otherwise it must return an NTSTATUS value that NT_SUCCESS evaluates as FALSE.

For more information about this callback function's return values, see Reporting Device Failures.

Remarks

Framework-based bus drivers can provide an EvtDeviceSetLock callback function. To register this callback function, bus drivers call WdfPdoInitSetEventCallbacks.

The framework calls the driver's EvtDeviceSetLock callback function when the PnP manager requests the bus driver to lock or unlock one of its enumerated child devices.

Not implementing an EvtDeviceSetLock callback function for a device is equivalent to returning an NTSTATUS value that evaluates as FALSE.

For more information about return values, see Supporting Ejectable Devices.

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfpdo.h (include Wdf.h)
IRQL PASSIVE_LEVEL

See also

EvtDeviceEject