Post by bigMikeYour last wasn't sent to me but I like to put my two cents in now and then
:-)
Those items are pretty good ways to track a computer being used but
personally I love to hide one or more files at various locations (registry
or other non-obvious locations) and check for their existence before
allowing a program to be run. Then your adding memory or making other
changes won't matter unless a hard drive is replaced. In that case a new
install could be mandated on the new hard drive and then allow a copying
of the files from the previous hard drive. The new install would place
all the hidden files where they belong and they would have all their data
from their previous install.
bigMike
Your 2 cents are always welcome especially in this economy. LOL
I just don't care for this method as just cloning a hard drive would allow
the program to be used on multiple machines. I've had this happen to me and
done it for other software.
But if you use the hard drive manufacturer's hardware serial number, you can
achieve this without depending on just hiding a file and it will only change
if the hard drive itself is changed since its unique to each hard drive.
Store the number in your hidden file or registry.
Try the below function instead (watch for word wrap).
if NOT getFirstPhysicalDriveSerial() == storedNumber // hard drive has
changed.
Rich...
************************************************************************
function getFirstPhysicalDriveSerial
************************************************************************
//local objLocator,objWMI,oItems,cNum
/* Rich - www.autotraker.com
returns the manufacturers serial number from the first physical disk (HD)
This should always be unique for every hard drive. We are only getting
the
serial number for the first physical disk so we can build our unique ID
with it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/Win32_PhysicalMedia.asp
Example of output: WD-WMAHL1136753
*/
objLocator = new OleAutoClient("WbemScripting.SWbemLocator")
objWMI=objLocator.ConnectServer(".", "root\cimv2")
objWMI.Security_.ImpersonationLevel=3 // Impersonate
oItems = objWMI.ExecQuery( [select * from Win32_PhysicalMedia where
Tag="\\\\.\\PHYSICALDRIVE0"])
cNum = iif(type("oItems[0].SerialNumber")=="C" and oItems.count => 0,new
string(""+oItems[0].SerialNumber).leftTrim().rightTrim(),"0")
// on some machines (Win 2003?) we may not be returning a hardware serial
number so use the drives signature
if empty(cNum) or cNum = "0"
oItems = objWMI.ExecQuery( [select * from Win32_DiskDrive where
Name="\\\\.\\PHYSICALDRIVE0"])
nNum = iif(type("oItems[0].Signature")=="N" and oItems.count =>
0,oItems[0].Signature,0)
cNum = new string(""+ABS(nNum))
endif
release object objWMI
release object objLocator
// make sure we don't have a NULL serial number
return iif(isBlank(cNum),"0",cNum)