Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/installer/util/compat_checks.cc

Issue 2777843002: Remove Symantec SEP compat check code -- it was never wired up. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/util/compat_checks.h ('k') | chrome/installer/util/compat_checks_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/installer/util/compat_checks.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h"
10 #include "base/win/registry.h"
11
12 namespace {
13
14 // SEP stands for Symantec End Point Protection.
15 std::wstring GetSEPVersion() {
16 const wchar_t kProductKey[] =
17 L"SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC";
18 // Versions before 11MR3 were always 32-bit, so check in the 32-bit hive.
19 base::win::RegKey key(
20 HKEY_LOCAL_MACHINE, kProductKey, KEY_READ | KEY_WOW64_32KEY);
21 std::wstring version_str;
22 key.ReadValue(L"ProductVersion", &version_str);
23 return version_str;
24 }
25
26 // The product version should be a string like "11.0.3001.2224". This function
27 // returns as params the first 3 values. Return value is false if anything
28 // does not fit the format.
29 bool ParseSEPVersion(const base::string16& version,
30 int* v0, int* v1, int* v2) {
31 std::vector<base::StringPiece16> v = base::SplitStringPiece(
32 version, L".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
33 if (v.size() != 4)
34 return false;
35 if (!base::StringToInt(v[0], v0))
36 return false;
37 if (!base::StringToInt(v[1], v1))
38 return false;
39 if (!base::StringToInt(v[2], v2))
40 return false;
41 return true;
42 }
43
44 // The incompatible versions are anything before 11MR3, which is 11.0.3001.
45 bool IsBadSEPVersion(int v0, int v1, int v2) {
46 if (v0 < 11)
47 return true;
48 if (v1 > 0)
49 return false;
50 if (v2 < 3001)
51 return true;
52 return false;
53 }
54
55 } // namespace
56
57 bool HasIncompatibleSymantecEndpointVersion(const wchar_t* version) {
58 int v0, v1, v2;
59 std::wstring ver_str(version ? version : GetSEPVersion());
60 if (!ParseSEPVersion(ver_str, &v0, &v1, &v2))
61 return false;
62 return IsBadSEPVersion(v0, v1, v2);
63 }
OLDNEW
« no previous file with comments | « chrome/installer/util/compat_checks.h ('k') | chrome/installer/util/compat_checks_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698