| 5 | |
| 6 | |
| 7 | bool TraceLoggingContext::DecodeTraceLoggingEventRecord(EVENT_RECORD* pEventRecord) |
| 8 | { |
| 9 | if (pEventRecord == nullptr) { |
| 10 | pmlog_warn("null event record pointer"); |
| 11 | return false; |
| 12 | } |
| 13 | |
| 14 | // We do not handle Windows Software Trace Preprocessor (WPP) events |
| 15 | if ((pEventRecord->EventHeader.Flags & EVENT_HEADER_FLAG_TRACE_MESSAGE) != 0) |
| 16 | { |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | if (pEventRecord->EventHeader.EventDescriptor.Opcode == EVENT_TRACE_TYPE_INFO && |
| 21 | pEventRecord->EventHeader.ProviderId == EventTraceGuid) |
| 22 | { |
| 23 | // TODO: determine if this necessary. As mentioned in the sample code |
| 24 | // the first event in every ETL file contains the data from the file header. |
| 25 | // This is the same data as was returned in the EVENT_TRACE_LOGFILEW by |
| 26 | // OpenTrace. Since we've already seen this information, we'll skip this |
| 27 | // event. |
| 28 | // In PresentMon we process ETW events in both realtime and from ETL files. |
| 29 | // Check how this works!! |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | // Reset event state |
| 34 | mpEventRecord = pEventRecord; |
| 35 | mpEventData = static_cast<BYTE const*>(mpEventRecord->UserData); |
| 36 | mpEventDataEnd = mpEventData + mpEventRecord->UserDataLength; |
| 37 | if (mpEventRecord->EventHeader.Flags & EVENT_HEADER_FLAG_32_BIT_HEADER) { |
| 38 | mPointerSize = 4; |
| 39 | } |
| 40 | else if (mpEventRecord->EventHeader.Flags & EVENT_HEADER_FLAG_64_BIT_HEADER) { |
| 41 | mPointerSize = 8; |
| 42 | } |
| 43 | else { |
| 44 | // Ambiguous, assume size of the decoder's pointer. |
| 45 | mPointerSize = sizeof(void*); |
| 46 | } |
| 47 | |
| 48 | return SetupTraceLoggingInfoBuffer(); |
| 49 | } |
| 50 | |
| 51 | bool TraceLoggingContext::SetupTraceLoggingInfoBuffer() |
| 52 | { |