Skip to content

Commit

Permalink
Remove the IShellLink::Resolve step in ResolveShortcutProperties.
Browse files Browse the repository at this point in the history
This call was only useful if we cared to have Windows attempt to find the target should the path have moved. Since moving Chrome installs (or installing them on anything but a local C: drive) is unsupported there is no need to do this. This code only cares about the target path currently stored in the shortcut (regardless of its existence) -- for which GetPath() is sufficient.

This call could otherwise take up to 3 seconds per unresolvable shortcut which can drastically impact uninstall times when setup.exe attempts to delete all shortcuts pointing to its chrome.exe in common shortcut paths.

This should also get rid of LOG(ERROR)s in test_installer about unresolveable shortcuts as we will now only inspect the path stored in the shortcut without trying to actually resolve it.

BUG=412380
R=cpu@chromium.org, grt@chromium.org

Review URL: https://codereview.chromium.org/553783005

Cr-Commit-Position: refs/heads/master@{#293986}
  • Loading branch information
Gabriel Charette committed Sep 9, 2014
1 parent e7ccb7e commit 8d5adf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 0 additions & 3 deletions base/win/shortcut.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,

wchar_t temp[MAX_PATH];
if (options & ShortcutProperties::PROPERTIES_TARGET) {
// Try to find the target of a shortcut.
if (FAILED(i_shell_link->Resolve(0, SLR_NO_UI | SLR_NOSEARCH)))
return false;
if (FAILED(i_shell_link->GetPath(temp, MAX_PATH, NULL, SLGP_UNCPRIORITY)))
return false;
properties->set_target(FilePath(temp));
Expand Down
10 changes: 6 additions & 4 deletions base/win/shortcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ BASE_EXPORT bool CreateOrUpdateShortcutLink(
const ShortcutProperties& properties,
ShortcutOperation operation);

// Resolves Windows shortcut (.LNK file)
// Resolves Windows shortcut (.LNK file).
// This methods tries to resolve selected properties of a shortcut .LNK file.
// The path of the shortcut to resolve is in |shortcut_path|. |options| is a bit
// field composed of ShortcutProperties::IndividualProperties, to specify which
// properties to read. It should be non-0. The resulting data are read into
// |properties|, which must not be NULL. The function returns true if all
// requested properties are successfully read. Otherwise some reads have failed
// and intermediate values written to |properties| should be ignored.
// |properties|, which must not be NULL. Note: PROPERTIES_TARGET will retrieve
// the target path as stored in the shortcut but won't attempt to resolve that
// path so it may not be valid. The function returns true if all requested
// properties are successfully read. Otherwise some reads have failed and
// intermediate values written to |properties| should be ignored.
BASE_EXPORT bool ResolveShortcutProperties(const FilePath& shortcut_path,
uint32 options,
ShortcutProperties* properties);
Expand Down

0 comments on commit 8d5adf5

Please sign in to comment.