Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TASM 2.x / MASM 6.x Assembly Language - <b>function 45h (69) duplicate a file handle (dup)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 45h (69)        Duplicate a File Handle (DUP)

    Creates a new file handle by duplicating the existing handle of an
    open file or device. The new handle shares the existing file pointer.

       On entry:      AH         45h
                      BX         File handle

       Returns:       AX         Duplicate file handle, or
                                 Error code, if CF is set

       Error Codes:   4          No handles available
                      6          Invalid handle

                      Call Function 59h for extended error code information
                      (DOS 3.0 and above).

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

    Function 45h (DUP) returns a new file handle that refers to the same
    file or device as the old file handle specified in BX.

       Notes:         Moving the file pointer of either handle by a Read,
                      Write, or Lseek causes the other handle to be
                      changed also. However, closing one handle does not
                      close the other.

                      By duplicating a handle and closing one of the
                      handles, you can flush the file to disk and update
                      the directory; since the other handle will still be
                      open, you won't need to re-open the file, a time-
                      consuming process.

See Also: 46h 59h

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