home *** CD-ROM | disk | FTP | other *** search
- PUBLIC isconsole
-
- IS_DEVICE EQU 0080H
- IS_FASTCONSOLE EQU 0010H
- IS_CONSOUT EQU 0002H
- IS_CONSIN EQU 0001H
-
- ;int isconsole(int handle)
- isconsole PROC NEAR
-
- mov ax,4400H ;IOCTL svc, get device information
- mov bx,sp ;parm is stack-relative
- mov bx,SS:[bx+2] ;get handle
- int 21H ;result in DX
-
- mov ax,dx ;into AX for faster testing
- xor dx,dx ;handy 0
- test ax,IS_DEVICE
- jz Ret_False ;not a device at all
- test ax,IS_FASTCONSOLE
- jz Ret_False
- test ax,IS_CONSOUT
- jz Ret_False
- test ax,IS_CONSIN
- jz Ret_False
- not dx ;return non-0, TRUE
- Ret_False:
- mov ax,dx ;return function in AX
- ret
- isconsole ENDP