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

Helper function provided by File System Driver manager (FSDMGR) to simplify the implementation of the MyFSD_LockFileExfunction in a file system driver (FSD).

Syntax

BOOL FSDMGR_AcquireFileLock(
  PACQUIREFILELOCKSTATE 
pAcquireFileLockState
  PRELEASEFILELOCKSTATE 
pReleaseFileLockState
  DWORD 
dwHandle, 
  DWORD 
dwFlags, 
  DWORD 
dwReserved, 
  DWORD 
nNumberOfBytesToLockLow, 
  DWORD 
nNumberOfBytesToLockHigh, 
  LPOVERLAPPED 
lpOverlapped
);

Parameters

pAcquireFileLockState

[in] Pointer to a PACQUIREFILELOCKSTATEfunction in the calling FSD.

pReleaseFileLockState

[in] Pointer to a PRELEASEFILELOCKSTATEfunction in the calling FSD.

dwHandle

[in] Pointer to the value that an FSD passes to the FSDMGR_CreateFileHandlefunction when creating the file handle.

dwFlags

[in] Flag value. The following table shows possible values.

Value Description

LOCKFILE_EXCLUSIVE_LOCK

This function requests an exclusive lock. If this flag is not specified, the function requests a shared lock.

LOCKFILE_FAIL_IMMEDIATELY

This function returns immediately if it is unable to acquire the requested lock. If this flag is not specified, the function waits.

dwReserved

Reserved. Set to zero.

nNumberOfBytesToLockLow

[in] Low-order 32 bits of the length of the byte range to lock.

nNumberOfBytesToLockHigh

[in] High-order 32 bits of the length of the byte range to lock.

lpOverlapped

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

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The FSD can simply pass all parameters received by MyFSD_LockFileExto this helper function, along with two helper function pointers, PACQUIREFILELOCKSTATEand PRELEASEFILELOCKSTATE, implemented by the FSD.

This function is a Lock Manager function provided by FSDMGR to assist FSDs with implementing the MyFSD_LockFileExand the MyFSD_UnLockFileExfunctions.

Requirements

Header lockmgr.h
Library Fsdmgr.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile 6 and later

See Also