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 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 FILELOCKSTATEstructure 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_AcquireFileLockand the FSDMGR_CloseFileLockStatemacros from the MyFSD_LockFileExand the MyFSD_UnLockFileExfunctions.

The following code example shows a simple implementation:

Copy Code
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