简体   繁体   English

通过C获取BIOS信息的常用方法

[英]Common way to get BIOS information via C

After reading some stuff it seems I can map the SMBIOS memory and parse it. 看完一些东西后,似乎我可以映射SMBIOS内存并解析它。 I have no idea on how to go about this. 我不知道如何解决这个问题。 I can't use any managed code as I would like this to be compilable under any OS. 我不能使用任何托管代码,因为我希望在任何操作系统下都可以编译。

Does anyone have any code examples how to go about this? 有没有人有任何代码示例如何去做?

On most systems, it is not mapped into user-mode accessible memory, so you need to call some system API. 在大多数系统上,它不会映射到用户模式可访问的内存,因此您需要调用某些系统API。

On Windows, you can call GetSystemFirmwareTable . 在Windows上,您可以调用GetSystemFirmwareTable

For Linux I guess you should have a look at the dmidecode source (GPL) for concrete code... 对于Linux,我想你应该看看具体代码的dmidecode (GPL)......

Using and parsing dmidecode output may be all you need... 使用和解析dmidecode输出可能就是您所需要的......

I wrote a reusable class to read all the SMBIOS stuff. 我写了一个可重用的类来阅读所有SMBIOS的东西。

It is very clean code with a proper error handling and easy to extend. 它是非常干净的代码,具有适当的错误处理和易于扩展。 You can derive a class from this class that uses the parsed data to display it or do whatever you want with it. 您可以从此类派生一个类,该类使用已分析的数据来显示它或使用它做任何您想做的事情。

You find also a link to the actual SMBios documentation in the code's comments. 您还可以在代码的注释中找到指向实际SMBios文档的链接。

You can download it from my homepage: ftp://ftp.netcult.ch/mirror/elmue/SMBiosClass.zip 您可以从我的主页下载它: ftp//ftp.netcult.ch/mirror/elmue/SMBiosClass.zip

Elmue Elmue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM