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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <propvarutil.h> | 8 #include <propvarutil.h> |
9 #include <psapi.h> | 9 #include <psapi.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 ::CloseHandle(file_); | 981 ::CloseHandle(file_); |
982 | 982 |
983 data_ = NULL; | 983 data_ = NULL; |
984 file_mapping_ = file_ = INVALID_HANDLE_VALUE; | 984 file_mapping_ = file_ = INVALID_HANDLE_VALUE; |
985 length_ = INVALID_FILE_SIZE; | 985 length_ = INVALID_FILE_SIZE; |
986 } | 986 } |
987 | 987 |
988 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 988 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
989 const base::Time& cutoff_time) { | 989 const base::Time& cutoff_time) { |
990 base::ThreadRestrictions::AssertIOAllowed(); | 990 base::ThreadRestrictions::AssertIOAllowed(); |
| 991 FILETIME file_time = cutoff_time.ToFileTime(); |
991 long result = CompareFileTime(&find_info.ftLastWriteTime, // NOLINT | 992 long result = CompareFileTime(&find_info.ftLastWriteTime, // NOLINT |
992 &cutoff_time.ToFileTime()); | 993 &file_time); |
993 return result == 1 || result == 0; | 994 return result == 1 || result == 0; |
994 } | 995 } |
995 | 996 |
996 bool NormalizeFilePath(const FilePath& path, FilePath* real_path) { | 997 bool NormalizeFilePath(const FilePath& path, FilePath* real_path) { |
997 base::ThreadRestrictions::AssertIOAllowed(); | 998 base::ThreadRestrictions::AssertIOAllowed(); |
998 FilePath mapped_file; | 999 FilePath mapped_file; |
999 if (!NormalizeToNativeFilePath(path, &mapped_file)) | 1000 if (!NormalizeToNativeFilePath(path, &mapped_file)) |
1000 return false; | 1001 return false; |
1001 // NormalizeToNativeFilePath() will return a path that starts with | 1002 // NormalizeToNativeFilePath() will return a path that starts with |
1002 // "\Device\Harddisk...". Helper DevicePathToDriveLetterPath() | 1003 // "\Device\Harddisk...". Helper DevicePathToDriveLetterPath() |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 uint8 unused = *(touch + offset); | 1165 uint8 unused = *(touch + offset); |
1165 offset += step_size; | 1166 offset += step_size; |
1166 } | 1167 } |
1167 FreeLibrary(dll_module); | 1168 FreeLibrary(dll_module); |
1168 } | 1169 } |
1169 | 1170 |
1170 return true; | 1171 return true; |
1171 } | 1172 } |
1172 | 1173 |
1173 } // namespace file_util | 1174 } // namespace file_util |
OLD | NEW |