My Uninstall Runs Twice
Every time that I run my uninstaller from Add/Remove appet it runs twice. I load the uninstaller, go through the uninstall (which works fine), get the Finish page, select the finish button and wham, the uninstall dialog just starts over again. After the second time it closes as it should. I can't figure out why this happens. Any idea? My script is:
;NSIS Modern User Interface
;Welcome/Finish Page Example Script
;Written by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
SetCompressor BZIP2
;--------------------------------
;General
;Name and file
Name "MyApp"
OutFile "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\ndi_de2.exe"
XPStyle on
RequestExecutionLevel admin
!define MUI_ICON "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\ndi_de.ico"
!define MUI_UNICON "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\ndi_de.ico"
;Default installation folder
InstallDir "$PROGRAMFILES\MyApp"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\MyApp" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "MyApp"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Inventory, backup, restore and locate system drivers."
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Gord Corp."
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "MyApp is a trademark of Gord Corp."
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Gord Corp. 2003 - 2007"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Inventory, backup, restore and locate system drivers."
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "2.1.26"
VIProductVersion "2.1.26.0"
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\Install Path\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Modified Finish Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE fin_pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW fin_show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE fin_leave
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION Desc_ShortCut
!define MUI_FINISHPAGE_RUN_TEXT "Create Desktop Shortcut"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Functions
Function Desc_Shortcut
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\myappexe.exe"
FunctionEnd
Function fin_show
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "HWND"
SetCtlColors $0 0x000000 0xFFFFFF
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 7" "HWND"
SetCtlColors $0 0x000000 0xFFFFFF
FunctionEnd
Function fin_pre
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "6"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Text" "&Create Quicklaunch Shortcut"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Right" "315"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Top" "110"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Bottom" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "State" "1"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "7"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Text" "&Launch MyApp"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Right" "315"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Top" "130"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "Bottom" "140"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 7" "State" "1"
FunctionEnd
Function fin_leave
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "State"
StrCmp $0 "0" end
SetOutPath "$INSTDIR"
CreateShortCut "$QUICKLAUNCH\MyApp.lnk" "$INSTDIR\myappexe.exe"
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 7" "State"
StrCmp $0 "0" end
SetOutPath "$INSTDIR"
Exec "$INSTDIR\myappexe.exe"
end:
FunctionEnd
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\myappexe.exe"
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\Help\myappexe.chm"
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\Install Path\*.*"
SetOutPath "$INSTDIR\bin"
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\bin\*.*"
SetOutPath "$SYSDIR"
SetOverwrite try
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\System Path\*.*"
SetOutPath "$SYSDIR\wbem"
SetOverwrite off
File "\\c343267-a\C\Software\Projects\Gord Corp\ndi_de Projects\Premium\ndi_de\NSIS\wbem\*.*"
;Store installation folder
WriteRegStr HKCU "Software\MyApp" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
RegDLL "$INSTDIR\bin\Codejock.CommandBars.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.DockingPane.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.PropertyGrid.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.ReportControl.v10.4.0.ocx"
RegDLL "$INSTDIR\bin\Codejock.TaskPanel.v10.4.0.ocx"
RegDLL "$SYSDIR\MSCOMCTL.OCX"
RegDLL "$SYSDIR\msvbvm60.dll"
RegDLL "$SYSDIR\scrrun.dll"
RegDLL "$SYSDIR\shfolder.dll"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "DisplayName" "MyApp"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "DisplayIcon" "$INSTDIR\myappexe.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "NoRepair" "1"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
;LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
;!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
;!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
;!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
RMDir /r /REBOOTOK "$INSTDIR"
Delete "$DESKTOP\MyApp.lnk"
Delete "$QUICKLAUNCH\MyApp.lnk"
DeleteRegKey HKCU "Software\MyApp"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp"
Delete "$INSTDIR\Uninstall.exe"
SectionEnd