Compartir a través de


Using the MakeShortcutRunAs Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the MakeShortcutRunAs compatibility fix, including the issue details, the intercepted APIs, the command-line options and usage, the included modules, and the recommended fix for a permanent solution.

MakeShortcutRunAs

MakeShortcutRunAs fixes an issue whereby a shortcut to a task that requires elevation makes a call into the Rundll.exe file, rather than pointing to an application executable (.exe) file. This compatibility fix works by intercepting calls to various IShellLink method calls. These methods then modify the flags to call the SetFlags function and to set the SLDF_RUNAS_USER flag, which marks the shortcut as requesting elevation.

Because of how this compatibility fix works, you will want to apply the fix to the process that created the shortcut initially. For example, some older versions of Installshield create shortcuts that point to the Rundll32.exe file and specify the .dll file that uninstalls the program. Because rundll32.exe does not run elevated by default, the user is unable to uninstall the application. To resolve this issue, you can use this fix to modify the installation program that creates the problematic link, and to enable the shortcut to have administrator access.

Investigating the Issue

Application-related issues that can be resolved by applying the MakeShortcutRunAs fix are typically detected when the application-removal process fails for a person running as a Standard User, but succeeds when performed by a person running as an Administrator.

It is important that you first uninstall the application while running as an Administrator, and then apply the MakeShortcutRunAs compatibility fix to the executable file that creates the shortcut. If you are unsure which executable creates the shortcut, you can repeat the application-installation process, while using the Sysinternals' Process Monitor, filtering the results for the path to the shortcut location. After you have identified the executable file, you can apply this compatibility fix and verify that the shortcut is fixed.

Intercepted APIs

The following APIs are intercepted by the MakeShortcutRunAs compatibility fix.

  • IShellLinkA::SetDescription

  • IShellLinkW::SetDescription

  • IShellLinkA::SetArguments

  • IShellLinkW::SetArguments

  • IShellLinkA::SetPath

  • IShellLinkW::SetPath

  • IShellLinkA::SetWorkingDirectory

  • IShellLinkW::SetWorkingDirectory

  • IShellLinkA::SetIconLocation

  • IShellLinkW::SetIconLocation

  • IPersistFile::Save

Command-Line Options

You must configure the command-line argument to include the text that will appear in either the path, the options, or the description of the shortcut that is being created. If a match is found, then the RunAs flag will be set. For example, /uninstall.

Included Modules

Microsoft, by default, excludes the contents of the system32 directory, which enables both the compatibility fix and the application entry to include or exclude additional information. The following modules are included in the MakeShortcutRunAs compatibility fix.

  • shell32.dll

  • ole32.dll

Fixing Your Code

Applications should be modified to specify the shortcut by changing the RunAs flag directly. Preferably, this could be done by refactoring the application to start the shortcut target as a separate executable file, which could then be changed to specify the required run-level. Optionally, if the application has an installer, you could also repackage this file to use a different installer technology that correctly handles elevation.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems