Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UnlockFileEx

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function unlocks a region in an open file. Unlocking a region enables other processes to access the region.


BOOL UnlockFileEx(
  HANDLE hFile, 
  DWORD dwReserved,
  DWORD nNumberOfBytesToLockLow,
  DWORD nNumberOfBytesToLockHigh,
  LPOVERLAPPED lpOverlapped
);

hFile

[in] Handle to a file that contains a region locked by the LockFileEx function. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right.

dwReserved

Reserved. Set to zero.

nNumberOfBytesToLockLow

[in] Low-order portion of the length of the byte range to unlock.

nNumberOfBytesToLockHigh

[in] High-order portion of the length of the byte range to unlock.

lpOverlapped

[in] Pointer to an OVERLAPPED structure that is used with the unlock request. This structure contains the file offset of the beginning of the unlock range.

Nonzero indicates success. Zero indicates failure. For 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.

If a process terminates with a portion of a file locked or closes a file that has outstanding locks, the locks are unlocked by the OS. However, the time it takes for the OS to unlock these locks depends upon available system resources. Therefore, explicitly unlock all locked files when a process ends. Otherwise, access to these files can be denied if the OS has not yet unlocked them.

Headerwinbase.h
Librarycoredll.lib
Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2014 Microsoft