From 47b8c58d47bae45d723ef22665e8f13ecc66725f Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 18 Feb 2018 13:12:13 +0100 Subject: Prevent installing stand-alone installers on unsupported environments. - Prevent installers from installing on XP/Vista. - Prevent x64 installers from installing on x86. --- browser/branding/official/branding.nsi | 2 +- browser/installer/windows/nsis/installer.nsi | 61 +++++----------------- .../windows/nsis/maintenanceservice_installer.nsi | 5 +- .../maintenanceservice_installer.nsi | 5 +- toolkit/mozapps/installer/windows/nsis/common.nsh | 45 +++------------- 5 files changed, 24 insertions(+), 94 deletions(-) diff --git a/browser/branding/official/branding.nsi b/browser/branding/official/branding.nsi index 24b0f4bba..58d7554df 100644 --- a/browser/branding/official/branding.nsi +++ b/browser/branding/official/branding.nsi @@ -20,7 +20,7 @@ !define OFFICIAL !define URLStubDownload "" !define URLManualDownload "" -!define URLSystemRequirements "" +!define URLSystemRequirements "http://www.basilisk-browser.org/requirements.shtml" !define Channel "release" # The installer's certificate name and issuer expected by the stub installer diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index aed5808cd..994c09279 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -1139,13 +1139,11 @@ Function .onInit ; Don't install on systems that don't support SSE2. The parameter value of ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the - ; SSE2 instruction set is available. + ; SSE2 instruction set is available. Result returned in $R7. System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7" -!ifdef HAVE_64BIT_BUILD - ; Restrict x64 builds from being installed on x86 and pre Win7 - ${Unless} ${RunningX64} - ${OrUnless} ${AtLeastWin7} + ; Windows NT 6.0 and lower are not supported on any architecture. + ${Unless} ${AtLeastWin7} ${If} "$R7" == "0" strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" ${Else} @@ -1156,59 +1154,28 @@ Function .onInit Quit ${EndUnless} - SetRegView 64 -!else - StrCpy $R8 "0" - ${If} ${AtMostWin2000} - StrCpy $R8 "1" - ${EndIf} - - ${If} ${IsWinXP} - ${AndIf} ${AtMostServicePack} 1 - StrCpy $R8 "1" - ${EndIf} - - ${If} $R8 == "1" - ; XXX-rstrong - some systems failed the AtLeastWin2000 test that we - ; used to use for an unknown reason and likely fail the AtMostWin2000 - ; and possibly the IsWinXP test as well. To work around this also - ; check if the Windows NT registry Key exists and if it does if the - ; first char in CurrentVersion is equal to 3 (Windows NT 3.5 and - ; 3.5.1), 4 (Windows NT 4), or 5 (Windows 2000 and Windows XP). - StrCpy $R8 "" - ClearErrors - ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion" - StrCpy $R8 "$R8" 1 - ${If} ${Errors} - ${OrIf} "$R8" == "3" - ${OrIf} "$R8" == "4" - ${OrIf} "$R8" == "5" - ${If} "$R7" == "0" - strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" - ${Else} - strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_MSG)" - ${EndIf} - MessageBox MB_OKCANCEL|MB_ICONSTOP "$R7" IDCANCEL +2 - ExecShell "open" "${URLSystemRequirements}" - Quit - ${EndIf} - ${EndUnless} -!endif - + ; SSE2 support ${If} "$R7" == "0" MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_CPU_MSG)" IDCANCEL +2 ExecShell "open" "${URLSystemRequirements}" Quit ${EndIf} +!ifdef HAVE_64BIT_BUILD + ${Unless} ${RunningX64} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndUnless} + SetRegView 64 +!endif + ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" ; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be ; removed after we require NSIS 3.0a2 or greater. !ifndef NSIS_PACKEDVERSION - ${If} ${AtLeastWinVista} - System::Call 'user32::SetProcessDPIAware()' - ${EndIf} + System::Call 'user32::SetProcessDPIAware()' !endif !insertmacro InitInstallOptionsFile "options.ini" diff --git a/browser/installer/windows/nsis/maintenanceservice_installer.nsi b/browser/installer/windows/nsis/maintenanceservice_installer.nsi index 4bc9d2bed..1f73bac6a 100644 --- a/browser/installer/windows/nsis/maintenanceservice_installer.nsi +++ b/browser/installer/windows/nsis/maintenanceservice_installer.nsi @@ -120,10 +120,7 @@ Function .onInit SetSilent silent - ; On Windows 2000 we do not install the maintenance service. - ; We won't run this installer from the parent installer, but just in case - ; someone tries to execute it on Windows 2000... - ${Unless} ${AtLeastWinXP} + ${Unless} ${AtLeastWin7} Abort ${EndUnless} FunctionEnd diff --git a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi index 9e831dc9c..d4d21e377 100644 --- a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi +++ b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi @@ -117,10 +117,7 @@ Function .onInit System::Call 'kernel32::SetDllDirectoryW(w "")' SetSilent silent - ; On Windows 2000 we do not install the maintenance service. - ; We won't run this installer from the parent installer, but just in case - ; someone tries to execute it on Windows 2000... - ${Unless} ${AtLeastWinXP} + ${Unless} ${AtLeastWin7} Abort ${EndUnless} FunctionEnd diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index ac7607449..846718dab 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -5107,46 +5107,15 @@ Quit ${EndIf} - !ifdef HAVE_64BIT_BUILD - ${Unless} ${RunningX64} - ${OrUnless} ${AtLeastWin7} - MessageBox MB_OK|MB_ICONSTOP "$R9" - ; Nothing initialized so no need to call OnEndCommon - Quit - ${EndUnless} + ; Windows NT 6.0 (Vista/Server 2008) and lower are not supported. + ${Unless} ${AtLeastWin7} + MessageBox MB_OK|MB_ICONSTOP "$R9" + ; Nothing initialized so no need to call OnEndCommon + Quit + ${EndUnless} + !ifdef HAVE_64BIT_BUILD SetRegView 64 - !else - StrCpy $R8 "0" - ${If} ${AtMostWin2000} - StrCpy $R8 "1" - ${EndIf} - - ${If} ${IsWinXP} - ${AndIf} ${AtMostServicePack} 1 - StrCpy $R8 "1" - ${EndIf} - - ${If} $R8 == "1" - ; XXX-rstrong - some systems failed the AtLeastWin2000 test that we - ; used to use for an unknown reason and likely fail the AtMostWin2000 - ; and possibly the IsWinXP test as well. To work around this also - ; check if the Windows NT registry Key exists and if it does if the - ; first char in CurrentVersion is equal to 3 (Windows NT 3.5 and - ; 3.5.1), to 4 (Windows NT 4) or 5 (Windows 2000 and Windows XP). - StrCpy $R8 "" - ClearErrors - ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion" - StrCpy $R8 "$R8" 1 - ${If} ${Errors} - ${OrIf} "$R8" == "3" - ${OrIf} "$R8" == "4" - ${OrIf} "$R8" == "5" - MessageBox MB_OK|MB_ICONSTOP "$R9" - ; Nothing initialized so no need to call OnEndCommon - Quit - ${EndIf} - ${EndUnless} !endif ${GetParameters} $R8 -- cgit v1.2.3