在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
思路是用加密程序 对硬盘号,cpu号和MAC号取出字符串并加密 产生一个序列号 每次程序启动后重新产生这个序列号并比对,如果一致则验证通过 using System; static string GetDeviceNumber() { string deviceinfo = ""; string cpuInfo = ""; //cpu序列号 ManagementClass cimobject = new ManagementClass("Win32_Processor"); ManagementObjectCollection moc = cimobject.GetInstances(); foreach (ManagementObject mo in moc) { cpuInfo = mo.Properties["ProcessorId"].Value.ToString(); deviceinfo = deviceinfo + cpuInfo.ToString(); } //获取网卡硬件地址 ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc2 = mc.GetInstances(); foreach (ManagementObject mo in moc2) { if ((bool)mo["IPEnabled"] == true) deviceinfo = deviceinfo + mo["MacAddress"].ToString(); mo.Dispose(); } return deviceinfo; }
|
请发表评论