Applies to: desktop apps | Metro style apps
Unlocks a region in the specified file. This function can operate either synchronously or asynchronously.
Syntax
BOOL WINAPI UnlockFileEx( __in HANDLE hFile, __reserved DWORD dwReserved, __in DWORD nNumberOfBytesToUnlockLow, __in DWORD nNumberOfBytesToUnlockHigh, __inout LPOVERLAPPED lpOverlapped );
Parameters
- hFile [in]
-
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.
- dwReserved
-
Reserved parameter; must be zero.
- nNumberOfBytesToUnlockLow [in]
-
The low-order part of the length of the byte range to unlock.
- nNumberOfBytesToUnlockHigh [in]
-
The high-order part of the length of the byte range to unlock.
- lpOverlapped [in, out]
-
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.
Return value
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.
Remarks
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.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- CreateFile
- File Management Functions
- LockFile
- LockFileEx
- OVERLAPPED
- Synchronous and Asynchronous I/O
- UnlockFile
Send comments about this topic to Microsoft
Build date: 4/17/2012