[comp.sys.ibm.pc] DOS "Critical Section Flag"

c37189h@saha.hut.fi (06/21/89)

Someone wanted to know when it is safe to access dos. (I think it was in this
newsgroup) So, here comes one way to ditect safety:

DOS Int 21h with AH=34h returns a pointer to "Critical Section Flag" in ES:BX.
Byte pointed by the pointer is zero in case it is safe to access DOS. Also
the critical error flag should be zero as long as it is safe. The Critical
error flag is the byte AFTER the critical section flag in  DOS 2.x and the
byte BEFORE the critical section flag in DOS 3.x (exept COMPAQ DOS 3.0 where
it is located 1AAh bytes before the critical section flag). Sorry, I don't
know about DOS 4.x :-(

This seems quite a complex way of detecting safety to me! I wonder if anyone
knows a better way to do it. (In case anyone does please, e-mail to me!)
---  
E-mail:  c37189h@saha.hut.fi            *  If you're feeling good, don't 
UUCP:    ...!mcvax!santra!saha!c37189h  *  worry  -  You'll get over it!   :)<-<

ben@val.UUCP (Ben Thornton) (06/29/89)

c37189h@saha.hut.fi writes:

>Someone wanted to know when it is safe to access dos. (I think it was in this
>newsgroup) So, here comes one way to ditect safety:

Describes Dos Int 21H Function 43H...

>This seems quite a complex way of detecting safety to me! I wonder if anyone
>knows a better way to do it. (In case anyone does please, e-mail to me!)

Actually, I think the only SAFE thing to do is intercept Int 21H and have the
handler maintain a status flag.  Your routines that handle file I/O within
your TSR can then test that flag.  I believe it is more reliable and less
hassle in the long run.
-- 

Ben Thornton             packet:  WD5HLS @ KB5PM
Video Associates Labs      uucp:  ...!cs.utexas.edu!oakhill!val!ben
Austin, TX              fidonet:  1:382/40 - The Antenna Farm BBS

ralf@b.gp.cs.cmu.edu (Ralf Brown) (06/30/89)

In article <353@val.UUCP> ben@val.UUCP (Ben Thornton) writes:
}c37189h@saha.hut.fi writes:
}
}>Someone wanted to know when it is safe to access dos. (I think it was in this
}
}Actually, I think the only SAFE thing to do is intercept Int 21H and have the
}handler maintain a status flag.  Your routines that handle file I/O within
}your TSR can then test that flag.  I believe it is more reliable and less
}hassle in the long run.

Whether you use the INDOS flag or trap INT 21h, you will need to trap INT 13h,
INT 25h, and INT 26h to be entirely sure that no disk access is in progress
when the TSR tries to use the disk.
-- 
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school)
ARPA: RALF@CS.CMU.EDU     |"The optimist is the kind of person who believes a
FIDO: Ralf Brown 1:129/46 | housefly is looking for a way out."--Geo.J.Nathan
BITnet: RALF%CS.CMU.EDU@CMUCCVMA -=-=-=-=-=- DISCLAIMER? I claimed something?