Compartilhar via


FSDMGR_AcquireFileLock (Windows CE 5.0)

Send Feedback

Helper function provided by FSDMGR to simplify the implementation of MyFSD_LockFileEx in an FSD.

BOOL FSDMGR_AcquireFileLock(
  PACQUIREFILELOCKSTATE pAcquireFileLockState  PRELEASEFILELOCKSTATE pReleaseFileLockState  DWORD dwHandle, 
  DWORDdwFlags, 
  DWORDdwReserved, 
  DWORDnNumberOfBytesToLockLow, 
  DWORDnNumberOfBytesToLockHigh, 
  LPOVERLAPPEDlpOverlapped
);

Parameters

  • pAcquireFileLockState
    [in] Pointer to a PACUIREFILELOCKSTATE function within the calling FSD.
  • pReleaseFileLockState
    [in] Pointer to a PRELEASEFILELOCKSTATE function within the calling FSD.
  • dwHandle
    [in] Pointer to the value that an FSD passes to the FSDMGR_CreateFileHandle function when creating the file handle.
  • dwFlags
    [in] Flag value. The following table shows the possible values for dwFlags.
    Value Description
    LOCKFILE_EXCLUSIVE_LOCK The function requests an exclusive lock. If this flag is not specified, the function requests a shared lock.
    LOCKFILE_FAIL_IMMEDIATELY The 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 OVERLAPPED structure that is used with the lock request. This structure contains the file offset of the beginning of the unlock range.

Return Values

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

Remarks

The FSD can simply pass all parameters received by MyFSD_LockFileEx to this helper function along with two helper function pointers, PACQUIREFILELOCKSTATE and PRELEASEFILELOCKSTATE (implemented by the FSD).

This function is a Lock Manager function provided by FSDMGR to assist FSDs with implementing MyFSD_LockFileEx and MyFSD_UnlockFileEx.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: lockmgr.h.
Link Library: Fsdmgr.lib.

See Also

FSDMGR_CreateFileHandle | MyFSD_CreateFileW | MyFSD_FindFirstFileW

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.