我想获取cpu的序列号用来实现我的软件加密,希望各位大哥大姐帮忙。但是如果是类似以下的代码就不要贴出来了,因为它获得的是cpu编号,不是序列号,同一批次出厂的cpu的编号是相同的,它无法满足我实现加密的要求。谢谢!
public static string GetComputerId()
{
string sProcessorID = "";
string diskID = "";
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);
}
public static string GetComputerId()
{
string cpuInfo = "";//cpu序列号
ManagementClass cimobject = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = cimobject.GetInstances();
foreach (ManagementObject mo in moc)
{
cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
}
return cpuInfo;
}
http://topic.csdn.net/t/20031031/11/2413817.html
http://www.doserver.net/read.php?1262
你应该用机器特征码,有些CPU没序列号.
把你代码中的 ProcessorId 替换成 UniqueId 试试看。或者两者结合。
看MSDN 中关于 UniqueId 的解释
http://msdn.microsoft.com/en-us/library/aa394373%28VS.85%29.aspx