Trace information (e.g., TRACE_PROVIDER_INFO) is provided in memory blocks where string members are specified as an offset from the base of the allocation. NOTE: in practice, some fields have tailing spaces (in particular Event::opcodeName_ and Event::layerName_ are typical) so we strip those here too.
| 78 | // Event::opcodeName_ and Event::layerName_ are typical) so we strip those here |
| 79 | // too. |
| 80 | wchar_t const* GetStringPtr(void* base, ULONG offset) |
| 81 | { |
| 82 | wchar_t* s = nullptr; |
| 83 | if (offset > 0) { |
| 84 | s = (wchar_t*) ((uintptr_t) base + offset); |
| 85 | for (auto n = wcslen(s); n-- && s[n] == L' '; ) { |
| 86 | s[n] = '\0'; |
| 87 | } |
| 88 | } |
| 89 | return s; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | // ---------------------------------------------------------------------------- |
no outgoing calls
no test coverage detected