Archive: UAC plugin: strange behaviour when UAC is off and installer is run from browser


UAC plugin: strange behaviour when UAC is off and installer is run from browser
I stumbled upon some strange behaviour when running downloaded installer from different browsers.

The problem is as follows:
I switch off UAC and do not reboot the computer.
Run the installer, choose install path which requires admin rights. UAC is run.
Installer shows "Run as" dialog. Select "Current user".

If I do all this running the downloaded installer from Windows Explorer, or from Internet Explorer or Firefox browsers (after downloading it), the following check works:

Function .onInit
${If} ${UAC_IsInnerInstance}
${IfNot} ${UAC_IsAdmin}
SetErrorLevel 0x666666 ;couldn't elevate
Quit
${EndIf}
${EndIf}
...

Then, this error level is returned after running

!insertmacro UAC_RunElevated

in $2 to the outer instance and I can check for it.

if I run the downloaded installer from Chrome, inner instance .onInit doesn't get called and the value in $2 is 2. This value is similar to NSIS return value "aborted by script".

I wonder why this can happen and what can I do to handle this situation. Would greatly appreciate your ideas.


$2 is only valid if $0==0. If you don't reboot, the system is probably in a weird unsupported state. What happens after reboot?


$0 is 0 in this case. $0 $1 $2 $3 are 0 1 2 0.

This behaviour appears both before reboot when UAC is turned off and after reboot if current user is non-admin.

But!

I've found out that this happens only if a file with same name already exists in the directory and Chrome renames the installer, for example, install (1).exe


Maybe you could try MessageBox mb_ok $exepath in .oninit


Thank you!!! I tried this and it led me to the solution.

The $exepath in the inner instance contains not the actual, but the original filename. The ${If} ${UAC_IsInnerInstance} in .onInit isn't true either and the execution goes to the outer instance branch. There, the script quits because it encounters a check for multiple instances of the installer. I will now be setting an errorlevel there and thus recognize this situation in UacElevation macro.