1;libCEC installer 2;Copyright (C) 2011-2020 Pulse-Eight Ltd. 3;http://www.pulse-eight.com/ 4 5Var StartMenuFolder 6Var VSRedistSetupError 7Var VSRedistInstalledX64 8Var VSRedistInstalledX86 9Var EventGhostLocation 10 11!include "MUI2.nsh" 12!include "nsDialogs.nsh" 13!include "LogicLib.nsh" 14!include "x64.nsh" 15!include "nsis\libcec-version.nsh" 16!include "nsis\functions.nsh" 17 18XPStyle on 19RequestExecutionLevel admin 20 21Name "Pulse-Eight libCEC v${LIBCEC_VERSION_STRING}" 22 23 24!ifdef INNER 25 ; only generate a temporary installer so we can sign the uninstaller if INNER is defined 26 OutFile "$%TEMP%\libcec_temp_installer.exe" 27 SetCompress off 28!else 29 ; create the uninstaller first 30 !makensis '/V1 /DINNER "${__FILE__}"' = 0 31 !system 'set __COMPAT_LAYER=RunAsInvoker&"$%TEMP%\libcec_temp_installer.exe"' = 2 32 ; sign the uninstaller if the signtool is present 33 ${!defineifexist} SIGNTOOL_EXISTS ..\support\private\sign-binary.cmd 34 !ifdef SIGNTOOL_EXISTS 35 !echo "Signing uninstaller binary" 36 !system "..\support\private\sign-binary.cmd $%TEMP%\uninstall_libcec.exe" = 0 37 !undef SIGNTOOL_EXISTS 38 !endif 39 40 ; generate a separate installer if pdb files are included, because it more than twice the size 41 !ifdef NSISINCLUDEPDB 42 OutFile "..\build\libcec-dbg-${LIBCEC_VERSION_STRING}.exe" 43 !else 44 OutFile "..\build\libcec-${LIBCEC_VERSION_STRING}.exe" 45 !endif 46 SetCompressor /SOLID lzma 47!endif 48 49InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter" 50InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" 51 52!define MUI_FINISHPAGE_LINK "Visit http://libcec.pulse-eight.com/ for more information." 53!define MUI_FINISHPAGE_LINK_LOCATION "http://libcec.pulse-eight.com/" 54!define MUI_ABORTWARNING 55 56!insertmacro MUI_PAGE_WELCOME 57!insertmacro MUI_PAGE_LICENSE "..\COPYING" 58!insertmacro MUI_PAGE_COMPONENTS 59!insertmacro MUI_PAGE_DIRECTORY 60 61!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" 62!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter sofware" 63!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" 64!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder 65 66!insertmacro MUI_PAGE_INSTFILES 67!insertmacro MUI_PAGE_FINISH 68 69!insertmacro MUI_UNPAGE_WELCOME 70!insertmacro MUI_UNPAGE_CONFIRM 71!insertmacro MUI_UNPAGE_INSTFILES 72!insertmacro MUI_UNPAGE_FINISH 73 74!insertmacro MUI_LANGUAGE "English" 75 76InstType "Full installation" 77InstType "USB-CEC Driver & libCEC" 78InstType "USB-CEC Driver Only" 79 80; installer sections, separate file to declutter a bit 81!include "nsis\sections.nsh" 82 83Function .onInit 84!ifdef INNER 85 ; just write the uninstaller and exit 86 SetSilent silent 87 WriteUninstaller "$%TEMP%\uninstall_libcec.exe" 88 Quit 89!else 90 ; the actual onInit function 91 92 ; check for vc x86 redist 93 ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version" 94 ${If} $1 != "" 95 StrCpy $VSRedistInstalledX86 "Yes" 96 ${Endif} 97 98 ${If} $VSRedistInstalledX86 == "Yes" 99 !insertMacro UnSelectSection ${SecVCRedistX86} 100 SectionSetText ${SecVCRedistX86} "" 101 ${Else} 102 !insertMacro SelectSection ${SecVCRedistX86} 103 SectionSetText ${SecVCRedistX86} "${REDISTRIBUTABLE_X86_SECTIONNAME}" 104 ${Endif} 105 106 ${If} ${RunningX64} 107 ; check for vc x64 redist 108 ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version" 109 ${If} $1 != "" 110 StrCpy $VSRedistInstalledX64 "Yes" 111 ${Endif} 112 113 ${If} $VSRedistInstalledX64 == "Yes" 114 !insertMacro UnSelectSection ${SecVCRedistX64} 115 SectionSetText ${SecVCRedistX64} "" 116 ${Else} 117 !insertMacro SelectSection ${SecVCRedistX64} 118 SectionSetText ${SecVCRedistX64} "${REDISTRIBUTABLE_X64_SECTIONNAME}" 119 ${Endif} 120 ${Else} 121 !insertMacro UnSelectSection ${SecVCRedistX64} 122 SectionSetText ${SecVCRedistX64} "" 123 ${Endif} 124 125 ; check for EventGhost 126 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EventGhost_is1" "InstallLocation" 127 ${If} $1 != "" 128 StrCpy $EventGhostLocation "$1" 129 !insertMacro SelectSection ${SecEvGhostCec} 130 SectionSetText ${SecEvGhostCec} "${EVENTGHOST_SECTIONNAME}" 131 ${Else} 132 !insertMacro UnSelectSection ${SecEvGhostCec} 133 ${Endif} 134 135 ; check for Kodi 136 IfFileExists "$PROGRAMFILES32\Kodi\cec.dll" 0 +2 137 SectionSetText ${SecLibCecKodi86} "${KODI_X86_SECTIONNAME}" 138 ${If} ${RunningX64} 139 IfFileExists "$PROGRAMFILES64\Kodi\cec.dll" 0 +2 140 SectionSetText ${SecLibCecKodi64} "${KODI_X64_SECTIONNAME}" 141 ${Endif} 142 !insertMacro UnSelectSection ${SecLibCecKodi86} 143 !insertMacro UnSelectSection ${SecLibCecKodi64} 144!endif 145FunctionEnd 146 147!ifdef INNER 148!include "nsis\uninstall.nsh" 149!endif 150