C# Creating a unique ID based on hardware ids [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 03:51:19

Here is a pretty decent article about how MS did it with Windows XP. Maybe not exactly what you're looking for, but it's a great jumping-off point.

Windows XP Activation Explained

What hardware does Windows check?

The system checks these ten categories of hardware:

  • Display Adapter
  • SCSI Adapter
  • IDE Adapter (effectively the motherboard)
  • Network Adapter (NIC) and its MAC Address
  • RAM Amount Range (i.e., 0-64mb, 64-128mb, etc.)
  • Processor Type
  • Processor Serial Number
  • Hard Drive Device
  • Hard Drive Volume Serial Number (VSN)
  • CD-ROM / CD-RW / DVD-ROM

Not really an answer, but a word of caution. I worked for a software company that did a similar sort of licensing mechanism and it was... brittle. Especially on laptops. Consider:

  1. When switching between wired and wireless on a laptop, you'll have a different MAC address on each interface.

  2. There may be advantages to changing your MAC address. eg, some cable internet providers in the states foolishly tie your MAC address to your account and one might need to plug their computer in straight to the cable modem and then clone their router's MAC if their router were to die.

  3. If a user were to boot from a different hard drive (for example, a flash drive or a USB stick), would this change what's reported as the first drive?

And this was long before the days of commodity virtualization. Now consider that you can switch a setting and reboot your VM and have: a different amount of RAM, a different sized hard drive, a different type of virtual hard drive controller type (IDE, SCSI, perhaps multiple SCSI controller interfaces). And you can hot-swap CD/DVD devices and change NIC settings with a mouse click.

So I'm not saying "don't do this", exactly, but I will encourage you to test this mechanism on as many machines in as many environments as you can, and I will further suggest that your users will have precious little patience when they can't run the software that they've paid for.

Have you considered hardware dongles?

I've found that the MAC address isn't really worth checking nowadays. Every computer has more than one network adapter, any one of them might be an external device that may or may not be present at any given time. We rolled out a system that paid too much attention to MAC address years ago, and it ended up being a customer service disaster.

On the other hand, it's relatively rare to swap out your CPU, motherboard, bus/disk controllers, or the main hard drive.

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