Chromium Code Reviews| 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/win/shortcut.h" | 5 #include "base/win/shortcut.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 | 10 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 return false; | 196 return false; |
| 197 | 197 |
| 198 // Load the shell link. | 198 // Load the shell link. |
| 199 if (FAILED(persist->Load(shortcut_path.value().c_str(), STGM_READ))) | 199 if (FAILED(persist->Load(shortcut_path.value().c_str(), STGM_READ))) |
| 200 return false; | 200 return false; |
| 201 | 201 |
| 202 // Reset |properties|. | 202 // Reset |properties|. |
| 203 properties->options = 0; | 203 properties->options = 0; |
| 204 | 204 |
| 205 wchar_t temp[MAX_PATH]; | 205 wchar_t temp[MAX_PATH]; |
| 206 if (options & ShortcutProperties::PROPERTIES_TARGET) { | 206 if (options & ShortcutProperties::PROPERTIES_TARGET) { |
|
grt (UTC plus 2)
2014/09/09 16:54:34
maybe document in the .h file that resolving the t
gab
2014/09/09 18:30:44
Done.
| |
| 207 // Try to find the target of a shortcut. | |
| 208 if (FAILED(i_shell_link->Resolve(0, SLR_NO_UI | SLR_NOSEARCH))) | |
| 209 return false; | |
| 210 if (FAILED(i_shell_link->GetPath(temp, MAX_PATH, NULL, SLGP_UNCPRIORITY))) | 207 if (FAILED(i_shell_link->GetPath(temp, MAX_PATH, NULL, SLGP_UNCPRIORITY))) |
| 211 return false; | 208 return false; |
| 212 properties->set_target(FilePath(temp)); | 209 properties->set_target(FilePath(temp)); |
| 213 } | 210 } |
| 214 | 211 |
| 215 if (options & ShortcutProperties::PROPERTIES_WORKING_DIR) { | 212 if (options & ShortcutProperties::PROPERTIES_WORKING_DIR) { |
| 216 if (FAILED(i_shell_link->GetWorkingDirectory(temp, MAX_PATH))) | 213 if (FAILED(i_shell_link->GetWorkingDirectory(temp, MAX_PATH))) |
| 217 return false; | 214 return false; |
| 218 properties->set_working_dir(FilePath(temp)); | 215 properties->set_working_dir(FilePath(temp)); |
| 219 } | 216 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 if (GetVersion() < VERSION_WIN7) | 324 if (GetVersion() < VERSION_WIN7) |
| 328 return false; | 325 return false; |
| 329 | 326 |
| 330 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", | 327 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", |
| 331 shortcut, NULL, NULL, 0)); | 328 shortcut, NULL, NULL, 0)); |
| 332 return result > 32; | 329 return result > 32; |
| 333 } | 330 } |
| 334 | 331 |
| 335 } // namespace win | 332 } // namespace win |
| 336 } // namespace base | 333 } // namespace base |
| OLD | NEW |