hFile (HFILE) - input

      File handle.

    pflUnlock (PFILELOCK) - input

      Address of the structure containing the offset and length of a range to be unlocked.

    pflLock (PFILELOCK) - input

      Address of the structure containing the offset and length of a range to be locked.

    timeout (ULONG) - input

      The maximum time, in milliseconds, that the process is to wait for the requested locks.

    flags (ULONG) - input

      Flags that describe the action to be taken.

      This parameter has the following bit fields:

      Bit

        Description
      31-2
        Reserved flags
      1
        Atomic

        This bit defines a request for atomic locking. If this bit is set to 1 and the lock range is equal to the unlock range, an atomic lock occurs. If this bit is set to 1 and the lock range is not equal to the unlock range, an error is returned.

        If this bit is set to 0, then the lock may or may not occur atomically with the unlock.

      0
        Share

        This bit defines the type of access that other processes may have to the file range that is being locked.

        If this bit is set to 0 (the default), other processes have no access to the locked file range. The current process has exclusive access to the locked file range, which must not overlap any other locked file range.

        If this bit is set to 1, the current process and other processes have shared read-only access to the locked file range. A file range with shared access may overlap any other file range with shared access, but must not overlap any other file range with exclusive access.

      ulrc (APIRET) - returns

        Return Code.

        DosSetFileLocks returns one of the following values:

      • NO_ERROR 1
          ERROR_INVALID_FUNCTION
        6
          ERROR_INVALID_HANDLE
        33
          ERROR_LOCK_VIOLATION
        36
          ERROR_SHARING_BUFFER_EXCEEDED
        87
          ERROR_INVALID_PARAMETER
        95
          ERROR_INTERRUPT
        174
          ERROR_ATOMIC_LOCK_NOT_SUPPORTED
        175
          ERROR_READ_LOCKS_NOT_SUPPORTED
        For a full list of error codes, see Errors.


      [Back] [Next]