Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Assembly Language - <b>function 5ch (92) lock/unlock file access . dos 3.0</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 5Ch (92)        Lock/Unlock File Access                    . DOS 3.0

    Denies or permits access to a specified region of a file.

       On entry:      AH         5Ch
                      AL         00h      to lock a file
                                 01h      to unlock a file
                      BX         File handle
                      CX         Offset of region (high-order word)
                      DX         Offset of region (low-order word)
                      SI         Length of region (high-order word)
                      DI         Length of region (low-order word)

       Returns:       AX         Error code, if CF is set

       Error codes:   1          Invalid function code
                      6          Invalid handle
                      33         File-locking violation (specified region is
                                 already locked)

  --------------------------------------------------------------------------

    This function is used to lock or unlock a selected portion of a file,
    preventing or allowing access to that region by other processes in a
    multitasking or networking environment.

       Notes:         CX and DX together make up a 4-byte integer that
                      specifies the byte offset into the file of the
                      region to be locked or unlocked; SI and DI make up a
                      4-byte integer specifying the length of the region.

                      Terminating a process that has an open file with a
                      locked region, or closing a file with a locked
                      region, has undefined results. If your program can
                      be aborted via Int 23h or 24h, you should ensure
                      that the locks are released before terminating the
                      program.

                      The unlocking operation must specify exactly the
                      same file region as the locking operation.

                      A child process (i.e., a process created via the
                      EXEC system call), does not inherit access to
                      regions of a file that were locked by its parent.

                      Use this function in the following file modes:
                           Deny read sharing mode
                           Deny none sharing mode
                           Deny write sharing mode, and file opened for
                               read/write
                           Deny write sharing mode, and file opened for
                               write only

See Also: 3Dh 59h

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson