The IoAcquireRemoveLock routine increments the count for a remove lock,
indicating that the associated device object should not be detached from the device stack or deleted.
_In_ PIO_REMOVE_LOCK RemoveLock,
_In_opt_ PVOID Tag
- RemoveLock [in]
Pointer to an IO_REMOVE_LOCK structure that the caller initialized with a
previous call to
- Tag [in, optional]
Optionally points to a caller-supplied tag that identifies this instance of acquiring the remove lock. For
example, a driver Dispatch routine typically sets this parameter to a pointer to the IRP the routine is
If a driver specifies a Tag on a call to
IoAcquireRemoveLock, the driver must supply the same
Tag in the corresponding call to
The Tag does not have to be unique, but should be something meaningful during
The I/O system uses this parameter on checked builds only.
IoAcquireRemoveLock returns STATUS_SUCCESS if the call was successful. One
possible error return value is the following:
The driver has received an
IRP_MN_REMOVE_DEVICE for the device and has
That routine is waiting for all remove locks to clear before returning control to the driver.
If the routine returns any value besides STATUS_SUCCESS, do not start any new operations on the device.
A driver must initialize a remove lock with a call to
IoInitializeRemoveLock before using the
A driver must call IoReleaseRemoveLock to
release the lock when it is no longer needed.
For more information, see Using Remove Locks.
|Available starting with Windows 2000.|
- Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)
DDI compliance rules
CompleteRequestStatusCheck, MarkDevicePower, MarkPower, MarkPowerDown, MarkQueryRelations, MarkStartDevice, MultRemoveLock, NsRemoveLockMnRemove, NsRemoveLockMnSurpriseRemove, NsRemoveLockQueryMnRemove, PowerDownAllocate, PowerDownFail, PowerUpFail, RemoveLock, RemoveLockCheck, RemoveLockForward, RemoveLockForward2, RemoveLockForwardDeviceControl, RemoveLockForwardDeviceControl2, RemoveLockForwardDeviceControlInternal, RemoveLockForwardDeviceControlInternal2, RemoveLockForwardRead, RemoveLockForwardRead2, RemoveLockForwardWrite, RemoveLockForwardWrite2, RemoveLockMnRemove, RemoveLockMnRemove2, RemoveLockMnSurpriseRemove, RemoveLockQueryMnRemove, RemoveLockRelease2, RemoveLockReleaseCleanup, RemoveLockReleaseClose, RemoveLockReleaseCreate, RemoveLockReleaseDeviceControl, RemoveLockReleaseInternalDeviceControl, RemoveLockReleasePnp, RemoveLockReleasePower, RemoveLockReleaseRead, RemoveLockReleaseShutdown, RemoveLockReleaseSystemControl, RemoveLockReleaseWrite, WmiForward
Send comments about this topic to Microsoft