如何在没有WMI的情况下获得唯一的机器签名?

发布于 2024-07-19 19:54:13 字数 378 浏览 5 评论 0原文

我知道已经有人询问问题有关为计算机生成唯一ID,但是我的问题略有不同。

我想知道是否有其他方法(API 调用?)来获取硬件信息而不是使用 WMI。 我从 MSDN 了解到 WMI 是在Win2000所以在Win98中似乎不可用。 我有一个应用程序,即使在 Win98 上也必须运行(我知道这很糟糕,但是你能做什么?)并且仍然可以获取硬件信息。

I know that a question has already been asked about generating a unique ID for a machine but my question is slightly different.

I want to know whether there are any other methods (API calls?) to get hardware information and NOT use WMI. I understand from MSDN that WMI is introduced in Win2000 so it doesnt seem to be available in Win98. I have an application that has to run even on Win98 (I know it sucks but what can you do?) and still get hold of hardware information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

穿透光 2024-07-26 19:54:13

我已经为许可项目这样做过好几次了。 对于硬盘驱动器序列号的使用:

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

使用函数返回的 VolumeSerialNumber

此外,您可能考虑过使用 Windows 产品 ID(位于 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId)。 请注意,大量 Windows XP 用户拥有盗版副本并共享相同的产品密钥。

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.

め七分饶幸 2024-07-26 19:54:13

您可以组合不同的硬件信息来创建唯一的密钥。

例如,CPU ID、MAC 地址等。您检索它们、组合它们、加密它们,您就拥有了这台机器的硬件设置的唯一表示。

尝试用谷歌搜索这个主题:如何读取硬件信息。

据我所知,CodeProject 中有一篇非常有用的帖子: 如何获取硬件信息 ( CPU ID、主板信息、硬盘序列号、系统信息……)

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 , ...).

病毒体 2024-07-26 19:54:13

查看 WinAPI 的 kernel32 和 user32 库。 它有各种各样的好东西,例如 EnumDisplayDevices, GetLogicalDrives, GlobalMemoryStatus, GetVolumeInformation 等,等等。我喜欢使用 PInvoke 浏览 API,因为它为我提供了 C# 包装器代码 - 但 MSDN 也将在 Windows SDK 中提供所有这些代码。

@novatrust 关于硬盘序列号的答案是一个很好的答案 - 但可以与更多答案相结合。 我在上面提供了用于 pinvoke 的 GetVolumeInformation API 链接,但简单的 Google 也应该可以工作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文