Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Key

Status
Not open for further replies.

dardapu

Programmer
Sep 10, 2002
67
0
0
To carry out an installation key I would like to know if there is some form of as reading the I number internal of a hard disk.
Thank you
 
FUNCTION ReadSerial()
** This function will retrive the HDD serial number! and return it back to the calling function

LOCAL lpRootPathName, ;
lpVolumeNameBuffer, ;
nVolumeNameSize, ;
lpVolumeSerialNumber, ;
lpMaximumComponentLength, ;
lpFileSystemFlags, ;
lpFileSystemNameBuffer, ;
nFileSystemNameSize

lpRootPathName = LTRIM(SYS(5))+"\" && Drive and directory path (e.g. C:\)
lpVolumeNameBuffer = SPACE(256) && lpVolumeName return buffer
nVolumeNameSize = 256 && Size of/lpVolumeNameBuffer
lpVolumeSerialNumber = 0 && lpVolumeSerialNumber buffer
lpMaximumComponentLength = 256
lpFileSystemFlags = 0
lpFileSystemNameBuffer = SPACE(256)
nFileSystemNameSize = 256

DECLARE INTEGER GetVolumeInformation IN Win32API AS GetVolInfo ;
STRING @lpRootPathName, ;
STRING @lpVolumeNameBuffer, ;
INTEGER nVolumeNameSize, ;
INTEGER @lpVolumeSerialNumber, ;
INTEGER @lpMaximumComponentLength, ;
INTEGER @lpFileSystemFlags, ;
STRING @lpFileSystemNameBuffer, ;
INTEGER nFileSystemNameSize

RetVal=GetVolInfo(@lpRootPathName, @lpVolumeNameBuffer, ;
nVolumeNameSize, @lpVolumeSerialNumber, ;
@lpMaximumComponentLength, @lpFileSystemFlags, ;
@lpFileSystemNameBuffer, nFileSystemNameSize)
cSerial = TRANSFORM(lpVolumeSerialNumber,'@0x')
RETURN (SUBSTR(cSerial,3,4)+'-'+subSTR(cSerial,7,4))

&& Returns it in Hex. If you want, just return lpVolumeSerialNumber (will return in numerical format)


Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top