Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Such a thing is Hardware Ser_No?
Message
 
To
05/09/2014 02:43:39
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 7
Network:
Windows NT
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01607065
Message ID:
01607072
Views:
62
>>In an effort to implement some sort of copy protection, I am currently registering the Computer Name
>>(using SYS(0) or GETENV() functions).. But that's kind of rudimentary. It can easily be changed.
>>
>>Is there a better way in VFP to retrieve some sort of Hardware or Windows Serial number?
>>I will even settle for Network WorkGroup, or anything else that's unique for a given computer.
>>
>>Thanks.
>
>
>Here is some code which I got from someone here on the UT which gets the hard disk serial number (the 3rd array item has the serial number):
>
>
>CLEAR
>?
>
>PUBLIC TARRAY
>DECLARE TARRAY(10)
>
>TARRAY = ""
>
>=GETVOLINFO( "c:\", @TARRAY )
>
>FOR I = 1 TO ALEN( TARRAY )
>  ? TARRAY(I)
>NEXT
>
>
>
>Function GetVolInfo
>
>Lparameters lcRoot, taInfo && Root of drive ie: "c:\", InfoArray passed by ref
>
>Declare SHORT GetVolumeInformation IN Win32API;
>  STRING @lpRootPathName, STRING @lpVolumeNameBuffer,;
>  INTEGER nVolumeNameSize, integer @lpVolumeSerialNumber,;
>  INTEGER @lpMaximumComponentLength, INTEGER @lpFileSystemFlags,;
>  STRING @lpFileSystemNameBuffer, INTEGER nFileSystemNameSize
>
>Store 0 TO lncomplen, lnsysflags, lnserialno
>Store SPACE(260) TO lcvolname, lcsysname
>Store LEN(lcvolname) TO lnvolsize, lnnamesize
>
>If (GetVolumeInformation(@lcRoot, @lcvolname,;
>    lnvolsize, @lnserialno, @lncomplen, @lnsysflags,;
>    @lcsysname, lnnamesize) # 0)
>
>  Dimension taInfo[3]
>
>  taInfo[1] = substr(lcvolname, 1, at(chr(0),lcvolname)-1) && Volume name
>  taInfo[2] = substr(lcsysname, 1, at(chr(0),lcsysname)-1) && Par.type
>  taInfo[3] = trans(right(trans(iif(lnSerialNo < 0, 0x7FFFFFFF-abs(lnSerialNo)+0x7FFFFFFF, lnSerialNo),'@0'),8) ) && Serial  
>
>Else
>
>  taInfo = ""
>
>Endif
>
>Return
>
The volume serial number can be changed easily right within windows. Better to get the physical serial number of the harddisk instead.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform