Share via


PRELEASEFILELOCKSTATE

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function is a prototype to be implemented by the file system driver (FSD) and used by Lock Manager to return the lock state of the specified file. This function must be called to exit the file lock state's critical section.

Syntax

typedef
BOOL
(*PRELEASEFILELOCKSTATE)(
    DWORD dwFile,
    PFILELOCKSTATE *ppFileLockState
    );

Parameters

  • dwFile
    Specifies the file.
  • ppFileLockState
    Pointer to a FILELOCKSTATE structure associated with the file referenced by dwFile.

Return Value

TRUE indicates that the file is locked.

Remarks

This is a function prototype to allow passing functions as parameters. An OEM must implement functions conforming to this type definition if using the FSDMGR_AcquireFileLock and the FSDMGR_CloseFileLockState macros from the MyFSD_LockFileEx and the MyFSD_UnLockFileEx functions.

The following code example shows a simple implementation:

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;
}

Requirements

Header lockmgrtypes.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
PACQUIREFILELOCKSTATE
FSDMGR_CreateFileHandle
MyFSD_CreateFileW
MyFSD_FindFirstFileW
FILELOCKSTATE