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

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

Issue 606473002: Remove implicit HANDLE conversions from chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spurious file and fix indent (+rebase) Created 6 years, 2 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/image_writer/image_writer_win.cc ('k') | no next file » | 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 <urlhist.h> 10 #include <urlhist.h>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Gets the creation time of the given file or directory. 66 // Gets the creation time of the given file or directory.
67 base::Time GetFileCreationTime(const base::string16& file) { 67 base::Time GetFileCreationTime(const base::string16& file) {
68 base::Time creation_time; 68 base::Time creation_time;
69 base::win::ScopedHandle file_handle( 69 base::win::ScopedHandle file_handle(
70 CreateFile(file.c_str(), GENERIC_READ, 70 CreateFile(file.c_str(), GENERIC_READ,
71 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 71 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
72 NULL, OPEN_EXISTING, 72 NULL, OPEN_EXISTING,
73 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL)); 73 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL));
74 FILETIME creation_filetime; 74 FILETIME creation_filetime;
75 if (GetFileTime(file_handle, &creation_filetime, NULL, NULL)) 75 if (!file_handle.IsValid())
76 return creation_time;
77 if (GetFileTime(file_handle.Get(), &creation_filetime, NULL, NULL))
76 creation_time = base::Time::FromFileTime(creation_filetime); 78 creation_time = base::Time::FromFileTime(creation_filetime);
77 return creation_time; 79 return creation_time;
78 } 80 }
79 81
80 // Safely read an object of type T from a raw sequence of bytes. 82 // Safely read an object of type T from a raw sequence of bytes.
81 template<typename T> 83 template<typename T>
82 bool BinaryRead(T* data, size_t offset, const std::vector<uint8>& blob) { 84 bool BinaryRead(T* data, size_t offset, const std::vector<uint8>& blob) {
83 if (offset + sizeof(T) > blob.size()) 85 if (offset + sizeof(T) > blob.size())
84 return false; 86 return false;
85 memcpy(data, &blob[offset], sizeof(T)); 87 memcpy(data, &blob[offset], sizeof(T));
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 static int version = -1; 874 static int version = -1;
873 if (version < 0) { 875 if (version < 0) {
874 wchar_t buffer[128]; 876 wchar_t buffer[128];
875 DWORD buffer_length = sizeof(buffer); 877 DWORD buffer_length = sizeof(buffer);
876 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 878 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
877 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 879 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
878 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 880 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
879 } 881 }
880 return version; 882 return version;
881 } 883 }
OLDNEW
« no previous file with comments | « chrome/utility/image_writer/image_writer_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698