[comp.os.msdos.programmer] Abort, Retry, Fail

tcs@mailer.jhuapl.edu (Carl Schelin) (04/19/91)

A few days ago I asked for assistance in solving a problem I was having. 
The response was overwhelming. I want to thank everyone who sent me e-mail 
and especially the answer that solved the last question.

Most everyone pointed to setvect() to take over the critical error handler 
(int 24) which worked with mixed results. While it would work fine on A: 
upon bypassing it, it would choke on B: and loop until booted. If it 
encountered an unlinked network drive, it would drop to Dos after invoking 
the handler.

Since Borland C++'s Programmer's Guide (page 281) said "A function of type 
interrupt will automatically save (in addition to SI, DI, and BP) the 
registers AX through DX, ES, and DS. These same registers are restored on 
exit from the interrupt handler.", I was under the mistaken impression that 
I could do nothing to the registers since the values saved would be 
restored after the handler returned. I was wrong as Frank Whaley's code 
segment pointed out:

void interrupt
criterr(bp, di, si, ds, es, dx, cx, bx, ax)
unsigned bp, di, si, ds, es, dx, cx, bx, ax;
{
    /*  return 'fail'  */
    ax = (ax & 0xFF00) + 3;
}

Once I added "ax = ..." to the handler, everything returned and I was able 
to continue. 

As a final bit of information, here are the values returned by dx when you 
generate int 21 with AX = 0x4409:

               VDISK     = 0x0800
               BERNOULLI = 0x0802
               LOCAL     = 0x0840
               LOCAL     = 0x0842      /* for Compaq Dos v4.01 */
               NETWORK   = 0x1756
               EXTERN    = 0x4840      /* external 3.5" for example */
               SUBST     = 0x8840

Joined and Assigned drives take the characteristics of the original drive 
in this case.

I've sent this information to Ralf Brown (INTER291 interrupt list). It may 
be a correction to his list.

Once again, thanks everyone and especially Frank Whaley (few@gupta.com).

Carl Schelin
tcs@mailer.jhuapl.edu

Ralf.Brown@B.GP.CS.CMU.EDU (04/20/91)

In article <1991Apr19.131352.255@aplcen.apl.jhu.edu>, tcs@mailer.jhuapl.edu (Carl Schelin) wrote:
}As a final bit of information, here are the values returned by dx when you 
}generate int 21 with AX = 0x4409:
}
}               VDISK     = 0x0800
}               BERNOULLI = 0x0802
}               LOCAL     = 0x0840
}               LOCAL     = 0x0842      /* for Compaq Dos v4.01 */
}               NETWORK   = 0x1756
}               EXTERN    = 0x4840      /* external 3.5" for example */
}               SUBST     = 0x8840
}
}Joined and Assigned drives take the characteristics of the original drive 
}in this case.
}
}I've sent this information to Ralf Brown (INTER291 interrupt list). It may 
}be a correction to his list.

I did a little further digging, and the interrupt list now reads:

INT 21 - DOS 3.1+ - IOCTL - CHECK IF BLOCK DEVICE REMOTE
	AX = 4409h
	BL = drive number (00h = default, 01h = A:, etc)
Return: CF clear if successful
	    DX = device attribute word
		bit 15: drive is SUBSTituted
		bit 12: drive is remote
		bit  9: direct I/O not allowed
	CF set on error
	    AX = error code (01h,0Fh) (see AH=59h)
Note:	on local drives, DX bits not listed above are the attribute word from
	  the device driver header (see AH=52h); for remote drives, the other
	  bits appear to be undefined
SeeAlso: AX=4400h,AX=4408h,AX=440Ah,INT 2F/AX=122Bh

--
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | It isn't what we don't know that gives us trouble, it's
I claim something?| what we know that ain't so.  --Will Rogers