Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Function 45H (decimal 69) duplicates an open file handle and returns a new
  handle number that refers to the same file or device. All actions
  performed with one handle will be reflected in the other handle--the new
  handle does not act independently in any way.

  Call function 45H with an open handle in BX. If the function executes
  successfully, it clears the carry flag and leaves a new handle number in
  AX. If an error occurs, the carry flag is set and AX contains an error
  code: 04H (no more handles) or 06H (invalid handle).

  You can use function 45H along with function 46H to implement
  input/output redirection. You can also use it to commit an open file to
  disk by duplicating the open file's handle and then closing the duplicate
  handle. This has the effect of flushing the file's disk buffers and
  updating the directory, without the overhead of closing the file,
  reopening it (which involves a directory search), and repositioning the
  file pointer:

  mov bx,Handle           ; BX = handle of open file
  mov ah,45h
  int 21h                 ; get duplicate handle into AX
  jc  Error
  mov bx,ax               ; BX = duplicate handle
  mov ah,3Eh
  int 21h                 ; close duplicate handle
                          ;   (original handle remains open)

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