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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 bool is_dual_mode = (options & SHORTCUT_DUAL_MODE) != 0; | 417 bool is_dual_mode = (options & SHORTCUT_DUAL_MODE) != 0; |
418 if ((app_id || is_dual_mode) && | 418 if ((app_id || is_dual_mode) && |
419 base::win::GetVersion() >= base::win::VERSION_WIN7) { | 419 base::win::GetVersion() >= base::win::VERSION_WIN7) { |
420 base::win::ScopedComPtr<IPropertyStore> property_store; | 420 base::win::ScopedComPtr<IPropertyStore> property_store; |
421 if (FAILED(property_store.QueryFrom(i_shell_link)) || !property_store.get()) | 421 if (FAILED(property_store.QueryFrom(i_shell_link)) || !property_store.get()) |
422 return false; | 422 return false; |
423 | 423 |
424 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id)) | 424 if (app_id && !base::win::SetAppIdForPropertyStore(property_store, app_id)) |
425 return false; | 425 return false; |
426 if (is_dual_mode && | 426 if (is_dual_mode && |
427 base::win::GetVersion() >= base::win::VERSION_WIN8 && | |
428 !base::win::SetDualModeForPropertyStore(property_store)) { | 427 !base::win::SetDualModeForPropertyStore(property_store)) { |
429 return false; | 428 return false; |
430 } | 429 } |
431 } | 430 } |
432 | 431 |
433 HRESULT result = i_persist_file->Save(destination, TRUE); | 432 HRESULT result = i_persist_file->Save(destination, TRUE); |
434 | 433 |
435 // If we successfully updated the icon, notify the shell that we have done so. | 434 // If we successfully updated the icon, notify the shell that we have done so. |
436 if (!create && SUCCEEDED(result)) { | 435 if (!create && SUCCEEDED(result)) { |
437 // Release the interfaces in case the SHChangeNotify call below depends on | 436 // Release the interfaces in case the SHChangeNotify call below depends on |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 HANDLE cp = GetCurrentProcess(); | 1108 HANDLE cp = GetCurrentProcess(); |
1110 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { | 1109 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { |
1111 *nt_path = FilePath(mapped_file_path); | 1110 *nt_path = FilePath(mapped_file_path); |
1112 success = true; | 1111 success = true; |
1113 } | 1112 } |
1114 ::UnmapViewOfFile(file_view); | 1113 ::UnmapViewOfFile(file_view); |
1115 return success; | 1114 return success; |
1116 } | 1115 } |
1117 | 1116 |
1118 } // namespace file_util | 1117 } // namespace file_util |
OLD | NEW |