Path: utzoo!utgpu!attcan!uunet!husc6!bloom-beacon!apple!blob From: blob@Apple.COM (Brian Bechtel) Newsgroups: comp.sys.mac.hypercard Subject: Re: Getting information from the desktop Message-ID: <20350@apple.Apple.COM> Date: 10 Nov 88 15:32:17 GMT References: <59820SAS102@PSUVM> <30733@think.UUCP> Organization: Apple Computer Inc, Cupertino, CA Lines: 50 In article <30733@think.UUCP> ephraim@vidar.think.com.UUCP (Ephraim Vishniac) writes: >In article <59820SAS102@PSUVM> SAS102@PSUVM.BITNET (Steven A. Schrader) writes: > >>Does anyone out there know how to get information such as what disk >>is in which drive, etc. > >This information (and lots of other good stuff) is recorded in the >Volume Control Block (VCB). See the volume information calls among >the file manager routines in IM II (old versions) or IM IV (HFS >versions). If you're writing in assembly language, you may find it >easier just to walk the VCB list directly. Apple will frown at you, >of course, since looking directly at low-memory stuff is discouraged. Okay, I'll bite. Yes, Apple discourages you from walking the VCB queue directly. Use the method explained on page IV-129 and IV-130: pass in a paramblock with a positive ioVolIndex. This works, and doesn't break the next time we modify the file system. Sample code follows: . . . (You'll need Files.h at least)... short i; OSErr result; Boolean foundIt; HVolumeParam hParamBlock; result = noErr; foundIt = false; /* loop until we find the volume we're looking for or get the ** "no such volume" error for this particular index */ for (i = 1; result != nsvErr && foundIt == false; i++) { hParamBlock.ioCompletion = 0; hParamBlock.ioNamePtr = nil; hParamBlock.ioVRefNum = 0; hParamBlock.ioVolIndex = i; result = PBHGetVInfo(&hParamBlock,false); if () /* <== fill in your terminating condition */ foundIt = true; } if (result == noErr) /* grab whatever information you were trying to get ** about a specific volume. */ . . .etc. --Brian Bechtel blob@apple.com "My opinions, not Apple's"