The ZwUnlockFile routine unlocks a byte-range lock in a file.
NTSTATUS ZwUnlockFile( _In_ HANDLE FileHandle, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ PLARGE_INTEGER ByteOffset, _In_ PLARGE_INTEGER Length, _In_ ULONG Key );
A handle for the file object that represents the file whose byte range is to be unlocked.
A pointer to an IO_STATUS_BLOCK structure that contains the final status.
A pointer to a variable that specifies the starting byte offset for the byte range to be unlocked.
A pointer to a variable that specifies the length, in bytes, of the byte range to unlock.
The caller-assigned value used to describe groups of related locks. This value should be set to zero.
The ZwUnlockFile routine returns STATUS_SUCCESS on success or an appropriate NTSTATUS value. Possible NTSTATUS values include:
The byte range specified is not locked.
The ZwUnlockFile routine takes a range of bytes as specified by the ByteOffset and Length arguments. This range must be identical to a range of bytes in the file that was previously locked with a single call to the ZwUnlockFile routine. It is not possible to unlock two previously locked adjacent ranges with a single call to ZwUnlockFile. It is also not possible to unlock part of a range that was previously locked with a single call to the ZwUnlockFile routine.
Callers of ZwUnlockFile must be running at IRQL = PASSIVE_LEVEL and with special kernel APCs enabled.
Note If the call to the ZwUnlockFile function occurs in user mode, you should use the name "NtUnlockFile" instead of "ZwUnlockFile".
For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.
Available starting with Windows 7.
|Ntifs.h (include Ntifs.h or FltKernel.h)|
PASSIVE_LEVEL (see Remarks section)
DDI compliance rules