| 1 | ;libCEC installer |
| 2 | ;Copyright (C) 2011 Pulse-Eight Ltd. |
| 3 | ;http://www.pulse-eight.com/ |
| 4 | |
| 5 | !include "MUI2.nsh" |
| 6 | !include "nsDialogs.nsh" |
| 7 | !include "LogicLib.nsh" |
| 8 | !include "x64.nsh" |
| 9 | |
| 10 | Name "libCEC" |
| 11 | OutFile "libCEC-installer.exe" |
| 12 | |
| 13 | XPStyle on |
| 14 | InstallDir "$PROGRAMFILES\libCEC" |
| 15 | InstallDirRegKey HKCU "Software\libCEC" "" |
| 16 | RequestExecutionLevel admin |
| 17 | Var StartMenuFolder |
| 18 | |
| 19 | !define MUI_FINISHPAGE_LINK "Please visit http://www.pulse-eight.com/ for more information." |
| 20 | !define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/" |
| 21 | !define MUI_ABORTWARNING |
| 22 | |
| 23 | !insertmacro MUI_PAGE_WELCOME |
| 24 | !insertmacro MUI_PAGE_LICENSE "..\COPYING" |
| 25 | !insertmacro MUI_PAGE_DIRECTORY |
| 26 | |
| 27 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" |
| 28 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC" |
| 29 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" |
| 30 | !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder |
| 31 | |
| 32 | !insertmacro MUI_PAGE_INSTFILES |
| 33 | !insertmacro MUI_PAGE_FINISH |
| 34 | |
| 35 | !insertmacro MUI_UNPAGE_WELCOME |
| 36 | !insertmacro MUI_UNPAGE_CONFIRM |
| 37 | !insertmacro MUI_UNPAGE_INSTFILES |
| 38 | !insertmacro MUI_UNPAGE_FINISH |
| 39 | |
| 40 | !insertmacro MUI_LANGUAGE "English" |
| 41 | |
| 42 | InstType "Full" |
| 43 | |
| 44 | Section "libCEC" SecLibCEC |
| 45 | SetShellVarContext current |
| 46 | SectionIn RO |
| 47 | SectionIn 1 #section is in installtype Full |
| 48 | SetOutPath "$INSTDIR" |
| 49 | File "..\AUTHORS" |
| 50 | File "..\cec-client.exe" |
| 51 | File "..\ChangeLog" |
| 52 | File "..\COPYING" |
| 53 | File "..\libcec.dll" |
| 54 | File "..\libcec.lib" |
| 55 | File "Release\LibCecSharp.dll" |
| 56 | File "..\pthreadVC2.dll" |
| 57 | File "..\README" |
| 58 | |
| 59 | SetOutPath "$INSTDIR\driver" |
| 60 | File "..\dpinst-amd64.exe" |
| 61 | File "..\dpinst-x86.exe" |
| 62 | File "..\OEM001.inf" |
| 63 | SetOutPath "$INSTDIR\include" |
| 64 | File /r /x *.so "..\include\cec*.*" |
| 65 | |
| 66 | ;Store installation folder |
| 67 | WriteRegStr HKCU "Software\libCEC" "" $INSTDIR |
| 68 | |
| 69 | ;Create uninstaller |
| 70 | WriteUninstaller "$INSTDIR\Uninstall.exe" |
| 71 | |
| 72 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application |
| 73 | SetOutPath "$INSTDIR" |
| 74 | |
| 75 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" |
| 76 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \ |
| 77 | "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \ |
| 78 | "" "Start the CEC Test client." |
| 79 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \ |
| 80 | "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \ |
| 81 | "" "Uninstall libCEC." |
| 82 | |
| 83 | WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/" |
| 84 | !insertmacro MUI_STARTMENU_WRITE_END |
| 85 | |
| 86 | |
| 87 | ;add entry to add/remove programs |
| 88 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 89 | "DisplayName" "libCEC" |
| 90 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 91 | "UninstallString" "$INSTDIR\uninstall.exe" |
| 92 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 93 | "NoModify" 1 |
| 94 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 95 | "NoRepair" 1 |
| 96 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 97 | "InstallLocation" "$INSTDIR" |
| 98 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 99 | "DisplayIcon" "$INSTDIR\cec-client.exe,0" |
| 100 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 101 | "Publisher" "Pulse-Eight Ltd." |
| 102 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 103 | "HelpLink" "http://www.pulse-eight.com/" |
| 104 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ |
| 105 | "URLInfoAbout" "http://www.pulse-eight.com" |
| 106 | |
| 107 | ;install driver |
| 108 | ${If} ${RunningX64} |
| 109 | ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"' |
| 110 | ${Else} |
| 111 | ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"' |
| 112 | ${EndIf} |
| 113 | SectionEnd |
| 114 | |
| 115 | ;-------------------------------- |
| 116 | ;Uninstaller Section |
| 117 | |
| 118 | Section "Uninstall" |
| 119 | |
| 120 | SetShellVarContext current |
| 121 | |
| 122 | ${If} ${RunningX64} |
| 123 | ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\OEM001.inf"' |
| 124 | ${Else} |
| 125 | ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"' |
| 126 | ${EndIf} |
| 127 | Delete "$INSTDIR\AUTHORS" |
| 128 | Delete "$INSTDIR\cec-client.exe" |
| 129 | Delete "$INSTDIR\ChangeLog" |
| 130 | Delete "$INSTDIR\COPYING" |
| 131 | Delete "$INSTDIR\libcec.dll" |
| 132 | Delete "$INSTDIR\libcec.lib" |
| 133 | Delete "$INSTDIR\libcec.pdb" |
| 134 | Delete "$INSTDIR\LibCecSharp.dll" |
| 135 | Delete "$INSTDIR\pthreadVC2.dll" |
| 136 | Delete "$INSTDIR\README" |
| 137 | Delete "$INSTDIR\driver\OEM001.inf" |
| 138 | Delete "$INSTDIR\driver\dpinst-amd64.exe" |
| 139 | Delete "$INSTDIR\driver\dpinst-x86.exe" |
| 140 | |
| 141 | RMDir /r "$INSTDIR\include" |
| 142 | Delete "$INSTDIR\Uninstall.exe" |
| 143 | RMDir /r "$INSTDIR" |
| 144 | |
| 145 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder |
| 146 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" |
| 147 | Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" |
| 148 | Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" |
| 149 | RMDir "$SMPROGRAMS\$StartMenuFolder" |
| 150 | |
| 151 | DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" |
| 152 | |
| 153 | DeleteRegKey /ifempty HKCU "Software\libCEC" |
| 154 | |
| 155 | SectionEnd |