views:

75

answers:

2

Hi I am trying to write a java applet that will get some hard ware info, mac address(which I have done), cpuid motherboard serial number and hard drive serial number. I know I need to use jna to do this. My question is, is there a way in c/c++ to get that information that is not platform dependent? Everything i have seen would work only on windows, and I need it to work on all platforms. I need this information so I can create a unique id of that computer. any help or a point in the right direction would be much appreciated.

A: 

My question is, is there a way in c/c++ to get that information that is not platform dependent?

Not possible. Heck, within the same PC market, querying e.g. BIOS version differs from one MB manufacturer/OEM to another. And that if the PC still has BIOS - not the newer EFI.

Sun/SPARCs are notable exception: their H/W has a relatively unique ID, provisioned mainly for inventorial purposes. It is not precisely unique (what brings up another point) as that might infer on privacy and Sun had no choice but to make sure it is not globally unique.

IOW unique identification of the hardware is illegal in many parts of the world, thus no reliable (least portable) method exists to achieve what you want.

I'd say binding to the MAC address should be already good enough. And that information is rather easy to access on pretty much all platforms. As long as your license check would be lenient enough for user to have sufficient time to receive new license key (in case of hardware replacement) there should be few problems.

Dummy00001
what if the user changes their MAC address? Or for some reason the MAC address can't be read? Using just the MAC address can't be reliable. Or am I just off the mark here?
Tony
Most consumer grade NICs do not allow MAC address changing. At least on *NIX MACs can always be accessed (via `ifconfig` or programmatically via `ioctl()`). It is better not to think about advanced users - this is a can of worms once open you can't close. (Think of virtualization: your software is once activated inside a VM and the VM image then cloned.) Or other way around: any protection scheme can be cracked. You can confine only normal users - advanced users would always find a way out. Optimize the protection for normal users, do NOT think about advanced users, they can think on their own
Dummy00001
ah ok, I guess I would be just giving my self an unneeded headache.
Tony
A: 

There's a project called OSHI that aims to do that. It's looking for contributors to write the *nix implementatoin.

dblock