wbemprox: Implement Win32_OperatingSystem.TotalVirtualMemorySize.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-11-16 10:01:53 -06:00 committed by Alexandre Julliard
parent 474d5be546
commit 710abd65bb
2 changed files with 28 additions and 1 deletions

View File

@ -342,6 +342,8 @@ static const WCHAR prop_threadcountW[] =
{'T','h','r','e','a','d','C','o','u','n','t',0};
static const WCHAR prop_totalphysicalmemoryW[] =
{'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
static const WCHAR prop_totalvirtualmemorysizeW[] =
{'T','o','t','a','l','V','i','r','t','u','a','l','M','e','m','o','r','y','S','i','z','e',0};
static const WCHAR prop_totalvisiblememorysizeW[] =
{'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
static const WCHAR prop_typeW[] =
@ -517,6 +519,7 @@ static const struct column col_os[] =
{ prop_servicepackminorW, CIM_UINT16, VT_I4 },
{ prop_suitemaskW, CIM_UINT32, VT_I4 },
{ prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_totalvirtualmemorysizeW, CIM_UINT64 },
{ prop_totalvisiblememorysizeW, CIM_UINT64 },
{ prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
};
@ -899,6 +902,7 @@ struct record_operatingsystem
UINT16 servicepackminor;
UINT32 suitemask;
const WCHAR *systemdirectory;
UINT64 totalvirtualmemorysize;
UINT64 totalvisiblememorysize;
const WCHAR *version;
};
@ -2763,7 +2767,8 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond )
rec->servicepackminor = ver.wServicePackMinor;
rec->suitemask = 272; /* Single User + Terminal */
rec->systemdirectory = get_systemdirectory();
rec->totalvisiblememorysize = get_total_physical_memory() / 1024;
rec->totalvirtualmemorysize = get_total_physical_memory() / 1024;
rec->totalvisiblememorysize = rec->totalvirtualmemorysize;
rec->version = get_osversion( &ver );
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;

View File

@ -1066,6 +1066,10 @@ static void test_OperatingSystem( IWbemServices *services )
{'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
static const WCHAR servicepackminorW[] =
{'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
static const WCHAR totalvisiblememorysizeW[] =
{'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
static const WCHAR totalvirtualmemorysizeW[] =
{'T','o','t','a','l','V','i','r','t','u','a','l','M','e','m','o','r','y','S','i','z','e',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
IWbemClassObject *obj;
@ -1170,6 +1174,24 @@ static void test_OperatingSystem( IWbemServices *services )
trace( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) );
VariantClear( &val );
type = 0xdeadbeef;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, totalvisiblememorysizeW, 0, &val, &type, NULL );
ok( hr == S_OK, "failed to get visible memory size %08x\n", hr );
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
ok( type == CIM_UINT64, "unexpected type 0x%x\n", type );
trace( "totalvisiblememorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) );
VariantClear( &val );
type = 0xdeadbeef;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, totalvirtualmemorysizeW, 0, &val, &type, NULL );
ok( hr == S_OK, "failed to get virtual memory size %08x\n", hr );
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
ok( type == CIM_UINT64, "unexpected type 0x%x\n", type );
trace( "totalvirtualmemorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) );
VariantClear( &val );
IWbemClassObject_Release( obj );
IEnumWbemClassObject_Release( result );
SysFreeString( query );