Silence false CodeQL issue and update event_session::name() doc

LoggerNameOffset represents offset (in bytes) from the start of the prop
to the beginning of the null-terminated string that contains the session
name. Hence, the prop must be cast from EVENT_TRACE_PROPERTIES* to char*
or BYTE* first, to calculate address properly.

Reference: https://docs.microsoft.com/en-us/windows/win32/api/evntrace/ns-evntrace-event_trace_properties
Fixes: #1
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2022-03-07 15:17:32 +01:00
parent 013e6b1625
commit ae7211d6b3

View File

@ -790,14 +790,14 @@ namespace winstd
}
///
/// Auto-typecasting operator
/// Gets session name
///
/// \return Session properties
/// \return Session name
///
LPCTSTR name() const
{
const EVENT_TRACE_PROPERTIES *prop = m_prop.get();
return reinterpret_cast<LPCTSTR>(reinterpret_cast<const char*>(prop) + prop->LoggerNameOffset);
return reinterpret_cast<LPCTSTR>(reinterpret_cast<LPCBYTE>(prop) + prop->LoggerNameOffset);
}
///