| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 bool GetFileCreationLocalTime(const std::wstring& filename, | 248 bool GetFileCreationLocalTime(const std::wstring& filename, |
| 249 LPSYSTEMTIME creation_time) { | 249 LPSYSTEMTIME creation_time) { |
| 250 ScopedHandle file_handle( | 250 ScopedHandle file_handle( |
| 251 CreateFile(filename.c_str(), GENERIC_READ, | 251 CreateFile(filename.c_str(), GENERIC_READ, |
| 252 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, | 252 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, |
| 253 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); | 253 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); |
| 254 return GetFileCreationLocalTimeFromHandle(file_handle.Get(), creation_time); | 254 return GetFileCreationLocalTimeFromHandle(file_handle.Get(), creation_time); |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool ResolveShortcut(std::wstring* path) { | |
| 258 FilePath file_path(*path); | |
| 259 bool result = ResolveShortcut(&file_path); | |
| 260 *path = file_path.value(); | |
| 261 return result; | |
| 262 } | |
| 263 | |
| 264 bool ResolveShortcut(FilePath* path) { | 257 bool ResolveShortcut(FilePath* path) { |
| 265 HRESULT result; | 258 HRESULT result; |
| 266 IShellLink *shell = NULL; | 259 IShellLink *shell = NULL; |
| 267 bool is_resolved = false; | 260 bool is_resolved = false; |
| 268 | 261 |
| 269 // Get pointer to the IShellLink interface | 262 // Get pointer to the IShellLink interface |
| 270 result = CoCreateInstance(CLSID_ShellLink, NULL, | 263 result = CoCreateInstance(CLSID_ShellLink, NULL, |
| 271 CLSCTX_INPROC_SERVER, IID_IShellLink, | 264 CLSCTX_INPROC_SERVER, IID_IShellLink, |
| 272 reinterpret_cast<LPVOID*>(&shell)); | 265 reinterpret_cast<LPVOID*>(&shell)); |
| 273 if (SUCCEEDED(result)) { | 266 if (SUCCEEDED(result)) { |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 ::CloseHandle(file_mapping_); | 802 ::CloseHandle(file_mapping_); |
| 810 if (file_ != INVALID_HANDLE_VALUE) | 803 if (file_ != INVALID_HANDLE_VALUE) |
| 811 ::CloseHandle(file_); | 804 ::CloseHandle(file_); |
| 812 | 805 |
| 813 data_ = NULL; | 806 data_ = NULL; |
| 814 file_mapping_ = file_ = INVALID_HANDLE_VALUE; | 807 file_mapping_ = file_ = INVALID_HANDLE_VALUE; |
| 815 length_ = INVALID_FILE_SIZE; | 808 length_ = INVALID_FILE_SIZE; |
| 816 } | 809 } |
| 817 | 810 |
| 818 } // namespace file_util | 811 } // namespace file_util |
| OLD | NEW |