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
${Unless} ${RunningX64}
${AndUnless} ${IsNativeARM64}
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2
ExecShell "open" "${URLSystemRequirements}"
Quit

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

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

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

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

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

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

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

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

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

@ -74,7 +74,11 @@
!include WinVer.nsh
!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.
!include overrides.nsh
@ -1450,6 +1454,7 @@
; 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.
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
${DisableX64FSRedirection}
ExecWait '"$SYSDIR\regsvr32.exe" /s "${DLL}"'
${EnableX64FSRedirection}
@ -1464,6 +1469,7 @@
; 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.
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
${DisableX64FSRedirection}
ExecWait '"$SYSDIR\regsvr32.exe" /s /u "${DLL}"'
${EnableX64FSRedirection}
@ -2473,6 +2479,7 @@
StrCpy $R6 0 ; set the counter for the outer loop to 0
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R0 "false"
; 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
@ -2532,17 +2539,19 @@
end:
${If} ${RunningX64}
${AndIf} "$R0" == "false"
; Set the registry to the correct view.
!ifdef HAVE_64BIT_BUILD
SetRegView 64
!else
SetRegView 32
!endif
${OrIf} ${IsNativeARM64}
${If} "$R0" == "false"
; Set the registry to the correct view.
!ifdef HAVE_64BIT_BUILD
SetRegView 64
!else
SetRegView 32
!endif
StrCpy $R6 0 ; set the counter for the outer loop to 0
StrCpy $R0 "true"
GoTo outerloop
StrCpy $R6 0 ; set the counter for the outer loop to 0
StrCpy $R0 "true"
GoTo outerloop
${EndIf}
${EndIf}
ClearErrors
@ -2639,6 +2648,7 @@
StrCpy $R8 0
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R3 "false"
; 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
@ -2684,18 +2694,20 @@
end:
${If} ${RunningX64}
${AndIf} "$R3" == "false"
; Set the registry to the correct view.
!ifdef HAVE_64BIT_BUILD
SetRegView 64
!else
SetRegView 32
!endif
${OrIf} ${IsNativeARM64}
${If} "$R3" == "false"
; Set the registry to the correct view.
!ifdef HAVE_64BIT_BUILD
SetRegView 64
!else
SetRegView 32
!endif
StrCpy $R7 ""
StrCpy $R8 0
StrCpy $R3 "true"
GoTo loop
StrCpy $R7 ""
StrCpy $R8 0
StrCpy $R3 "true"
GoTo loop
${EndIf}
${EndIf}
ClearErrors
@ -3143,6 +3155,7 @@
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $R4 $PROGRAMFILES64
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
${EndIf}
@ -5760,6 +5773,7 @@ end:
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
; 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.
; In that case, just use the default path instead of offering an upgrade.

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

@ -8,8 +8,8 @@
!ifndef OVERRIDES_INCLUDED
!define OVERRIDES_INCLUDED
!ifndef ___WINVER__NSH___
!include WinVer.nsh
!ifndef ___X64__NSH___
!include x64.nsh
!endif
; When including a file check if its verbose macro is defined to prevent
@ -22,35 +22,41 @@
!include FileFunc.nsh
!endif
!macro __MOZ__WinVer_DefineOSTests WinVer
!insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} ""
!insertmacro __WinVer_DefineOSTest Is ${WinVer} ""
!insertmacro __WinVer_DefineOSTest AtMost ${WinVer} ""
; This was added to NSIS 3.0.4 and is needed for Windows ARM64 support
!ifmacrondef GetNativeMachineArchitecture
!define GetNativeMachineArchitecture "!insertmacro GetNativeMachineArchitecture "
!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
!ifndef WINVER_8
!define WINVER_8 0x06020000 ;6.02.9200
!insertmacro __MOZ__WinVer_DefineOSTests 8
!endif
!macro _IsNativeMachineArchitecture _ignore _arc _t _f
!insertmacro _LOGICLIB_TEMP
${GetNativeMachineArchitecture} $_LOGICLIB_TEMP
!insertmacro _= $_LOGICLIB_TEMP ${_arc} `${_t}` `${_f}`
!macroend
!ifndef WINVER_8.1
!define WINVER_8.1 0x06030000 ;6.03.9600
!insertmacro __MOZ__WinVer_DefineOSTests 8.1
!endif
!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
!define IsNativeMachineArchitecture `"" IsNativeMachineArchitecture `
!define IsNativeIA32 '${IsNativeMachineArchitecture} 332' ; Intel x86
!define IsNativeAMD64 '${IsNativeMachineArchitecture} 34404' ; x86-64/x64
!define IsNativeARM64 '${IsNativeMachineArchitecture} 43620'
!endif
!verbose push