Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use in Windows? #2

Closed
ghost opened this issue Apr 19, 2020 · 7 comments
Closed

How to use in Windows? #2

ghost opened this issue Apr 19, 2020 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 19, 2020

Code not worked ...

#include <iostream>

#include "smbios/abstract_smbios_entry.h"
#include "smbios/smbios.h"
#include "smbios/smbios_entry_factory.h"

int main()
{
	smbios::SMBios bios;
	smbios::SMBiosVersion ver = bios.get_smbios_version();
	std::cout << "DMI version: " << ver.major_version << '.' << ver.minor_version << '\n';
	std::cout << "Table size: " << bios.get_table_size() << '\n';
	std::cout << bios.render_to_description();


	smbios::SMBiosEntryFactory smbios_factory;
	for (const smbios::DMIHeader& header : bios)
	{
		std::cout << "Header ID = " << header.get_type() << '\n';
		std::unique_ptr<smbios::AbstractSMBiosEntry> entry = smbios_factory.create(header, ver);
		if (entry)
		{
			std::cout << entry->render_to_description() << '\n';
		}
	}
}

@yuchdev
Copy link
Owner

yuchdev commented Apr 19, 2020

Could you provide more details, like OS version? Did you try to debug? Which function return error? Does GetSystemFirmwareTable() from smbios_util/smbios/src/win_bios.cpp execute without problems?
Because currently the solution works perfectly under Windows in a desktop product (macOS and Linux are left for future though), so it could be a corner case.

@ghost
Copy link
Author

ghost commented Apr 19, 2020

Windows 10 1909 x64


@ghost
Copy link
Author

ghost commented Apr 19, 2020

smbios_entry64_ empty

@ghost
Copy link
Author

ghost commented Apr 19, 2020

render_to_description return nothing..

@yuchdev
Copy link
Owner

yuchdev commented Apr 19, 2020

Check GetSystemFirmwareTable() return value. If it's a zero, call ::GetLastError() and check the code. Non-zero value is unlikely, because it's against function description and means memory buffer should be bigger, but I can't deny any possibility

@ghost
Copy link
Author

ghost commented Apr 19, 2020

GetSystemFirmwareTable not a zero

@yuchdev
Copy link
Owner

yuchdev commented Apr 19, 2020

It's outside application scope then, and might be connected to last Windows Update. I'll check it out in nearest time.
You also can isolate the problem by calling GetSystemFirmwareTable() in your own console application and check the output

@ghost ghost closed this as completed Apr 19, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant