How can I uniquely identify a USB key from C#?

后端 未结 3 1777
夕颜
夕颜 2021-02-10 00:40

I\'d like to be able to detect when a USB key is inserted. Furthermore, if I can distinguish between USB key A and USB key B then I am in even better shape. Lastly, if I can u

相关标签:
3条回答
  • 2021-02-10 01:07

    You need to retrieve the key's Hardware ID.

    I don't see how to subscribe to the plugged-in event, but you could always have the user click a button too.

    0 讨论(0)
  • 2021-02-10 01:26

    Hard Disk Id is not unique. Maybe theoretically it is, but in practice it is not. This is without any crack, emulator or any special program.

    0 讨论(0)
  • 2021-02-10 01:28

    All hard-drives have a Serial Number, USB flash drives are no different. Here is an article, with a sample project, that shows how to get the non-volatile serial number. Basically you just need to enumerate the system drives and grab the PNPDeviceID property.

    0 讨论(0)
提交回复
热议问题