Hi,
I have been looking at the code for the Shareware kit and there is some code that creates a ClientID from the processer ID. The code is:
try
{
string cpuInfo = String.Empty;
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (cpuInfo == String.Empty)
{ // only return cpuInfo from first CPU
cpuInfo = mo.Properties[
"ProcessorId"].Value.ToString();}
}
return cpuInfo;}
catch(Exception ex){
throw new DataStoreUniqueMachineIDException( "Error while calculating the unique machine ID.", ex);}
My question is: How dependable would this be using it for Licensing an application so that the app could only run the machine with the same cpuInfo value. Anyone know of any problems with doing this
thanks
-Barb

Unique Machine ID
Harini
GAINSCOM
Dare Obasanjo - MSFT
Jacky Chau
I already know how I am going to store and use the value, I was just wondering about:
1) its uniqueness
2) and it's one-to-one correspondence ie: the procedure will always return a value and this value will not be different on subsequent calls to the procedure
thanks
-Barb
Federico Provera
When will cpuinfo be obtained Will it be in a build Will it be on install Will it be on runtime Where are you going to be storing this CpuInfo
Srikanth Bogadapati
cpuinfo starts off empty,
it then gets the collection of management objects from the system
then it runs through the for loop looking for a non-empty string for the ProcessorId index
this is what it will return, this value is inside of at least one of the instances of management object or so I am lead to believe by the code -
now this is code directly from the Shareware Starter kit and it seems to work just fine for me. I was just wondering about my original questions.
Nagarajan
Visual Studio offers the tool to do simplify this process.
Activate the Server Explorer panel, then:
Servers -> [your computer] -> Processors -> [first processor]
Drag'n'drop this to your Form or User Control.
Then it's just:
string id = processor1.ProcessorId;