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

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

Issue 24015: Test for Symantec SEP... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
« 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) 2006-2009 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/registry.h"
8 #include "base/string_util.h"
9
10 namespace {
11
12 // SEP stands for Symantec End Point Protection.
13 std::wstring GetSEPVersion() {
14 const wchar_t kProductKey[] =
15 L"SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC";
16 RegKey key(HKEY_LOCAL_MACHINE, kProductKey, KEY_READ);
17 std::wstring version_str;
18 key.ReadValue(L"ProductVersion", &version_str);
19 return version_str;
20 }
21
22 // The product version should be a string like "11.0.3001.2224". This function
23 // returns as params the first 3 values. Return value is false if anything
24 // does not fit the format.
25 bool ParseSEPVersion(const std::wstring& version, int* v0, int* v1, int* v2) {
26 std::vector<std::wstring> v;
27 SplitString(version, L'.', &v);
28 if (v.size() != 4)
29 return false;
30 if (!StringToInt(v[0], v0))
31 return false;
32 if (!StringToInt(v[1], v1))
33 return false;
34 if (!StringToInt(v[2], v2))
35 return false;
36 return true;
37 }
38
39 // The incompatible versions are anything before 11MR3, which is 11.0.3001.
40 bool IsBadSEPVersion(int v0, int v1, int v2) {
41 if (v0 < 11)
42 return true;
43 if (v1 > 0)
44 return false;
45 if (v2 < 3001)
46 return true;
47 return false;
48 }
49
50 } // namespace
51
52 bool HasIncompatibleSymantecEndpointVersion(const wchar_t* version) {
53 int v0, v1, v2;
54 std::wstring ver_str(version ? version : GetSEPVersion());
55 if (!ParseSEPVersion(ver_str, &v0, &v1, &v2))
56 return false;
57 return IsBadSEPVersion(v0, v1, v2);
58 }
59
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