OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" | 5 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" |
6 | 6 |
7 #include <iwscapi.h> | 7 #include <iwscapi.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <wbemidl.h> | 9 #include <wbemidl.h> |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 if (FAILED(hr)) | 343 if (FAILED(hr)) |
344 return RESULT_FAILED_TO_CREATE_INSTANCE; | 344 return RESULT_FAILED_TO_CREATE_INSTANCE; |
345 | 345 |
346 base::win::ScopedComPtr<IWbemServices> wmi_services; | 346 base::win::ScopedComPtr<IWbemServices> wmi_services; |
347 hr = wmi_locator->ConnectServer( | 347 hr = wmi_locator->ConnectServer( |
348 base::win::ScopedBstr(L"ROOT\\SecurityCenter2"), nullptr, nullptr, | 348 base::win::ScopedBstr(L"ROOT\\SecurityCenter2"), nullptr, nullptr, |
349 nullptr, 0, nullptr, nullptr, wmi_services.Receive()); | 349 nullptr, 0, nullptr, nullptr, wmi_services.Receive()); |
350 if (FAILED(hr)) | 350 if (FAILED(hr)) |
351 return RESULT_FAILED_TO_CONNECT_TO_WMI; | 351 return RESULT_FAILED_TO_CONNECT_TO_WMI; |
352 | 352 |
353 hr = ::CoSetProxyBlanket(wmi_services.get(), RPC_C_AUTHN_WINNT, | 353 hr = ::CoSetProxyBlanket(wmi_services.Get(), RPC_C_AUTHN_WINNT, |
354 RPC_C_AUTHZ_NONE, nullptr, RPC_C_AUTHN_LEVEL_CALL, | 354 RPC_C_AUTHZ_NONE, nullptr, RPC_C_AUTHN_LEVEL_CALL, |
355 RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE); | 355 RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE); |
356 if (FAILED(hr)) | 356 if (FAILED(hr)) |
357 return RESULT_FAILED_TO_SET_SECURITY_BLANKET; | 357 return RESULT_FAILED_TO_SET_SECURITY_BLANKET; |
358 | 358 |
359 // This interface is available on Windows Vista and above, and is officially | 359 // This interface is available on Windows Vista and above, and is officially |
360 // undocumented. | 360 // undocumented. |
361 base::win::ScopedBstr query_language(L"WQL"); | 361 base::win::ScopedBstr query_language(L"WQL"); |
362 base::win::ScopedBstr query(L"SELECT * FROM AntiVirusProduct"); | 362 base::win::ScopedBstr query(L"SELECT * FROM AntiVirusProduct"); |
363 base::win::ScopedComPtr<IEnumWbemClassObject> enumerator; | 363 base::win::ScopedComPtr<IEnumWbemClassObject> enumerator; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 std::string product_name("Trusteer Endpoint Protection"); | 498 std::string product_name("Trusteer Endpoint Protection"); |
499 if (ShouldReportFullNames()) { | 499 if (ShouldReportFullNames()) { |
500 av_product.set_product_name(product_name); | 500 av_product.set_product_name(product_name); |
501 av_product.set_product_version(product_version); | 501 av_product.set_product_version(product_version); |
502 } | 502 } |
503 av_product.set_product_name_hash(metrics::HashName(product_name)); | 503 av_product.set_product_name_hash(metrics::HashName(product_name)); |
504 av_product.set_product_version_hash(metrics::HashName(product_version)); | 504 av_product.set_product_version_hash(metrics::HashName(product_version)); |
505 | 505 |
506 products->push_back(av_product); | 506 products->push_back(av_product); |
507 } | 507 } |
OLD | NEW |