Technical Q&ANW 09 - Determining if a Volume is a Network Volume (Updated 01-June-98)Q How can I reliably determine if a volume is mounted over the network ? A The best way to determine whether a volume is mounted over the network is to compare the vMServerAdr field of the
GetVolParmsInfoBuffer (returned by PBHGetVolParms ) to zero. This field is zero on local
volumes and non-zero on network volumes. This technique is illustrated by the isNetworkVolume routine defined in
the DTS sample code MoreFiles.
The If you merely wish to determine whether a volume is an AppleShare volume, you can do so by comparing the volume's controlling driver reference number to the driver reference number of the ".AFPTranslator" driver. The following code iterates the volume list, printing all the volumes that are controlled by AFP: static void PrintAFPVolumes() { OSErr err; HVolumeParam volPB; Str255 volName; DriverRefNum afpRefNum; SInt16 index; err = OpenDriver("\p.AFPTranslator", &afpRefNum); if (err == noErr) { index = 1; do { volName[0] = 0; volPB.ioNamePtr = volName; volPB.ioVRefNum = 0; volPB.ioVolIndex = index; err = PBHGetVInfoSync((HParmBlkPtr) &volPB); if (err == noErr) { if (volPB.ioVDrvInfo != 0 && volPB.ioVDRefNum == afpRefNum) { printf("%#s\n", volName); } } index += 1; } while (err == noErr); } } -- Quinn "The Eskimo!" -- Revised by Quinn "The Eskimo!" Worldwide Developer Technical Support Technical Q&A Previous Question | Contents | Next Question |