views:

209

answers:

5

Hi,

I have a program that is using a configuration file.

I would like to tie the configuration file to the PC, so copying the file on another PC with the same configuration won't work.

I know that Windows Activation Mecanism is monitoring hardware to detect changes and that it can tolerates some minor changes to the hardware.

Is there any library that can help me doing that?

My other option is to use WMI to get Hardware configuration and to program my own tolerance mecanism.

Thanks a lot,

Nicolas

+2  A: 

If you wish to restrict the use of data to a particular PC you'll have to implement this yourself, or find a third-party solution that can do this. There are no general Windows API's that offer this functionality.

Andrew Grant
+4  A: 

Microsoft Software Licensing and Protection Services has functionality to bind a license to hardware. It might be worth looking into. Here's a blog posting that might be of interest to you as well.

Eclipse
+1  A: 

You'll need to define what you currently call a "machine."

If I replace the CPU, memory, and hard drive, is it still the same computer? Network adaptor, video card?

What defines a machine?

There are many, many licensing libraries out there to do this for you, but almost all are for pay (because, ostensibly, you'd only ever want to protect commercial software this way). Check out what RSA, Verisign, and even microsoft have to offer. The windows API does not expose this, ostensibly to prevent hacking.

Alternately, do it yourself. It's not hard to do, the difficult part is defining what you believe a machine to be.

If you decide to track 5 things (HD, Network card, Video card, motherboard, memory sticks) and you allow 3 changes before requiring a new license, then users can duplicate the hard drive, take out two of the above, put them in a new machine, replace them with new parts in the old machine and run your program on the two separate PCs.

So it does require some thought.

Adam Davis
Once I was evaluating software that depended on IP address, among other things, and stopped working suddenly. Since our sysadmin hadn't announced the IP changes (figuring, mostly correctly, we didn't know or care), and the vendor hadn't told me what the keys were based on, it took some digging.
David Thornley
A: 

If the machine has a network card you could always check its mac address. This is supposed to be unique and checking it as part of the program's startup routine should guarantee that it only works in one machine at a time... even if you remove the network card and put it another machine it will then only work in that machine. This will prevent network card upgrades though.

jheriko
MAC addresses unfortunately are quite often user modifiable. Not easily user modifiable, but modifiable nevertheless.
Blank Xavier
A: 

Maybe you could just keep something in the registry? Like the last modification timestamp for this file - if there's no entry in the registry or the timestamps do not match then fall back to defaults - would that work? (there's more then one way to skin a cat ;) )

RnR