Bug 1478032 - Add aarch64 detection and set the correct registry views in the installer. r=mhowell

This commit is contained in:
Robert Strong 2018-12-17 11:17:26 -08:00
Родитель 6468b181f7
Коммит 24b436868b
7 изменённых файлов: 95 добавлений и 55 удалений

Просмотреть файл

@ -1552,6 +1552,7 @@ Function .onInit
!ifdef HAVE_64BIT_BUILD !ifdef HAVE_64BIT_BUILD
${Unless} ${RunningX64} ${Unless} ${RunningX64}
${AndUnless} ${IsNativeARM64}
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2 MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2
ExecShell "open" "${URLSystemRequirements}" ExecShell "open" "${URLSystemRequirements}"
Quit Quit

Просмотреть файл

@ -181,6 +181,7 @@ Section "MaintenanceService"
; Since the Maintenance service can be installed either x86 or x64, ; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry. ; always use the 64-bit registry.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
; Previous versions always created the uninstall key in the 32-bit registry. ; Previous versions always created the uninstall key in the 32-bit registry.
; Clean those old entries out if they still exist. ; Clean those old entries out if they still exist.
SetRegView 32 SetRegView 32
@ -218,6 +219,7 @@ Section "MaintenanceService"
; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation" ; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation"
; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA" ; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
SectionEnd SectionEnd
@ -318,6 +320,7 @@ Section "Uninstall"
RMDir /REBOOTOK "$INSTDIR" RMDir /REBOOTOK "$INSTDIR"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
DeleteRegKey HKLM "${MaintUninstallKey}" DeleteRegKey HKLM "${MaintUninstallKey}"
@ -325,6 +328,7 @@ Section "Uninstall"
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
DeleteRegKey HKLM "${FallbackKey}\" DeleteRegKey HKLM "${FallbackKey}\"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
SectionEnd SectionEnd

Просмотреть файл

@ -128,11 +128,13 @@
; Since the Maintenance service can be installed either x86 or x64, ; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made. ; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted"
ClearErrors ClearErrors
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
@ -590,6 +592,7 @@
; Running Firefox 32 bit ; Running Firefox 32 bit
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
; Running Firefox 32 bit on a Windows 64 bit system ; Running Firefox 32 bit on a Windows 64 bit system
ClearErrors ClearErrors
ReadRegDWORD $2 HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" ReadRegDWORD $2 HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1"
@ -903,6 +906,7 @@
; if the binary is replaced with a different certificate. ; if the binary is replaced with a different certificate.
; We always use the 64bit registry for certs. ; We always use the 64bit registry for certs.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
@ -925,6 +929,7 @@
WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}" WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}"
WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}" WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
ClearErrors ClearErrors

Просмотреть файл

@ -194,6 +194,7 @@ Function un.UninstallServiceIfNotUsed
; The maintenance service always uses the 64-bit registry on x64 systems ; The maintenance service always uses the 64-bit registry on x64 systems
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
@ -209,6 +210,7 @@ Function un.UninstallServiceIfNotUsed
; Restore back the registry view ; Restore back the registry view
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastUsed SetRegView lastUsed
${EndIf} ${EndIf}
@ -219,11 +221,13 @@ Function un.UninstallServiceIfNotUsed
ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
SetRegView lastused SetRegView lastused
${If} $1 == "" ${If} ${RunningX64}
${AndIf} ${RunningX64} ${OrIf} ${IsNativeARM64}
SetRegView 64 ${If} $1 == ""
ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" SetRegView 64
SetRegView lastused ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
SetRegView lastused
${EndIf}
${EndIf} ${EndIf}
; If the uninstall string does not exist, skip executing it ; If the uninstall string does not exist, skip executing it
@ -475,10 +479,12 @@ Section "Uninstall"
${If} $MaintCertKey != "" ${If} $MaintCertKey != ""
; Always use the 64bit registry for certs on 64bit systems. ; Always use the 64bit registry for certs on 64bit systems.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
DeleteRegKey HKLM "$MaintCertKey" DeleteRegKey HKLM "$MaintCertKey"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
${EndIf} ${EndIf}

Просмотреть файл

