home *** CD-ROM | disk | FTP | other *** search
- /* DeleteDesktops 1.1, ⌐1992 by Pete Resnick. Freeware. */
-
- #include <Errors.h>
- #include <Files.h>
- #include <Traps.h>
-
- #define _HFSDispatch 0xA260
-
- main()
- {
- OSErr errCode;
- DrvQEl *drvQueue;
- GetVolParmsInfoBuffer infoBuff;
- HParamBlockRec thePB;
- StringPtr desktopFile = "\pDesktop";
-
- if(GetOSTrapAddress(_HFSDispatch) != GetToolTrapAddress(_Unimplemented)) {
- drvQueue = (DrvQEl *)(GetDrvQHdr())->qHead;
- while(drvQueue != nil) {
- thePB.volumeParam.ioVRefNum = drvQueue->dQDrive;
- if(((errCode = PBMountVol((ParmBlkPtr)&thePB)) == noErr) || (errCode == volOnLinErr)) {
- thePB.ioParam.ioCompletion = nil;
- thePB.ioParam.ioNamePtr = nil;
- thePB.ioParam.ioBuffer = (Ptr)&infoBuff;
- thePB.ioParam.ioReqCount = sizeof(infoBuff);
- if(PBHGetVolParmsSync(&thePB) == noErr) {
- if(infoBuff.vMAttrib & (1 << bHasDesktopMgr)) {
- thePB.fileParam.ioNamePtr = desktopFile;
- thePB.fileParam.ioDirID = fsRtDirID;
- PBHDeleteSync(&thePB);
- }
- }
- if(errCode == noErr)
- PBUnmountVol((ParmBlkPtr)&thePB);
- }
- drvQueue = (DrvQEl *)drvQueue->qLink;
- }
- }
- }
-