This aligns the class with other COM classes (see com_obj) and makes
client code simpler as it does not need to check for error explicitly.
Signed-off-by: Simon Rozman <simon@rozman.si>
Upper levels usually just catch std::exception and display what()
message to the user. Rather than requiring typed exception catching and
per-type user message synthesis, it's easier for upper levels if we
stuff the Windows/Winsock2 formatted error message at the end of the
string returned by what() and leave the catch (std::exception&) do the
magic.
Signed-off-by: Simon Rozman <simon@rozman.si>
An exception can be way more elaborate why duplication failed and it
doesn't require consistent checking for result.
Signed-off-by: Simon Rozman <simon@rozman.si>
When using winstd::com_obj<> as a member of another class and we want
to create an instance of the object in another class' constructor, this
comes convenient.
Signed-off-by: Simon Rozman <simon@rozman.si>
Documentation says hInstall may be NULL "in which case only the record
field parameters are processed and properties are not available for
substitution."
Signed-off-by: Simon Rozman <simon@rozman.si>
When used in place of void*, typecasting is redundant. In other
situations use reinterpret_cast<true type>() rather than C-style
typecasting.
Signed-off-by: Simon Rozman <simon@rozman.si>
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_propertiesFixes: #1
Signed-off-by: Simon Rozman <simon@rozman.si>
Other than having a convenient framework to test our helpers, this
allows CodeQL code analysis GitHub action.
Signed-off-by: Simon Rozman <simon@rozman.si>