Chapter 1 I System Calls
DupZ
Force a Duplicate
of a File Handle
Function Call 46H
Takes a file handle that is already open and returns a new han-
dle that refers to the same file at the same position. If there al-
ready is a file open on the handle specified in CX, it is closed
first.
Entry Conditions:
AH
=
46H
BX
=
existing file handle
CX
=
new file handle
Exit Conditions:
Carry set:
AX
=
error code
Carry not set:
No error.
Error Returns:
AX
=
6
Invalid handle. The handle passed in BX is not currently
open.
Too many open files. There were no free handles available in
the current process or the internal system tables were full.
AX
=
4
Example:
D u p 2
e q u
46H
mov
b x ,
h a n d l e
mov
c x ,
newhandle
mov
a h ,
D u p e
int
21
H
121