PerfMon.dll: Fixed wrong return value after option is changed with PerfMonDifference=1

This commit is contained in:
Birunthan Mohanathas 2012-03-26 21:29:45 +03:00
parent 521b5c18b7
commit 5f05e79b6a

View File

@ -36,6 +36,13 @@ struct MeasureData
ULONGLONG oldValue; ULONGLONG oldValue;
bool difference; bool difference;
bool firstTime; bool firstTime;
MeasureData() :
oldValue(),
difference(false),
firstTime(false)
{
}
}; };
ULONGLONG GetPerfData(PCTSTR ObjectName, PCTSTR InstanceName, PCTSTR CounterName); ULONGLONG GetPerfData(PCTSTR ObjectName, PCTSTR InstanceName, PCTSTR CounterName);
@ -50,9 +57,27 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{ {
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
measure->objectName = RmReadString(rm, L"PerfMonObject", L""); LPCWSTR value = RmReadString(rm, L"PerfMonObject", L"");
measure->counterName = RmReadString(rm, L"PerfMonCounter", L""); if (_wcsicmp(value, measure->objectName.c_str()) != 0)
measure->instanceName = RmReadString(rm, L"PerfMonInstance", L""); {
measure->objectName = value;
measure->oldValue = 0;
}
value = RmReadString(rm, L"PerfMonCounter", L"");
if (_wcsicmp(value, measure->counterName.c_str()) != 0)
{
measure->objectName = value;
measure->oldValue = 0;
}
value = RmReadString(rm, L"PerfMonInstance", L"");
if (_wcsicmp(value, measure->instanceName.c_str()) != 0)
{
measure->objectName = value;
measure->oldValue = 0;
}
measure->difference = RmReadInt(rm, L"PerfMonDifference", 1) == 1; measure->difference = RmReadInt(rm, L"PerfMonDifference", 1) == 1;
*maxValue = 0.0; *maxValue = 0.0;