Jump to Real's How-to Main page

Get hard disk serial number

[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



If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]