From cc431158fd76b217e82250af3003c8a96820db91 Mon Sep 17 00:00:00 2001 From: anders_k Date: Fri, 17 Sep 2021 18:13:17 +0000 Subject: [PATCH] Added ExecShell /ALLOWERRORUI git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7327 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/basic.but | 6 +++--- Source/script.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Docs/src/basic.but b/Docs/src/basic.but index a0ce5096..bb1193f3 100644 --- a/Docs/src/basic.but +++ b/Docs/src/basic.but @@ -27,9 +27,9 @@ Execute the specified program and continue immediately. Note that the file speci \S2{execshell} ExecShell -\c [/INVOKEIDLIST] action file [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] +\c [flags] action file [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] -Execute the specified file using ShellExecuteEx. 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 as the working directory. The error flag is set if the process could not be launched. +Execute the specified file using ShellExecuteEx. Note that \cw{action} is usually "open", "print", etc, but can be an empty string to use the default action. \cw{Parameters} and the show type are optional. $OUTDIR is used as the working directory. The error flag is set if the file could not be launched. \cw{Flags} can be any combination of /ALLOWERRORUI, /DOENVSUBST and /INVOKEIDLIST. \c ExecShell "open" "http://nsis.sf.net/" \c ExecShell "" "$SysDir\Notepad.exe" "" SW_SHOWMAXIMIZED @@ -38,7 +38,7 @@ Execute the specified file using ShellExecuteEx. Note that action is usually "op \S2{execshellwait} ExecShellWait -\c [/INVOKEIDLIST] action file [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] +\c [flags] action file [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE] Execute the specified file using ExecShell and wait for executed process to quit. It will only wait for executable files, not other file types nor URLs. diff --git a/Source/script.cpp b/Source/script.cpp index c36fc75e..9b85490a 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -3134,14 +3134,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) #ifdef NSIS_SUPPORT_SHELLEXECUTE { UINT to=0, xflags=0; - static const TCHAR*fn=_T("/INVOKEIDLIST\0/CONNECTNETDRV\0/DOENVSUBST\0/NOIDLIST\0/NOCONSOLE\0/NOZONECHECKS\0/WAITFORINPUTIDLE\0/LOGUSAGE\0/ASYNCOK\0"); - static const UINT fv[]={ 0x0000000C, 0x00000080, 0x00000200, 0x00001000,0x00008000, 0x00800000, 0x02000000, 0x04000000,0x00100000 }; + static const TCHAR*fn=_T("/INVOKEIDLIST\0/CONNECTNETDRV\0/DOENVSUBST\0/NOIDLIST\0/NOCONSOLE\0/NOZONECHECKS\0/WAITFORINPUTIDLE\0/LOGUSAGE\0/ASYNCOK\0/ALLOWERRORUI\0"); + static const UINT fv[]={ 0x0000000C, 0x00000080, 0x00000200, 0x00001000,0x00008000, 0x00800000, 0x02000000, 0x04000000,0x100000, 0x0100 }; for (int k;;) if ((k = line.gettoken_enum(to+1,fn)) < 0) { if (line.gettoken_str(to+1)[0]=='/') PRINTHELP(); break; } else xflags|=fv[k], to++; const TCHAR *verb=line.gettoken_str(to+1), *file=line.gettoken_str(to+2), *params=line.gettoken_str(to+3), *cnam=get_commandtoken_name(which_token); ent.which=EW_SHELLEXEC; ent.offsets[0]=add_string(verb), ent.offsets[1]=add_string(file); ent.offsets[2]=add_string(params), ent.offsets[3]=SW_SHOWNORMAL; - ent.offsets[4]=SEE_MASK_FLAG_NO_UI|SEE_MASK_FLAG_DDEWAIT|xflags|(which_token==TOK_EXECSHELLWAIT ? SEE_MASK_NOCLOSEPROCESS : 0); + ent.offsets[4]=SEE_MASK_FLAG_DDEWAIT|((xflags&0x0100)?0:SEE_MASK_FLAG_NO_UI)|xflags|(which_token==TOK_EXECSHELLWAIT ? SEE_MASK_NOCLOSEPROCESS : 0); if (line.getnumtokens()-to > 4) { int tab[8]={SW_SHOWDEFAULT,SW_SHOWNORMAL,SW_SHOWMAXIMIZED,SW_SHOWMINIMIZED,SW_HIDE,SW_SHOW,SW_SHOWNA,SW_SHOWMINNOACTIVE};