Old 11th January 2007, 13:47   #1
Nniol
Junior Member
 
Join Date: Oct 2006
Posts: 26
Uninstaller error levels

Hi

I need to get the error levels from an uninstaller...

I see

CopyFiles $INSTDIR\uninstaller.exe $TEMP
ExecWait '"$TEMP\uninstaller.exe" _?=$INSTDIR' $0
DetailPrint "uninstaller set error level $0"


In section D.1 in the manual.... so how does this work?

Where do I put this??? I have my normal uninstall section does this go in there, if so where does the uninstall code go?

Nniol
Nniol is offline   Reply With Quote
Old 11th January 2007, 15:39   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I'm not quite sure what are you trying to achieve. The manual is pretty clear:

Note that uninstallers copy themselves to the temporary directory and execute from there so the original uninstaller can be deleted. This means the error level the uninstaller sets is not available to the executing process, unless it simulates this copy process and executes the copied uninstaller. To simulate this process, use:
code:
CopyFiles $INSTDIR\uninstaller.exe $TEMP
ExecWait '"$TEMP\uninstaller.exe" _?=$INSTDIR' $0
DetailPrint "uninstaller set error level $0"


Also this code executes the uninstaller of installation A from the installer of installation B. The included in examples makensis.nsi is pretty self explained on that.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 26th September 2014, 14:55   #3
orhuidobro
Junior Member
 
Join Date: Feb 2014
Posts: 7
Question

Hi, this post is pretty old, but things didn't change much in NSIS.
Quoting the latest post:
Quote:
Originally Posted by Red Wine View Post
Also this code executes the uninstaller of installation A from the installer of installation B. The included in examples makensis.nsi is pretty self explained on that.
I need to get a return code from my uninstaller, but I don't have installation A and installation B.
My uninstaller is going to be executed by a 3rd party uninstaller (I can't modify it), and that 3rd party uninstaller expect a return code from my uninstaller.
If I put these lines in my code, they are executed recursively:
code:
CopyFiles $INSTDIR\uninstaller.exe $TEMP
ExecWait '"$TEMP\uninstaller.exe" _?=$INSTDIR' $0


The installer copies itself to $TEMP and executes itself, resulting in another copy and execution, and so on.

Is there a way to do what I need?

Thank you.
orhuidobro is offline   Reply With Quote
Old 26th September 2014, 23:18   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by orhuidobro View Post
My uninstaller is going to be executed by a 3rd party uninstaller (I can't modify it), and that 3rd party uninstaller expect a return code from my uninstaller.
Can this uninstaller pass a parameter to the NSIS uninstaller? If not, it is not going to be possible to wait for the real NSIS uninstaller...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th September 2014, 04:30   #5
orhuidobro
Junior Member
 
Join Date: Feb 2014
Posts: 7
Smile

Quote:
Originally Posted by Anders View Post
Can this uninstaller pass a parameter to the NSIS uninstaller?
Hi Anders!
Actually, I'm not sure if I can get that, but I can try. I do know that installer isn't made with NSIS.
In case I can get it, which parameter should I pass? My uninstaller must run silently.
Thanks and best regards.
orhuidobro is offline   Reply With Quote
Old 28th September 2014, 17:24   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
How about having them run an included wrapper executable which itself executes the uninstaller with the required parameters and returns its exit code?

To run the uninstaller silently, use the case sensitive /S switch (must come before _?=). You could also just add SilentUninstall silent if it should always be ran silently.

Stu
Afrow UK is offline   Reply With Quote
Old 28th September 2014, 23:54   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by Afrow UK View Post
How about having them run an included wrapper executable which itself executes the uninstaller with the required parameters and returns its exit code?
Where is he supposed to store this wrapper? In $InstDir? Then you are back to square one again and you are unable to delete $InstDir.

The best option might actually be to use the selfdelete plugin but I'm not sure if that thing works on Vista+

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th September 2014, 14:56   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by Anders View Post
Where is he supposed to store this wrapper? In $InstDir? Then you are back to square one again and you are unable to delete $InstDir.

The best option might actually be to use the selfdelete plugin but I'm not sure if that thing works on Vista+
SelfDel works up to and including Windows 8 (32/64-bit).

Stu
Afrow UK is offline   Reply With Quote
Old 29th September 2014, 17:02   #9
orhuidobro
Junior Member
 
Join Date: Feb 2014
Posts: 7
Smile

Hi Afro UK and Anders.
Actually, I tried both of your suggestions (and both of them worked)!

Quote:
Originally Posted by Afrow UK View Post
How about having them run an included wrapper executable which itself executes the uninstaller with the required parameters and returns its exit code?
I wrote my own wrapper, and it worked like a charm. But I noted that still have to ask for the 3rd. party installer to locate that wrapper outside my INSTDIR, and execute it.

So I tried the Anders proposal:
Quote:
Originally Posted by Anders View Post
Can this uninstaller pass a parameter to the NSIS uninstaller?
The people who writes the 3rd party uninstaller made the requested modifications, and it worked flawlessly.

Thanks a lot for your disinterested help (both of you)!

I think the included documentation isn't clear enough, but you really helped me to get the things working.
orhuidobro 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