Files
fastfetch/src/detection/bios/bios_windows.cpp
T
李通洲 38b3aae1e3 Windows: simplify WMI query code
by making C++ code more C++
2022-10-17 00:17:26 +08:00

29 lines
797 B
C++

extern "C" {
#include "bios.h"
}
#include "util/windows/wmi.hpp"
extern "C" void ffDetectBios(FFBiosResult* bios)
{
ffStrbufInit(&bios->error);
ffStrbufInit(&bios->biosDate);
ffStrbufInit(&bios->biosRelease);
ffStrbufInit(&bios->biosVendor);
ffStrbufInit(&bios->biosVersion);
FFWmiQuery query(L"SELECT Name, ReleaseDate, Version, Manufacturer FROM Win32_BIOS", &bios->error);
if(!query)
return;
if(FFWmiRecord record = query.next())
{
record.getString(L"Name", &bios->biosRelease);
record.getString(L"ReleaseDate", &bios->biosDate);
record.getString(L"Version", &bios->biosVersion);
record.getString(L"Manufacturer", &bios->biosVendor);
}
else
ffStrbufInitS(&bios->error, "No Wmi result returned");
}