wbemprox: Add more Win32_Processor properties.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bc07327c15
commit
4f640fa9b6
|
@ -139,6 +139,8 @@ static const WCHAR prop_adaptertypeW[] =
|
|||
{'A','d','a','p','t','e','r','T','y','p','e',0};
|
||||
static const WCHAR prop_addresswidthW[] =
|
||||
{'A','d','d','r','e','s','s','W','i','d','t','h',0};
|
||||
static const WCHAR prop_architectureW[] =
|
||||
{'A','r','c','h','i','t','e','c','t','u','r','e',0};
|
||||
static const WCHAR prop_attributesW[] =
|
||||
{'A','t','t','r','i','b','u','t','e','s',0};
|
||||
static const WCHAR prop_availabilityW[] =
|
||||
|
@ -251,6 +253,8 @@ static const WCHAR prop_ipenabledW[] =
|
|||
{'I','P','E','n','a','b','l','e','d',0};
|
||||
static const WCHAR prop_lastbootuptimeW[] =
|
||||
{'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
|
||||
static const WCHAR prop_levelW[] =
|
||||
{'L','e','v','e','l',0};
|
||||
static const WCHAR prop_localW[] =
|
||||
{'L','o','c','a','l',0};
|
||||
static const WCHAR prop_localdatetimeW[] =
|
||||
|
@ -321,6 +325,8 @@ static const WCHAR prop_referenceddomainnameW[] =
|
|||
{'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
|
||||
static const WCHAR prop_releasedateW[] =
|
||||
{'R','e','l','e','a','s','e','D','a','t','e',0};
|
||||
static const WCHAR prop_revisionW[] =
|
||||
{'R','e','v','i','s','i','o','n',0};
|
||||
static const WCHAR prop_serialnumberW[] =
|
||||
{'S','e','r','i','a','l','N','u','m','b','e','r',0};
|
||||
static const WCHAR prop_servicepackmajorW[] =
|
||||
|
@ -610,6 +616,7 @@ static const struct column col_process[] =
|
|||
static const struct column col_processor[] =
|
||||
{
|
||||
{ prop_addresswidthW, CIM_UINT16, VT_I4 },
|
||||
{ prop_architectureW, CIM_UINT16, VT_I4 },
|
||||
{ prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
|
||||
{ prop_cpustatusW, CIM_UINT16 },
|
||||
{ prop_currentclockspeedW, CIM_UINT32, VT_I4 },
|
||||
|
@ -617,6 +624,7 @@ static const struct column col_processor[] =
|
|||
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
|
||||
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
||||
{ prop_familyW, CIM_UINT16, VT_I4 },
|
||||
{ prop_levelW, CIM_UINT16, VT_I4 },
|
||||
{ prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
|
||||
{ prop_maxclockspeedW, CIM_UINT32, VT_I4 },
|
||||
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
||||
|
@ -624,6 +632,7 @@ static const struct column col_processor[] =
|
|||
{ prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
|
||||
{ prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
|
||||
{ prop_processortypeW, CIM_UINT16, VT_I4 },
|
||||
{ prop_revisionW, CIM_UINT16, VT_I4 },
|
||||
{ prop_uniqueidW, CIM_STRING },
|
||||
{ prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
|
||||
};
|
||||
|
@ -1012,6 +1021,7 @@ struct record_process
|
|||
struct record_processor
|
||||
{
|
||||
UINT16 addresswidth;
|
||||
UINT16 architecture;
|
||||
const WCHAR *caption;
|
||||
UINT16 cpu_status;
|
||||
UINT32 currentclockspeed;
|
||||
|
@ -1019,6 +1029,7 @@ struct record_processor
|
|||
const WCHAR *description;
|
||||
const WCHAR *device_id;
|
||||
UINT16 family;
|
||||
UINT16 level;
|
||||
const WCHAR *manufacturer;
|
||||
UINT32 maxclockspeed;
|
||||
const WCHAR *name;
|
||||
|
@ -1026,6 +1037,7 @@ struct record_processor
|
|||
UINT32 num_logical_processors;
|
||||
const WCHAR *processor_id;
|
||||
UINT16 processortype;
|
||||
UINT16 revision;
|
||||
const WCHAR *unique_id;
|
||||
const WCHAR *version;
|
||||
};
|
||||
|
@ -2605,6 +2617,12 @@ static void get_processor_version( WCHAR *version )
|
|||
do_cpuid( 1, regs );
|
||||
sprintfW( version, fmtW, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
|
||||
}
|
||||
static UINT16 get_processor_revision(void)
|
||||
{
|
||||
unsigned int regs[4] = {0, 0, 0, 0};
|
||||
do_cpuid( 1, regs );
|
||||
return regs[0];
|
||||
}
|
||||
static void get_processor_id( WCHAR *processor_id )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
|
||||
|
@ -2699,6 +2717,7 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
|
|||
{
|
||||
rec = (struct record_processor *)(table->data + offset);
|
||||
rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
|
||||
rec->architecture = get_osarchitecture() == os_32bitW ? 0 : 9;
|
||||
rec->caption = heap_strdupW( caption );
|
||||
rec->cpu_status = 1; /* CPU Enabled */
|
||||
rec->currentclockspeed = get_processor_currentclockspeed( i );
|
||||
|
@ -2707,6 +2726,7 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
|
|||
sprintfW( device_id, fmtW, i );
|
||||
rec->device_id = heap_strdupW( device_id );
|
||||
rec->family = 2; /* Unknown */
|
||||
rec->level = 15;
|
||||
rec->manufacturer = heap_strdupW( manufacturer );
|
||||
rec->maxclockspeed = get_processor_maxclockspeed( i );
|
||||
rec->name = heap_strdupW( name );
|
||||
|
@ -2714,6 +2734,7 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
|
|||
rec->num_logical_processors = num_logical_processors;
|
||||
rec->processor_id = heap_strdupW( processor_id );
|
||||
rec->processortype = 3; /* central processor */
|
||||
rec->revision = get_processor_revision();
|
||||
rec->unique_id = NULL;
|
||||
rec->version = heap_strdupW( version );
|
||||
if (!match_row( table, i, cond, &status ))
|
||||
|
|
|
@ -1444,6 +1444,118 @@ static void test_IP4RouteTable( IWbemServices *services )
|
|||
SysFreeString( wql );
|
||||
}
|
||||
|
||||
static void test_Win32_Processor( IWbemServices *services )
|
||||
{
|
||||
static const WCHAR architectureW[] =
|
||||
{'A','r','c','h','i','t','e','c','t','u','r','e',0};
|
||||
static const WCHAR familyW[] =
|
||||
{'F','a','m','i','l','y',0};
|
||||
static const WCHAR levelW[] =
|
||||
{'L','e','v','e','l',0};
|
||||
static const WCHAR manufacturerW[] =
|
||||
{'M','a','n','u','f','a','c','t','u','r','e','r',0};
|
||||
static const WCHAR nameW[] =
|
||||
{'N','a','m','e',0};
|
||||
static const WCHAR processoridW[] =
|
||||
{'P','r','o','c','e','s','s','o','r','I','d',0};
|
||||
static const WCHAR revisionW[] =
|
||||
{'R','e','v','i','s','i','o','n',0};
|
||||
static const WCHAR versionW[] =
|
||||
{'V','e','r','s','i','o','n',0};
|
||||
static const WCHAR queryW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
|
||||
'P','r','o','c','e','s','s','o','r',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 );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
for (;;)
|
||||
{
|
||||
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
|
||||
if (hr != S_OK) break;
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, architectureW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %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( "architecture %u\n", V_I4( &val ) );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, familyW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %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( "family %u\n", V_I4( &val ) );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, levelW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %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( "level %u\n", V_I4( &val ) );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "manufacturer %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "name %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, processoridW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "processorid %s\n", wine_dbgstr_w(V_BSTR( &val )) );
|
||||
VariantClear( &val );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, revisionW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %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( "revision %u\n", V_I4( &val ) );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &val );
|
||||
hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
|
||||
ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
|
||||
trace( "version %s\n", wine_dbgstr_w(V_BSTR( &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};
|
||||
|
@ -1485,6 +1597,7 @@ START_TEST(query)
|
|||
test_ComputerSystemProduct( services );
|
||||
test_PhysicalMemory( services );
|
||||
test_IP4RouteTable( services );
|
||||
test_Win32_Processor( services );
|
||||
|
||||
SysFreeString( path );
|
||||
IWbemServices_Release( services );
|
||||
|
|
Loading…
Reference in New Issue