!include "LogicLib.nsh"
!include "x64.nsh"
-Name "libCEC"
+Name "Pulse-Eight USB-CEC Adapter"
OutFile "..\build\libCEC-installer.exe"
XPStyle on
-InstallDir "$PROGRAMFILES\libCEC"
-InstallDirRegKey HKCU "Software\libCEC" ""
+InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter"
+InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" ""
RequestExecutionLevel admin
Var StartMenuFolder
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
-!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
-!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC"
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter sofware"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
SectionIn RO
SectionIn 1 2 3
+ ; Uninstall the old unsigned software if it's found
+ ReadRegStr $1 HKCU "Software\libCEC" ""
+ ${If} $1 != ""
+ MessageBox MB_OK \
+ "A previous libCEC and USB-CEC driver was found. This update requires the old version to be uninstalled. Press OK to uninstall the old version."
+ ExecWait '"$1\Uninstall.exe" /S _?=$1'
+ Delete "$1\Uninstall.exe"
+ RMDir "$1"
+ ${EndIf}
+
; Copy to the installation directory
SetOutPath "$INSTDIR"
File "..\AUTHORS"
File "..\COPYING"
- ; Copy the driver installer and .inf file
+ ; Copy the driver installer
SetOutPath "$INSTDIR\driver"
- File "..\build\dpinst-amd64.exe"
- File "..\build\dpinst-x86.exe"
- File "..\driver\p8usb-cec.inf"
- File "..\driver\p8usb-cec.cat"
+ File "..\build\p8-usbcec-driver-installer.exe"
;Store installation folder
- WriteRegStr HKCU "Software\libCEC" "" $INSTDIR
+ WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
- CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" "$INSTDIR\Uninstall.exe" \
"" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
- "" "Uninstall libCEC."
+ "" "Uninstall Pulse-Eight USB-CEC Adapter software."
WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
!insertmacro MUI_STARTMENU_WRITE_END
;add entry to add/remove programs
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
- "DisplayName" "libCEC"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
+ "DisplayName" "Pulse-Eight USB-CEC Adapter software"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"UninstallString" "$INSTDIR\uninstall.exe"
- WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"NoModify" 1
- WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"NoRepair" 1
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"InstallLocation" "$INSTDIR"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"DisplayIcon" "$INSTDIR\cec-client.exe,0"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
- "Publisher" "Pulse-Eight Ltd."
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
+ "Publisher" "Pulse-Eight Limited"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"HelpLink" "http://www.pulse-eight.com/"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
"URLInfoAbout" "http://www.pulse-eight.com"
;install driver
- ${If} ${RunningX64}
- ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
- ${Else}
- ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
- ${EndIf}
+ ExecWait '"$INSTDIR\driver\p8-usbcec-driver-installer.exe" /S'
+ Delete "$INSTDIR\driver\p8-usbcec-driver-installer.exe"
SectionEnd
Section "libCEC" SecLibCec
; Copy to the installation directory
SetOutPath "$INSTDIR"
- File /x dpinst*.exe "..\build\*.exe"
+ File /x p8-usbcec-driver-installer.exe "..\build\*.exe"
SetOutPath "$INSTDIR\x64"
File /nonfatal "..\build\x64\*.exe"
SetShellVarContext current
- ${If} ${RunningX64}
- ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
- ${Else}
- ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
- ${EndIf}
Delete "$INSTDIR\AUTHORS"
Delete "$INSTDIR\cec*.exe"
Delete "$INSTDIR\ChangeLog"
Delete "$INSTDIR\x64\*.dll"
Delete "$INSTDIR\x64\*.lib"
Delete "$INSTDIR\README"
- Delete "$INSTDIR\driver\p8usb-cec.inf"
- Delete "$INSTDIR\driver\p8usb-cec.cat"
- Delete "$INSTDIR\driver\dpinst-amd64.exe"
- Delete "$INSTDIR\driver\dpinst-x86.exe"
+
+ ; Uninstall the driver
+ ReadRegStr $1 HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" ""
+ ${If} $1 != ""
+ ExecWait '"$1\Uninstall.exe" /S _?=$1'
+ ${EndIf}
RMDir /r "$INSTDIR\include"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
+ RMDir "$PROGRAMFILES\Pulse-Eight"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
${If} ${RunningX64}
Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
${EndIf}
- Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
+ Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
- RMDir "$SMPROGRAMS\$StartMenuFolder"
-
- DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC"
-
- DeleteRegKey /ifempty HKCU "Software\libCEC"
+ RMDir "$SMPROGRAMS\$StartMenuFolder"
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware"
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver"
+ DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter software"
+ DeleteRegKey /ifempty HKLM "Software\Pulse-Eight"
SectionEnd
--- /dev/null
+;p8-usbcec-driver installer
+;Copyright (C) 2012 Pulse-Eight Ltd.
+;http://www.pulse-eight.com/
+
+!include "MUI2.nsh"
+!include "nsDialogs.nsh"
+!include "LogicLib.nsh"
+!include "x64.nsh"
+
+Name "Pulse-Eight USB-CEC Adapter"
+OutFile "..\build\p8-usbcec-driver-installer.exe"
+
+XPStyle on
+InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter\driver"
+InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" ""
+RequestExecutionLevel admin
+
+!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
+!define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
+!define MUI_ABORTWARNING
+
+!insertmacro MUI_PAGE_WELCOME
+!insertmacro MUI_PAGE_LICENSE "..\COPYING"
+!insertmacro MUI_PAGE_DIRECTORY
+
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter driver"
+
+!insertmacro MUI_PAGE_INSTFILES
+!insertmacro MUI_PAGE_FINISH
+
+!insertmacro MUI_UNPAGE_WELCOME
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+
+!insertmacro MUI_LANGUAGE "English"
+
+InstType "USB-CEC driver only"
+
+Section "USB-CEC driver" SecDriver
+ SetShellVarContext current
+ SectionIn RO
+ SectionIn 1
+
+ ; Copy to the installation directory
+ SetOutPath "$INSTDIR"
+ File "..\AUTHORS"
+ File "..\COPYING"
+
+ ; Copy the driver installer and .inf file
+ File "..\build\dpinst-amd64.exe"
+ File "..\build\dpinst-x86.exe"
+ File "..\driver\p8usb-cec.inf"
+ File "..\driver\p8usb-cec.cat"
+
+ ;Store installation folder
+ WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" "" $INSTDIR
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+
+ ;add entry to add/remove programs
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "DisplayName" "Pulse-Eight USB-CEC Adapter driver"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "UninstallString" "$INSTDIR\uninstall.exe"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "NoRepair" 1
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "InstallLocation" "$INSTDIR"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "Publisher" "Pulse-Eight Limited"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "HelpLink" "http://www.pulse-eight.com/"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
+ "URLInfoAbout" "http://www.pulse-eight.com"
+
+ ;install driver
+ ${If} ${RunningX64}
+ ExecWait '"$INSTDIR\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR"'
+ ${Else}
+ ExecWait '"$INSTDIR\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR"'
+ ${EndIf}
+SectionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+
+ SetShellVarContext current
+
+ ${If} ${RunningX64}
+ ExecWait '"$INSTDIR\dpinst-amd64.exe" /u "$INSTDIR\p8usb-cec.inf"'
+ ${Else}
+ ExecWait '"$INSTDIR\dpinst-x64.exe" /u "$INSTDIR\p8usb-cec.inf"'
+ ${EndIf}
+ Delete "$INSTDIR\AUTHORS"
+ Delete "$INSTDIR\COPYING"
+ Delete "$INSTDIR\p8usb-cec.inf"
+ Delete "$INSTDIR\p8usb-cec.cat"
+ Delete "$INSTDIR\dpinst-amd64.exe"
+ Delete "$INSTDIR\dpinst-x86.exe"
+
+ RMDir /r "$INSTDIR\include"
+ Delete "$INSTDIR\Uninstall.exe"
+ RMDir /r "$INSTDIR"
+ RMDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter"
+ RMDir "$PROGRAMFILES\Pulse-Eight"
+
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver"
+ DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter driver"
+ DeleteRegKey /ifempty HKLM "Software\Pulse-Eight"
+
+SectionEnd
--- /dev/null
+@echo off
+
+rem Check for NSIS
+IF EXIST "%ProgramFiles%\NSIS\makensis.exe" (
+ set NSIS="%ProgramFiles%\NSIS\makensis.exe"
+) ELSE IF EXIST "%ProgramFiles(x86)%\NSIS\makensis.exe" (
+ set NSIS="%ProgramFiles(x86)%\NSIS\makensis.exe"
+) ELSE GOTO NONSIS
+
+rem Check for the Windows DDK
+IF NOT EXIST "C:\WinDDK\7600.16385.1" GOTO NODDK
+set DDK="C:\WinDDK\7600.16385.1"
+
+cd ..\project
+
+del /s /f /q ..\build
+mkdir ..\build
+
+echo. Copying driver installer
+copy "%DDK%\redist\DIFx\dpinst\MultiLin\amd64\dpinst.exe" ..\build\dpinst-amd64.exe
+copy "%DDK%\redist\DIFx\dpinst\MultiLin\x86\dpinst.exe" ..\build\dpinst-x86.exe
+
+:CREATEINSTALLER
+echo. Creating the installer
+%NSIS% /V1 /X"SetCompressor /FINAL lzma" "p8-usbcec-driver.nsi"
+
+IF NOT EXIST "..\build\p8-usbcec-driver-installer.exe" GOTO :ERRORCREATINGINSTALLER
+
+rem Sign the installer if sign-binary.cmd exists
+IF EXIST "..\support\sign-binary.cmd" (
+ echo. Signing the installer binaries
+ CALL ..\support\sign-binary.cmd ..\build\p8-usbcec-driver-installer.exe
+)
+
+echo. The installer can be found here: ..\build\p8-usbcec-driver-installer.exe
+
+GOTO EXIT
+
+:NOSIS
+echo. NSIS could not be found on your system.
+GOTO EXIT
+
+:NODDK
+echo. Windows DDK could not be found on your system
+GOTO EXIT
+
+:ERRORCREATINGINSTALLER
+echo. The installer could not be created.
+
+:EXIT
+del /q /f ..\build\dpinst-amd64.exe
+del /q /f ..\build\dpinst-x86.exe
+cd ..\support
\ No newline at end of file
set COMPILER10="%VS100COMNTOOLS%\..\IDE\devenv.exe"
) ELSE GOTO NOSDK10
-cd ..\project
-
del /s /f /q ..\build
mkdir ..\build
+
+call create-driver-installer.cmd
+
mkdir ..\build\x64
+cd ..\project
+
rem Skip to libCEC/x86 when we're running on win32
if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecx86
%COMPILER9% LibCecSharp.sln /build "Release|x86" /project CecSharpTester
:NOSDK9
-echo. Copying driver installer
-copy "%DDK%\redist\DIFx\dpinst\MultiLin\amd64\dpinst.exe" ..\build\dpinst-amd64.exe
-copy "%DDK%\redist\DIFx\dpinst\MultiLin\x86\dpinst.exe" ..\build\dpinst-x86.exe
-
rem Clean things up before creating the installer
-del ..\build\LibCecSharp.pdb
-del ..\build\CecSharpTester.pdb
+del /q /f ..\build\LibCecSharp.pdb
+del /q /f ..\build\CecSharpTester.pdb
copy ..\build\cec-client.x64.exe ..\build\x64\cec-client.x64.exe
-del ..\build\cec-client.x64.exe
+del /q /f ..\build\cec-client.x64.exe
copy ..\build\libcec.x64.dll ..\build\x64\libcec.x64.dll
-del ..\build\libcec.x64.dll
+del /q /f ..\build\libcec.x64.dll
copy ..\build\libcec.x64.lib ..\build\x64\libcec.x64.lib
-del ..\build\libcec.x64.lib
+del /q /f ..\build\libcec.x64.lib
rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
echo. The installer could not be created. The most likely cause is that something went wrong while compiling.
:EXIT
+del /q /f ..\build\cec-client.exe
+del /q /f ..\build\CecSharpTester.exe
+del /q /f ..\build\*.dll
+del /q /f ..\build\*.lib
+del /q /f ..\build\*.exp
+del /s /f /q ..\build\x64
+rmdir ..\build\x64
cd ..\support
\ No newline at end of file