home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / HSBASIC2.DMS / in.adf / HB2Examples1.3.Lha / Examples / GetFilesys / GetFilesys.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-14  |  1.5 KB  |  55 lines

  1. ''
  2. '' $Id: GetFilesys.bas,v 1.2 1994/03/16 12:41:49 alex Rel $
  3. ''
  4. '' Example of examining the FileSysRes list
  5. ''
  6. '' Derived from RKM example (c) Copyright 1992 Commodore-Amiga, Inc.
  7. ''
  8.  
  9. DEFINT A-Z
  10.  
  11. 'REM $INCLUDE Exec.bh
  12. 'REM $INCLUDE FileSystem.bc
  13.  
  14. LIBRARY OPEN "exec.library", LIBRARY_MINIMUM&
  15.  
  16. SUB main
  17.     STATIC FileSysResBase&, fse&, x
  18.  
  19.     ' NOTE - you should actually be in a Forbid while accessing any
  20.     ' system list for which no other method of arbitration is available.
  21.     ' However, for this example we will be printing the information
  22.     ' (which would break a Forbid anyway) so we won't Forbid.
  23.     ' In real life, you should Forbid, copy the information you need,
  24.     ' Permit, then print the info.
  25.  
  26.     FileSysResBase& = OpenResource&(SADD("FileSystem.resource" + CHR$(0)))
  27.     IF FileSysResBase& = NULL& THEN
  28.         PRINT "Cannot open FileSystem.resource"
  29.     ELSE
  30.         fse& = PEEKL(PEEKL(FileSysResBase& + fsr_FileSysEntries) + lh_Head)
  31.         IF fse& <> NULL& THEN
  32.             DO
  33.                 IF PEEKL(fse& + fse_Node + ln_Name) <> NULL&
  34.                     PRINT "Found filesystem creator: "; PEEK$(PEEKL(fse& + fse_Node + ln_Name))
  35.                 END IF
  36.                 PRINT "                 DosType: ";
  37.                 FOR x = 0 TO 2
  38.                     PRINT CHR$(PEEKB(fse& + fse_DosType + x));
  39.                 NEXT x
  40.                 PRINT CHR$(PEEKB(fse& + fse_DosType + 3) + &h30);
  41.                 PRINT
  42.                 PRINT "                 Version: ";
  43.                 PRINT PEEKW(fse& + fse_Version); "."; PEEKW(fse& + fse_Version + 2); 
  44.                 PRINT
  45.                 PRINT
  46.                 
  47.                 fse& = PEEKL(fse& + fse_Node + ln_Succ)
  48.             LOOP WHILE PEEKL(fse& + fse_Node + ln_Succ)
  49.         END IF
  50.     END IF
  51. END SUB
  52.  
  53. main
  54. END
  55.