Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!hp-pcd!hpcvlo!everett
From: everett@hpcvlo.HP.COM (Everett Kaser)
Newsgroups: comp.sys.ibm.pc
Subject: Re: DOS Critical-error handler
Message-ID: <1610020@hpcvlo.HP.COM>
Date: Tue, 21-Jul-87 18:23:12 EDT
Article-I.D.: hpcvlo.1610020
Posted: Tue Jul 21 18:23:12 1987
Date-Received: Fri, 24-Jul-87 05:10:58 EDT
References: <1871@isis.UUCP>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 60


This is a code fragment that I used in a recent program.  It seems to do the
job.  The effect is that the Abort, Retry, or Ignore message is suppressed,
and the application receives a CY flag set upon return from the function call
to indicate an error occurred during the call.

;
; call INIT during program initialization to take over int vector
;
init:
	push	ds
	cli
	xor	bx,bx
	mov	ds,bx			; point data segment to vector table
	mov	di,4*24h		; point to critical error int vector
	mov	cx,[di]			; get old vector
	mov	dx,[di+2]
	mov	word ptr [di],offset criterr	; set vector to our routine
	mov	[di+2],cs
	sti
	pop	ds
	mov	savint24off,cx		; save old vector
	mov	savint24seg,dx
	ret
;
; call UN_INIT before exiting program to restore int vector (may not be
;  necessary, since I think DOS restores the vector when a program terminates).
;
un_init:
	mov	ax,savint24off
	mov	bx,savint24seg
	push	ds
	xor	di,di
	mov	ds,di
	mov	di,4*24h
	cli
	mov	[di],ax
	mov	[di+2],bx
	sti
	pop	ds
	ret
;
; actual critical error handling routine.  can be far more complex, but this
; should suffice to keep the Abort, Retry, or Ignore message from appearing.
;
criterr	proc	far
	mov	al,0			; tell DOS to ignore error, but return
ctrlc:					; the CY flag set so application
	iret				; knows an error occurred
criterr	endp
;
savint24off	dw	?
savint24seg	dw	?
;

Hope this helps.

Everett Kaser
Hewlett-Packard Co.
Corvallis, OR