From ae7211d6b3e89a8dfc03ed502d0cfad480a0ef80 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 7 Mar 2022 15:17:32 +0100 Subject: [PATCH] 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 --- include/WinStd/ETW.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/WinStd/ETW.h b/include/WinStd/ETW.h index c3624460..4d659eef 100644 --- a/include/WinStd/ETW.h +++ b/include/WinStd/ETW.h @@ -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(reinterpret_cast(prop) + prop->LoggerNameOffset); + return reinterpret_cast(reinterpret_cast(prop) + prop->LoggerNameOffset); } ///