Unlocks a region in the specified file. This function can operate either synchronously or asynchronously.
BOOL UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped );
A handle to the file. The handle must have been created with either the GENERIC_READ or GENERIC_WRITE access right. For more information, see File Security and Access Rights.
Reserved parameter; must be zero.
The low-order part of the length of the byte range to unlock.
The high-order part of the length of the byte range to unlock.
A pointer to an OVERLAPPED structure that the function uses with the unlocking request. This structure contains the file offset of the beginning of the unlock range. You must initialize the hEvent member to a valid handle or zero. For more information, see Synchronous and Asynchronous I/O.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero or NULL. To get extended error information, call GetLastError.
Unlocking a region of a file releases a previously acquired lock on the file. The region to unlock must correspond exactly to an existing locked region. Two adjacent regions of a file cannot be locked separately and then unlocked using a single region that spans both locked regions.
Locks are released before the CloseHandle function is finished processing.
In Windows 8 and Windows Server 2012, this function is supported by the following technologies.
|Server Message Block (SMB) 3.0 protocol||Yes|
|SMB 3.0 Transparent Failover (TFO)||Yes|
|SMB 3.0 with Scale-out File Shares (SO)||Yes|
|Cluster Shared Volume File System (CsvFS)||Yes|
|Resilient File System (ReFS)||Yes|
|Windows version||Windows XP [desktop apps | UWP apps] Windows Server 2003 [desktop apps | UWP apps]|
|Header||fileapi.h (include Windows.h)|