C# 视频监控系列(15):总结贴——可能用到的C# WinForm技术小结
2009-04-08 08:25:34 来源:WEB开发网3. 获取网卡号
可用于软件加密
/// <summary>
/// 获得网卡号
/// </summary>
/// <returns></returns>
public static string GetNetCardMacAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string str = "";
foreach (ManagementObject mo in moc)
{
if ((bool)mo["IPEnabled"] == true)
str = mo["MacAddress"].ToString();
}
return str;
}
4. 获取采集卡序列化
可用于软件加密绑定,注意结构体DS_BOARD_DETAIL.sn是16位的,但是实际只有12位,VC++源码也只取了12位,后门都是0。
/// <summary>
/// 获取板卡序号
/// </summary>
/// <returns></returns>
public static string GetBoardSN()
{
uint boardCount = HikVisionSDK.GetBoardCount();
StringBuilder sn = new StringBuilder();
for (uint i = 0; i < boardCount; )
{
DS_BOARD_DETAIL boardDetail = new DS_BOARD_DETAIL();
HikVisionSDK.GetBoardDetail(i, ref boardDetail);
for (int j = 0; j < 12; j++)
{
sn.Append((char)(boardDetail.sn[j] + 0x30));
}
break;
}
return sn.ToString();
}
更多精彩
赞助商链接