Output error text when event information retrieval fails

In some cases Event Monitor reported blank event text. I am suspecting
the TdhGetEventInformation() fails for some reason resulting in a silent
failure to return event text.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-06-23 13:04:46 +02:00
parent d113388a69
commit dd9cd83400

View File

@ -608,7 +608,9 @@ wxString wxETWListCtrl::OnGetItemText(const winstd::event_rec &rec, long column)
// Get event meta-info.
unique_ptr<TRACE_EVENT_INFO> info;
ULONG ulResult;
if ((ulResult = TdhGetEventInformation((PEVENT_RECORD)&rec, 0, NULL, info)) == ERROR_SUCCESS) {
if ((ulResult = TdhGetEventInformation((PEVENT_RECORD)&rec, 0, NULL, info)) != ERROR_SUCCESS)
return tstring_printf(_T("(Error getting event information (error %u))"), ulResult).c_str();
if (info->DecodingSource != DecodingSourceWPP) {
if (rec.EventHeader.Flags & EVENT_HEADER_FLAG_STRING_ONLY) {
// This is a string-only event. Print it.
@ -637,7 +639,6 @@ wxString wxETWListCtrl::OnGetItemText(const winstd::event_rec &rec, long column)
}
}
}
}
return wxEmptyString;
}
@ -1059,7 +1060,7 @@ static tstring PropertyToString(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, U
// Get the size of the array if the property is an array.
ULONG ulArraySize = 0;
if ((ulResult = GetArraySize(pEvent, pInfo, ulPropIndex, &ulArraySize)) != ERROR_SUCCESS)
return tstring_printf(_T("(Error getting array size (error %u))"), ulResult);;
return tstring_printf(_T("(Error getting array size (error %u))"), ulResult);
tstring out;
bool out_nonfirst = false;