OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/installer/util/wmi.h" | 5 #include "chrome/installer/util/wmi.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> |
8 #include <stdint.h> | 9 #include <stdint.h> |
9 | 10 |
10 #include "base/win/scoped_bstr.h" | 11 #include "base/win/scoped_bstr.h" |
11 #include "base/win/scoped_comptr.h" | 12 #include "base/win/scoped_comptr.h" |
12 #include "base/win/scoped_variant.h" | 13 #include "base/win/scoped_variant.h" |
13 | 14 |
14 using base::win::ScopedVariant; | 15 using base::win::ScopedVariant; |
15 | 16 |
16 namespace installer { | 17 namespace installer { |
17 | 18 |
18 bool WMI::CreateLocalConnection(bool set_blanket, | 19 bool WMI::CreateLocalConnection(bool set_blanket, |
19 IWbemServices** wmi_services) { | 20 IWbemServices** wmi_services) { |
20 base::win::ScopedComPtr<IWbemLocator> wmi_locator; | 21 base::win::ScopedComPtr<IWbemLocator> wmi_locator; |
21 HRESULT hr = wmi_locator.CreateInstance(CLSID_WbemLocator, NULL, | 22 HRESULT hr = ::CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, |
22 CLSCTX_INPROC_SERVER); | 23 IID_PPV_ARGS(&wmi_locator)); |
23 if (FAILED(hr)) | 24 if (FAILED(hr)) |
24 return false; | 25 return false; |
25 | 26 |
26 base::win::ScopedComPtr<IWbemServices> wmi_services_r; | 27 base::win::ScopedComPtr<IWbemServices> wmi_services_r; |
27 hr = wmi_locator->ConnectServer(base::win::ScopedBstr(L"ROOT\\CIMV2"), NULL, | 28 hr = wmi_locator->ConnectServer(base::win::ScopedBstr(L"ROOT\\CIMV2"), NULL, |
28 NULL, 0, NULL, 0, 0, | 29 NULL, 0, NULL, 0, 0, |
29 wmi_services_r.GetAddressOf()); | 30 wmi_services_r.GetAddressOf()); |
30 if (FAILED(hr)) | 31 if (FAILED(hr)) |
31 return false; | 32 return false; |
32 | 33 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (model.type() == VT_BSTR) | 164 if (model.type() == VT_BSTR) |
164 model_string += L" "; | 165 model_string += L" "; |
165 } | 166 } |
166 if (model.type() == VT_BSTR) | 167 if (model.type() == VT_BSTR) |
167 model_string += V_BSTR(model.ptr()); | 168 model_string += V_BSTR(model.ptr()); |
168 | 169 |
169 return model_string; | 170 return model_string; |
170 } | 171 } |
171 | 172 |
172 } // namespace installer | 173 } // namespace installer |
OLD | NEW |