Okay so I have figured out a simple solution but the problem is it might not always work; so I want to combine it with something else to make sure my applications only run on the computer that ran the application first. Basically I retrieved the host name of the computer and stored it to the application settings, then at runtime it compares the host name to the one stored in the settings page.

using System.Net.NetworkInformation;

public string GetHost()
{
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
return computerProperties.HostName;
}

private Properties.Settings s = new Properties.Settings();

private void Form1_Load(object sender, EventArgs e)
{
if (s.FirstRun == true)
{
s.FirstRun = false;
s.Host = GetHost();
s.Save();
}

else if (!s.FirstRun && s.Host != GetHost())
Application.Exit();
}

So are there any more complex ways of ensuring that the application only runs on the first computer it runs on, preventing it from being passed to other computers?

Edited 5 Years Ago by lxXTaCoXxl: n/a

You would probably have better luck with something else...Try getting the MAC address of the network card, that's supposed to be unique.

Well I tried grabbing the MAC address but it always returns 00000000000E0 (didn't count the zeros). So I'm looking for something a little more dynamic, although I will google the network card method to see if it was what I was doing.

There is no ONE absolute way to identify a computer using the hardware, as far as I know, it could change if the user decides to upgrade or whatever.

I would try to find a registry value, maybe the windows installation ID?

Alternatively, you can try using more than one piece of information to identify unique machines.

There is no ONE absolute way to identify a computer using the hardware, as far as I know, it could change if the user decides to upgrade or whatever.

I would try to find a registry value, maybe the windows installation ID?

Alternatively, you can try using more than one piece of information to identify unique machines.

Using the Windows installation ID is a good point, I may adopt that in my future programs ;)

Personally I use a combination of the HDD serial number (from the controller firmware) and the primary network card's MAC address. MAGICâ„¢ is applied and I get a single key from both unique numbers. This has worked very well for us and is a rather cost effective anti-piracy method.

It is not bullet proof. Any competent enough programmer will be able to break the code and get it working. You will not find a 100% guaranteed solution. All you can do is increase the level of deterrent to "Not worth the effort" and hope it's enough. We have found there are more honest people than dishonest people and the dishonest people we find, are punished with the law.

EDIT: Obviously as Charlie said, they upgrade, they lose their installation. You would need to work around that. We simply change the installation ID in our database and the software now works on the new machine and not the old one.

Edited 5 Years Ago by Ketsuekiame: n/a

If you solve this problem - you will be a rich man. Just look at licensing for games. There has yet to be one method of this type of security that hasn't been broken. (Although online validation seems to be pretty solid)

The MAC you grabbed is probably the first one (index 0). For some reason every computer has a mac of all 0's in the first index. Try taking the second one (index 1). The problem with doing things like this is that if the hardware is changed the program no longer works.

Edited 5 Years Ago by skatamatic: n/a

This article has been dead for over six months. Start a new discussion instead.