Module: wine Branch: master Commit: 1711b99e980b2fb39d2f35c69777e5b34cdf458a URL: http://source.winehq.org/git/wine.git/?a=commit;h=1711b99e980b2fb39d2f35c697...
Author: Piotr Caban piotr@codeweavers.com Date: Fri Aug 31 15:58:47 2012 +0200
wbemprox: Added MaxClockSpeed and NumberOfLogicalProcessors builtin properties.
---
dlls/wbemprox/builtin.c | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 8f2335b..19afa0c 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -163,6 +163,10 @@ 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_typeW[] = {'T','y','p','e',0}; +static const WCHAR prop_maxclockspeedW[] = + {'M','a','x','C','l','o','c','k','S','p','e','e','d',0}; +static const WCHAR prop_numberoflogicalprocessorsW[] = + {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0}; @@ -249,11 +253,13 @@ static const struct column col_process[] = }; static const struct column col_processor[] = { - { prop_cpustatusW, CIM_UINT16 }, - { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC } + { prop_cpustatusW, CIM_UINT16 }, + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_maxclockspeedW, CIM_UINT32 }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_numberoflogicalprocessorsW, CIM_UINT32 }, + { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC } }; static const struct column col_service[] = { @@ -390,7 +396,9 @@ struct record_processor UINT16 cpu_status; const WCHAR *device_id; const WCHAR *manufacturer; + UINT32 maxclockspeed; const WCHAR *name; + UINT32 numberoflogicalprocessors; const WCHAR *processor_id; }; struct record_service @@ -747,7 +755,8 @@ static void fill_processor( struct table *table ) static const WCHAR fmtW[] = {'C','P','U','%','u',0}; WCHAR device_id[14], processor_id[17], manufacturer[13], name[49] = {0}; struct record_processor *rec; - UINT i, offset = 0, count = get_processor_count(); + UINT i, offset = 0, count = get_processor_count(), cpuMhz; + PROCESSOR_POWER_INFORMATION ppi;
if (!(table->data = heap_alloc( sizeof(*rec) * count ))) return;
@@ -755,6 +764,11 @@ static void fill_processor( struct table *table ) get_processor_manufacturer( manufacturer ); get_processor_name( name );
+ if(!NtPowerInformation(ProcessorInformation, NULL, 0, &ppi, sizeof(ppi))) + cpuMhz = ppi.MaxMhz; + else + cpuMhz = 1000000; + for (i = 0; i < count; i++) { rec = (struct record_processor *)(table->data + offset); @@ -762,7 +776,9 @@ static void fill_processor( struct table *table ) sprintfW( device_id, fmtW, i ); rec->device_id = heap_strdupW( device_id ); rec->manufacturer = heap_strdupW( manufacturer ); + rec->maxclockspeed = cpuMhz; rec->name = heap_strdupW( name ); + rec->numberoflogicalprocessors = count; rec->processor_id = heap_strdupW( processor_id ); offset += sizeof(*rec); }