MyFSD_UnLockFileEx
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_CreateFileHandle function 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 OVERLAPPED structure 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 OVERLAPPED structure, it does not support asynchronous locking. In Windows Embedded CE, the OVERLAPPED structure is used only to describe the byte range to be locked. Members other than OffsetHigh and Offset of the OVERLAPPED structure are ignored.
FSDMGR provides the lock helper function FSDMGR_RemoveFileLock to simplify implementation of this function in an FSD.
The following code example shows a simple implementation:
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
Reference
MyFSD Functions
CreateDirectory
CloseHandle
FSDMGR_CreateFileHandle
FSDMGR_RegisterVolume
MyFSD_CreateDirectoryW
MyFSD_CreateFileW
MyFSD_DeleteFileW
MyFSD_FindClose
MyFSD_FindFirstFileW