How to get unique machine signature without WMI?

百般思念 提交于 2019-12-06 03:42:50
Robert Venables

I've done this several times for licensing projects. For the hard drive serial number use:

private static extern long GetVolumeInformation(string PathName, StringBuilder VolumeNameBuffer, UInt32 VolumeNameSize, ref UInt32 VolumeSerialNumber, ref UInt32 MaximumComponentLength, ref UInt32 FileSystemFlags, StringBuilder FileSystemNameBuffer, UInt32 FileSystemNameSize);

Use the VolumeSerialNumber that is returned by the function.

Also, you may have thought about using the Windows Product ID (Located at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId). Be careful, a large number of Windows XP users have pirated copies and share the same product keys.

Konstantinos

You can combine different hardware information in order to create a unique key.

For example, CPU ID, MAC address etc etc. You retrieve them, combine them, encrypt them and you have a unique representation of the hardware setup of this machine.

Try googling about the subject: how to read hardware information.

From what I can see there is a very useful post in CodeProject: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...).

TheSoftwareJedi

Look through the WinAPI's kernel32 and user32 library. It has all sorts of goodies like EnumDisplayDevices, GetLogicalDrives, GlobalMemoryStatus, GetVolumeInformation, etc, etc. I Like to use PInvoke to browse the API since it gives me the C# wrapper code - but MSDN will have it all as well in the Windows SDK.

@novatrust's answer regarding the hard drive serial is a good one - but can be combined with more. I've provided the GetVolumeInformation API link to pinvoke above, but a simple Google should work as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!