Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!well!gurgle From: gurgle@well.sf.ca.us (Pete Gontier) Newsgroups: comp.sys.mac.programmer Subject: Re: trapping for floppy disk Message-ID: <23818@well.sf.ca.us> Date: 25 Mar 91 20:45:29 GMT References: <1991Mar19.164204.8847@hubcap.clemson.edu> <6761@rex.cs.tulane.edu> Organization: cellular Lines: 32 In article <6761@rex.cs.tulane.edu> mandel@vax.anes.tulane.edu writes: >In article <1991Mar19.164204.8847@hubcap.clemson.edu>, mcmac@hubcap.clemson.edu (Scott McAlister) writes: >>I am working on an init that traps on MountVol. What I want to do >>is to distinguish between floppies and hard disks. Can anybody help >>me out? Sample code would be appreciated. Thanks in advance. >I had to figure this out once, and I seem to recall deciphering it from the >Volume Control Block's vcbDrvNum field. I believe (but it may ONLY be a belief) >that this was always 1 or 2 for floppies. In any event, if you have to be >absolutely safe, you can walk the Drive Queue and check the flag bytes of the >Drive Queue Element for that drive number; byte 1 will tell you if the volume >is ejectable. See Inside Mac Vol IV pp 176-182 for confusion in greater depth. Erm... I was waiting for an answer to this one, as well, and I don't think this is it. The problem is that at MountVol time, the volume isn't mounted. It's possible to tail-patch MountVol -- AFTER MountVol, at least you have a vRefNum and you can run the VCB's looking for it. Then you can get the handle/pointer to the driver itself and look for its name. "\p.Sony" is a foolproof way of getting an indication you've a floppy on your hands, as long as it's smaller than 20M (the original Apple HD20 used the Sony driver). However, tail-patching is a no-no. If you head-patch MountVol, you get the drive number as a parameter, and you can use the strategy proposed by mandel@vax.anes.tulane.edu once you have the drive number. But I wouldn't guess that it's fool-proof. I wonder what the drive number of the ROM disk in some of the newer model Macs is... -- Pete Gontier, gurgle@well.sf.ca.us Software Imagineer, Kiwi Software, Inc.