[wbemprox] Patches for adding currentclockspeed in record_processor
Hans Leidekker
hans at codeweavers.com
Wed Jul 3 02:11:27 CDT 2013
On Tue, 2013-07-02 at 20:34 +0900, Rosen Diankov wrote:
> you are right again, i'll be more careful. now, i've addressed every
> problem except creating the patches with git. any help would be
> appreciated.
See http://wiki.winehq.org/GitWine
> --- wine-1.6-rc4-old/dlls/wbemprox/builtin.c 2013-06-29 04:53:55.000000000 +0900
> +++ wine-1.6-rc4/dlls/wbemprox/builtin.c 2013-07-02 19:30:39.157916619 +0900
> @@ -168,6 +168,8 @@
> {'M','a','n','u','f','a','c','t','u','r','e','r',0};
> static const WCHAR prop_maxclockspeedW[] =
> {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
> +static const WCHAR prop_currentclockspeedW[] =
> + {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
> static const WCHAR prop_memberW[] =
> {'M','e','m','b','e','r',0};
> static const WCHAR prop_methodW[] =
> @@ -381,6 +383,7 @@
> { prop_familyW, CIM_UINT16, VT_I4 },
> { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
> { prop_maxclockspeedW, CIM_UINT32, VT_I4 },
> + { prop_currentclockspeedW, CIM_UINT32, VT_I4 },
> { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
> { prop_numcoresW, CIM_UINT32, VT_I4 },
> { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
> @@ -633,6 +636,7 @@
> UINT16 family;
> const WCHAR *manufacturer;
> UINT32 maxclockspeed;
> + UINT32 currentclockspeed;
> const WCHAR *name;
> UINT32 num_cores;
> UINT32 num_logical_processors;
> @@ -1690,20 +1694,30 @@
> regs_to_str( regs, 16, name + 32 );
> }
> }
Please keep properties sorted alphabetically.
> -static UINT get_processor_maxclockspeed( void )
> +static void get_processor_clockspeeds( UINT* maxclockspeed, UINT* currentclockspeed )
> {
> PROCESSOR_POWER_INFORMATION *info;
> - UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
> + UINT size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
> NTSTATUS status;
> -
> + UINT valueswritten=0;
> if ((info = heap_alloc( size )))
> {
> status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
> - if (!status) ret = info[0].MaxMhz;
> + if (!status)
> + {
> + *maxclockspeed = info[0].MaxMhz;
> + *currentclockspeed = info[0].CurrentMhz;
> + valueswritten = 1;
> + }
> heap_free( info );
> }
> - return ret;
> + if( valueswritten == 0 )
> + {
> + *maxclockspeed = 1000;
> + *currentclockspeed = 1000;
> + }
> }
You don't need an extra variable, just return early.
More information about the wine-devel
mailing list