From f95479b981b41f51a3ecf055c73f42440766e5d7 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 18 Jul 2019 22:35:12 -0400 Subject: log guid for security products --- src/shared/util.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'src/shared/util.cpp') diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 441b64bd..4ee4b766 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -1264,7 +1264,7 @@ std::vector Environment::getSecurityProductsFromWMI() const map.insert({ guid, - {QString::fromStdWString(name), provider, active, upToDate}}); + {guid, QString::fromStdWString(name), provider, active, upToDate}}); }; { @@ -1334,7 +1334,7 @@ std::optional Environment::getWindowsFirewall() const } return SecurityProduct( - "Windows Firewall", WSC_SECURITY_PROVIDER_FIREWALL, true, true); + {}, "Windows Firewall", WSC_SECURITY_PROVIDER_FIREWALL, true, true); } @@ -1907,9 +1907,9 @@ std::optional WindowsInfo::getElevated() const SecurityProduct::SecurityProduct( - QString name, int provider, + QUuid guid, QString name, int provider, bool active, bool upToDate) : - m_name(std::move(name)), m_provider(provider), + m_guid(std::move(guid)), m_name(std::move(name)), m_provider(provider), m_active(active), m_upToDate(upToDate) { } @@ -1938,10 +1938,27 @@ QString SecurityProduct::toString() const { QString s; - s += m_name + " "; + s += m_name + " (" + providerToString() + ")"; + if (!m_active) { + s += ", inactive"; + } + + if (!m_upToDate) { + s += ", definitions outdated"; + } + + if (!m_guid.isNull()) { + s += ", " + m_guid.toString(QUuid::QUuid::WithoutBraces); + } + + return s; +} +QString SecurityProduct::providerToString() const +{ QStringList ps; + if (m_provider & WSC_SECURITY_PROVIDER_FIREWALL) { ps.push_back("firewall"); } @@ -1971,20 +1988,10 @@ QString SecurityProduct::toString() const } if (ps.empty()) { - s += "(doesn't provide anything)"; - } else { - s += "(" + ps.join("|") + ")"; - } - - if (!m_active) { - s += ", inactive"; - } - - if (!m_upToDate) { - s += ", definitions outdated"; + return "doesn't provider anything"; } - return s; + return ps.join("|"); } -- cgit v1.3.1