From 09054f708d81b6b51b54b47d31bf84fac8d14487 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Sun, 9 Oct 2011 19:06:37 +0200 Subject: [PATCH] cec: added installer for windows. requires Visual Studio / Visual C++ 2010, NSIS and WinDDK. --- .gitignore | 3 + OEM001.inf | 87 ++++++++++++++++++++ project/create-installer.cmd | 31 +++++++ project/libCEC.nsi | 154 +++++++++++++++++++++++++++++++++++ 4 files changed, 275 insertions(+) create mode 100644 OEM001.inf create mode 100644 project/create-installer.cmd create mode 100644 project/libCEC.nsi diff --git a/.gitignore b/.gitignore index 50135e7..2c1e410 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ src/testclient/.libs src/testclient/cec-client src/testclient/*.o + +/dpinst-x86.exe +/dpinst-amd64.exe \ No newline at end of file diff --git a/OEM001.inf b/OEM001.inf new file mode 100644 index 0000000..1731e8d --- /dev/null +++ b/OEM001.inf @@ -0,0 +1,87 @@ +; Copyright (c) 2011 Pulse-Eight Limited + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MFGNAME% +LayoutFile=layout.inf +CatalogFile=%MFGFILENAME%.cat +DriverVer=07/04/2011,1.0.0.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTamd64 + +[DestinationDirs] +DefaultDestDir=12 + + +;------------------------------------------------------------------------------ +; Windows 2000/XP/Vista-32bit Sections +;------------------------------------------------------------------------------ + +[DriverInstall.nt] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.nt +AddReg=DriverInstall.nt.AddReg + +[DriverCopyFiles.nt] +usbser.sys,,,0x20 + +[DriverInstall.nt.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,%DRIVERFILENAME%.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.nt.Services] +AddService=usbser, 0x00000002, DriverService.nt + +[DriverService.nt] +DisplayName=%SERVICE% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\%DRIVERFILENAME%.sys + +;------------------------------------------------------------------------------ +; Vista-64bit Sections +;------------------------------------------------------------------------------ + +[DriverInstall.NTamd64] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles.NTamd64 +AddReg=DriverInstall.NTamd64.AddReg + +[DriverCopyFiles.NTamd64] +%DRIVERFILENAME%.sys,,,0x20 + +[DriverInstall.NTamd64.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,%DRIVERFILENAME%.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.NTamd64.Services] +AddService=usbser, 0x00000002, DriverService.NTamd64 + +[DriverService.NTamd64] +DisplayName=%SERVICE% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\%DRIVERFILENAME%.sys + +[SourceDisksFiles] +[SourceDisksNames] +[DeviceList] +%DESCRIPTION%=DriverInstall, USB\VID_2548&PID_1001 + +[DeviceList.NTamd64] +%DESCRIPTION%=DriverInstall, USB\VID_2548&PID_1001 + +[Strings] +MFGFILENAME="p8usb-cec" +DRIVERFILENAME ="usbser" +MFGNAME="Pulse-Eight Limited" +INSTDISK="Pulse-Eight USB-CEC Installation Disc" +DESCRIPTION="Pulse-Eight USB to HDMI CEC Adapter" +SERVICE="USB to HDMI-CEC" diff --git a/project/create-installer.cmd b/project/create-installer.cmd new file mode 100644 index 0000000..951b92b --- /dev/null +++ b/project/create-installer.cmd @@ -0,0 +1,31 @@ +@echo off + +set NSIS="C:\Program Files (x86)\NSIS\makensis.exe" +set DDK=C:\WinDDK\7600.16385.1 + +IF "%VS100COMNTOOLS%"=="" ( + set COMPILER="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe" +) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\VCExpress.exe" ( + set COMPILER="%VS100COMNTOOLS%\..\IDE\VCExpress.exe" +) ELSE IF EXIST "%VS100COMNTOOLS%\..\IDE\devenv.exe" ( + set COMPILER="%VS100COMNTOOLS%\..\IDE\devenv.exe" +) + +rem Compile libCEC +echo Cleaning libCEC +%COMPILER% libcec.sln /clean Debug + +echo Compiling libCEC +%COMPILER% libcec.sln /clean Debug +%COMPILER% libcec.sln /build Debug + +rem Copy driver installer +echo Copying driver installer +copy "%DDK%\redist\DIFx\dpinst\MultiLin\amd64\dpinst.exe" ..\dpinst-amd64.exe +copy "%DDK%\redist\DIFx\dpinst\MultiLin\x86\dpinst.exe" ..\dpinst-x86.exe + +rem Run the NSIS installer +echo Creating the installer +%NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi" + +echo The installer can be found here: libCEC-installer.exe \ No newline at end of file diff --git a/project/libCEC.nsi b/project/libCEC.nsi new file mode 100644 index 0000000..8fb7143 --- /dev/null +++ b/project/libCEC.nsi @@ -0,0 +1,154 @@ +;libCEC installer +;Copyright (C) 2011 Pulse-Eight Ltd. +;http://www.pulse-eight.com/ + +!include "MUI2.nsh" +!include "nsDialogs.nsh" +!include "LogicLib.nsh" +!include "x64.nsh" + +Name "libCEC" +OutFile "libCEC-installer.exe" + +XPStyle on +InstallDir "$PROGRAMFILES\libCEC" +InstallDirRegKey HKCU "Software\libCEC" "" +RequestExecutionLevel admin +Var StartMenuFolder + +!define MUI_FINISHPAGE_LINK "Please 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 "HKCU" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder + +!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 "Full" + +Section "libCEC" SecLibCEC + SetShellVarContext current + SectionIn RO + SectionIn 1 #section is in installtype Full + SetOutPath "$INSTDIR" + File "..\AUTHORS" + File "..\cec-client.exe" + File "..\ChangeLog" + File "..\COPYING" + File "..\libcec.dll" + File "..\libcec.lib" + File "..\libcec.pdb" + File "..\pthreadVC2.dll" + File "..\README" + + SetOutPath "$INSTDIR\driver" + File "..\dpinst-amd64.exe" + File "..\dpinst-x86.exe" + File "..\OEM001.inf" + SetOutPath "$INSTDIR\include" + File /r /x *.so "..\include\*.*" + + ;Store installation folder + WriteRegStr HKCU "Software\libCEC" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + SetOutPath "$INSTDIR" + + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \ + "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \ + "" "Start the CEC Test client." + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \ + "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \ + "" "Uninstall libCEC." + + 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" \ + "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ + "NoModify" 1 + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ + "NoRepair" 1 + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ + "InstallLocation" "$INSTDIR" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ + "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" \ + "HelpLink" "http://www.pulse-eight.com/" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ + "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} +SectionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + + SetShellVarContext current + + ${If} ${RunningX64} + ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\OEM001.inf"' + ${Else} + ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"' + ${EndIf} + Delete "$INSTDIR\AUTHORS" + Delete "$INSTDIR\cec-client.exe" + Delete "$INSTDIR\ChangeLog" + Delete "$INSTDIR\COPYING" + Delete "$INSTDIR\libcec.dll" + Delete "$INSTDIR\libcec.lib" + Delete "$INSTDIR\libcec.pdb" + Delete "$INSTDIR\pthreadVC2.dll" + Delete "$INSTDIR\README" + Delete "$INSTDIR\driver\OEM001.inf" + Delete "$INSTDIR\driver\dpinst-amd64.exe" + Delete "$INSTDIR\driver\dpinst-x86.exe" + + RMDir /r "$INSTDIR\include" + Delete "$INSTDIR\Uninstall.exe" + RMDir /r "$INSTDIR" + + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" + RMDir "$SMPROGRAMS\$StartMenuFolder" + + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" + + DeleteRegKey /ifempty HKCU "Software\libCEC" + +SectionEnd -- 2.34.1