ShellExecAsUser plug-in: Difference between revisions
Installer32 (talk | contribs) No edit summary |
(The example was misleading, partly because "optional" was unclear. The plugin unconditionally does four popstring() calls on ShellExecAsUser invocation, which will mess up the stack state and put unexpected contents there if there are other items remaining on the stack.) |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 7: | Line 7: | ||
As such it's a light alternative to UAC plugin. | As such it's a light alternative to UAC plugin. | ||
[http://forums.winamp.com/showthread.php?t=335435 Forum thread] | |||
== Usage == | == Usage == | ||
Syntax is exactly the same as NSIS built in ExecShell command: | Syntax is exactly the same as NSIS built in ExecShell command: | ||
<highlight-nsis> | |||
ShellExecAsUser::ShellExecAsUser action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] | ShellExecAsUser::ShellExecAsUser action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] | ||
</highlight-nsis> | |||
Note that action is usually "open", "print", etc, but can be an empty string to use the default action. Parameters and the show type are optional. $OUTDIR is used for the working directory. | Note that action is usually "open", "print", etc, but can be an empty string to use the default action. Parameters and the show type are optional, but must be provided as empty string ("") to get default behavior. $OUTDIR is used for the working directory. | ||
When installer process is non-elevated (e.g. executed on Windows XP, or UAC is disabled, etc), defaults to ShellExecute method. | When installer process is non-elevated (e.g. executed on Windows XP, or UAC is disabled, etc), defaults to ShellExecute method. | ||
Example: | Example: | ||
<highlight-nsis> | |||
ShellExecAsUser::ShellExecAsUser "open" 'http://www.google.com/' "" "" | |||
</highlight-nsis> | |||
== Limitations == | == Limitations == | ||
#If Explorer is not running or running as elevated process, plugin will launch elevated process. | |||
#The process is launched under the same user Explorer is running. Under some circumstances (e.g. using runas to run installer on behalf of another user) desktop user may be different from before-elevation user. | |||
== Download == | == Download == | ||
<attach>ShellExecAsUser.zip</attach> | Release (Ansi only) <attach>ShellExecAsUser.zip</attach> <br> | ||
Unicode Update <attach>ShellExecAsUserUnicodeUpdate.zip</attach> <br> | |||
Amd64 Unicode <attach>ShellExecAsUser_amd64-Unicode.7z</attach> | |||
[[Category:Plugins]] | [[Category:Plugins]] | ||
Latest revision as of 06:33, 13 December 2025
Description
Execute the specified program using ShellExecute in non-admin context.
The ShellExecAsUser plug-in is intended for installers that run with admin rights, but need to execute something as a normal non-elevated process.
This is accomplished by having Explorer launch the application on the installer’s behalf (http://brandonlive.com/2008/04/27/getting-the-shell-to-run-an-application-for-you-part-2-how/).
As such it's a light alternative to UAC plugin. Forum thread
Usage
Syntax is exactly the same as NSIS built in ExecShell command:
ShellExecAsUser::ShellExecAsUser action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE]
Note that action is usually "open", "print", etc, but can be an empty string to use the default action. Parameters and the show type are optional, but must be provided as empty string ("") to get default behavior. $OUTDIR is used for the working directory. When installer process is non-elevated (e.g. executed on Windows XP, or UAC is disabled, etc), defaults to ShellExecute method.
Example:
ShellExecAsUser::ShellExecAsUser "open" 'http://www.google.com/' "" ""
Limitations
- If Explorer is not running or running as elevated process, plugin will launch elevated process.
- The process is launched under the same user Explorer is running. Under some circumstances (e.g. using runas to run installer on behalf of another user) desktop user may be different from before-elevation user.
Download
Release (Ansi only)
ShellExecAsUser.zip (18 KB)
Unicode Update
ShellExecAsUserUnicodeUpdate.zip (65 KB)
Amd64 Unicode
ShellExecAsUser_amd64-Unicode.7z (54 KB)