Yathosho
1st June 2012 10:13 UTC
ShellEx macro
i don't know where this macro came from, i couldn't find it on the wiki or the forum. i'm pretty sure though i got it from someone here.
so, i've been using this for some years now and never ran into a problem. from what i remember, this allowed me building an installer with user rights and whenever it runs an executable, it will display an elevation dialog if required by the executable.
however, i've been told it won't work if the path or the executable contains a single quote. any ideas?
Afrow UK
1st June 2012 10:39 UTC
How is that macro different to ExecShell? And why would you want to put a quote in the file path? You have a separate parameter for command line arguments.
Stu
Anders
1st June 2012 10:53 UTC
That macro uses the SEE_MASK_NOCLOSEPROCESS (0x00000040) flag meaning that your code is leaking process handles. Other than passing the working directory as a parameter without having to use SetOutPath, this macro has no advantage over ExecShell...
Edit: I'm guessing somebody that does not know what they are doing copied parts of this macro. That macro has the same single quote issue but at least it provides some actual value over ExecShell...
Yathosho
1st June 2012 11:14 UTC
Originally posted by Afrow UK
How is that macro different to ExecShell? And why would you want to put a quote in the file path? You have a separate parameter for command line arguments.
Stu
i have no idea. as i said, this was recommended me to someone as i wanted to be able to execute a program with admin rights even if the installer runs with user rights only. from what i remember a simple exec didn't execute such a program, whereas this macro popped up an elevation dialog.
Anders
1st June 2012 11:24 UTC
Originally posted by Yathosho
i have no idea. as i said, this was recommended me to someone as i wanted to be able to execute a program with admin rights even if the installer runs with user rights only. from what i remember a simple exec didn't execute such a program, whereas this macro popped up an elevation dialog.
A normal ExecShell will do that (ExecShell calls ShellExecute and Exec[Wait] calls CreateProcess)
Yathosho
1st June 2012 12:46 UTC
thanks, will give it a try
Yathosho
1st March 2013 10:52 UTC
hm, i noticed when using ExecShell runas it only works with .exe files but .msi files will not open at all. is this a limitation by windows?
Afrow UK
1st March 2013 14:39 UTC
An MSI file is not an executable. You must use msiexec.exe.
Edit: And why are you using runas exactly? You should just use RequestExecutionLevel (along with UserInfo) to ensure the installer is already elevated before any installation occurs.
Stu
Marshallx7
14th March 2013 18:17 UTC
Indeed, it always annoys me when installers install partly to all users/HKLM and partly to current user/HKCU. The rest of my family end up with partially installed/broken apps that they don't want.