home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------------------------;
- ; ;
- ; INT60.ASM -- Signaller program for INTHOOK example application ;
- ; ;
- ; Written by Walter Oney ;
- ; ;
- ;-----------------------------------------------------------------------------;
-
- name int60
- int60 segment byte public 'code'
- assume cs:int60, ds:int60
- org 100h ; required for .COM file usage
-
- ; See if the forwarder program is present by checking the interrupt
- ; vector for 61h.
-
- begin: mov ax, 3561h ; get int 61 vector address
- int 21h ; ..
- mov ax, es ; be sure there is one
- or ax, bx ; ..
- jz cantcall ; if not, complain and quit
-
- ; Use 2F/1685 to switch to the system virtual machine and call the
- ; forwarder program. Note that no-one actually does an INT 61h -- we
- ; simply use the vector as a convenient (and facile) place to park
- ; the address of the callback
-
- mov ax, 1685h ; fcn 1685: switch VM's and callback
- mov di, bx ; ES:DI = callback address (int 61 hdlr)
- mov bx, 1 ; BX = VM to switch to (system VM)
- mov cx, 3 ; CX = .... .... .... ..11 -- wait until
- ; interrupts enabled and critical
- ; section unowned
- xor dx, dx ; DX:SI = priority boost (zero)
- xor si, si ; ..
- int 2Fh ; switch to system VM & do INT 60
-
- ; If the forwarder found an INT 60 handler, it saved the address beginning
- ; after a 3-byte JMP located at 100h. Check this in order to complain if
- ; the responder WinApp isn't loaded. Note that this test will sometimes
- ; fail because we're running asynchronously with the system VM.
-
- mov ax, word ptr es:[103h]; see if forwarder found an INT 60 handler
- or ax, word ptr es:[105h]; ..
- jz no60 ; if not, complain about it
-
- goback: mov ax, 4C00h ; terminate with errorlevel 0
- int 21h ; (does not return)
-
- cantmsg db 'The forwarder program is not installed', 13, 10, '$'
- nomsg db 'The responder WinApp is not running', 13, 10, '$'
-
- no60: lea dx, nomsg ; responder not present
- jmp short complain ; ..
-
- cantcall:lea dx, cantmsg ; forwarder not present
-
- complain:mov ah, 9 ; fcn 9: print msg in DS:DX on screen
- int 21h ; ..
- jmp goback ; exit
-
- int60 ends
- end begin