Bus drivers must handle this IRP for their child devices (child PDOs) that support device locking. Function and filter drivers do not handle this request.

Major Code

IRP_MJ_PNP When Sent

The PnP manager sends this IRP to direct driver(s) to lock the device and prevent device eject, or to unlock the device.

The PnP manager sends this IRP at IRQL PASSIVE_LEVEL in an arbitrary thread context.

Input Parameters

The Parameters.SetLock.Lock member of the IO_STACK_LOCATION structure is a BOOLEAN value specifying whether to lock (TRUE) or unlock (FALSE) the device.

Output Parameters


I/O Status Block

A bus driver sets Irp->IoStatus.Status to STATUS_SUCCESS or to an appropriate error status.

On success, a driver sets Irp->IoStatus.Information to zero.

If a bus driver does not handle this IRP, it leaves Irp->IoStatus.Status as is and completes the IRP.

Function and filter drivers do not handle this IRP. Such drivers call IoSkipCurrentIrpStackLocation and pass the IRP down to the next driver. Function and filter drivers do not set an IoCompletion routine, do not modify Irp->IoStatus, and must not complete the IRP.


If a driver returns success for this IRP, it ensures that the device has been locked or unlocked before completing the IRP.

See Plug and Play for the general rules for handling Plug and Play minor IRPs.

Sending This IRP

Reserved for system use. Drivers must not send this IRP.



Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)