Link to home
Start Free TrialLog in
Avatar of dbnewbie
dbnewbie

asked on

Unique Computer ID

Is there a way to obtain an ID unique to a particular computer that cannot be mimic or duplicated by another computer? I have a DLL I want to deploy and want to make sure it stays on the computer that I authorize it to be. I intend to hardcode this in my DLL. I suppose the logic to be:

If Unique_ID = "123" Then
   ' Execute functions
   ...
   ...
Else
   ' Do NOT execute functions
   Exit Function
End If
Avatar of rdrunner
rdrunner

Try this website...

www.activelock.com

It has some sourcecode you can use... hth
dbnewbie,
    Just check the serial number of the hard drive

http://www.andreavb.com/tip030015.html

Dang123

Avatar of dbnewbie

ASKER

Dang123, your link seems simple enough. Steve, do you have a quick and dirty implementation on getting CPU ID in VB? The links you provided seems to require some actual thought -- I just want something fast.

Security isn't really a big issue, I'm just trying to play around with this concept.
if these are networked computers you could also use the MAC address of the network card. Thats unique
g_land,

Not every computer will have a MAC address. All will have a CPU, and 99.99% should have a hard drive. In any case, how do you obtain the MAC address via VB?
MAC addresses:

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=12361&lngWId=1

Note that I had trouble getting this code to detect physical network connections on Windows XP, but it words beautifully on Windows 98.  (Non-ethernet connections, such as COM or LPT connections, and Internet connections, were detected under XP.)

For a registration program similar to what you want, try this:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=48926&lngWId=1
Hello,

Network Adapter Address is unique for each and every computer

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q175/4/72.asp&NoWebContent=1

All the best,
V.Thandava Krishna.
Sort of, itsvtk.  You don't want to use the MAC address to generate registration codes, though, because if your computer does not have a physical network card (mine, for example) then the MAC address is generated randomly by Windows AFTER EACH REBOOT.  So the only way to maintain a consistent MAC address without a physical network adapter is to keep your computer on forever.

Hard disk and CPU serials are much better suited for this purpose, as every computer is guaranteed to have these, and the numbers are guaranteed to not change unless a new disk or CPU is installed.
So, is there an easy way of getting CPU ID in VB?
The link that I gave you:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=48926&lngWId=1

Says that it makes software keys from the CPU serial.  Try downloading it and looking for the part of the code that does that.
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ark,

Your code won't work on other versions of Windows except 2000/XP?

crazycomputers,

I'll look at the link you gave me again. What I really wanted is something very simple. The link you provided looked a lot more complex than what I had hoped for.
The link I provided you with is also Win2k (or at least WMI) dependant, it seems.  After seeing all this information, it seems that it is not possible to get the CPU serial number from VB without WMI.  Just a guess.  But VB isn't tailored for hardware tasks, it's more of a database frontend tool.

As usual, I could be very wrong.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As crazycomputers mentioned, HARDWARE\CONFIGURATION registry key presents only on NT based OS, so you can not get ProcessorID directly from VB on w9x machines. Theer are a lot of asm code over the net to perform this operation, as well as ready-to-use dlls (including native Intel dll) which perform this task.
As for drive's serial - please, don't mix  VOLUME serial, which is SOFT_CODED and changing after every format operation and CAN BE chaged manually (with any disk editor and even from VB using direct drive access). My second link to freevbcode return HDD serial, which is HARD_CODED by vendor and can not be changed. I used S.M.A.R.T. for this, so code is too complex.
Ah, my apologies.  I know the difference between a partition serial number and a disk serial number, I was just unaware that the VB code returned the former.