Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected override void BeginProcessing()
_resourceMgr = Microsoft.PowerShell.Commands.Diagnostics.Common.CommonUtilities.GetResourceManager();

uint res = _pdhHelper.ConnectToDataSource();
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
ReportPdhError(res, true);
return;
Expand Down Expand Up @@ -319,7 +319,7 @@ private void ProcessListSetPerMachine(string machine)
{
StringCollection counterSets = new StringCollection();
uint res = _pdhHelper.EnumObjects(machine, ref counterSets);
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
// add an error message
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("NoCounterSetsOnComputer"), machine, res);
Expand Down Expand Up @@ -367,7 +367,7 @@ private void ProcessListSetPerMachine(string machine)
WriteError(new ErrorRecord(exc, "CounterSetEnumAccessDenied", ErrorCategory.InvalidResult, null));
continue;
}
else if (res != 0)
else if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
ReportPdhError(res, false);
continue;
Expand Down Expand Up @@ -437,21 +437,21 @@ private void ProcessGetCounter()
CultureInfo culture = GetCurrentCulture();
List<Tuple<char, char>> characterReplacementList = null;
List<string> paths = CombineMachinesAndCounterPaths();
uint res = 0;

if (!_defaultCounters)
{
_cultureAndSpecialCharacterMap.TryGetValue(culture.Name, out characterReplacementList);
}

StringCollection allExpandedPaths = new StringCollection();
uint res;
foreach (string path in paths)
{
string localizedPath = path;
if (_defaultCounters)
{
res = _pdhHelper.TranslateLocalCounterPath(path, out localizedPath);
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
string msg = string.Format(CultureInfo.CurrentCulture, _resourceMgr.GetString("CounterPathTranslationFailed"), res);
Exception exc = new Exception(msg);
Expand All @@ -470,7 +470,7 @@ private void ProcessGetCounter()

StringCollection expandedPaths;
res = _pdhHelper.ExpandWildCardPath(localizedPath, out expandedPaths);
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
WriteDebug("Could not expand path " + localizedPath);
ReportPdhError(res, false);
Expand Down Expand Up @@ -498,13 +498,13 @@ private void ProcessGetCounter()
}

res = _pdhHelper.OpenQuery();
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
ReportPdhError(res, false);
}

res = _pdhHelper.AddCounters(ref allExpandedPaths, true);
if (res != 0)
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
ReportPdhError(res, true);

Expand All @@ -526,7 +526,7 @@ private void ProcessGetCounter()
// read the first set just to get the initial values
res = _pdhHelper.ReadNextSet(out nextSet, bSkip);

if (res == 0)
if (res == PdhResults.PDH_CSTATUS_VALID_DATA)
{
// Display valid data
if (!bSkip)
Expand Down
Loading