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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Workstation Hardware Unique Identifiers 2

Status
Not open for further replies.

jbs

Programmer
Feb 19, 2000
121
US
I'd like to write some code that will protect a software product that I'm writing. The code will obtain unique hardware values and use these numbers to create a key code. I've heard and seen this done on expensive COTS packages....it's used to make sure that the software that is sold is ONLY used on a single workstation (based upon the hardware values).

I want to insert similar functionality into my code. I know how to obtain the unique MAC address for a network interface card; however if the customer doesn't have a NIC then I really do need other unique information. Does anyone know what other hardware unique identifiers there are on typical x86 workstations and how to access them via C++? I suspect Motherboards, modems, and CPU's have unique serial numbers that can be accessed but I can't find any documentation that will show me what unique serial numbers exist on a workstation and how to access them?

BTW, yes, I know when a piece of hardware fails the software will have to be re-registered; this will be ok.

Articles via online publications that describe this type of method of protecting software would also be appreciated. I'm searching....but not really finding anything.

thanks,

Jerry
 
Yea, funny thing you mention this...Microsofts Windows XP will have this functionality in it...unfortunately...so hey, if a piece of hardware fails, you have to call microsoft up get a new reg key, enter it, fix the problem, get a new key, etc...What is this going to do to the troubleshooting process?!...we might as well just hand everything off to microsoft for anything and everything we do...anyways,

Look for pentium identifiers, that might get you started in the right direction...and also, why not get the CPU pin?...I know these things display in DOS when you boot your computer up...it shouldn't be too hard...I will find some documentation for you tonight... ----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute kitten? ;-)
 
thanks for the help. I hope Microsoft changes the direction that they are going in.....but kinda doubt they will. On my systems I'm always swapping out something so I hope they are not keying off of every single serial number on every single circuit board. That will send everyone to Linux real fast.

Using hardware identifiers to product individual, expensive, COTS products is one thing....but making the entire operating system sensitive to these issues is another. Fixing hardware bugs and upgrading systems is going to be a pain. They seem to be taking out the 'plug-n-play' capability that the worked so hard to put in (i.e. ability to plug in a new card or replace a card and move on with life).

Anyway, yes obtainin pentium info, chipset serial #'s (if they exist) and even the o/s serial/license number will all be helpful.

Thanks for the help.

/jerry
 
They're taking out PNP?!...yikes.

Also, I found a REALLY simple solution to your problem...the REGESTRY...windows stores various information on what hardware a user has (harddrives, etc), you might be able to just search around your regestry and find those keys and play with that a little... ----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute kitten? ;-)
 
ooops. let me rework my last entry.

The effect of having to 're-key' the license with microsoft after each change in hardware will have the effect of killing the advantages that PnP gave the end user.

When PnP came along it suddenly became real easy to install a new hardware component or replace a bad NIC. With what you said XP is going to do, the end user will no longer be able to just remove the old NIC and replace the new NIC. Now with XP they will also need to get a new 'key' for the operating system because the operating system was using unique identifiers like the MAC on the NIC.

It will be interesting, and possible a big pain, to see how microsoft does o/s licenses in the future.

By-the-way, I'm still a bit of a beginner. I know how to manually review the registry (I'll do it right after i write this email, however once I find a registry entry that I want to import....how do I do it?

For example (I just looked at the registry), let say in my program I want to obtain/grab/get the values of the following two keys that are named below and have the following path:

Path:
HKEY_LOCAL_MACHINE/Hardware/Description/System/CentralProcessor/0

Registry Values:

Identifier = "x86 Family 6 Mode 8"
Vendor Identifier = "GenuineIntel"

Clearly what I want to do is get the values and place them into a string in my program. How do I access a registry value?

....also, I've been scanning the registry and can't find any specifics on hardware such as motherboard ID, chipset ID, or any other hardware specific entries. I'll keep looking. Also am going to grab a motherboard manual online from someone like ASUS and see if there is a typical memory location for this info. Any thoughts?

thanks,

Jerry
 
For accessing the registry some basic comands are
API functions RegOpenKEy, RegQueryKey, RegCloseKey all from advapi.dll

But I would count on that because you may install your software and use it on NT machines where not all keys can be accessed by a common user.

I advice you to use the Assembler command
cpuid (inside C with the __asm commands).

You will get the same results, but from the source... :)
I had an example with that but is not very complicated, I think you have to put 0 or 1 in AX and the results will be in BX:DX, but I am not very sure.

Hope this helps,


s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
BurtanI,

Using the assembler 'cpuid' command makes sense to me. I've done some research and your suggestion makes a lot sense. Only problem is that I've never had to use assembly language inside of a 'C' program before....not sure how to issue the commands and get the data back as strings.

FYI, my first assembly language was on an IBM 1401 mainframe (..ok I'm giving away my age here...). Since that time I've learned and worked with more assembly languages than I can recall or count, and then of course moved on to higher level languages. So far I haven't really needed to write any x86 assembler until now.

Of course one of the great things about programming is that there is always something else to learn and experiement with...

Anyway, I've checked out Amazon.com for some assembly language books and am heading for Intel.com to see what they have; however anything you can provide would be greatly helpful (example code,etc.)

thanks,

/jerry
 
Example: This code you should put in a VC++ console aplication. (To me it returns GenuineIntel)

// GetProcessor.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <windows.h>

int main(int argc, char* argv[])
{
union ProcInfo
{
DWORD dw;
char ch[5];
};

ProcInfo piBX,piCX,piDX;
__asm
{
mov eax,0L
mov ebx,0L
cpuid
mov piBX.dw,ebx
mov piCX.dw,ecx
mov piDX.dw,edx
}
piBX.ch[4]=piCX.ch[4]=piDX.ch[4]='\0';
printf(piBX.ch);
printf(piDX.ch);
printf(piCX.ch);

return 0;
}
s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top