mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Temps (Windows): dirty support
Note: https://stackoverflow.com/a/17083409
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "temps_windows.h"
|
||||
}
|
||||
#include "util/windows/wmi.hpp"
|
||||
|
||||
extern "C"
|
||||
const char* ffDetectSmbiosTemp(double* current, double* critical)
|
||||
{
|
||||
// Requires Administrator priviledges
|
||||
// https://wutils.com/wmi/root/wmi/msacpi_thermalzonetemperature/#properties
|
||||
FFWmiQuery query(L"SELECT CurrentTemperature, CriticalTripPoint FROM MSAcpi_ThermalZoneTemperature WHERE Active = TRUE", nullptr, FFWmiNamespace::WMI);
|
||||
if(!query)
|
||||
return "Query WMI service failed";
|
||||
|
||||
if(FFWmiRecord record = query.next())
|
||||
{
|
||||
if (current && record.getReal(L"CurrentTemperature", current)) // In tenth of degrees Kelvin
|
||||
*current = *current / 10 - 273.15;
|
||||
if (critical && record.getReal(L"CriticalTripPoint", critical)) // In tenth of degrees Kelvin
|
||||
*critical = *critical / 10 - 273.15;
|
||||
}
|
||||
|
||||
return "No WMI result returned";
|
||||
}
|
||||
Reference in New Issue
Block a user