如何检测计算机中的所有操作系统 [英] how to detect all operating systems in your computer

查看:145
本文介绍了如何检测计算机中的所有操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题.我的老师要求我们建立一个程序来检测您计算机中的所有操作系统.
实际上,在Windows中,我们可以调用Windows API GetVersionEx来获取有关当前操作系统的信息.在Linux中,我们可以调用uname.
但是我怎么能找到所有的操作系​​统.我想也许我们可以做到
来自MBR.我的计算机中装有Windows和Fedora.因此也许我们可以从grub获取一些信息.

所以请帮我找到它.谢谢!!!!!


ps:我的英语真的很不好.给我一些有用的代码,c ++或c代码

I got a problem.My teacher asks us to build a program to detect all operating systems in your computer .
Actually in windows ,we can call windows API GetVersionEx to get information about the current os.In Linux ,we can call uname.
But how can I find all operating systems . I think maybe we can do it
from MBR.I have windows and fedora in my computer .So maybe we can get some information from grub.

So please help me find it.Thank you !!!!!


ps: my English is realy very bad.Give me some useful code ,c++ or c code

推荐答案

在Windows中,如果您有多个操作系统,那么那里"主驱动器根目录中的一个文件,列出了所有文件,并且可以正常运行,默认为一个.我假设您要找到此文件并对其进行解析. boot.ini,也许?我不确定具体细节.
In windows, if you have more than one OS, there''s a file at the root of your primary drive that lists them all and works our which one is the default. I assume you are to find this file and parse it. boot.ini, perhaps ? I am not sure of the details.


在我的boot.ini中

in my boot.ini

[boot loader]
timeout=3
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect




boot.ini仅列出Windows.我想编写一个程序来检查所有系统,包括Windows和Linux.

而且我们可以自己编辑boot.ini.例如,我可以在boot.ini中用WinXP更改Microsoft Windows XP Professional,因此通过这种方式,我们无法获得正确的系统版本.我们得到的是您私下放置在那里的信息.

有什么办法可以从MBR或Grub获取系统信息吗?




boot.ini only list windows . I want to Write a program to check all systems include windows and linux.

And we can edit boot.ini by ourself. for example I can change Microsoft Windows XP Professional with WinXP in boot.ini,So by this way ,we can''t get the correct system version. what we get is information your put there priviously.

Is there any way to get system information from MBR or Grub???


这篇关于如何检测计算机中的所有操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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