[PATCH v2 7/7] wbemprox: Add FreeVirtualMemory property to Win32_Operatingsystem.
Hans Leidekker
hans at codeweavers.com
Thu Apr 28 05:43:25 CDT 2022
From: Louis Lenders <xerox.xerox2000x at gmail.com>
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/wbemprox/builtin.c | 12 ++++++++++++
dlls/wbemprox/tests/query.c | 1 +
2 files changed, 13 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 98a32313461..d27130b00c9 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -239,6 +239,7 @@ static const struct column col_operatingsystem[] =
{ L"CSName", CIM_STRING|COL_FLAG_DYNAMIC },
{ L"CurrentTimeZone", CIM_SINT16 },
{ L"FreePhysicalMemory", CIM_UINT64 },
+ { L"FreeVirtualMemory", CIM_UINT64 },
{ L"InstallDate", CIM_DATETIME },
{ L"LastBootUpTime", CIM_DATETIME|COL_FLAG_DYNAMIC },
{ L"LocalDateTime", CIM_DATETIME|COL_FLAG_DYNAMIC },
@@ -676,6 +677,7 @@ struct record_operatingsystem
const WCHAR *csname;
INT16 currenttimezone;
UINT64 freephysicalmemory;
+ UINT64 freevirtualmemory;
const WCHAR *installdate;
const WCHAR *lastbootuptime;
const WCHAR *localdatetime;
@@ -1572,6 +1574,15 @@ static UINT64 get_available_physical_memory(void)
return status.ullAvailPhys;
}
+static UINT64 get_available_virtual_memory(void)
+{
+ MEMORYSTATUSEX status;
+
+ status.dwLength = sizeof(status);
+ if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
+ return status.ullAvailVirtual;
+}
+
static WCHAR *get_computername(void)
{
WCHAR *ret;
@@ -3683,6 +3694,7 @@ static enum fill_status fill_operatingsystem( struct table *table, const struct
rec->csname = get_computername();
rec->currenttimezone = get_currenttimezone();
rec->freephysicalmemory = get_available_physical_memory() / 1024;
+ rec->freevirtualmemory = get_available_virtual_memory() / 1024;
rec->installdate = L"20140101000000.000000+000";
rec->lastbootuptime = get_lastbootuptime();
rec->localdatetime = get_localdatetime();
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index f8508cd1405..f6faaea0d99 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1404,6 +1404,7 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
VariantClear( &val );
check_property( obj, L"FreePhysicalMemory", VT_BSTR, CIM_UINT64 );
+ check_property( obj, L"FreeVirtualMemory", VT_BSTR, CIM_UINT64 );
check_property( obj, L"Name", VT_BSTR, CIM_STRING );
type = 0xdeadbeef;
--
2.30.2
More information about the wine-devel
mailing list