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

Made with FB

DISK I/O

Check for hard and soft locked volumes


CLEAR LOCAL
LOCAL FN isVolLocked%(theWDrefNum%)
  DIM isLocked%, volPath$, count%, pathSize%, theChar$
  DIM pbBlk.128, 63 vName$, srcVName$, osErr%
  DIM hardLock%, softLock%, message$

  volPath$  = FN convertWDRef$("",theWDrefNum%)
  pathSize% = LEN(volPath$)
  FOR count% = 1 TO pathSize%
    theChar$ = MID$(volPath$, count%, 1)
    LONG IF theChar$ <> ":"
      srcVName$ = srcVName$ + theChar$
    XELSE
      count% = pathSize%
    END IF
  NEXT count%

  pbBlk.ioCompletion&   = 0                       'no iocompletion
  pbBlk.ioNamePtr&      = @srcVName$              'pointer to volume name
  pbBlk.ioVRefNum%      = theWDrefNum%            'vol ref num
  pbBlk.ioVolIndex%     = 0                       'no volume index

  osErr% = FN HGETVINFO (@pbBlk)                  'get original volume info
  LONG IF osErr% = _noErr
    hardLock% = pbBlk.ioVAtrb% AND _hardLockFlag
    softLock% = pbBlk.ioVAtrb% AND _softLockFlag
    LONG IF (hardLock% <> 0) OR (softLock% <> 0)
      isLocked% = _true
    XELSE
      isLocked% = _false
    END IF
  END IF

END FN = isLocked%
Michael Evans