mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
BIOS: improve performance (Windows)
This commit is contained in:
parent
04c9d16c16
commit
fbd8c0237f
@ -422,7 +422,7 @@ elseif(WIN32)
|
||||
src/common/networking_windows.c
|
||||
src/common/processing_windows.c
|
||||
src/detection/battery/battery_windows.cpp
|
||||
src/detection/bios/bios_windows.cpp
|
||||
src/detection/bios/bios_windows.c
|
||||
src/detection/board/board_windows.cpp
|
||||
src/detection/cpu/cpu_windows.cpp
|
||||
src/detection/cpuUsage/cpuUsage_nowait_windows.cpp
|
||||
|
28
src/detection/bios/bios_windows.c
Normal file
28
src/detection/bios/bios_windows.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include "bios.h"
|
||||
#include "util/windows/register.h"
|
||||
|
||||
void ffDetectBios(FFBiosResult* bios)
|
||||
{
|
||||
ffStrbufInit(&bios->error);
|
||||
|
||||
ffStrbufInit(&bios->biosDate);
|
||||
ffStrbufInit(&bios->biosRelease);
|
||||
ffStrbufInit(&bios->biosVendor);
|
||||
ffStrbufInit(&bios->biosVersion);
|
||||
|
||||
FF_HKEY_AUTO_DESTROY hKey = NULL;
|
||||
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\BIOS", &hKey, &bios->error))
|
||||
return;
|
||||
|
||||
if(!ffRegReadStrbuf(hKey, "BIOSVersion", &bios->biosRelease, &bios->error))
|
||||
return;
|
||||
ffRegReadStrbuf(hKey, "BIOSVendor", &bios->biosVendor, NULL);
|
||||
ffRegReadStrbuf(hKey, "BIOSReleaseDate", &bios->biosDate, NULL);
|
||||
|
||||
uint32_t major, minor;
|
||||
if(
|
||||
ffRegReadUint(hKey, "BiosMajorRelease", &major, NULL) &&
|
||||
ffRegReadUint(hKey, "BiosMinorRelease", &minor, NULL)
|
||||
)
|
||||
ffStrbufAppendF(&bios->biosVersion, "%u.%u", (unsigned)major, (unsigned)minor);
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
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");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user