home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn45h.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.1 KB  |  23 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;             Function 45H: Duplicate File Handle            ;
  4.         ;                                                            ;
  5.         ;             int dup_handle(handle)                         ;
  6.         ;                 int handle;                                ;
  7.         ;                                                            ;
  8.         ;             Returns -1 for errors,                         ;
  9.         ;             otherwise returns new handle.                  ;
  10.         ;                                                            ;
  11.         ;************************************************************;
  12.  
  13. cProc   dup_handle,PUBLIC
  14. parmW   handle
  15. cBegin
  16.         mov     bx,handle       ; Get handle to copy.
  17.         mov     ah,45h          ; Set function code.
  18.         int     21h             ; Ask MS-DOS to duplicate handle.
  19.         jnb     dup_ok          ; Branch if copy was successful.
  20.         mov     ax,-1           ; Else return -1.
  21. dup_ok:
  22. cEnd
  23.