1
votes

An NSIS newbie here.

I am invoking my Uninstaller with ExecWait command as i have pre defined custom pages before the uninstallation takes place.

ExecWait '"$R6\Uninstall.exe" _?=$R6' ;Do not copy the uninstaller to a temp file

$R6 is my install dir path.

but this is copying files during uninstallation in windows temp folder and the anti-virus software is blocking these files from uninstallation and corrupting the uninstaller.exe

How can i stop the creation of these temp files during uninstallation?? I am facing this problem even while i am uninstalling it from control panel.!?

As it is clients system, we cannot disable the anti virus (that option is ruled out). Please can someone help me out with this. thanks in advance

1
Where is this ExecWait call? In the installer or uninstaller? Post more code.Anders
Hi Anders, it is invoked in installer during the checking of previously installed application, if any version found then this command is invoked.faisal
If you use _?= when running the uninstaller from the installer then the uninstaller does not get copied to %temp%.Anders
Anders , yes even i have been wondering what is making my uninstaller creating the temp files as i am using _?= , and this happens only in few systems which we tested on, rest the code works perfectly fine. Is there anything else which i have to be concerned about other than antivirus ? Does NSIS conflict with any system processes ? i am a bit confused with this,as the user is not able to uninstall the application from his systemfaisal
It will get copied to temp when a user run it from controlpanel, _?= only applies to users installing the new version on top of the old.Anders

1 Answers

1
votes

Report false positives to Trend Micro.

If you want to avoid %Temp% then you can use a little uninstall launcher:

!define UNBINNAME "Uninst.bin"
!define UNHLPNAME "Uninst.exe"
!ifndef UNHELPER ; Main script:
OutFile "MySetup.exe"
RequestExecutionLevel Admin
Name "MySetup"
InstallDir "$ProgramFiles\MyApp"

Page Directory
Page InstFiles

Section
SetOutPath $InstDir
WriteUninstaller "$InstDir\${UNBINNAME}" ; Real uninstaller
!makensis '-DUNHELPER "${__FILE__}"' = 0 ; Compile helper (NSIS v3+)
File "${UNHLPNAME}" ; Uninstall launcher
; TODO: Write uninstall registry entries here
SectionEnd

Section Uninstall
Delete "$InstDir\${UNBINNAME}"
Delete "$InstDir\${UNHLPNAME}"
RMDir "$InstDir"
SectionEnd

!else ; Helper:
OutFile "${UNHLPNAME}"
RequestExecutionLevel Admin
SilentInstall silent
Name "UnHelper"
Icon "${NSISDIR}\Contrib\Graphics\Icons\classic-uninstall.ico"
Section
System::Call "OLE32::CoCreateGuid(g.r0)" ; Note: This will create a .dll in %Temp%, use a unique name instead if this is a problem.
StrCpy $0 "$LocalAppData\Un$0.exe"
CopyFiles /SILENT /FILESONLY "$ExeDir\${UNBINNAME}" "$0"
Exec '"$0" _?=$ExeDir'
Quit
SectionEnd
!endif

If this works then the AV is rather silly, %Temp% is not really special, the user can write to other places.