Archive: UAC plugin, uninstaller display name


UAC plugin, uninstaller display name
I'm working on a very typical installer, installing an application in the programs folder and launching it when the install is done. Now on Vista, I must of course run the installer in elevated mode and then launch the application in the context of the original user. Enter the UAC plugin, to the rescue. Great job and saved me a lot of headaches. The installer is working fine, it is signed with a file description and the elevation dialog displays this description.

The uninstaller on the other hand is not signed (I know it can be done with some inner/outer exercises but I'd really rather not go there) and since it's removing files from the programs directory it must of course run elevated. And the elevation dialog asks for permission to run the program Au_.exe which is nothing similar to the actual name of the application. It seems that this is some generated temp name for the process that's being launched by the plugin.

So my question is, is there anyway to change this name? And it's not possible to let the uninstaller request admin level directly, it must have the same execution level request as the entire installer, right?


Re: UAC plugin, uninstaller display name
The NSIS uninstaller copies itself to the temporary directory, runs the temporary uninstaller created and then exits. This is done so it will be able to delete itself, this is where the random name comes from.

You can get around this by using Copyfiles to copy the uninstaller manually to $temp yourself, then do
ExecWait '"$temp\uninstall.exe" _?=$INSTDIR' (Been a couple of questions related to this already, I'm sure there are other forum threads with more information)


Originally posted by berglind
And it's not possible to let the uninstaller request admin level directly, it must have the same execution level request as the entire installer, right?
I'm not sure what you mean here, but if you store the uninstall info in the HKLM part of the registry, Vista will elevate your installer even with RequestExecutionLevel user (I HATE VISTA)

Thanks for replying so quickly Anders! I had done some searching in the forum but I obviously didn't have the right keywords :) I'll figure it out from here.

As for the elevation level, in my case I don't mind that it runs elevated when launched from Programs and Features. In fact I would prefer that it would run elevated from the start, also when launched from the installation folder. But as I understand, Vista determines whether to elevate from the manifest, and when NSIS generates the uninstaller I imagine it uses the same manifest as the installer. Which totally makes sense. But my speculation was if it might be possible to change it. Like putting "RequestExecutionLevel admin" in the uninstaller section or something. But I don't really find that I'm making much sense here so... :D

One more question though. Since the installer doesn't really require admin level to start up, Vista doesn't display a shield on the icon. I know that some people are only too glad to be rid of it, but it annoys me slightly that the user won't be informed that he'll need admin privileges. There's no way around this, is there?


Nope, no way around the missing shield.

You can use the UAC plugin in the uninstaller aswell to make sure it always runs as admin, even if started from the startmenu or whatever


I am having the exact same problem and to make this painfully obvious to those of us who may need it:

In the script
1. Where do you run ExecWait '"$temp\uninstall.exe" _?=$INSTDIR' ?
2. Where do you copy uninstaller to $temp?
3. Do you still make the uninstaller the same way?
4. How do you make sure that the auto copy of installer doesn't get executed in addition to the manual copy?

I get how to do it from command line, but I'm looking for an example of how to turn my current 'WriteUninstaller/section uninstall" duo into an executable that knows to copy it's name to $temp and run from there. Where do I put these commands in the script?


The best solution would be an option to set the uninstallers RequestExecutionLevel from inside the installer, that would solve all of this.

I hacked up some code that might do what you want (Not tested on Vista)


Originally posted by Anders
The best solution would be an option to set the uninstallers RequestExecutionLevel from inside the installer, that would solve all of this.
Absolutely, that would be really neat.

Thanks for the code, I had pretty much put this aside and decided to live with the temp name, but I'm going to try this on Vista after the weekend. In the meantime, bradkohl if you try it, please post on how it goes :)

Well it works but it's ugly. Originally, I had one .nsi file which on install could elevate permissions with UAC plugin do all it's magic and create an uninstaller. Now I have two files. One is an uninstall.nsi which creates the super slick $temp executing uninstall.exe. The other is the original .nsi which now packages the newly created uninstall.exe rather than writing it's own. So now everytime I make a change to uninstaller I have to recompile two files before I can check it. Additionally, the uninstall.exe writes it's own uninstaller which gets copied and execwait-ed so for a brief period of time there are two uninstall files and that's just bad mojo in my opinion. If I'm doing something wrong please please let me know, I would really like to go back to the all in one file design.