diff --git a/VERSION b/VERSION index f317be1d..fd71e328 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc3-21-g380b5df9f9+1 \ No newline at end of file +B2-rc3-30-g7dba6b9b08+1 \ No newline at end of file diff --git a/host/README.md b/host/README.md index 5152307f..e99bbc90 100644 --- a/host/README.md +++ b/host/README.md @@ -44,11 +44,13 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw64.cmake .. make ``` -## Building the installer +## Building the Windows installer Install NSIS compiler Build the host program, see above sections. -Build installer with `makensis c-host/installer/installer.nsi` +Build installer with `makensis platform/Windows/installer.nsi` +The resulting installer will be at +`platform/Windows/looking-glass-host-setup.exe` ## Where is the log? diff --git a/host/platform/Windows/CMakeLists.txt b/host/platform/Windows/CMakeLists.txt index a358f88d..2aba1b8d 100644 --- a/host/platform/Windows/CMakeLists.txt +++ b/host/platform/Windows/CMakeLists.txt @@ -34,3 +34,9 @@ target_include_directories(platform_Windows PRIVATE src ) + +# these are for the nsis installer generator +configure_file("${PROJECT_SOURCE_DIR}/installer.nsi" "${PROJECT_BINARY_DIR}/installer.nsi" COPYONLY) +configure_file("${PROJECT_TOP}/resources/icon.ico" "${PROJECT_BINARY_DIR}/icon.ico" COPYONLY) +configure_file("${PROJECT_TOP}/VERSION" "${PROJECT_BINARY_DIR}/VERSION" COPYONLY) +configure_file("${PROJECT_TOP}/LICENSE" "${PROJECT_BINARY_DIR}/LICENSE.txt" COPYONLY) diff --git a/host/installer/installer.nsi b/host/platform/Windows/installer.nsi similarity index 54% rename from host/installer/installer.nsi rename to host/platform/Windows/installer.nsi index 49df6e1d..63829796 100644 --- a/host/installer/installer.nsi +++ b/host/platform/Windows/installer.nsi @@ -25,21 +25,21 @@ Place, Suite 330, Boston, MA 02111-1307 USA !include "Sections.nsh" ;Settings -Name "Looking Glass Host" -OutFile "..\build\looking-glass-host-setup.exe" +Name "Looking Glass (host)" +OutFile "looking-glass-host-setup.exe" Unicode true RequestExecutionLevel admin ShowInstDetails "show" ShowUninstDetails "show" -InstallDir "$PROGRAMFILES64\Looking Glass" +InstallDir "$PROGRAMFILES64\Looking Glass (host)" -!define MUI_ICON "..\..\resources\icon.ico" -!define MUI_UNICON "..\..\resources\icon.ico" +!define MUI_ICON "icon.ico" +!define MUI_UNICON "icon.ico" !define MUI_LICENSEPAGE_BUTTON "Agree" -!define /file VERSION "..\..\VERSION" +!define /file VERSION "VERSION" ;Install and uninstall pages -!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE" +!insertmacro MUI_PAGE_LICENSE "LICENSE.txt" !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES @@ -49,94 +49,96 @@ InstallDir "$PROGRAMFILES64\Looking Glass" Function ShowHelpMessage - !define line1 "Command line options:$\r$\n$\r$\n" - !define line2 "/S - silent install (must be uppercase)$\r$\n" - !define line3 "/D=path\to\install\folder - Change install directory$\r$\n" - !define line4 " (Must be uppercase, the last option given and no quotes)$\r$\n$\r$\n" - !define line5 "/startmenu - create start menu shortcut$\r$\n" - !define line6 "/desktop - create desktop shortcut$\r$\n" - !define line7 "/noservice - do not create a service to auto start and elevate the host" - MessageBox MB_OK "${line1}${line2}${line3}${line4}${line5}${line6}${line7}" - Abort + !define line1 "Command line options:$\r$\n$\r$\n" + !define line2 "/S - silent install (must be uppercase)$\r$\n" + !define line3 "/D=path\to\install\folder - Change install directory$\r$\n" + !define line4 " (Must be uppercase, the last option given and no quotes)$\r$\n$\r$\n" + !define line5 "/startmenu - create start menu shortcut$\r$\n" + !define line6 "/desktop - create desktop shortcut$\r$\n" + !define line7 "/noservice - do not create a service to auto start and elevate the host" + MessageBox MB_OK "${line1}${line2}${line3}${line4}${line5}${line6}${line7}" + Abort FunctionEnd Function .onInit - var /GLOBAL cmdLineParams - Push $R0 - ${GetParameters} $cmdLineParams - ClearErrors - - ${GetOptions} $cmdLineParams '/?' $R0 - IfErrors +2 0 - Call ShowHelpMessage - - ${GetOptions} $cmdLineParams '/H' $R0 - IfErrors +2 0 - Call ShowHelpMessage - - Pop $R0 + var /GLOBAL cmdLineParams + Push $R0 + ${GetParameters} $cmdLineParams + ClearErrors + + ${GetOptions} $cmdLineParams '/?' $R0 + IfErrors +2 0 + Call ShowHelpMessage + + ${GetOptions} $cmdLineParams '/H' $R0 + IfErrors +2 0 + Call ShowHelpMessage + + Pop $R0 - Var /GLOBAL option_startMenu - Var /GLOBAL option_desktop - Var /GlOBAL option_noservice - StrCpy $option_startMenu 0 - StrCpy $option_desktop 0 - StrCpy $option_noservice 0 + Var /GLOBAL option_startMenu + Var /GLOBAL option_desktop + Var /GlOBAL option_noservice + StrCpy $option_startMenu 0 + StrCpy $option_desktop 0 + StrCpy $option_noservice 0 - Push $R0 - - ${GetOptions} $cmdLineParams '/startmenu' $R0 - IfErrors +2 0 - StrCpy $option_startMenu 1 - - ${GetOptions} $cmdLineParams '/desktop' $R0 - IfErrors +2 0 - StrCpy $option_desktop 1 + Push $R0 - ${GetOptions} $cmdLineParams '/noservice' $R0 - IfErrors +2 0 - StrCpy $option_noservice 1 - - Pop $R0 + ${GetOptions} $cmdLineParams '/startmenu' $R0 + IfErrors +2 0 + StrCpy $option_startMenu 1 + + ${GetOptions} $cmdLineParams '/desktop' $R0 + IfErrors +2 0 + StrCpy $option_desktop 1 + + ${GetOptions} $cmdLineParams '/noservice' $R0 + IfErrors +2 0 + StrCpy $option_noservice 1 + + Pop $R0 FunctionEnd ;Install Section "-Install" Section1 + nsExec::Exec 'net.exe STOP "Looking Glass (host)"' + SetOutPath $INSTDIR - File ..\build\looking-glass-host.exe - File /oname=LICENSE.txt ..\..\LICENSE + File ..\..\looking-glass-host.exe + File LICENSE.txt WriteUninstaller $INSTDIR\uninstaller.exe ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "EstimatedSize" "$0" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "DisplayName" "Looking-Glass" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "UninstallString" "$\"$INSTDIR\uninstaller.exe$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "QuietUninstallString" "$\"$INSTDIR\uninstaller.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "InstallLocation" "$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "Publisher" "Geoffrey McRae" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "DisplayIcon" "$\"$INSTDIR\looking-glass-host.exe$\"" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "NoRepair" "1" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ - "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "EstimatedSize" "$0" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "DisplayName" "Looking Glass" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "UninstallString" "$\"$INSTDIR\uninstaller.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "QuietUninstallString" "$\"$INSTDIR\uninstaller.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "Publisher" "Geoffrey McRae" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "DisplayIcon" "$\"$INSTDIR\looking-glass-host.exe$\"" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "NoRepair" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ + "NoModify" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \ "DisplayVersion" ${VERSION} SectionEnd -Section "Looking-Glass Service" Section2 +Section "Looking Glass (host) Service" Section2 ${If} $option_noservice == 0 nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService' @@ -157,11 +159,11 @@ Section "-Hidden Start Menu" Section5 SetShellVarContext all ${If} $option_startMenu == 1 - CreateShortCut $SMPROGRAMS\Looking Glass (host).lnk $INSTDIR\looking-glass-host.exe + CreateShortCut "$SMPROGRAMS\Looking Glass (host).lnk" $INSTDIR\looking-glass-host.exe ${EndIf} ${If} $option_desktop == 1 - CreateShortCut $DESKTOP\Looking Glass (host).lnk $INSTDIR\looking-glass-host.exe + CreateShortCut "$DESKTOP\Looking Glass (host).lnk" $INSTDIR\looking-glass-host.exe ${EndIf} SectionEnd @@ -169,22 +171,22 @@ SectionEnd Section "Uninstall" Section6 SetShellVarContext all + nsExec::Exec 'net.exe STOP "Looking Glass (host)"' nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService' - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" - Delete $SMPROGRAMS\Looking-Glass-Host.lnk - Delete $DESKTOP\Looking-Glass-Host.lnk - Delete $INSTDIR\uninstaller.exe - Delete $INSTDIR\looking-glass-host.exe - Delete $INSTDIR\LICENSE.txt + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" + Delete "$SMPROGRAMS\Looking Glass (host).lnk" + Delete "$DESKTOP\Looking Glass (host).lnk" + Delete "$INSTDIR\uninstaller.exe" + Delete "$INSTDIR\looking-glass-host.exe" + Delete "$INSTDIR\LICENSE.txt" RMDir $INSTDIR - SectionEnd ;Description text for selection of install items LangString DESC_Section1 ${LANG_ENGLISH} "Install Files into $INSTDIR" -LangString DESC_Section2 ${LANG_ENGLISH} "Create service to automatically start Looking-Glass." +LangString DESC_Section2 ${LANG_ENGLISH} "Install service to automatically start Looking Glass (host)." LangString DESC_Section3 ${LANG_ENGLISH} "Create desktop shortcut icon." LangString DESC_Section4 ${LANG_ENGLISH} "Create start menu shortcut." diff --git a/host/platform/Windows/src/service.c b/host/platform/Windows/src/service.c index 6db7f6c6..f5239bea 100644 --- a/host/platform/Windows/src/service.c +++ b/host/platform/Windows/src/service.c @@ -34,7 +34,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include -#define SVCNAME "Looking Glass Host" +#define SVCNAME "Looking Glass (host)" #define SVC_ERROR ((DWORD)0xC0020001L) struct Service