fitzgerd@psu-cs.UUCP (Don Fitzgerald) (02/24/89)
Is there a straight forward way in Pascal to determine if a given volume is ejectable? I took a look in IM I-V and found several sections that had something to say about volumes and drives but nothing quite so simple as to tell me that I can or cannot eject this volume. I did try a section in the Disk Driver called Status and upon using it I get a StatusErr which doesn't make me very happy. Since I am using it as recommended in IM V (CsCode 23) to find out about the drive. According to IM V drives are connected dynamically at startup and I really don't want to go around ejecting Hard-Drives. I tested using an Eject on my HardDrive and there was no Error sent. What happens when you do Eject the HardDrive volume? Mine(HD20) seems to work fine after the call. To Delete or Compile That is the Question, Don
siegel@endor.harvard.edu (Rich Siegel) (02/24/89)
There's no "straightforward" way to do it, but these procedures should help somewhat. Function GetDrivInfo (vRefNum: Integer): SignedByte; Var DriveNum: Integer; DiskInfo: ^SignedByte; DriveQ: QHdrPtr; DriveElem: ^DrvQEl; wpb: WDPBRec; hpb: HParamBlockRec; err: OSErr; Begin With wpb Do Begin ioNamePtr := Nil; ioWDIndex := 0; ioVRefNum := vRefNum; ioWDProcID := LongInt('ERIK'); End; err := PBGetWDInfo(@wpb, False); With hpb Do Begin ioNamePtr := Nil; ioVRefNum := wpb.ioWDVRefNum; ioVolIndex := 0; End; err := PBHGetVInfo(@hpb, False); DriveQ := GetDrvQHdr; DriveElem := Pointer(DriveQ^.qHead); While (DriveElem^.dQDrive <> hpb.ioVDrvInfo) Do Begin If Pointer(DriveElem) = (DriveQ^.qTail) Then Leave; DriveElem := Pointer(DriveElem^.qLink); End; DiskInfo := Pointer(Ord4(@DriveElem^.qLink) - 3); GetDriveInfo := DiskInfo^; End; Function Ejectable (vRefNum: Integer): Boolean; Var DiskInfo: SignedByte; Begin DiskInfo := GetDriveInfo(vRefNum); Ejectable := (DiskInfo <> 8); End; Rich Siegel Staff Software Developer THINK Technologies Division, Symantec Corp. Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel Phone: (617) 275-4800 x305