Skip to content
⌘ NSIS Forum Archive

Problems signing Uninstaller

5 posts

extremecarver#

Problems signing Uninstaller

I tried to use the following guide: http://nsis.sourceforge.net/Run_Comm...er_Compilation

However the uninstaller is not signed, only the installer will be signed. Anyone sees why it's not working?

I commendted out the echo off directive in the scrip in order to see what is going on - besides this is just the standard script.

!insertmacro: _PostExecWriteBatFile
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "SETLOCAL
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "SET Command=%~1
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "IF NOT "%1"=="DELAYED_LOAD" (
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " :: Run this script again with "DELAYED_LOAD" as the first parameter
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " :: this lets use break out of the original shell so that makensis will not wait for
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " :: this script to finish
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " start "" /D "%~dp0" "%COMSPEC%" /c "%~dpf0" DELAYED_LOAD %1 %2 %3 %4 %5 %6 %7 %8 %9
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " EXIT /B
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" ")
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "SHIFT
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "SET PROCESS=makensis.exe
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "echo Waiting for %PROCESS% to exit
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "echo %1 %2 %3 %4 %5 %6 %7 %8 %9
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" ":: Get the PID of makensis.exe
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "FOR /F "tokens=2 skip=3" %%i IN (
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " 'tasklist.exe /FI "USERNAME eq %USERDOMAIN%\%USERNAME%" /FI "IMAGENAME eq %Process%"'
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" ") DO (
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " CALL :TASKWAIT %PROCESS% %%~i
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" ")
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "%1 %2 %3 %4 %5 %6 %7 %8 %9
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "ENDLOCAL
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "DEL %0.bat
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "EXIT
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" "
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" ":TASKWAIT
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " ping.exe -n 2 -w 100000 127.0.0.1 >NUL
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " tasklist.exe /FI "USERNAME eq %USERDOMAIN%\%USERNAME%" /FI "IMAGENAME eq %1" /FI "PID eq %2" 2>NUL | find.exe "%1" >NUL && GOTO %0
"
!appendfile: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" " EXIT /B
"
!insertmacro: end of _PostExecWriteBatFile
!system: "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp signtool sign /f key.p12 /p password /t http://timestamp.comodoca.com/authenticode C:\setup.exe"

C:\OpenMTBMap\mapfolder\mtblegend>SETLOCAL

C:\OpenMTBMap\mapfolder\mtblegend>SET Command=signtool

C:\OpenMTBMap\mapfolder\mtblegend>IF NOT "signtool" == "DELAYED_LOAD" (

start "" /D "C:\Users\OPENMT~1\AppData\Local\Temp\2\" "C:\Windows\system32\cmd.exe" /c "C:\Users\OPENMT~1\AppData\Local\Temp\2\nstC9B4.tmp.bat" DELAYED_LOAD signtool sign /f C:\key.p12 /p password /t http://timestamp.comodoca.com/authenticode C:\setup.exe
EXIT /B
)
The system cannot find the drive specified.
!system: returned 0
!insertmacro: end of _PostExec9

The installer is correctly signed. However after running the installer - the uninstaller is not signed.
Also note at the end of the code the error " The system cannot find the drive specified.".
extremecarver#
I added /B to the start directive - and then it ends like this:
Done Adding Additional Store
Successfully signed: C:\setup.exe

C:\Users\OPENMT~1\AppData\Local\Temp\2>ENDLOCAL

C:\Users\OPENMT~1\AppData\Local\Temp\2>DEL DELAYED_LOAD.bat
Could Not Find C:\Users\OPENMT~1\AppData\Local\Temp\2\DELAYED_LOAD.bat

C:\Users\OPENMT~1\AppData\Local\Temp\2>EXIT
Anders#
You cannot sign the uninstaller like this. See http://nsis.sourceforge.net/Signing_an_Uninstaller
extremecarver#
Thanks - that was often linked up when I searched for how to sign the uninstaller. Anyhow I wonder if this is really needed? The uninstaller is usually created locally - so it should not matter much. It is not part of the download normally - so antirus software that works as stupid as smartscreen (Norton Reputation) should'nt matter. Or are there cases where they do block the installation due to the creation of unsigned uinstaller?
Anders#
I don't know but if it requires elevation then you get a friendlier UAC prompt when it is signed...