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

Side by Side Diff: chrome/utility/importer/ie_importer_win.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « chrome/utility/importer/ie_importer_win.h ('k') | chrome/utility/importer/importer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h>
10 #include <urlhist.h> 11 #include <urlhist.h>
11 #include <wininet.h> 12 #include <wininet.h>
12 13
13 #include <algorithm> 14 #include <algorithm>
14 #include <map> 15 #include <map>
15 #include <string> 16 #include <string>
16 #include <vector> 17 #include <vector>
17 18
18 #include "base/files/file_enumerator.h" 19 #include "base/files/file_enumerator.h"
19 #include "base/files/file_path.h" 20 #include "base/files/file_path.h"
20 #include "base/files/file_util.h" 21 #include "base/files/file_util.h"
22 #include "base/macros.h"
21 #include "base/strings/string16.h" 23 #include "base/strings/string16.h"
22 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
23 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
25 #include "base/time/time.h" 27 #include "base/time/time.h"
26 #include "base/win/registry.h" 28 #include "base/win/registry.h"
27 #include "base/win/scoped_co_mem.h" 29 #include "base/win/scoped_co_mem.h"
28 #include "base/win/scoped_comptr.h" 30 #include "base/win/scoped_comptr.h"
29 #include "base/win/scoped_handle.h" 31 #include "base/win/scoped_handle.h"
30 #include "base/win/scoped_propvariant.h" 32 #include "base/win/scoped_propvariant.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL)); 75 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL));
74 FILETIME creation_filetime; 76 FILETIME creation_filetime;
75 if (!file_handle.IsValid()) 77 if (!file_handle.IsValid())
76 return creation_time; 78 return creation_time;
77 if (GetFileTime(file_handle.Get(), &creation_filetime, NULL, NULL)) 79 if (GetFileTime(file_handle.Get(), &creation_filetime, NULL, NULL))
78 creation_time = base::Time::FromFileTime(creation_filetime); 80 creation_time = base::Time::FromFileTime(creation_filetime);
79 return creation_time; 81 return creation_time;
80 } 82 }
81 83
82 // Safely read an object of type T from a raw sequence of bytes. 84 // Safely read an object of type T from a raw sequence of bytes.
83 template<typename T> 85 template <typename T>
84 bool BinaryRead(T* data, size_t offset, const std::vector<uint8>& blob) { 86 bool BinaryRead(T* data, size_t offset, const std::vector<uint8_t>& blob) {
85 if (offset + sizeof(T) > blob.size()) 87 if (offset + sizeof(T) > blob.size())
86 return false; 88 return false;
87 memcpy(data, &blob[offset], sizeof(T)); 89 memcpy(data, &blob[offset], sizeof(T));
88 return true; 90 return true;
89 } 91 }
90 92
91 // Safely read an ITEMIDLIST from a raw sequence of bytes. 93 // Safely read an ITEMIDLIST from a raw sequence of bytes.
92 // 94 //
93 // An ITEMIDLIST is a list of SHITEMIDs, terminated by a SHITEMID with 95 // An ITEMIDLIST is a list of SHITEMIDs, terminated by a SHITEMID with
94 // .cb = 0. Here, before simply casting &blob[offset] to LPITEMIDLIST, 96 // .cb = 0. Here, before simply casting &blob[offset] to LPITEMIDLIST,
95 // we verify that the list structure is not overrunning the boundary of 97 // we verify that the list structure is not overrunning the boundary of
96 // the binary blob. 98 // the binary blob.
97 LPCITEMIDLIST BinaryReadItemIDList(size_t offset, size_t idlist_size, 99 LPCITEMIDLIST BinaryReadItemIDList(size_t offset,
98 const std::vector<uint8>& blob) { 100 size_t idlist_size,
101 const std::vector<uint8_t>& blob) {
99 size_t head = 0; 102 size_t head = 0;
100 while (true) { 103 while (true) {
101 // Use a USHORT instead of SHITEMID to avoid buffer over read. 104 // Use a USHORT instead of SHITEMID to avoid buffer over read.
102 USHORT id_cb; 105 USHORT id_cb;
103 if (head >= idlist_size || !BinaryRead(&id_cb, offset + head, blob)) 106 if (head >= idlist_size || !BinaryRead(&id_cb, offset + head, blob))
104 return NULL; 107 return NULL;
105 if (id_cb == 0) 108 if (id_cb == 0)
106 break; 109 break;
107 head += id_cb; 110 head += id_cb;
108 } 111 }
109 return reinterpret_cast<LPCITEMIDLIST>(&blob[offset]); 112 return reinterpret_cast<LPCITEMIDLIST>(&blob[offset]);
110 } 113 }
111 114
112 // Compares the two bookmarks in the order of IE's Favorites menu. 115 // Compares the two bookmarks in the order of IE's Favorites menu.
113 // Returns true if rhs should come later than lhs (lhs < rhs). 116 // Returns true if rhs should come later than lhs (lhs < rhs).
114 struct IEOrderBookmarkComparator { 117 struct IEOrderBookmarkComparator {
115 bool operator()(const ImportedBookmarkEntry& lhs, 118 bool operator()(const ImportedBookmarkEntry& lhs,
116 const ImportedBookmarkEntry& rhs) const { 119 const ImportedBookmarkEntry& rhs) const {
117 static const uint32 kNotSorted = 0xfffffffb; // IE uses this magic value. 120 static const uint32_t kNotSorted = 0xfffffffb; // IE uses this magic value.
118 base::FilePath lhs_prefix; 121 base::FilePath lhs_prefix;
119 base::FilePath rhs_prefix; 122 base::FilePath rhs_prefix;
120 for (size_t i = 0; i <= lhs.path.size() && i <= rhs.path.size(); ++i) { 123 for (size_t i = 0; i <= lhs.path.size() && i <= rhs.path.size(); ++i) {
121 const base::FilePath::StringType lhs_i = 124 const base::FilePath::StringType lhs_i =
122 (i < lhs.path.size() ? lhs.path[i] : lhs.title + L".url"); 125 (i < lhs.path.size() ? lhs.path[i] : lhs.title + L".url");
123 const base::FilePath::StringType rhs_i = 126 const base::FilePath::StringType rhs_i =
124 (i < rhs.path.size() ? rhs.path[i] : rhs.title + L".url"); 127 (i < rhs.path.size() ? rhs.path[i] : rhs.title + L".url");
125 lhs_prefix = lhs_prefix.Append(lhs_i); 128 lhs_prefix = lhs_prefix.Append(lhs_i);
126 rhs_prefix = rhs_prefix.Append(rhs_i); 129 rhs_prefix = rhs_prefix.Append(rhs_i);
127 if (lhs_i == rhs_i) 130 if (lhs_i == rhs_i)
128 continue; 131 continue;
129 // The first path element that differs between the two. 132 // The first path element that differs between the two.
130 std::map<base::FilePath, uint32>::const_iterator lhs_iter = 133 std::map<base::FilePath, uint32_t>::const_iterator lhs_iter =
131 sort_index_->find(lhs_prefix); 134 sort_index_->find(lhs_prefix);
132 std::map<base::FilePath, uint32>::const_iterator rhs_iter = 135 std::map<base::FilePath, uint32_t>::const_iterator rhs_iter =
133 sort_index_->find(rhs_prefix); 136 sort_index_->find(rhs_prefix);
134 uint32 lhs_sort_index = (lhs_iter == sort_index_->end() ? kNotSorted 137 uint32_t lhs_sort_index =
135 : lhs_iter->second); 138 (lhs_iter == sort_index_->end() ? kNotSorted : lhs_iter->second);
136 uint32 rhs_sort_index = (rhs_iter == sort_index_->end() ? kNotSorted 139 uint32_t rhs_sort_index =
137 : rhs_iter->second); 140 (rhs_iter == sort_index_->end() ? kNotSorted : rhs_iter->second);
138 if (lhs_sort_index != rhs_sort_index) 141 if (lhs_sort_index != rhs_sort_index)
139 return lhs_sort_index < rhs_sort_index; 142 return lhs_sort_index < rhs_sort_index;
140 // If they have the same sort order, sort alphabetically. 143 // If they have the same sort order, sort alphabetically.
141 return lhs_i < rhs_i; 144 return lhs_i < rhs_i;
142 } 145 }
143 return lhs.path.size() < rhs.path.size(); 146 return lhs.path.size() < rhs.path.size();
144 } 147 }
145 const std::map<base::FilePath, uint32>* sort_index_; 148 const std::map<base::FilePath, uint32_t>* sort_index_;
146 }; 149 };
147 150
148 // IE stores the order of the Favorites menu in registry under: 151 // IE stores the order of the Favorites menu in registry under:
149 // HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites. 152 // HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites.
150 // The folder hierarchy of Favorites menu is directly mapped to the key 153 // The folder hierarchy of Favorites menu is directly mapped to the key
151 // hierarchy in the registry. 154 // hierarchy in the registry.
152 // 155 //
153 // If the order of the items in a folder is customized by user, the order is 156 // If the order of the items in a folder is customized by user, the order is
154 // recorded in the REG_BINARY value named "Order" of the corresponding key. 157 // recorded in the REG_BINARY value named "Order" of the corresponding key.
155 // The content of the "Order" value is a raw binary dump of an array of the 158 // The content of the "Order" value is a raw binary dump of an array of the
156 // following data structure 159 // following data structure
157 // struct { 160 // struct {
158 // uint32 size; // Note that ITEMIDLIST is variably-sized. 161 // uint32_t size; // Note that ITEMIDLIST is variably-sized.
159 // uint32 sort_index; // 0 means this is the first item, 1 the second, ... 162 // uint32_t sort_index; // 0 means this is the first item, 1 the second,
163 // ...
160 // ITEMIDLIST item_id; 164 // ITEMIDLIST item_id;
161 // }; 165 // };
162 // where each item_id should correspond to a favorites link file (*.url) in 166 // where each item_id should correspond to a favorites link file (*.url) in
163 // the current folder. 167 // the current folder.
164 // gcc, in its infinite wisdom, only allows WARN_UNUSED_RESULT for prototypes. 168 // gcc, in its infinite wisdom, only allows WARN_UNUSED_RESULT for prototypes.
165 // Clang, to be compatible with gcc, warns if WARN_UNUSED_RESULT is used in a 169 // Clang, to be compatible with gcc, warns if WARN_UNUSED_RESULT is used in a
166 // non-gcc compatible manner (-Wgcc-compat). So even though gcc isn't used to 170 // non-gcc compatible manner (-Wgcc-compat). So even though gcc isn't used to
167 // build on Windows, declare some prototypes anyway to satisfy Clang's gcc 171 // build on Windows, declare some prototypes anyway to satisfy Clang's gcc
168 // compatibility warnings. 172 // compatibility warnings.
169 bool ParseFavoritesOrderBlob(const Importer* importer, 173 bool ParseFavoritesOrderBlob(const Importer* importer,
170 const std::vector<uint8>& blob, 174 const std::vector<uint8_t>& blob,
171 const base::FilePath& path, 175 const base::FilePath& path,
172 std::map<base::FilePath, uint32>* sort_index) 176 std::map<base::FilePath, uint32_t>* sort_index)
173 WARN_UNUSED_RESULT; 177 WARN_UNUSED_RESULT;
174 bool ParseFavoritesOrderBlob(const Importer* importer, 178 bool ParseFavoritesOrderBlob(const Importer* importer,
175 const std::vector<uint8>& blob, 179 const std::vector<uint8_t>& blob,
176 const base::FilePath& path, 180 const base::FilePath& path,
177 std::map<base::FilePath, uint32>* sort_index) { 181 std::map<base::FilePath, uint32_t>* sort_index) {
178 static const int kItemCountOffset = 16; 182 static const int kItemCountOffset = 16;
179 static const int kItemListStartOffset = 20; 183 static const int kItemListStartOffset = 20;
180 184
181 // Read the number of items. 185 // Read the number of items.
182 uint32 item_count = 0; 186 uint32_t item_count = 0;
183 if (!BinaryRead(&item_count, kItemCountOffset, blob)) 187 if (!BinaryRead(&item_count, kItemCountOffset, blob))
184 return false; 188 return false;
185 189
186 // Traverse over the items. 190 // Traverse over the items.
187 size_t base_offset = kItemListStartOffset; 191 size_t base_offset = kItemListStartOffset;
188 for (uint32 i = 0; i < item_count && !importer->cancelled(); ++i) { 192 for (uint32_t i = 0; i < item_count && !importer->cancelled(); ++i) {
189 static const int kSizeOffset = 0; 193 static const int kSizeOffset = 0;
190 static const int kSortIndexOffset = 4; 194 static const int kSortIndexOffset = 4;
191 static const int kItemIDListOffset = 8; 195 static const int kItemIDListOffset = 8;
192 196
193 // Read the size (number of bytes) of the current item. 197 // Read the size (number of bytes) of the current item.
194 uint32 item_size = 0; 198 uint32_t item_size = 0;
195 if (!BinaryRead(&item_size, base_offset + kSizeOffset, blob) || 199 if (!BinaryRead(&item_size, base_offset + kSizeOffset, blob) ||
196 base_offset + item_size <= base_offset || // checking overflow 200 base_offset + item_size <= base_offset || // checking overflow
197 base_offset + item_size > blob.size()) 201 base_offset + item_size > blob.size())
198 return false; 202 return false;
199 203
200 // Read the sort index of the current item. 204 // Read the sort index of the current item.
201 uint32 item_sort_index = 0; 205 uint32_t item_sort_index = 0;
202 if (!BinaryRead(&item_sort_index, base_offset + kSortIndexOffset, blob)) 206 if (!BinaryRead(&item_sort_index, base_offset + kSortIndexOffset, blob))
203 return false; 207 return false;
204 208
205 // Read the file name from the ITEMIDLIST structure. 209 // Read the file name from the ITEMIDLIST structure.
206 LPCITEMIDLIST idlist = BinaryReadItemIDList( 210 LPCITEMIDLIST idlist = BinaryReadItemIDList(
207 base_offset + kItemIDListOffset, item_size - kItemIDListOffset, blob); 211 base_offset + kItemIDListOffset, item_size - kItemIDListOffset, blob);
208 TCHAR item_filename[MAX_PATH]; 212 TCHAR item_filename[MAX_PATH];
209 if (!idlist || !SHGetPathFromIDList(idlist, item_filename)) 213 if (!idlist || !SHGetPathFromIDList(idlist, item_filename))
210 return false; 214 return false;
211 base::FilePath item_relative_path = 215 base::FilePath item_relative_path =
212 path.Append(base::FilePath(item_filename).BaseName()); 216 path.Append(base::FilePath(item_filename).BaseName());
213 217
214 // Record the retrieved information and go to the next item. 218 // Record the retrieved information and go to the next item.
215 sort_index->insert(std::make_pair(item_relative_path, item_sort_index)); 219 sort_index->insert(std::make_pair(item_relative_path, item_sort_index));
216 base_offset += item_size; 220 base_offset += item_size;
217 } 221 }
218 return true; 222 return true;
219 } 223 }
220 224
221 bool ParseFavoritesOrderRegistryTree( 225 bool ParseFavoritesOrderRegistryTree(
222 const Importer* importer, 226 const Importer* importer,
223 const base::win::RegKey& key, 227 const base::win::RegKey& key,
224 const base::FilePath& path, 228 const base::FilePath& path,
225 std::map<base::FilePath, uint32>* sort_index) WARN_UNUSED_RESULT; 229 std::map<base::FilePath, uint32_t>* sort_index) WARN_UNUSED_RESULT;
226 bool ParseFavoritesOrderRegistryTree( 230 bool ParseFavoritesOrderRegistryTree(
227 const Importer* importer, 231 const Importer* importer,
228 const base::win::RegKey& key, 232 const base::win::RegKey& key,
229 const base::FilePath& path, 233 const base::FilePath& path,
230 std::map<base::FilePath, uint32>* sort_index) { 234 std::map<base::FilePath, uint32_t>* sort_index) {
231 // Parse the order information of the current folder. 235 // Parse the order information of the current folder.
232 DWORD blob_length = 0; 236 DWORD blob_length = 0;
233 if (key.ReadValue(L"Order", NULL, &blob_length, NULL) == ERROR_SUCCESS) { 237 if (key.ReadValue(L"Order", NULL, &blob_length, NULL) == ERROR_SUCCESS) {
234 std::vector<uint8> blob(blob_length); 238 std::vector<uint8_t> blob(blob_length);
235 if (blob_length > 0 && 239 if (blob_length > 0 &&
236 key.ReadValue(L"Order", reinterpret_cast<DWORD*>(&blob[0]), 240 key.ReadValue(L"Order", reinterpret_cast<DWORD*>(&blob[0]),
237 &blob_length, NULL) == ERROR_SUCCESS) { 241 &blob_length, NULL) == ERROR_SUCCESS) {
238 if (!ParseFavoritesOrderBlob(importer, blob, path, sort_index)) 242 if (!ParseFavoritesOrderBlob(importer, blob, path, sort_index))
239 return false; 243 return false;
240 } 244 }
241 } 245 }
242 246
243 // Recursively parse subfolders. 247 // Recursively parse subfolders.
244 for (base::win::RegistryKeyIterator child(key.Handle(), L""); 248 for (base::win::RegistryKeyIterator child(key.Handle(), L"");
245 child.Valid() && !importer->cancelled(); 249 child.Valid() && !importer->cancelled();
246 ++child) { 250 ++child) {
247 base::win::RegKey subkey(key.Handle(), child.Name(), KEY_READ); 251 base::win::RegKey subkey(key.Handle(), child.Name(), KEY_READ);
248 if (subkey.Valid()) { 252 if (subkey.Valid()) {
249 base::FilePath subpath(path.Append(child.Name())); 253 base::FilePath subpath(path.Append(child.Name()));
250 if (!ParseFavoritesOrderRegistryTree(importer, subkey, subpath, 254 if (!ParseFavoritesOrderRegistryTree(importer, subkey, subpath,
251 sort_index)) { 255 sort_index)) {
252 return false; 256 return false;
253 } 257 }
254 } 258 }
255 } 259 }
256 return true; 260 return true;
257 } 261 }
258 262
259 bool ParseFavoritesOrderInfo(const Importer* importer, 263 bool ParseFavoritesOrderInfo(const Importer* importer,
260 std::map<base::FilePath, uint32>* sort_index) 264 std::map<base::FilePath, uint32_t>* sort_index)
261 WARN_UNUSED_RESULT; 265 WARN_UNUSED_RESULT;
262 bool ParseFavoritesOrderInfo(const Importer* importer, 266 bool ParseFavoritesOrderInfo(const Importer* importer,
263 std::map<base::FilePath, uint32>* sort_index) { 267 std::map<base::FilePath, uint32_t>* sort_index) {
264 base::string16 key_path(importer::GetIEFavoritesOrderKey()); 268 base::string16 key_path(importer::GetIEFavoritesOrderKey());
265 base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ); 269 base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ);
266 if (!key.Valid()) 270 if (!key.Valid())
267 return false; 271 return false;
268 return ParseFavoritesOrderRegistryTree(importer, key, base::FilePath(), 272 return ParseFavoritesOrderRegistryTree(importer, key, base::FilePath(),
269 sort_index); 273 sort_index);
270 } 274 }
271 275
272 // Reads the sort order from registry. If failed, we don't touch the list 276 // Reads the sort order from registry. If failed, we don't touch the list
273 // and use the default (alphabetical) order. 277 // and use the default (alphabetical) order.
274 void SortBookmarksInIEOrder( 278 void SortBookmarksInIEOrder(
275 const Importer* importer, 279 const Importer* importer,
276 std::vector<ImportedBookmarkEntry>* bookmarks) { 280 std::vector<ImportedBookmarkEntry>* bookmarks) {
277 std::map<base::FilePath, uint32> sort_index; 281 std::map<base::FilePath, uint32_t> sort_index;
278 if (!ParseFavoritesOrderInfo(importer, &sort_index)) 282 if (!ParseFavoritesOrderInfo(importer, &sort_index))
279 return; 283 return;
280 IEOrderBookmarkComparator compare = {&sort_index}; 284 IEOrderBookmarkComparator compare = {&sort_index};
281 std::sort(bookmarks->begin(), bookmarks->end(), compare); 285 std::sort(bookmarks->begin(), bookmarks->end(), compare);
282 } 286 }
283 287
284 // Reads an internet shortcut (*.url) |file| and returns a COM object 288 // Reads an internet shortcut (*.url) |file| and returns a COM object
285 // representing it. 289 // representing it.
286 bool LoadInternetShortcut( 290 bool LoadInternetShortcut(
287 const base::string16& file, 291 const base::string16& file,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 }; 421 };
418 // {A79029D6-753E-4e27-B807-3D46AB1545DF} 422 // {A79029D6-753E-4e27-B807-3D46AB1545DF}
419 const GUID IEImporter::kUnittestGUID = { 423 const GUID IEImporter::kUnittestGUID = {
420 0xa79029d6, 0x753e, 0x4e27, 424 0xa79029d6, 0x753e, 0x4e27,
421 { 0xb8, 0x7, 0x3d, 0x46, 0xab, 0x15, 0x45, 0xdf } 425 { 0xb8, 0x7, 0x3d, 0x46, 0xab, 0x15, 0x45, 0xdf }
422 }; 426 };
423 427
424 IEImporter::IEImporter() : edge_import_mode_(false) {} 428 IEImporter::IEImporter() : edge_import_mode_(false) {}
425 429
426 void IEImporter::StartImport(const importer::SourceProfile& source_profile, 430 void IEImporter::StartImport(const importer::SourceProfile& source_profile,
427 uint16 items, 431 uint16_t items,
428 ImporterBridge* bridge) { 432 ImporterBridge* bridge) {
429 edge_import_mode_ = source_profile.importer_type == importer::TYPE_EDGE; 433 edge_import_mode_ = source_profile.importer_type == importer::TYPE_EDGE;
430 bridge_ = bridge; 434 bridge_ = bridge;
431 435
432 if (edge_import_mode_) { 436 if (edge_import_mode_) {
433 // When using for Edge imports we only support Favorites. 437 // When using for Edge imports we only support Favorites.
434 DCHECK_EQ(items, importer::FAVORITES); 438 DCHECK_EQ(items, importer::FAVORITES);
435 // As coming from untrusted source ensure items is correct. 439 // As coming from untrusted source ensure items is correct.
436 items = importer::FAVORITES; 440 items = importer::FAVORITES;
437 } 441 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 static int version = -1; 918 static int version = -1;
915 if (version < 0) { 919 if (version < 0) {
916 wchar_t buffer[128]; 920 wchar_t buffer[128];
917 DWORD buffer_length = sizeof(buffer); 921 DWORD buffer_length = sizeof(buffer);
918 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 922 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
919 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 923 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
920 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 924 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
921 } 925 }
922 return version; 926 return version;
923 } 927 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/ie_importer_win.h ('k') | chrome/utility/importer/importer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698