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

Side by Side Diff: base/firewall_product_detection.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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 | « base/firewall_product_detection.h ('k') | base/firewall_product_detection_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 2006-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include "omaha/base/firewall_product_detection.h"
17 #include "omaha/base/debug.h"
18 #include "omaha/base/logging.h"
19 #include "omaha/base/reg_key.h"
20 #include "omaha/base/utils.h"
21 #include "omaha/base/wmi_query.h"
22
23 namespace omaha {
24
25 namespace firewall_detection {
26
27 namespace {
28
29 const TCHAR kWmiSecurityCenter[] = _T("root\\SecurityCenter");
30 const TCHAR kWmiQueryFirewallProduct[] = _T("select * from FirewallProduct");
31 const TCHAR kWmiPropDisplayName[] = _T("displayName");
32 const TCHAR kWmiPropVersionNumber[] = _T("versionNumber");
33
34 } // namespace
35
36
37 HRESULT Detect(CString* name, CString* version) {
38 ASSERT1(name);
39 ASSERT1(version);
40
41 name->Empty();
42 version->Empty();
43
44 WmiQuery wmi_query;
45 HRESULT hr = wmi_query.Connect(kWmiSecurityCenter);
46 if (FAILED(hr)) {
47 return hr;
48 }
49 hr = wmi_query.Query(kWmiQueryFirewallProduct);
50 if (FAILED(hr)) {
51 return hr;
52 }
53 if (wmi_query.AtEnd()) {
54 return E_FAIL;
55 }
56 hr = wmi_query.GetValue(kWmiPropDisplayName, name);
57 if (FAILED(hr)) {
58 return hr;
59 }
60 wmi_query.GetValue(kWmiPropVersionNumber, version);
61 return S_OK;
62 }
63
64 } // namespace firewall_detection
65
66 } // namespace omaha
67
OLDNEW
« no previous file with comments | « base/firewall_product_detection.h ('k') | base/firewall_product_detection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698