mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
49921f5ed1
Also major refactoring of util/windows/wmi
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#ifndef FF_INCLUDED_util_windows_wmi
|
|
#define FF_INCLUDED_util_windows_wmi
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
#include "util/FFstrbuf.h"
|
|
}
|
|
|
|
#include <Wbemidl.h>
|
|
|
|
//<comdef.h> is not usable in MSYS, so provide our simple bstr_t implementation
|
|
struct bstr_t
|
|
{
|
|
explicit bstr_t(const wchar_t* str) noexcept: _bstr(SysAllocString(str)) {}
|
|
|
|
~bstr_t() noexcept { SysFreeString(_bstr); }
|
|
|
|
explicit operator const wchar_t*() const noexcept {
|
|
return _bstr;
|
|
}
|
|
|
|
operator BSTR() const noexcept {
|
|
return _bstr;
|
|
}
|
|
|
|
private:
|
|
BSTR _bstr;
|
|
};
|
|
|
|
void ffBstrToStrbuf(BSTR bstr, FFstrbuf* strbuf);
|
|
|
|
IEnumWbemClassObject* ffQueryWmi(const wchar_t* queryStr, FFstrbuf* error);
|
|
bool ffGetWmiObjString(IWbemClassObject* obj, const wchar_t* key, FFstrbuf* strbuf);
|
|
bool ffGetWmiObjSigned(IWbemClassObject* obj, const wchar_t* key, int64_t* integer);
|
|
bool ffGetWmiObjUnsigned(IWbemClassObject* obj, const wchar_t* key, uint64_t* integer);
|
|
bool ffGetWmiObjReal(IWbemClassObject* obj, const wchar_t* key, double* real);
|
|
|
|
#else
|
|
// Win32 COM headers requires C++ compiler
|
|
#error Must be included in C++ source file
|
|
#endif //__cplusplus
|
|
|
|
#endif //FF_INCLUDED_util_windows_wmi
|