日期:2014-05-18  浏览次数:20987 次

如何获取cpu序列号
我想获取cpu的序列号用来实现我的软件加密,希望各位大哥大姐帮忙。但是如果是类似以下的代码就不要贴出来了,因为它获得的是cpu编号,不是序列号,同一批次出厂的cpu的编号是相同的,它无法满足我实现加密的要求。谢谢!
[code=C#][/code]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); }
 

[code=C#][/code]
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; }

------解决方案--------------------

不懂,帮顶