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 <ole2.h> | 7 #include <ole2.h> |
8 #include <intshcut.h> | 8 #include <intshcut.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #include <urlhist.h> | 10 #include <urlhist.h> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 // Read the sort index of the current item. | 191 // Read the sort index of the current item. |
192 uint32 item_sort_index = 0; | 192 uint32 item_sort_index = 0; |
193 if (!BinaryRead(&item_sort_index, base_offset + kSortIndexOffset, blob)) | 193 if (!BinaryRead(&item_sort_index, base_offset + kSortIndexOffset, blob)) |
194 return false; | 194 return false; |
195 | 195 |
196 // Read the file name from the ITEMIDLIST structure. | 196 // Read the file name from the ITEMIDLIST structure. |
197 LPCITEMIDLIST idlist = BinaryReadItemIDList( | 197 LPCITEMIDLIST idlist = BinaryReadItemIDList( |
198 base_offset + kItemIDListOffset, item_size - kItemIDListOffset, blob); | 198 base_offset + kItemIDListOffset, item_size - kItemIDListOffset, blob); |
199 TCHAR item_filename[MAX_PATH]; | 199 TCHAR item_filename[MAX_PATH]; |
200 if (!idlist || FAILED(SHGetPathFromIDList(idlist, item_filename))) | 200 if (!idlist || !SHGetPathFromIDList(idlist, item_filename)) |
201 return false; | 201 return false; |
202 base::FilePath item_relative_path = | 202 base::FilePath item_relative_path = |
203 path.Append(base::FilePath(item_filename).BaseName()); | 203 path.Append(base::FilePath(item_filename).BaseName()); |
204 | 204 |
205 // Record the retrieved information and go to the next item. | 205 // Record the retrieved information and go to the next item. |
206 sort_index->insert(std::make_pair(item_relative_path, item_sort_index)); | 206 sort_index->insert(std::make_pair(item_relative_path, item_sort_index)); |
207 base_offset += item_size; | 207 base_offset += item_size; |
208 } | 208 } |
209 return true; | 209 return true; |
210 } | 210 } |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 static int version = -1; | 874 static int version = -1; |
875 if (version < 0) { | 875 if (version < 0) { |
876 wchar_t buffer[128]; | 876 wchar_t buffer[128]; |
877 DWORD buffer_length = sizeof(buffer); | 877 DWORD buffer_length = sizeof(buffer); |
878 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 878 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
879 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 879 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
880 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 880 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
881 } | 881 } |
882 return version; | 882 return version; |
883 } | 883 } |
OLD | NEW |