[comp.os.msdos.programmer] Notice diskchange

sverrehu@ifi.uio.no (Sverre H Huseby) (04/16/91)

How can I make my program aware that a diskette
has been removed from a drive, and a new one
inserted instead?

This is to awoid overwriting sectors on the
new diskette.

Several cache-programs do this, so it must
somehow be possible.



Sverre.

----------------------------------------
Sverre H. Huseby   (sverrehu@ifi.uio.no)
Student   -   University of Oslo, Norway

dj@ctron.com (DJ Delorie) (04/16/91)

> How can I make my program aware that a diskette
> has been removed from a drive, and a new one
> inserted instead?

There is a special error code that the BIOS returns that is used for
this.  It reports a "diskette changed" error for the first operation
attempted on a diskette that's just been changed.

DJ
dj@ctron.com

frisk@rhi.hi.is (Fridrik Skulason) (04/17/91)

In article <CMM.0.90.2.671783143.sverrehu@helblinde.ifi.uio.no> sverrehu@ifi.uio.no (Sverre H Huseby) writes:
>How can I make my program aware that a diskette
>has been removed from a drive, and a new one
>inserted instead?

Hm - I was looking at a related problem - how to make my virus scanner
automatically scan all diskettes inserted, and here is the conclusion I
reached:

On a PC (or PCjr) you simply cannot do this - there is no way to know if
the diskette has been replaced with an identical one.

On most XTs, all ATs, '386 etc.... it is fairly easy... 

		MOV DL, drive
		MOV AH,16H
		INT 13H
		CMP AH,6
		JE diskette_changed

Either do this in the timer interrupt (if you are not in the INT 13H
routine at the moment), or intercept INT 13H, and do this before doing any
reads/writes...

See the interrupt list from Ralf Brown for further information.

-frisk

Fridrik Skulason      University of Iceland  |       
Technical Editor of the Virus Bulletin (UK)  |  Reserved for future expansion
E-Mail: frisk@rhi.hi.is    Fax: 354-1-28801  |   

		

) (04/21/91)

In article <CMM.0.90.2.671783143.sverrehu@helblinde.ifi.uio.no> sverrehu@ifi.uio.no (Sverre H Huseby) writes:
>How can I make my program aware that a diskette
>has been removed from a drive, and a new one
>inserted instead?
>
>Sverre.
>




Well, you didn't specify what type of floppies or what DOS version so I'll
have to give you a broad answer... Starting with v3.3 you can use the
DRIVPARM entry in CONFIG.SYS.  Various DOS releases changed the parameters
a bit but I think that the "changedoor" option is "/C".  Hope this helps.


---

  Steve Bibbo                       UUCP : bibbo@moncol.UUCP (The Monk!)
  Computer Operations               Internet: moncol!bibbo@princeton.edu
  Monmouth College                  CompuServe: 72657,602
  W Long Branch, NJ 07764           Voice: (908) 571-3559