|
You can check on the Ctrl-C/Ctrl-Break flag using service 3300h of interrupt 21h. If the value in DL on return is 00h, then DOS checks for Ctrl-C/Break only on character devices. If the flag is set (not 00h) then DOS checks on character devices and File I/O.
You can disable the break check using service 3301h with DL = 00h. Enable again with DL = 01h.
'$INCLUDE: 'QB.BI'
DIM inreg AS RegTypeX, outreg AS RegTypeX
' Get Status
inreg.ax = &H3300
CALL INTERRUPTX(&H21, inreg, outreg)
IF (outreg.dx AND &HFF) THEN
PRINT "Status: Only Character Devices"
ELSE PRINT "Status: Character and File I/O Devices"
END IF
' Disable
inreg.ax = &H3301
inreg.dx = &H0
CALL INTERRUPTX(&H21, inreg, outreg)
' enable
inreg.ax = &H3301
inreg.dx = &H1
CALL INTERRUPTX(&H21, inreg, outreg)
Another way to disable Ctrl-C/Break is to create your own interrupt handler and point to it with the interrupt vector 23h.
To totally disable it, just have your interrupt handler be an empty one. i.e.: have only a IRET in it.
IRET% = &H00CF ' This puts CFh 00h at the offset of the variable IRET%
' (little endian style)
Ofs% = VARPTR(IRET%)
VSg% = VARSEG(IRET%)
DEF SEG = 0
POKE &H8C, (Ofs% AND &HFF)
POKE &H8C + 1, ((Ofs% AND &HFF00) \ 256)
POKE &H8C + 2, (VSg% AND &HFF)
POKE &H8C + 3, ((VSg% AND &HFF00) \ 256)
DEF SEG
You don't have to worry about saving the old address. DOS restores INT 22h - 24h on exit of your
program.¥
|