;; 2FOPEN.SCR
;; Intended for use with versions of DOS >=3.1 and <4.00

include "dosstruc"

intercept 21h
    function 3dh
        on_entry
            output "== DOS OPEN (3Dh) ====================="
            output "File name: " (ds:dx->byte,asciiz,40)
            output "Open mode: " al
        on_exit
            output ""
            output "== 3D OPEN Completed "
            if (cflag == 1) sameline "(FAILED " ax ") =========="
            if (cflag == 0) sameline "(Handle " ax ") =========="

intercept 2fh
    function 11h
        subfunction 16h
            on_entry
                output ""
                output "-- 2F Open (16h) -----------------"
                output "File name: " (sda_seg:sda_ofs->SDA3.FN1)
                output "Open mode: " (sda_seg:sda_ofs->SDA3.OPEN_MODE)
                output "Uninitialized SFT:"
                output (es:di->SFT)
            on_exit
                output ""
                output "-- 2F Open completed "
                if (cflag == 0)
                    sameline "-----------------"
                    output "Completed SFT:"
                    output (es:di->SFT)
                if (cflag == 1) sameline "(FAILED " ax ") ---------"

run "command /c type %1"

report "2fopen.out"
