Locks and unlocks a range of an open file.

#define INCL_DOSFILEMGR
#include <os2.h>

HFILE        hFile;               /*  File handle. */
PFILELOCK    pflUnlock;           /*  Address of the structure containing the offset and length of a range to be unlocked. */
PFILELOCK    pflLock;             /*  Address of the structure containing the offset and length of a range to be locked. */
ULONG        timeout;             /*  The maximum time that the process is to wait for the requested locks. */
ULONG        flags;               /*  Flags that describe the action to be taken. */
FHLOCK       fhFileHandleLockID;  /*  The filehandle lockid returned by a previous DosProtectOpen. */
APIRET       ulrc;                /*  Return Code. */

ulrc = DosProtectSetFileLocks(hFile, pflUnlock,
         pflLock, timeout, flags, fhFileHandleLockID);


[Back] [Next]