| 31 | |
| 32 | template<typename T> |
| 33 | void GetStringPropertyInfo(TRACE_EVENT_INFO const& tei, EVENT_RECORD const& eventRecord, uint32_t index, uint32_t offset, |
| 34 | PropertyInfo* info) |
| 35 | { |
| 36 | auto const& epi = tei.EventPropertyInfoArray[index]; |
| 37 | |
| 38 | if ((epi.Flags & PropertyParamLength) != 0) { |
| 39 | assert(false); // TODO: just not implemented yet |
| 40 | info->size_ = 0; |
| 41 | } else if (epi.length != 0) { |
| 42 | info->size_ = epi.length * sizeof(T); |
| 43 | } else { |
| 44 | if (offset == UINT32_MAX) { |
| 45 | offset = GetPropertyDataOffset(tei, eventRecord, index); |
| 46 | assert(offset <= eventRecord.UserDataLength); |
| 47 | } |
| 48 | |
| 49 | for (uint32_t size = 0;; size += sizeof(T)) { |
| 50 | if (offset + size > eventRecord.UserDataLength) { |
| 51 | // string ends at end of block, possibly ok (see note above) |
| 52 | // paranoia check addressing coverity issue, likely not relevant |
| 53 | assert(size >= sizeof(T)); |
| 54 | info->size_ = size - sizeof(T); |
| 55 | break; |
| 56 | } |
| 57 | if (*(T const*) ((uintptr_t) eventRecord.UserData + offset + size) == (T) 0) { |
| 58 | info->status_ |= PROP_STATUS_NULL_TERMINATED; |
| 59 | info->size_ = size + sizeof(T); |
| 60 | break; |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | PropertyInfo GetPropertyInfo(TRACE_EVENT_INFO const& tei, EVENT_RECORD const& eventRecord, uint32_t index, uint32_t offset) |
| 67 | { |
nothing calls this directly
no test coverage detected