wbemprox: Add FreeVirtualMemory property to Win32_Operatingsystem.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Louis Lenders 2022-04-28 12:43:25 +02:00 committed by Alexandre Julliard
parent ba8e416e63
commit 1d0dd6d778
2 changed files with 13 additions and 0 deletions

View File

@ -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();

View File

@ -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;