MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / GetStringPtr

Function GetStringPtr

Tools/etw_list/etw_list.cpp:80–90  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

78// Event::opcodeName_ and Event::layerName_ are typical) so we strip those here
79// too.
80wchar_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// ----------------------------------------------------------------------------

Callers 7

ProviderMethod · 0.85
EventPropertyMethod · 0.85
EventMethod · 0.85
EnumerateSystemEventsFunction · 0.85
EventRecordCallbackFunction · 0.85
PrintEnumFunction · 0.85
wmainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected