Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
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.

Syntax

BOOL MyFSD_UnlockFileEx(
  DWORD 
dwFile,
  DWORD 
dwReserved,
  DWORD 
nNumberOfBytesToUnlockLow,
  DWORD 
nNumberOfBytesToUnlockHigh,
  LPOVERLAPPED 
lpOverlapped
);

Parameters

dwFile

[in] Pointer to the value that a file system driver (FSD) passes to the FSDMGR_CreateFileHandlefunction when creating the file handle.

dwReserved

Ignored. Set to zero

nNumberOfBytesToUnlockLow

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

nNumberOfBytesToUnlockHigh

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

lpOverlapped

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

Return Value

Nonzero indicates that the lock was successfully removed. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

All FSD functions can be called re-entry. Therefore, take this into account when developing an FSD.

Though the function requires an OVERLAPPEDstructure, it does not support asynchronous locking. In Windows Embedded CE, the OVERLAPPEDstructure is used only to describe the byte range to be locked. Members other than OffsetHighand Offsetof the OVERLAPPEDstructure are ignored.

FSDMGR provides the lock helper function FSDMGR_RemoveFileLockto simplify implementation of this function in an FSD.

The following code example shows a simple implementation:

Copy Code
BOOL MyFSD_UnlockFileEx (
   PFILE pFile, 
   DWORD dwReserved, 
   DWORD nNumberOfBytesToLockLow, 
   DWORD nNumberOfBytesToLockHigh, 
   LPOVERLAPPED lpOverlapped
   )
{
   return FSDMGR_RemoveFileLock (
   MyAcquireFileLockState, 
   MyReleaseFileLockState, 
   (DWORD)pFile, 
   dwReserved, 
   nNumberOfBytesToLockLow, 
   nNumberOfBytesToLockHigh, 
   lpOverlapped
);
}

FSDMGR is a DLL that manages all OS interaction with installable files systems. Each installable file system requires an FSD, which is a DLL that supports an installable file system. The name of the DLL for the FSD and the names of the functions it exports start with the name of the associated installable file system. For example, if the name of file system is MyFSD, its DLL is MyFSD.dll, and its exported functions are prefaced with MyFSD_*.

Requirements

Header fsdmgr.h
Library Fsdmgr.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also