Get hard disk serial numberTag(s): WinAPI/Registry


[local external function declaration]
FUNCTION long GetVolumeInformation & 
  (string lpRootPathName, REF string lpVolumeNameBuffer, &
   long nVolumeNameSize, & 
   REF long lpVolumeSerialNumber, REF long lpMaximumComponentLength, & 
   REF long lpFileSystemFlags, REF string lpFileSystemNameBuffer, & 
   long nFileSystemNameSize) & 
   LIBRARY "Kernel32.dll" ALIAS FOR "GetVolumeInformationA"
   
[powerscript]
String ls_volbuffer, ls_fsname
Long  ll_serial, ll_MaxCompLength, ll_FileSystemFlags, ll_rtn

ls_volbuffer = Space(255)
ls_fsname = Space(255)
ll_maxCompLength = 0
ll_FileSystemFlags = 0

ll_rtn = GetVolumeinformation("C:\", ls_volbuffer, 255, ll_serial, & 
                 ll_MaxCompLength, ll_FileSystemFlags , ls_fsname, 255)

// ls volbuffer  - volume name
// ll_serial     - hard disk serial number
// ls_fsname     - file system name ex. NTFS



blog comments powered by Disqus