Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!uunet!mcsun!ukc!mucs!liv-cs!phil From: phil@anduin.cs.liverpool.ac.uk (Phil Jimmieson) Newsgroups: comp.sys.mac.programmer Subject: Re: How to tell if a volume is a floppy drive? Message-ID: <1990Aug17.144259.14901@anduin.cs.liverpool.ac.uk> Date: 17 Aug 90 13:42:59 GMT References: <1517@ntmtv.UUCP> Organization: Computer Science, Liverpool University Lines: 32 In article <1517@ntmtv.UUCP>, gauthier@ntmtv.UUCP (Jay Gauthier) writes: > Hi, another simple question that I can't find an answer to in IM. > How can you tell if a vRefNum refers to a floppy disk drive? > Also, how can you tell if it is an AppleShare volume? The general > question is "How can I tell if an 'Eject' is a valid option?" Hmm, the answer is that you have to access the drive queue entry for the drive that holds the volume that you're looking at. IM IV p181 says "four bytes of flags precede each drive queue entry; they're accessible only from assembly language" Bzzzzt - wrong!! Tech note 36 shows you how: FUNCTION DriveFlags(aDQEPtr: DrvQElPtr):LONGINT; VAR flagsPtr : ^LONGINT; {we'll point at drive queue flags with this} BEGIN {subtract 4 from DrvQElPtr, and get the LONGINT there} flagsPtr:=POINTER(ORD4(aDQEPtr) - 4); DriveFlags:=flagsPtr^; END; so now you test to see if (DriveFlags and $80000)<>0 then you *cannot* eject it. In order to be able to use all of this you have to examine all of the entries in the drive queue. I can send you a piece of pascal that does all this if you want it, but you're sure to get other offers!! Phil Jimmieson, *************************************************** Computer Science Dept., * JANET : PHIL@UK.AC.LIV.CS.AND **new address** * Liverpool University, * ARPA : PHIL%and.cs.liv.ac.uk@cunyvm.cuny.edu * PO Box 147 *************************************************** Liverpool L69 3BX "The Wild West, where men were men, women were women, and (UK) 051-794-3689 Roy Rodgers was *years* ahead of his time..."