PACQUIREFILELOCKSTATE (Compact 2013)
3/26/2014
This data type is a pointer to a function implemented by a file system driver (FSD). Used by Lock Manager to get the file lock state associated with the specified file when a lock is being modified.
Syntax
typedef VOID (*PACQUIREFILELOCKSTATE)(
DWORD dwFile,
PFILELOCKSTATE* ppFileLockState
);
Parameters
- dwFile
[in] File handle context passed to FSDMGR_InstallFileLockState. This should be the pointer to the value that the FSD passed to the FSDMGR_CreateFileHandle function when the file handle was created.
- ppFileLockState
[out] Pointer to a FILELOCKSTATE structure associated with the file referenced by dwFile.
Remarks
This data type is required to enter the PFILELOCKSTATE critical section, lpcs, before returning the FILELOCKSTATE structure to the caller.
Before returning the FILELOCKSTATE structure to the caller, the function should update the dwPosLow, dwPosHigh,and****dwAccess members of that structure, based on the current file pointer and access mode of the handle context referenced by dwFile.
The following code example shows a simple implementation:
Important
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
BOOL MyAcquireFileLockState(DWORD dwPfh, PFILELOCKSTATE *ppFileLockState)
{
PFILE pFileHandle = (PFILE)dwPfh;
PINTERNALFILE pFile = pFileHandle->pInternalFile;
if (NULL == pFile->FileLockState.lpcs)
{
return FALSE;
}
// Acquire file lock state; exit in MyReleaseFileLockState.
EnterCriticalSection(pFile->FileLockState.lpcs);
// Obtain file position (64-bit offsets not supported).
pFile->FileLockState.dwPosLow = pFileHandle->dwCurrentFileOffset;
pFile->FileLockState.dwPosHigh = 0;
// Obtain create access.
pFile->FileLockState.dwAccess = pFileHandle->dwAccessMode;
// Return file lock container.
*ppFileLockState = &pFile->FileLockState;
return TRUE;
}
This function is a Lock Manager function provided by File System Disk Manager (FSDMGR) to assist FSDs with implementing the MyFSD_LockFileEx and the MyFSD_UnLockFileEx functions.
Requirements
Header |
lockmgrtypes.h |
Library |
Fsdmgr.lib |
See Also
Reference
FSD Data Types
FSDMGR_CreateFileHandle
MyFSD_CreateFileW
MyFSD_FindFirstFileW