@ -194,6 +194,7 @@ Section "MaintenanceService"
; Since the Maintenance service can be installed either x86 or x64, ; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made. ; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1 WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
@ -208,6 +209,7 @@ Section "MaintenanceService"
WriteRegStr HKLM "${FallbackKey}\1" "name" "Mozilla Fake SPC" WriteRegStr HKLM "${FallbackKey}\1" "name" "Mozilla Fake SPC"
WriteRegStr HKLM "${FallbackKey}\1" "issuer" "Mozilla Fake CA" WriteRegStr HKLM "${FallbackKey}\1" "issuer" "Mozilla Fake CA"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
SectionEnd SectionEnd
@ -253,12 +255,14 @@ Section "Uninstall"
DeleteRegKey HKLM "${MaintUninstallKey}" DeleteRegKey HKLM "${MaintUninstallKey}"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed" DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed"
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
DeleteRegKey HKLM "${FallbackKey}\" DeleteRegKey HKLM "${FallbackKey}\"
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
SetRegView lastused SetRegView lastused
${EndIf} ${EndIf}
SectionEnd SectionEnd

Просмотреть файл

@ -74,7 +74,11 @@
!include WinVer.nsh !include WinVer.nsh
!endif !endif
!include x64.nsh ; When including x64.nsh check if ___X64__NSH___ is defined to prevent
; loading the file a second time.
!ifndef ___X64__NSH___
!include x64.nsh
!endif
; NSIS provided macros that we have overridden. ; NSIS provided macros that we have overridden.
!include overrides.nsh !include overrides.nsh
@ -1450,6 +1454,7 @@
; The x64 regsvr32.exe registers x86 DLL's properly so just use it ; The x64 regsvr32.exe registers x86 DLL's properly so just use it
; when installing on an x64 systems even when installing an x86 application. ; when installing on an x64 systems even when installing an x86 application.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
${DisableX64FSRedirection} ${DisableX64FSRedirection}
ExecWait '"$SYSDIR\regsvr32.exe" /s "${DLL}"' ExecWait '"$SYSDIR\regsvr32.exe" /s "${DLL}"'
${EnableX64FSRedirection} ${EnableX64FSRedirection}
@ -1464,6 +1469,7 @@
; The x64 regsvr32.exe registers x86 DLL's properly so just use it ; The x64 regsvr32.exe registers x86 DLL's properly so just use it
; when installing on an x64 systems even when installing an x86 application. ; when installing on an x64 systems even when installing an x86 application.
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
${DisableX64FSRedirection} ${DisableX64FSRedirection}
ExecWait '"$SYSDIR\regsvr32.exe" /s /u "${DLL}"' ExecWait '"$SYSDIR\regsvr32.exe" /s /u "${DLL}"'
${EnableX64FSRedirection} ${EnableX64FSRedirection}
@ -2473,6 +2479,7 @@
StrCpy $R6 0 ; set the counter for the outer loop to 0 StrCpy $R6 0 ; set the counter for the outer loop to 0
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R0 "false" StrCpy $R0 "false"
; Set the registry to the 32 bit registry for 64 bit installations or to ; Set the registry to the 32 bit registry for 64 bit installations or to
; the 64 bit registry for 32 bit installations at the beginning so it can ; the 64 bit registry for 32 bit installations at the beginning so it can
@ -2532,17 +2539,19 @@
end: end:
${If} ${RunningX64} ${If} ${RunningX64}
${AndIf} "$R0" == "false" ${OrIf} ${IsNativeARM64}
; Set the registry to the correct view. ${If} "$R0" == "false"
!ifdef HAVE_64BIT_BUILD ; Set the registry to the correct view.
SetRegView 64 !ifdef HAVE_64BIT_BUILD
!else SetRegView 64
SetRegView 32 !else
!endif SetRegView 32
!endif
StrCpy $R6 0 ; set the counter for the outer loop to 0 StrCpy $R6 0 ; set the counter for the outer loop to 0
StrCpy $R0 "true" StrCpy $R0 "true"
GoTo outerloop GoTo outerloop
${EndIf}
${EndIf} ${EndIf}
ClearErrors ClearErrors
@ -2639,6 +2648,7 @@
StrCpy $R8 0 StrCpy $R8 0
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R3 "false" StrCpy $R3 "false"
; Set the registry to the 32 bit registry for 64 bit installations or to ; Set the registry to the 32 bit registry for 64 bit installations or to
; the 64 bit registry for 32 bit installations at the beginning so it can ; the 64 bit registry for 32 bit installations at the beginning so it can
@ -2684,18 +2694,20 @@
end: end:
${If} ${RunningX64} ${If} ${RunningX64}
${AndIf} "$R3" == "false" ${OrIf} ${IsNativeARM64}
; Set the registry to the correct view. ${If} "$R3" == "false"
!ifdef HAVE_64BIT_BUILD ; Set the registry to the correct view.
SetRegView 64 !ifdef HAVE_64BIT_BUILD
!else SetRegView 64
SetRegView 32 !else
!endif SetRegView 32
!endif
StrCpy $R7 "" StrCpy $R7 ""
StrCpy $R8 0 StrCpy $R8 0
StrCpy $R3 "true" StrCpy $R3 "true"
GoTo loop GoTo loop
${EndIf}
${EndIf} ${EndIf}
ClearErrors ClearErrors
@ -3143,6 +3155,7 @@
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R4 $PROGRAMFILES64 StrCpy $R4 $PROGRAMFILES64
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
${EndIf} ${EndIf}
@ -5760,6 +5773,7 @@ end:
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9 ${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} ${RunningX64} ${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
; In HKCU there is no WOW64 redirection, which means we may have gotten ; In HKCU there is no WOW64 redirection, which means we may have gotten
; the path to a 32-bit install even though we're 64-bit, or vice-versa. ; the path to a 32-bit install even though we're 64-bit, or vice-versa.
; In that case, just use the default path instead of offering an upgrade. ; In that case, just use the default path instead of offering an upgrade.

Просмотреть файл

@ -8,8 +8,8 @@
!ifndef OVERRIDES_INCLUDED !ifndef OVERRIDES_INCLUDED
!define OVERRIDES_INCLUDED !define OVERRIDES_INCLUDED
!ifndef ___WINVER__NSH___ !ifndef ___X64__NSH___
!include WinVer.nsh !include x64.nsh
!endif !endif
; When including a file check if its verbose macro is defined to prevent ; When including a file check if its verbose macro is defined to prevent
@ -22,35 +22,41 @@
!include FileFunc.nsh !include FileFunc.nsh
!endif !endif
!macro __MOZ__WinVer_DefineOSTests WinVer ; This was added to NSIS 3.0.4 and is needed for Windows ARM64 support
!insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} "" !ifmacrondef GetNativeMachineArchitecture
!insertmacro __WinVer_DefineOSTest Is ${WinVer} "" !define GetNativeMachineArchitecture "!insertmacro GetNativeMachineArchitecture "
!insertmacro __WinVer_DefineOSTest AtMost ${WinVer} "" !macro GetNativeMachineArchitecture outvar
!define GetNativeMachineArchitecture_lbl lbl_GNMA_${__COUNTER__}
System::Call kernel32::GetCurrentProcess()p.s
System::Call kernel32::IsWow64Process2(ps,*i,*i0s)
Pop ${outvar}
IntCmp ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_done ${GetNativeMachineArchitecture_lbl}_done
!if "${NSIS_PTR_SIZE}" <= 4
!if "${NSIS_CHAR_SIZE}" <= 1
System::Call 'USER32::CharNextW(w"")p.s'
Pop ${outvar}
IntPtrCmpU ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_oldnt ${GetNativeMachineArchitecture_lbl}_oldnt
StrCpy ${outvar} 332 ; Always IMAGE_FILE_MACHINE_I386 on Win9x
Goto ${GetNativeMachineArchitecture_lbl}_done
${GetNativeMachineArchitecture_lbl}_oldnt:
!endif
!endif
System::Call '*0x7FFE002E(&i2.s)'
Pop ${outvar}
${GetNativeMachineArchitecture_lbl}_done:
!undef GetNativeMachineArchitecture_lbl
!macroend !macroend
!ifndef WINVER_8 !macro _IsNativeMachineArchitecture _ignore _arc _t _f
!define WINVER_8 0x06020000 ;6.02.9200 !insertmacro _LOGICLIB_TEMP
!insertmacro __MOZ__WinVer_DefineOSTests 8 ${GetNativeMachineArchitecture} $_LOGICLIB_TEMP
!endif !insertmacro _= $_LOGICLIB_TEMP ${_arc} `${_t}` `${_f}`
!macroend
!ifndef WINVER_8.1 !define IsNativeMachineArchitecture `"" IsNativeMachineArchitecture `
!define WINVER_8.1 0x06030000 ;6.03.9600 !define IsNativeIA32 '${IsNativeMachineArchitecture} 332' ; Intel x86
!insertmacro __MOZ__WinVer_DefineOSTests 8.1 !define IsNativeAMD64 '${IsNativeMachineArchitecture} 34404' ; x86-64/x64
!endif !define IsNativeARM64 '${IsNativeMachineArchitecture} 43620'
!ifndef WINVER_2012
!define WINVER_2012 0x06020001 ;6.02.9200
!insertmacro __MOZ__WinVer_DefineOSTests 2012
!endif
!ifndef WINVER_2012R2
!define WINVER_2012R2 0x06030001 ;6.03.9600
!insertmacro __MOZ__WinVer_DefineOSTests 2012R2
!endif
!ifndef WINVER_10
!define WINVER_10 0x0A000000 ;10.0.10240
!insertmacro __MOZ__WinVer_DefineOSTests 10
!endif !endif
!verbose push !verbose push