在csharp中获取硬盘序列号 [英] get hard disk serial number in csharp

查看:117
本文介绍了在csharp中获取硬盘序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想创建一个程序给我一个唯一的编号或序列号,为此我想获得csharp中计算机c驱动器的序列号,因为我认为它对世界上任何计算机都是唯一的,是否有其他方式吗?
如果是,请对我说,我可以尝试什么方法?
如果否,请说如何在csharp中获取"c"驱动器的序列号?

Hi
I want to create a program that get a unique number or serial to me , for this job i want to get serial number of c drive of computer in csharp , because i think that it is unique for any computer in the world , is there any other way?
if yes , please say to me , what way can i try?
if no , please say how can i get serial number of "c" drive in csharp?

推荐答案

通过System.Management命名空间 [如何获取硬件信息(CPU ID,主板信息,硬盘序列号,系统信息...) [^ ]-这个站点上的一篇文章,向您展示如何获取大量信息,包括HDD序列号-OriginalGriff [/edit]
Look at WMI via the System.Management namespace[^] - it provides calls to access all sorts of information about a PC.

But be aware, that simple security like this is easily hacked, and will frequently annoy genuine customers more than it deters pirates. A quick look at any of the torrent sites will show you what I mean...

[edit]I forgot to add this: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^] - an article on this very site which shows you how to get loads of info, including the HDD serial number - OriginalGriff[/edit]


获取硬盘序列号有一个主要缺点.首先,不能使用WMI 一致地获取所有驱动器和所有平台上的序列号.没有什么可以说制造商必须将此信息提供给WMI.

其次,大约有4种不同的方法来获取任何单个驱动器的序列号.并非每种方法都适用于每个驱动器,因此您必须尝试每种方法,评估所获得的结果,然后在需要时尝试下一种方法,依此类推.

最后,如果您的软件安装在硬件RAID阵列中具有多个驱动器的计算机上,则无法获取驱动器的序列号.它们被阵列控制器隐藏,并且O/S仅看到RAID驱动器".该驱动器"通常没有序列号.
That''s nice and all, but getting the hard disk serial number has one major drawback. First, WMI cannot be used to consistantly get the serial number on all drives and on all platforms. There is nothing that says a manufacturer has to provide this information to WMI.

Second, there are about 4 different methods of getting the serial number of any single drive. Not every method works on every drive, so you''d have to try each method, evaluate what you get, then try the next method if needed, and so on.

Lastly, if your software is installed on a machine with multiple drives in a hardware RAID array, you cannot get the serial number of the drives. They are hidden by the array controller and the O/S only sees the RAID "drive". That "drive" usually will not have a serial number.


选中此


这篇关于在csharp中获取硬盘序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