Old 30th October 2007, 11:27   #1
berglind
Junior Member
 
Join Date: Oct 2007
Posts: 10
Question 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?
berglind is offline   Reply With Quote
Old 30th October 2007, 12:47   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,946
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)


Quote:
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)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 30th October 2007, 13:06   #3
berglind
Junior Member
 
Join Date: Oct 2007
Posts: 10
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...

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?
berglind is offline   Reply With Quote
Old 30th October 2007, 13:48   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,946
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th November 2007, 01:24   #5
bradkohl
Junior Member
 
Join Date: Nov 2007
Location: San Jose, CA
Posts: 12
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?

Last edited by bradkohl; 8th November 2007 at 01:41.
bradkohl is offline   Reply With Quote
Old 8th November 2007, 13:35   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,946
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)
Attached Files
File Type: nsi uac_uninstaller.nsi (1.1 KB, 543 views)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 8th November 2007, 13:44   #7
berglind
Junior Member
 
Join Date: Oct 2007
Posts: 10
Quote:
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
berglind is offline   Reply With Quote
Old 13th November 2007, 21:46   #8
bradkohl
Junior Member
 
Join Date: Nov 2007
Location: San Jose, CA
Posts: 12
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.
bradkohl is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump