
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
DISK I/O
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
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)
hardLock=_true
XELSE
hardLock=_false
END IF
bitMask = BIT(15)
'repeat check of ioVAtrb% for softLock here
END IF
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.
|