Skip to content

Commit f2cb153

Browse files
committed
Installer stuffs reverted by copying 121 code because I can't redo the revert because I rart
1 parent 621da96 commit f2cb153

File tree

7 files changed

+634
-282
lines changed

7 files changed

+634
-282
lines changed

browser/installer/windows/nsis/installer.nsi

Lines changed: 117 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Var TmpVal
4141
Var InstallType
4242
Var AddStartMenuSC
4343
Var AddTaskbarSC
44+
Var AddQuickLaunchSC
4445
Var AddDesktopSC
4546
Var AddPrivateBrowsingSC
4647
Var InstallMaintenanceService
@@ -381,20 +382,22 @@ Section "-Application" APP_IDX
381382

382383
ClearErrors
383384

384-
; Apply LPAC permissions to install directory.
385-
${LogHeader} "File access permissions"
386-
Push "Marker"
387-
AccessControl::GrantOnFile \
388-
"$INSTDIR" "(${LpacFirefoxInstallFilesSid})" "GenericRead + GenericExecute"
389-
Pop $TmpVal ; get "Marker" or error msg
390-
${If} $TmpVal == "Marker"
391-
${LogMsg} "Granted access for LPAC to $INSTDIR"
392-
${Else}
393-
${LogMsg} "** Error granting access for LPAC to $INSTDIR : $TmpVal **"
394-
Pop $TmpVal ; get "Marker"
395-
${EndIf}
385+
${If} ${AtLeastWin10}
386+
; Apply LPAC permissions to install directory.
387+
${LogHeader} "File access permissions"
388+
Push "Marker"
389+
AccessControl::GrantOnFile \
390+
"$INSTDIR" "(${LpacFirefoxInstallFilesSid})" "GenericRead + GenericExecute"
391+
Pop $TmpVal ; get "Marker" or error msg
392+
${If} $TmpVal == "Marker"
393+
${LogMsg} "Granted access for LPAC to $INSTDIR"
394+
${Else}
395+
${LogMsg} "** Error granting access for LPAC to $INSTDIR : $TmpVal **"
396+
Pop $TmpVal ; get "Marker"
397+
${EndIf}
396398

397-
ClearErrors
399+
ClearErrors
400+
${EndIf}
398401

