wbemprox: Implement Win32_PhysicalMemory.MemoryType.

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:02:07 -06:00 committed by Alexandre Julliard
parent 710abd65bb
commit b05928aae0
2 changed files with 77 additions and 7 deletions

View File

@ -252,6 +252,8 @@ static const WCHAR prop_mediatypeW[] =
{'M','e','d','i','a','T','y','p','e',0};
static const WCHAR prop_memberW[] =
{'M','e','m','b','e','r',0};
static const WCHAR prop_memorytypeW[] =
{'M','e','m','o','r','y','T','y','p','e',0};
static const WCHAR prop_methodW[] =
{'M','e','t','h','o','d',0};
static const WCHAR prop_modelW[] =
@ -540,7 +542,8 @@ static const struct column col_physicalmedia[] =
};
static const struct column col_physicalmemory[] =
{
{ prop_capacityW, CIM_UINT64 }
{ prop_capacityW, CIM_UINT64 },
{ prop_memorytypeW, CIM_UINT16, VT_I4 }
};
static const struct column col_printer[] =
{
@ -924,6 +927,7 @@ struct record_physicalmedia
struct record_physicalmemory
{
UINT64 capacity;
UINT16 memorytype;
};
struct record_printer
{
@ -2303,7 +2307,8 @@ static enum fill_status fill_physicalmemory( struct table *table, const struct e
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
rec = (struct record_physicalmemory *)table->data;
rec->capacity = get_total_physical_memory();
rec->capacity = get_total_physical_memory();
rec->memorytype = 9; /* RAM */
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;

View File

@ -482,9 +482,11 @@ static void test_Win32_Process( IWbemServices *services )
static void test_Win32_ComputerSystem( IWbemServices *services )
{
static const WCHAR backslashW[] = {'\\',0};
static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0};
static const WCHAR modelW[] = {'M','o','d','e','l',0};
static const WCHAR nameW[] = {'N','a','m','e',0};
static const WCHAR usernameW[] = {'U','s','e','r','N','a','m','e',0};
static const WCHAR backslashW[] = {'\\',0};
static const WCHAR queryW[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
@ -524,6 +526,20 @@ static void test_Win32_ComputerSystem( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &service, &count );
ok( hr == S_OK, "got %08x\n", hr );
type = 0xdeadbeef;
VariantInit( &value );
hr = IWbemClassObject_Get( service, memorytypeW, 0, &value, &type, NULL );
ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr );
type = 0xdeadbeef;
VariantInit( &value );
hr = IWbemClassObject_Get( service, modelW, 0, &value, &type, NULL );
ok( hr == S_OK, "failed to get model %08x\n", hr );
ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) );
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
trace( "model: %s\n", wine_dbgstr_w(V_BSTR( &value )) );
VariantClear( &value );
type = 0xdeadbeef;
VariantInit( &value );
hr = IWbemClassObject_Get( service, nameW, 0, &value, &type, NULL );
@ -1206,7 +1222,7 @@ static void test_ComputerSystemProduct( IWbemServices *services )
'C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
IWbemClassObject *service;
IWbemClassObject *obj;
VARIANT value;
CIMTYPE type;
HRESULT hr;
@ -1219,24 +1235,72 @@ static void test_ComputerSystemProduct( IWbemServices *services )
return;
}
hr = IEnumWbemClassObject_Next( result, 10000, 1, &service, &count );
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
ok( hr == S_OK, "got %08x\n", hr );
type = 0xdeadbeef;
VariantInit( &value );
hr = IWbemClassObject_Get( service, uuidW, 0, &value, &type, NULL );
hr = IWbemClassObject_Get( obj, uuidW, 0, &value, &type, NULL );
ok( hr == S_OK, "failed to get computer name %08x\n", hr );
ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) );
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
trace( "uuid %s\n", wine_dbgstr_w(V_BSTR(&value)) );
VariantClear( &value );
IWbemClassObject_Release( service );
IWbemClassObject_Release( obj );
IEnumWbemClassObject_Release( result );
SysFreeString( query );
SysFreeString( wql );
}
static void test_PhysicalMemory( IWbemServices *services )
{
static const WCHAR capacityW[] = {'C','a','p','a','c','i','t','y',0};
static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0};
static const WCHAR queryW[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
IWbemClassObject *obj;
VARIANT val;
CIMTYPE type;
HRESULT hr;
DWORD count;
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
if (hr != S_OK)
{
win_skip( "Win32_PhysicalMemory not available\n" );
return;
}
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
ok( hr == S_OK, "got %08x\n", hr );
type = 0xdeadbeef;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, capacityW, 0, &val, &type, NULL );
ok( hr == S_OK, "failed to get capacity %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( "capacity %s\n", wine_dbgstr_w(V_BSTR( &val )) );
VariantClear( &val );
type = 0xdeadbeef;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, memorytypeW, 0, &val, &type, NULL );
ok( hr == S_OK, "failed to get memory type %08x\n", hr );
ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) );
ok( type == CIM_UINT16, "unexpected type 0x%x\n", type );
trace( "memorytype %u\n", V_I4( &val ) );
VariantClear( &val );
IWbemClassObject_Release( obj );
SysFreeString( query );
SysFreeString( wql );
}
START_TEST(query)
{
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@ -1276,6 +1340,7 @@ START_TEST(query)
test_SystemSecurity( services );
test_OperatingSystem( services );
test_ComputerSystemProduct( services );
test_PhysicalMemory( services );
SysFreeString( path );
IWbemServices_Release( services );