Hi,
Well i want to make a protection for my program that it can't be easily copied on other machines.. So far i have come up with getting some Uniques ID's from the machine where the program could run, such as:
1. Getting the MAC address,
2. Getting the Processor ID,
3. Getting the Hard Drive ID and
4. Getting the BIOS Serial number..
Now:
1. By little researching i have seen that having the mac address to identify a PC is a bad idea, mostly because it is easy changed.. So it is out..
2. Next, Processor ID i see as a good idea (by me), and here is the code i use to get it:
string sProcessorID = "";
string sQuery = "SELECT ProcessorId FROM Win32_Processor";
ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);
ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)
{
sProcessorID = (string)oManagementObject["ProcessorId"];
}
return (sProcessorID);string sProcessorID = "";
string sQuery = "SELECT ProcessorId FROM Win32_Processor";
ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);
ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)
{
sProcessorID = (string)oManagementObject["ProcessorId"];
}
return (sProcessorID);
And so far as i have tested on two machines, it works just fine.. But the problem for this is that i read that not all motherboards will have the serial number populated in the property, and if that does occurs than does someone knows what does it actually returns? (like a string of "Null" or something similar?)
3. Getting the hard drive id is also a good thing, i found a code and here is how the code is:
ststring drive = "C";
ManagementObject dsk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + drive + @":""");
dsk.Get();
string volumeSerial = dsk["VolumeSerialNumber"].ToString();
But the problem here would be, 'does this value is the same after the pc has been formated', and 'is it probably some hard drive not to have its unique id'?
4. Well i don't know if this is actually a good idea, cause when i wanted to read on my PC the Bios ID it says "To Be Filled By O.E.M."...
So here is my idea for protecting my program:
First to read the ProcessorID and HardDriveID (as those two only seems reliable) and write then in my database. Then every time when the programs starts, on load it checks if the string in the database is the same as the current information taken from the current machine.. But for this to make i first have to know what string would it return if there is nothing written as a Processor ID or HardDriveID (like is it '000000' or 'unknown' or something else)...
Or is there even better way to protect my software that i haven't found so far..
I hope i get an answer,
Thank you in forward...