399402
; Default for creating Start Menu shortcut
400403
; (1 = create, 0 = don't create)
@@ -406,6 +409,16 @@ Section "-Application" APP_IDX
406409
StrCpy $AddPrivateBrowsingSC "1"
407410
${EndIf}
408411

412+
; Default for creating Quick Launch shortcut (1 = create, 0 = don't create)
413+
${If} $AddQuickLaunchSC == ""
414+
; Don't install the quick launch shortcut on Windows 7
415+
${If} ${AtLeastWin7}
416+
StrCpy $AddQuickLaunchSC "0"
417+
${Else}
418+
StrCpy $AddQuickLaunchSC "1"
419+
${EndIf}
420+
${EndIf}
421+
409422
; Default for creating Desktop shortcut (1 = create, 0 = don't create)
410423
${If} $AddDesktopSC == ""
411424
StrCpy $AddDesktopSC "1"
@@ -494,11 +507,13 @@ Section "-Application" APP_IDX
494507
SetShellVarContext all ; Set SHCTX to HKLM
495508

496509
; The keys below can be set in HKCU if needed.
510+
; For pre win8, the following keys should only be set if we can write to HKLM.
511+
; For post win8, the keys below can be set in HKCU if needed.
497512
${If} $TmpVal == "HKLM"
498513
; Set the Start Menu Internet and Registered App HKLM registry keys.
499514
${SetStartMenuInternet} "HKLM"
500515
${FixShellIconHandler} "HKLM"
501-
${Else}
516+
${ElseIf} ${AtLeastWin8}
502517
; Set the Start Menu Internet and Registered App HKCU registry keys.
503518
${SetStartMenuInternet} "HKCU"
504519
${FixShellIconHandler} "HKCU"
@@ -559,7 +574,9 @@ Section "-Application" APP_IDX
559574
WriteRegDWORD HKCU ${MOZ_LAUNCHER_SUBKEY} "$INSTDIR\${FileMainEXE}|Telemetry" 1
560575
!endif
561576

562-
${WriteToastNotificationRegistration} $TmpVal
577+
${If} ${AtLeastWin10}
578+
${WriteToastNotificationRegistration} $TmpVal
579+
${EndIf}
563580

564581
; Create shortcuts
565582
${LogHeader} "Adding Shortcuts"
@@ -648,14 +665,16 @@ Section "-Application" APP_IDX
648665
; Update lastwritetime of the Start Menu shortcut to clear the tile cache.
649666
; Do this for both shell contexts in case the user has shortcuts in multiple
650667
; locations, then restore the previous context at the end.
651-
SetShellVarContext all
652-
${TouchStartMenuShortcut}
653-
SetShellVarContext current
654-
${TouchStartMenuShortcut}
655-
${If} $TmpVal == "HKLM"
668+
${If} ${AtLeastWin8}
656669
SetShellVarContext all
657-
${ElseIf} $TmpVal == "HKCU"
670+
${TouchStartMenuShortcut}
658671
SetShellVarContext current
672+
${TouchStartMenuShortcut}
673+
${If} $TmpVal == "HKLM"
674+
SetShellVarContext all
675+
${ElseIf} $TmpVal == "HKCU"
676+
SetShellVarContext current
677+
${EndIf}
659678
${EndIf}
660679

661680
${If} $AddDesktopSC == 1
@@ -684,6 +703,27 @@ Section "-Application" APP_IDX
684703
${EndIf}
685704
${EndIf}
686705

706+
; If elevated the Quick Launch shortcut must be added from the unelevated
707+
; original process.
708+
${If} $AddQuickLaunchSC == 1
709+
${Unless} ${AtLeastWin7}
710+
ClearErrors
711+
${GetParameters} $0
712+
${GetOptions} "$0" "/UAC:" $0
713+
${If} ${Errors}
714+
Call AddQuickLaunchShortcut
715+
${LogMsg} "Added Shortcut: $QUICKLAUNCH\${BrandShortName}.lnk"
716+
${Else}
717+
; It is not possible to add a log entry from the unelevated process so
718+
; add the log entry without the path since there is no simple way to
719+
; know the correct full path.
720+
${LogMsg} "Added Quick Launch Shortcut: ${BrandShortName}.lnk"
721+
GetFunctionAddress $0 AddQuickLaunchShortcut
722+
UAC::ExecCodeSegment $0
723+
${EndIf}
724+
${EndUnless}
725+
${EndIf}
726+
687727
!ifdef MOZ_OPTIONAL_EXTENSIONS
688728
${If} ${FileExists} "$INSTDIR\distribution\optional-extensions"
689729
${LogHeader} "Installing optional extensions if requested"
@@ -970,6 +1010,14 @@ FunctionEnd
9701010
################################################################################
9711011
# Helper Functions
9721012

1013+
Function AddQuickLaunchShortcut
1014+
CreateShortCut "$QUICKLAUNCH\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}"
1015+
${If} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk"
1016+
ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandShortName}.lnk" \
1017+
"$INSTDIR"
1018+
${EndIf}
1019+
FunctionEnd
1020+
9731021
Function CheckExistingInstall
9741022
; If there is a pending file copy from a previous upgrade don't allow
9751023
; installing until after the system has rebooted.
@@ -1667,15 +1715,55 @@ Function preSummary
16671715
DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText
16681716
${EndIf}
16691717

1718+
1719+
; Remove the "Field 4" ini section in case the user hits back and changes the
1720+
; installation directory which could change whether the make default checkbox
1721+
; should be displayed.
1722+
DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
1723+
1724+
; Check if it is possible to write to HKLM
1725+
ClearErrors
1726+
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
1727+
${Unless} ${Errors}
1728+
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
1729+
; Check if Firefox is the http handler for this user.
1730+
SetShellVarContext current ; Set SHCTX to the current user
1731+
${IsHandlerForInstallDir} "http" $R9
1732+
; If Firefox isn't the http handler for this user show the option to set
1733+
; Firefox as the default browser.
1734+
${If} "$R9" != "true"
1735+
${AndIf} ${AtMostWin2008R2}
1736+
WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
1737+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "checkbox"
1738+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_TAKE_DEFAULTS)"
1739+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0"
1740+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1"
1741+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State "1"
1742+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "32"
1743+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53"
1744+
${EndIf}
1745+
${EndUnless}
1746+
16701747
${If} "$TmpVal" == "true"
1671-
WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
1672-
1673-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "label"
1674-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)"
1675-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0"
1676-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1"
1677-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "35"
1678-
WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "50"
1748+
; If there is already a Type entry in the "Field 4" section with a value of
1749+
; checkbox then the set as the default browser checkbox is displayed and
1750+
; this text must be moved below it.
1751+
ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type"
1752+
${If} "$0" == "checkbox"
1753+
StrCpy $0 "5"
1754+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "53"
1755+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68"
1756+
${Else}
1757+
StrCpy $0 "4"
1758+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35"
1759+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50"
1760+
${EndIf}
1761+
WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0"
1762+
1763+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label"
1764+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)"
1765+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
1766+
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
16791767
${EndIf}
16801768

16811769
!insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"

browser/installer/windows/nsis/maintenanceservice_installer.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Function .onInit
118118

119119
SetSilent silent
120120

121-
${Unless} ${AtLeastWin10}
121+
${Unless} ${AtLeastWin95}
122122
Abort
123123
${EndUnless}
124124
FunctionEnd

0 commit comments

Comments
 (0)