FB II Compiler
Detect if an application is running on a locked volume
I'm attempting to use the following code (from Joe Lertola) to detect if my app is being run on a locked volume.
'setup of pbBlk not included in the email
The ioVolIndex% parameter isn't supposed to represent a volume ref number nor a working directory ref. number. Rather, it's an index number ranging from 1 to the total count of how many volume's you've got mounted. Its purpose is to allow you to "index" through all the mounted volumes one at a time (by setting ioVolIndex first to 1 and then incrementing it for each call to HGETVINFO) in cases where you don't necessarily have any other way to ID the volume you want. But if you _do_ have a reference number, then you stick it into ioVRefNum, and set ioVolIndex to 0.
pbBlk.ioVolIndex% = 0
pbBlk.ioVRefNum% = SYSTEM(_aplVol)
OSErr = FN HGETVINFO(@pbBlk)
LONG IF OSErr = _noErr
'is disk hardware locked?
bitMask = BIT(7)
LONG IF (pbBlk.ioVAtrb% AND bitMask)
bitMask = BIT(15)
'repeat check of ioVAtrb% for softLock here