Win32_Processor::Is Processorid Unique for All Computers

WIN32_Processor::Is ProcessorId Unique for all computers

No, it can't be guaranteed that it will be unique, as the processor might not even support the CPUID instruction, in which case, the call can't be guaranteed to succeed.

Also, you are neglecting that a machine might have multiple processors in it, so getting the id of a single processor doesn't help.


As others have indicated, if you want to get a unique id for the system, your best bet is to create an id which is an amalgam of various component ids on the system.

A hash (and not just any, but one that has very few collisions) of various values of the hardware could suffice. You'd probably want to use things that are fairly embedded in the system, such as the processor, motherboard info, but not things easily detached/changed, such as USB drives/hubs/etc.

what is totally unique in each Computer

From what I can tell, there is nothing that could not be faked by someone with access to the hardware.

  • The MAC address of a NIC can be changed relatively easily in software on a typical OS if you have admin rights.

  • The ProcessorId (as reported by "wmic") is harder because it comes from the BIOS and the OS treats this as a read-only property; see How to change the ProcessorId.

    However:

    • it may be possible to change the ID via the BIOS itself,
    • the user could potentially replace the BIOS,
    • the user could potentially update the private memory location (?) that the BIOS is reading the ProcessorId value from.
    • if your code used "wmic" to retrieve the ProcessorId, it would be feasible to replace it with a version that returned a fake id
    • etcetera

    See also: WIN32_Processor::Is ProcessorId Unique for all computers

Even assuming that you could stop users from faking the ids, if they can spin a virtual machine, they can almost certainly fake the ids in the virtual.

This means that any scheme that you develop that depends on having a unique, unfakeable (uncloneable) identifier for a stock-standard Windows system is fundamentally flawed. If you really need unfakeable ids, you will have to look at alternative approaches like tamper-proof hardware "dongles".

On the other hand, if you are willing to accept that users could fake id information, then combining the MAC address, the ProcessorId and/or a type 4 UUID should be sufficient for uniqueness. (Indeed, just a type 4 UUID by itself should be sufficient, provided you have a good source of random numbers.)

Same CPU ID on two Intel machines

Instead of using the processor ID, combine multiple ID's of a system into 1 string to compare each time the program sends check.

Use something like this:

using System.Management;
ManagementObjectSearcher searcher = new ManagementObjectSearcher(
"select * from " + whatever_id);

All the values you can replace whatever_id with can be found here:
http://www.codeproject.com/Articles/17973/How-To-Get-Hardware-Information-CPU-ID-MainBoard-I

I would find a few you want to use, some of which can be unique, but even if you dont use a unique field, you can make combinations that will, for most intents and purposes, be unique.

Is there really any way to uniquely identify any computer at all

The fact in getting a globally unique ID is, only MAC address is the ID that will not change if you set up your system all over. IF you are generating a key for a specific product, the best way to do it is assigning unique IDs for products and combining the product ID with MAC address. Hope it helps.

Safest way to get processor ID or some hardware info

For a small tool I wrote (Windows Forms .NET 2.0), I needed something similar.

I wrote a helper class that simply uses some common information like HDD serial number through PInvoke of the GetVolumeInformation function.

This is by no way really safe or bullet-proof, but accurate enough to fit my needs.

(If you are interested this is the tool, if I'm allowed to link to)

Unique computer ID

Like you've said CPU Id wont be unique, however you can use it with another hardware identifier to create your own unique key.

Reference assembly System.Management

So, use this code to get the CPU ID:

string cpuInfo = string.Empty;
ManagementClass mc = new ManagementClass("win32_processor");
ManagementObjectCollection moc = mc.GetInstances();

foreach (ManagementObject mo in moc)
{
cpuInfo = mo.Properties["processorID"].Value.ToString();
break;
}

Then use this code to get the HD ID:

string drive = "C";
ManagementObject dsk = new ManagementObject(
@"win32_logicaldisk.deviceid=""" + drive + @":""");
dsk.Get();
string volumeSerial = dsk["VolumeSerialNumber"].ToString();

Then, you can just combine these two serials to get a uniqueId for that machine:

string uniqueId = cpuInfo + volumeSerial;

Obviously, the more hardware components you get the IDs of, the greater the uniqueness becomes. However, the chances of the same machine having an identical CPU serial and Hard disk serial are already slim to none.



Related Topics



Leave a reply



Submit