示例#1
0
int main()
{
	if (SMBios::Instance().Available())
	{
		cout << "SMBios Ver: " << static_cast<int>(SMBios::Instance().MajorVersion())
			<< '.' << static_cast<int>(SMBios::Instance().MinorVersion()) << endl;
		cout << endl;

		Mainboard mainboard;
		cout << "Mainboard: " << mainboard.Manufacturer() << ' ' << mainboard.Product() << endl;
		cout << "Bios: " << mainboard.BiosVendor() << ' ' << mainboard.BiosVersion() << endl;
		cout << "Release Date: " << mainboard.BiosReleaseDate() << endl;
		cout << endl;

		MemoryBank mem;
		for (size_t i = 0; i < mem.SlotCount(); ++i)
		{
			if (mem[i].size != 0)
			{
				cout << mem[i].manufacturer << ' ' << mem[i].size << " MB" << endl;
				cout << "Part #: " << mem[i].part_number << endl;
				cout << "Serial #: " << mem[i].serial_num << endl;
				cout << endl;
			}
		}
	}
	else
	{
		cout << "Could not read from SMBios." << endl;
	}

	return 0;
}
示例#2
0
void DetectMainboardInfo(std::ostream& os)
{
	if (SMBios::Instance().Available())
	{
		os << "SMBios Ver: " << static_cast<int>(SMBios::Instance().MajorVersion())
			<< '.' << static_cast<int>(SMBios::Instance().MinorVersion()) << endl;
		os << endl;

		Mainboard mainboard;
		os << "Mainboard: " << mainboard.Manufacturer() << ' ' << mainboard.Product() << endl;
		os << "Bios: " << mainboard.BiosVendor() << ' ' << mainboard.BiosVersion() << endl;
		os << "Release Date: " << mainboard.BiosReleaseDate() << endl;
		os << endl;

		MemoryBank mem;
		for (size_t i = 0; i < mem.SlotCount(); ++i)
		{
			if (mem[i].size != 0)
			{
				os << "Memory slot " << i << ": ";
				os << mem[i].manufacturer << ' ' << mem[i].size << " MB" << endl;
				os << "Part #: " << mem[i].part_number << endl;
				os << "Serial #: " << mem[i].serial_num << endl;
				os << endl;
			}
		}
	}
	else
	{
		os << "Could not read from SMBios." << endl;
	}
}