C#怎么读取主板和cpu序列号?
主要是用于加密软件,防止软件盗版,读取主板或者cpu的序列号作为注册码,这种方式好吗?还是有什么别的方式?如果要读取主板和cpu序列号,c#怎么做呢?C#C#C#C#C#...
主要是用于加密软件,防止软件盗版,读取主板或者cpu的序列号作为注册码,这种方式好吗?还是有什么别的方式?
如果要读取主板和cpu序列号,c#怎么做呢?
C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# 展开
如果要读取主板和cpu序列号,c#怎么做呢?
C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# C# 展开
2个回答
展开全部
private void GetInfo()
{
string cpuInfo = "";//cpu序列号
ManagementClass cimobject = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = cimobject.GetInstances();
foreach(ManagementObject mo in moc)
{
cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
Response.Write ("cpu序列号:"+cpuInfo.ToString ());
}
//获取硬盘ID
String HDid;
ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc1 = cimobject1.GetInstances();
foreach(ManagementObject mo in moc1)
{
HDid = (string)mo.Properties["Model"].Value;
Response.Write ("硬盘序列号:"+HDid.ToString ());
}
//获取网卡硬件地址
9558821702001755616
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc2 = mc.GetInstances();
foreach(ManagementObject mo in moc2)
{
if((bool)mo["IPEnabled"] == true)
Response.Write("MAC address\t{0}"+mo["MacAddress"].ToString());
mo.Dispose();
}
}
//主板
string strbNumber = string.Empty;
ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_baseboard");
foreach (ManagementObject mo in mos.Get())
{
strbNumber=mo["SerialNumber"].ToString();
break;
}
{
string cpuInfo = "";//cpu序列号
ManagementClass cimobject = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = cimobject.GetInstances();
foreach(ManagementObject mo in moc)
{
cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
Response.Write ("cpu序列号:"+cpuInfo.ToString ());
}
//获取硬盘ID
String HDid;
ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc1 = cimobject1.GetInstances();
foreach(ManagementObject mo in moc1)
{
HDid = (string)mo.Properties["Model"].Value;
Response.Write ("硬盘序列号:"+HDid.ToString ());
}
//获取网卡硬件地址
9558821702001755616
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc2 = mc.GetInstances();
foreach(ManagementObject mo in moc2)
{
if((bool)mo["IPEnabled"] == true)
Response.Write("MAC address\t{0}"+mo["MacAddress"].ToString());
mo.Dispose();
}
}
//主板
string strbNumber = string.Empty;
ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_baseboard");
foreach (ManagementObject mo in mos.Get())
{
strbNumber=mo["SerialNumber"].ToString();
break;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
读取主板信息:
Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard")
Dim share As ManagementObject
For Each share In searcher.Get()
Debug.WriteLine("主板制造商:" & share("Manufacturer"))
Debug.WriteLine("型号:" & share("Product"))
Debug.WriteLine("序列号:" & share("SerialNumber"))
Next share
Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard")
Dim share As ManagementObject
For Each share In searcher.Get()
Debug.WriteLine("主板制造商:" & share("Manufacturer"))
Debug.WriteLine("型号:" & share("Product"))
Debug.WriteLine("序列号:" & share("SerialNumber"))
Next share
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询