This call returns a new file handle for an open file, which refers to the same position in the file as the old file handle.
DosDupHandle
OldFileHandle (HFILE) - input
Value
On output, a value of FFFFH returns a value for NewFileHandle, allocated by OS/2.
Duplicating the handle duplicates and ties all handle-specific information between OldFileHandle and NewFileHandle. For example, if you move the read/write pointer of either handle by a DosRead, DosWrite, or DosChgFilePtr function call, the pointer for the other handle is also changed.
The valid values for NewFileHandle include the following handles for standard I/O, which are always available to the process:
0000H
If a file handle value of a currently open file is specified in NewFileHandle, the file handle is closed before it is redefined as the duplicate of OldFileHandle. Avoid using arbitrary values for NewFileHandle.
Issuing a DosClose against a file handle does not affect the duplicate handle.