Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: How to tell if a volume is a floppy drive? Message-ID: <9794@goofy.Apple.COM> Date: 16 Aug 90 16:37:29 GMT References: <1517@ntmtv.UUCP> Organization: Apple Computer Inc., Cupertino, CA Lines: 44 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? Call PBHGetVInfo() (note the "H") with the vRefNum. If the ioVDRefNum field is equal to -5 (the floppy disk driver's refNum), then it's a floppy disk. >Also, how can you tell if it is an AppleShare volume? Check the ioVFSID field after doing the PBHGetVInfo() call. HFS (Mac) disks have an ID of zero. Others are non-zero, but I can't remember what ID AppleShare volumes use. >"How can I tell if an 'Eject' is a valid option?" In this case, I think you'll have to walk the drive queue. With the driver's refNum from above, plus the drive number (in the ioVDrvInfo field), walk the drive queue until you find that drive's entry. The 4 bytes BEFORE the queue entry tell you a bit about the state of the disk: -4 writeProtect bit 7=1: write protected, bit 7=0: write enabled -3 diskInPlace $48=unejectable but notify driver of eject anyway 8=unejectable (no notification) 1-2=disk in drive 0=no disk in drive <0=disk was just ejected -2 installed 1=drive installed, 0=no drive installed -1 sides bit 7=1: 2-sided disk, bit 7=0: 1-sided disk For what you want to do, just check to see if the diskInPlace byte is less than 8... steve -- ____________________________________________________________________ Steve Christensen Internet: stevec@goofy.apple.com Apple Computer, Inc. AppleLink: STEVEC 20525 Mariani Ave, MS 81-CS CompuServe: 76174,1712 Cupertino, CA 95014 "You just contradicted me." "No I didn't." ____________________________________________________________________