[comp.sys.mac.programmer] Controlling a disk drive

russotto@eng.umd.edu (Matthew T. Russotto) (08/17/90)

Here's a related question:  How can I grab control of a specific disk drive?
What I want to do is I want to write raw data to the disk drive (like Apple
Diskmaker does), but I have to make sure that the system doesn't eject the
disk I have in there, put up a disk switch alert, and have an unsuspecting user
put in a disk only for my program (once it gets control) to write all over
their disk.  Also, it would be nice if I could ask the user to switch disks--
if I want to unpack a compressed disk image from a disk to a different disk in
the same drive, for instance.

(Right now what I do is never call Get/Wait NextEvent, don't use any resources
in the critical section, and don't allow single-drive use)

Also, is there any way I can get a descriptive name for a specific floppy drive
(for instance 1: Bottom drive 2: Top drive 3: External drive, but without 
hard-coding that).
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?

urlichs@smurf.sub.org (Matthias Urlichs) (08/20/90)

In comp.sys.mac.programmer, article <1990Aug17.141156.7785@eng.umd.edu>,
  russotto@eng.umd.edu (Matthew T. Russotto) writes:
< Here's a related question:  How can I grab control of a specific disk drive?
<(Right now what I do is never call Get/Wait NextEvent, don't use any resources
<in the critical section, and don't allow single-drive use)
< 
Assuming that the driver knows about its entries in the drive queue, as
opposed to searching for them at every _Prime and _Control call (IMHO a very
reasonable assumption, but stranger things have been programmed), then what
I'd try in that situation is to _UnmountVol the disk which might be in that
drive, and then temporarily remove it from the drive queue.

Disclaimer:
I didn't do this yet -- it sounds reasonable but there may be problems.

<Also, is there any way I can get a descriptive name for a specific floppy drive
<(for instance 1: Bottom drive 2: Top drive 3: External drive, but without 
<hard-coding that).

Why not use the physical icons?
There's a documented Control call to get them...
After the icon, there's supposed to be some descriptive text.
If not, look at the bytes immediately after the "normal" icon.
If still not, hard-code some reasonable strings, but _please_ put them into
 resources!

-- 
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(Voice)/621227(PEP)