home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CHIP_CD_2004-07.iso / software / nncron_hit / files / nncron189.exe / plugins / system.spf < prev    next >
Text File  |  2003-10-15  |  2KB  |  56 lines

  1. \ File:         system.spf
  2. \ Author:       Nicholas Nemtsev
  3. \ Date:         09.11.2002
  4. \ Modified:     01.10.2003 (GetVolID is added)
  5. \ Modified:     15.10.2003 (GET-VOL-ID is added)
  6. \ Description:  Useful words for system purpose
  7.  
  8. WINAPI: GlobalMemoryStatus KERNEL32.DLL
  9.  
  10. : MemStat ( # -- ) 
  11.     CREATE C,
  12.     DOES> C@ CELLS
  13.     32 ALLOCATE THROW >R 32 R@ !
  14.     R@ GlobalMemoryStatus DROP R@ + @ 
  15.     R> FREE DROP ;
  16.  
  17. 1 MemStat MemLoad           \ in percentage
  18. 2 MemStat TotalPhys
  19. 3 MemStat AvailPhys
  20. 4 MemStat TotalPageFile 
  21. 5 MemStat AvailPageFile 
  22. 6 MemStat TotalVirt
  23. 7 MemStat AvailVirt
  24.  
  25. WINAPI: GetVolumeInformationA kernel32.dll
  26.  
  27. \ BOOL GetVolumeInformation(
  28. \   LPCTSTR lpRootPathName,           // root directory
  29. \   LPTSTR lpVolumeNameBuffer,        // volume name buffer
  30. \   DWORD nVolumeNameSize,            // length of name buffer
  31. \   LPDWORD lpVolumeSerialNumber,     // volume serial number
  32. \   LPDWORD lpMaximumComponentLength, // maximum file name length
  33. \   LPDWORD lpFileSystemFlags,        // file system options
  34. \   LPTSTR lpFileSystemNameBuffer,    // file system name buffer
  35. \   DWORD nFileSystemNameSize         // length of file system name buffer
  36. \ );
  37.  
  38. : GetVolID { letter \ name serial maxlen flags -- serial_number }
  39.     letter 0xFF AND 0x005C3A00 OR TO name
  40.     0 0
  41.     AT flags
  42.     AT maxlen
  43.     AT serial
  44.     0 0
  45.     AT name 
  46.     GetVolumeInformationA
  47.     IF serial ELSE 0 THEN
  48. ;
  49.  
  50. : GET-VOL-ID ( letter -- a u)
  51.     BASE @ >R HEX 
  52.     GetVolID 0 <# #S #> 
  53.     EVAL-SUBST
  54.     R> BASE !
  55. ;
  56.