This source file includes following definitions.
- GetSEPVersion
- ParseSEPVersion
- IsBadSEPVersion
- HasIncompatibleSymantecEndpointVersion
#include "chrome/installer/util/compat_checks.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/win/registry.h"
namespace {
std::wstring GetSEPVersion() {
const wchar_t kProductKey[] =
L"SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC";
base::win::RegKey key(HKEY_LOCAL_MACHINE, kProductKey, KEY_READ);
std::wstring version_str;
key.ReadValue(L"ProductVersion", &version_str);
return version_str;
}
bool ParseSEPVersion(const std::wstring& version, int* v0, int* v1, int* v2) {
std::vector<std::wstring> v;
base::SplitString(version, L'.', &v);
if (v.size() != 4)
return false;
if (!base::StringToInt(v[0], v0))
return false;
if (!base::StringToInt(v[1], v1))
return false;
if (!base::StringToInt(v[2], v2))
return false;
return true;
}
bool IsBadSEPVersion(int v0, int v1, int v2) {
if (v0 < 11)
return true;
if (v1 > 0)
return false;
if (v2 < 3001)
return true;
return false;
}
}
bool HasIncompatibleSymantecEndpointVersion(const wchar_t* version) {
int v0, v1, v2;
std::wstring ver_str(version ? version : GetSEPVersion());
if (!ParseSEPVersion(ver_str, &v0, &v1, &v2))
return false;
return IsBadSEPVersion(v0, v1, v2);
}