// wdm.h
void IoReleaseRemoveLock(
[in] RemoveLock,
[in] Tag
);
View the official Windows Driver Kit DDI referenceNo description available.
The IoReleaseRemoveLock routine releases a remove lock acquired with a previous call to IoAcquireRemoveLock.
RemoveLock [in]Pointer to an IO_REMOVE_LOCK structure that the caller passed to a previous call to IoAcquireRemoveLock.
Tag [in]Pointer to a caller-supplied tag that was passed to a previous call to IoAcquireRemoveLock.
If a driver specified a Tag when it acquired the lock, the driver must specify the same Tag when releasing the lock.
If the call to IoAcquireRemoveLock did not specify a Tag, then this parameter is NULL.
A driver calls IoReleaseRemoveLock when it has completed the I/O operation for which it called IoAcquireRemoveLock.
Each call to IoAcquireRemoveLock must have a corresponding call to IoReleaseRemoveLock.
IoReleaseRemoveLock decrements the count of outstanding acquisitions of the remove lock. If the count goes to zero and the driver has received an IRP_MN_REMOVE_DEVICE request, IoReleaseRemoveLock sets an internal event. When a driver is ready to delete a device object, it calls a similar routine, IoReleaseRemoveLockAndWait. The driver makes this call only in its dispatch code for an IRP_MN_REMOVE_DEVICE request. The IoReleaseRemoveLockAndWait routine does not return until IoReleaseRemoveLock sets the event that indicates the acquisition count is zero. After IoReleaseRemoveLockAndWait returns, the driver can safely detach and delete the device object.
For more information, see Using Remove Locks.