| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utility/importer/ie_importer_win.h" | 5 #include "chrome/utility/importer/ie_importer_win.h" |
| 6 | 6 |
| 7 #include <objbase.h> | 7 #include <objbase.h> |
| 8 #include <ole2.h> | 8 #include <ole2.h> |
| 9 #include <intshcut.h> | 9 #include <intshcut.h> |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 HMODULE pstorec_dll = LoadLibrary(L"pstorec.dll"); | 583 HMODULE pstorec_dll = LoadLibrary(L"pstorec.dll"); |
| 584 if (!pstorec_dll) | 584 if (!pstorec_dll) |
| 585 return; | 585 return; |
| 586 PStoreCreateFunc PStoreCreateInstance = | 586 PStoreCreateFunc PStoreCreateInstance = |
| 587 (PStoreCreateFunc)GetProcAddress(pstorec_dll, "PStoreCreateInstance"); | 587 (PStoreCreateFunc)GetProcAddress(pstorec_dll, "PStoreCreateInstance"); |
| 588 if (!PStoreCreateInstance) { | 588 if (!PStoreCreateInstance) { |
| 589 FreeLibrary(pstorec_dll); | 589 FreeLibrary(pstorec_dll); |
| 590 return; | 590 return; |
| 591 } | 591 } |
| 592 | 592 |
| 593 base::win::ScopedComPtr<IPStore, &IID_IPStore> pstore; | 593 base::win::ScopedComPtr<IPStore> pstore; |
| 594 HRESULT result = PStoreCreateInstance(pstore.GetAddressOf(), 0, 0, 0); | 594 HRESULT result = PStoreCreateInstance(pstore.GetAddressOf(), 0, 0, 0); |
| 595 if (result != S_OK) { | 595 if (result != S_OK) { |
| 596 FreeLibrary(pstorec_dll); | 596 FreeLibrary(pstorec_dll); |
| 597 return; | 597 return; |
| 598 } | 598 } |
| 599 | 599 |
| 600 std::vector<AutoCompleteInfo> ac_list; | 600 std::vector<AutoCompleteInfo> ac_list; |
| 601 | 601 |
| 602 // Enumerates AutoComplete items in the protected database. | 602 // Enumerates AutoComplete items in the protected database. |
| 603 base::win::ScopedComPtr<IEnumPStoreItems, &IID_IEnumPStoreItems> item; | 603 base::win::ScopedComPtr<IEnumPStoreItems> item; |
| 604 result = pstore->EnumItems(0, &AutocompleteGUID, &AutocompleteGUID, 0, | 604 result = pstore->EnumItems(0, &AutocompleteGUID, &AutocompleteGUID, 0, |
| 605 item.GetAddressOf()); | 605 item.GetAddressOf()); |
| 606 if (result != PST_E_OK) { | 606 if (result != PST_E_OK) { |
| 607 pstore.Reset(); | 607 pstore.Reset(); |
| 608 FreeLibrary(pstorec_dll); | 608 FreeLibrary(pstorec_dll); |
| 609 return; | 609 return; |
| 610 } | 610 } |
| 611 | 611 |
| 612 wchar_t* item_name; | 612 wchar_t* item_name; |
| 613 while (!cancelled() && SUCCEEDED(item->Next(1, &item_name, 0))) { | 613 while (!cancelled() && SUCCEEDED(item->Next(1, &item_name, 0))) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 static int version = -1; | 913 static int version = -1; |
| 914 if (version < 0) { | 914 if (version < 0) { |
| 915 wchar_t buffer[128]; | 915 wchar_t buffer[128]; |
| 916 DWORD buffer_length = sizeof(buffer); | 916 DWORD buffer_length = sizeof(buffer); |
| 917 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 917 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
| 918 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 918 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
| 919 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 919 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
| 920 } | 920 } |
| 921 return version; | 921 return version; |
| 922 } | 922 } |
| OLD | NEW |