; Shortwave Radio Installer ; Compatible with Windows XP and later !define APPNAME "Shortwave Radio" !define COMPANYNAME "Kieran Klukas" !define DESCRIPTION "Vintage Shortwave Radio Tuner with Internet Streaming" !define VERSIONMAJOR 1 !define VERSIONMINOR 0 !define VERSIONBUILD 0 !define HELPURL "https://github.com/taciturnaxolotl/shortwave" !define UPDATEURL "https://github.com/taciturnaxolotl/shortwave/releases" !define ABOUTURL "https://github.com/taciturnaxolotl/shortwave" !define INSTALLSIZE 2048 ; Disable CRC check to avoid cross-platform issues CRCCheck off ; Use solid compression SetCompressor /SOLID lzma RequestExecutionLevel admin InstallDir "$PROGRAMFILES\${APPNAME}" Name "${APPNAME}" outFile "ShortwaveRadioInstaller.exe" !include LogicLib.nsh page directory page instfiles !macro VerifyUserIsAdmin UserInfo::GetAccountType pop $0 ${If} $0 != "admin" messageBox mb_iconstop "Administrator rights required!" setErrorLevel 740 quit ${EndIf} !macroend function .onInit setShellVarContext all !insertmacro VerifyUserIsAdmin functionEnd section "install" setOutPath $INSTDIR ; Main executable file "result/bin/Shortwave.exe" ; BASS audio library file "libs/bass.dll" ; License and documentation file "LICENSE.md" file "README.md" ; Create uninstaller writeUninstaller "$INSTDIR\uninstall.exe" ; Start menu shortcuts createDirectory "$SMPROGRAMS\${APPNAME}" createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe" createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" ; Desktop shortcut createShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe" ; Registry entries for Add/Remove Programs WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\Shortwave.exe$\"" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "${HELPURL}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLUpdateInfo" "${UPDATEURL}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "${ABOUTURL}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE} sectionEnd function un.onInit SetShellVarContext all MessageBox MB_OKCANCEL "Remove ${APPNAME}?" IDOK next Abort next: !insertmacro VerifyUserIsAdmin functionEnd section "uninstall" ; Remove files delete "$INSTDIR\Shortwave.exe" delete "$INSTDIR\bass.dll" delete "$INSTDIR\LICENSE.md" delete "$INSTDIR\README.md" delete "$INSTDIR\uninstall.exe" ; Remove shortcuts delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" rmDir "$SMPROGRAMS\${APPNAME}" delete "$DESKTOP\${APPNAME}.lnk" ; Remove registry entries DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" ; Remove installation directory rmDir "$INSTDIR" sectionEnd