michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # Required Plugins: michael@0: # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in michael@0: # ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in michael@0: # CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash michael@0: # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in michael@0: # UAC http://nsis.sourceforge.net/UAC_plug-in michael@0: # ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis michael@0: michael@0: ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs michael@0: !verbose 3 michael@0: michael@0: ; 7-Zip provides better compression than the lzma from NSIS so we add the files michael@0: ; uncompressed and use 7-Zip to create a SFX archive of it michael@0: SetDatablockOptimize on michael@0: SetCompress off michael@0: CRCCheck on michael@0: michael@0: RequestExecutionLevel user michael@0: michael@0: ; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can michael@0: ; be removed after we require NSIS 3.0a2 or greater. michael@0: !ifdef NSIS_PACKEDVERSION michael@0: Unicode true michael@0: ManifestSupportedOS all michael@0: ManifestDPIAware true michael@0: !endif michael@0: michael@0: !addplugindir ./ michael@0: michael@0: Var TmpVal michael@0: Var InstallType michael@0: Var AddStartMenuSC michael@0: Var AddQuickLaunchSC michael@0: Var AddDesktopSC michael@0: Var InstallMaintenanceService michael@0: Var PageName michael@0: Var PreventRebootRequired michael@0: michael@0: ; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for michael@0: ; an application's Start Menu PROGRAMS directory and doesn't define the michael@0: ; StartMenuDir variable can use the common InstallOnInitCommon macro. michael@0: !define NO_STARTMENU_DIR michael@0: michael@0: ; On Vista and above attempt to elevate Standard Users in addition to users that michael@0: ; are a member of the Administrators group. michael@0: !define NONADMIN_ELEVATE michael@0: michael@0: !define AbortSurveyURL "http://www.kampyle.com/feedback_form/ff-feedback-form.php?site_code=8166124&form_id=12116&url=" michael@0: michael@0: ; Other included files may depend upon these includes! michael@0: ; The following includes are provided by NSIS. michael@0: !include FileFunc.nsh michael@0: !include LogicLib.nsh michael@0: !include MUI.nsh michael@0: !include WinMessages.nsh michael@0: !include WinVer.nsh michael@0: !include WordFunc.nsh michael@0: michael@0: !insertmacro GetOptions michael@0: !insertmacro GetParameters michael@0: !insertmacro GetSize michael@0: !insertmacro StrFilter michael@0: !insertmacro WordFind michael@0: !insertmacro WordReplace michael@0: michael@0: ; The following includes are custom. michael@0: !include branding.nsi michael@0: !include defines.nsi michael@0: !include common.nsh michael@0: !include locales.nsi michael@0: michael@0: VIAddVersionKey "FileDescription" "${BrandShortName} Installer" michael@0: VIAddVersionKey "OriginalFilename" "setup.exe" michael@0: michael@0: ; Must be inserted before other macros that use logging michael@0: !insertmacro _LoggingCommon michael@0: michael@0: !insertmacro AddDisabledDDEHandlerValues michael@0: !insertmacro ChangeMUIHeaderImage michael@0: !insertmacro CheckForFilesInUse michael@0: !insertmacro CleanUpdateDirectories michael@0: !insertmacro CopyFilesFromDir michael@0: !insertmacro CreateRegKey michael@0: !insertmacro GetLongPath michael@0: !insertmacro GetPathFromString michael@0: !insertmacro GetParent michael@0: !insertmacro InitHashAppModelId michael@0: !insertmacro IsHandlerForInstallDir michael@0: !insertmacro IsPinnedToTaskBar michael@0: !insertmacro IsUserAdmin michael@0: !insertmacro LogDesktopShortcut michael@0: !insertmacro LogQuickLaunchShortcut michael@0: !insertmacro LogStartMenuShortcut michael@0: !insertmacro ManualCloseAppPrompt michael@0: !insertmacro OnStubInstallUninstall michael@0: !insertmacro PinnedToStartMenuLnkCount michael@0: !insertmacro RegCleanAppHandler michael@0: !insertmacro RegCleanMain michael@0: !insertmacro RegCleanUninstall michael@0: !ifdef MOZ_METRO michael@0: !insertmacro RemoveDEHRegistrationIfMatching michael@0: !endif michael@0: !insertmacro SetAppLSPCategories michael@0: !insertmacro SetBrandNameVars michael@0: !insertmacro UpdateShortcutAppModelIDs michael@0: !insertmacro UnloadUAC michael@0: !insertmacro WriteRegStr2 michael@0: !insertmacro WriteRegDWORD2 michael@0: !insertmacro CheckIfRegistryKeyExists michael@0: michael@0: !include shared.nsh michael@0: michael@0: ; Helper macros for ui callbacks. Insert these after shared.nsh michael@0: !insertmacro CheckCustomCommon michael@0: !insertmacro InstallEndCleanupCommon michael@0: !insertmacro InstallOnInitCommon michael@0: !insertmacro InstallStartCleanupCommon michael@0: !insertmacro LeaveDirectoryCommon michael@0: !insertmacro LeaveOptionsCommon michael@0: !insertmacro OnEndCommon michael@0: !insertmacro PreDirectoryCommon michael@0: michael@0: Name "${BrandFullName}" michael@0: OutFile "setup.exe" michael@0: !ifdef HAVE_64BIT_OS michael@0: InstallDir "$PROGRAMFILES64\${BrandFullName}\" michael@0: !else michael@0: InstallDir "$PROGRAMFILES32\${BrandFullName}\" michael@0: !endif michael@0: ShowInstDetails nevershow michael@0: michael@0: ################################################################################ michael@0: # Modern User Interface - MUI michael@0: michael@0: !define MOZ_MUI_CUSTOM_ABORT michael@0: !define MUI_CUSTOMFUNCTION_ABORT "CustomAbort" michael@0: !define MUI_ICON setup.ico michael@0: !define MUI_UNICON setup.ico michael@0: !define MUI_WELCOMEPAGE_TITLE_3LINES michael@0: !define MUI_HEADERIMAGE michael@0: !define MUI_HEADERIMAGE_RIGHT michael@0: !define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp michael@0: michael@0: ; Use a right to left header image when the language is right to left michael@0: !ifdef ${AB_CD}_rtl michael@0: !define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp michael@0: !else michael@0: !define MUI_HEADERIMAGE_BITMAP wizHeader.bmp michael@0: !endif michael@0: michael@0: /** michael@0: * Installation Pages michael@0: */ michael@0: ; Welcome Page michael@0: !define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcome michael@0: !insertmacro MUI_PAGE_WELCOME michael@0: michael@0: ; Custom Options Page michael@0: Page custom preOptions leaveOptions michael@0: michael@0: ; Select Install Directory Page michael@0: !define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory michael@0: !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory michael@0: !define MUI_DIRECTORYPAGE_VERIFYONLEAVE michael@0: !insertmacro MUI_PAGE_DIRECTORY michael@0: michael@0: ; Custom Components Page michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: Page custom preComponents leaveComponents michael@0: !endif michael@0: michael@0: ; Custom Shortcuts Page michael@0: Page custom preShortcuts leaveShortcuts michael@0: michael@0: ; Custom Summary Page michael@0: Page custom preSummary leaveSummary michael@0: michael@0: ; Install Files Page michael@0: !insertmacro MUI_PAGE_INSTFILES michael@0: michael@0: ; Finish Page michael@0: !define MUI_FINISHPAGE_TITLE_3LINES michael@0: !define MUI_FINISHPAGE_RUN michael@0: !define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp michael@0: !define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT) michael@0: !define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish michael@0: !insertmacro MUI_PAGE_FINISH michael@0: michael@0: ; Use the default dialog for IDD_VERIFY for a simple Banner michael@0: ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" michael@0: michael@0: ################################################################################ michael@0: # Install Sections michael@0: michael@0: ; Cleanup operations to perform at the start of the installation. michael@0: Section "-InstallStartCleanup" michael@0: SetDetailsPrint both michael@0: DetailPrint $(STATUS_CLEANUP) michael@0: SetDetailsPrint none michael@0: michael@0: SetOutPath "$INSTDIR" michael@0: ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}" michael@0: michael@0: StrCpy $PreventRebootRequired "false" michael@0: ${GetParameters} $R8 michael@0: ${GetOptions} "$R8" "/INI=" $R7 michael@0: ${Unless} ${Errors} michael@0: ; The configuration file must also exist michael@0: ${If} ${FileExists} "$R7" michael@0: ReadINIStr $R8 $R7 "Install" "PreventRebootRequired" michael@0: ${If} $R8 == "true" michael@0: StrCpy $PreventRebootRequired "true" michael@0: StrCpy $R2 "false" michael@0: StrCpy $R3 "false" michael@0: ${OnStubInstallUninstall} "$R2" "$R3" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: ; Delete the app exe if present to prevent launching the app while we are michael@0: ; installing. michael@0: ClearErrors michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${Errors} michael@0: ; If the user closed the application it can take several seconds for it to michael@0: ; shut down completely. If the application is being used by another user we michael@0: ; can rename the file and then delete is when the system is restarted. michael@0: Sleep 5000 michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ClearErrors michael@0: ${EndIf} michael@0: michael@0: ; setup the application model id registration value michael@0: ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" michael@0: michael@0: ; Remove the updates directory for Vista and above michael@0: ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates" michael@0: michael@0: ${RemoveDeprecatedFiles} michael@0: michael@0: ${InstallStartCleanupCommon} michael@0: SectionEnd michael@0: michael@0: Section "-Application" APP_IDX michael@0: ${StartUninstallLog} michael@0: michael@0: SetDetailsPrint both michael@0: DetailPrint $(STATUS_INSTALL_APP) michael@0: SetDetailsPrint none michael@0: michael@0: RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" michael@0: michael@0: ${LogHeader} "Installing Main Files" michael@0: ${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \ michael@0: "$(ERROR_CREATE_DIRECTORY_PREFIX)" \ michael@0: "$(ERROR_CREATE_DIRECTORY_SUFFIX)" michael@0: michael@0: ; Register DLLs michael@0: ; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but michael@0: ; is only registered for the last application installed. When the last michael@0: ; application installed is uninstalled AccessibleMarshal.dll will no longer be michael@0: ; registered. bug 338878 michael@0: ${LogHeader} "DLL Registration" michael@0: ClearErrors michael@0: ${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll" michael@0: ${If} ${Errors} michael@0: ${LogMsg} "** ERROR Registering: $INSTDIR\AccessibleMarshal.dll **" michael@0: ${Else} michael@0: ${LogUninstall} "DLLReg: \AccessibleMarshal.dll" michael@0: ${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll" michael@0: ${EndIf} michael@0: michael@0: ; Write extra files created by the application to the uninstall log so they michael@0: ; will be removed when the application is uninstalled. To remove an empty michael@0: ; directory write a bogus filename to the deepest directory and all empty michael@0: ; parent directories will be removed. michael@0: ${LogUninstall} "File: \components\compreg.dat" michael@0: ${LogUninstall} "File: \components\xpti.dat" michael@0: ${LogUninstall} "File: \active-update.xml" michael@0: ${LogUninstall} "File: \install.log" michael@0: ${LogUninstall} "File: \install_status.log" michael@0: ${LogUninstall} "File: \install_wizard.log" michael@0: ${LogUninstall} "File: \updates.xml" michael@0: michael@0: ClearErrors michael@0: michael@0: ; Default for creating Start Menu shortcut michael@0: ; (1 = create, 0 = don't create) michael@0: ${If} $AddStartMenuSC == "" michael@0: StrCpy $AddStartMenuSC "1" michael@0: ${EndIf} michael@0: michael@0: ; Default for creating Quick Launch shortcut (1 = create, 0 = don't create) michael@0: ${If} $AddQuickLaunchSC == "" michael@0: ; Don't install the quick launch shortcut on Windows 7 michael@0: ${If} ${AtLeastWin7} michael@0: StrCpy $AddQuickLaunchSC "0" michael@0: ${Else} michael@0: StrCpy $AddQuickLaunchSC "1" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ; Default for creating Desktop shortcut (1 = create, 0 = don't create) michael@0: ${If} $AddDesktopSC == "" michael@0: StrCpy $AddDesktopSC "1" michael@0: ${EndIf} michael@0: michael@0: ${LogHeader} "Adding Registry Entries" michael@0: SetShellVarContext current ; Set SHCTX to HKCU michael@0: ${RegCleanMain} "Software\Mozilla" michael@0: ${RegCleanUninstall} michael@0: !ifdef MOZ_METRO michael@0: ${ResetWin8PromptKeys} "HKCU" "" michael@0: !endif michael@0: ${UpdateProtocolHandlers} michael@0: michael@0: ClearErrors michael@0: WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" michael@0: ${If} ${Errors} michael@0: StrCpy $TmpVal "HKCU" ; used primarily for logging michael@0: ${Else} michael@0: SetShellVarContext all ; Set SHCTX to HKLM michael@0: DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" michael@0: StrCpy $TmpVal "HKLM" ; used primarily for logging michael@0: ${RegCleanMain} "Software\Mozilla" michael@0: ${RegCleanUninstall} michael@0: ${UpdateProtocolHandlers} michael@0: michael@0: ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" michael@0: ${If} "$0" != "${GREVersion}" michael@0: WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${RemoveDeprecatedKeys} michael@0: michael@0: ; The previous installer adds several regsitry values to both HKLM and HKCU. michael@0: ; We now try to add to HKLM and if that fails to HKCU michael@0: michael@0: ; The order that reg keys and values are added is important if you use the michael@0: ; uninstall log to remove them on uninstall. When using the uninstall log you michael@0: ; MUST add children first so they will be removed first on uninstall so they michael@0: ; will be empty when the key is deleted. This allows the uninstaller to michael@0: ; specify that only empty keys will be deleted. michael@0: ${SetAppKeys} michael@0: michael@0: ${FixClassKeys} michael@0: michael@0: ; Uninstall keys can only exist under HKLM on some versions of windows. Since michael@0: ; it doesn't cause problems always add them. michael@0: ${SetUninstallKeys} michael@0: michael@0: ; On install always add the FirefoxHTML and FirefoxURL keys. michael@0: ; An empty string is used for the 5th param because FirefoxHTML is not a michael@0: ; protocol handler. michael@0: ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 michael@0: StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" michael@0: michael@0: ; In Win8, the delegate execute handler picks up the value in FirefoxURL and michael@0: ; FirefoxHTML to launch the desktop browser when it needs to. michael@0: ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ michael@0: "${AppRegName} Document" "" michael@0: ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ michael@0: "true" michael@0: michael@0: ; For pre win8, the following keys should only be set if we can write to HKLM. michael@0: ; For post win8, the keys below get set in both HKLM and HKCU. michael@0: ${If} $TmpVal == "HKLM" michael@0: ; Set the Start Menu Internet and Vista Registered App HKLM registry keys. michael@0: ${SetStartMenuInternet} "HKLM" michael@0: ${FixShellIconHandler} "HKLM" michael@0: michael@0: ; If we are writing to HKLM and create either the desktop or start menu michael@0: ; shortcuts set IconsVisible to 1 otherwise to 0. michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" michael@0: ${If} $AddDesktopSC == 1 michael@0: ${OrIf} $AddStartMenuSC == 1 michael@0: WriteRegDWORD HKLM "$0" "IconsVisible" 1 michael@0: ${Else} michael@0: WriteRegDWORD HKLM "$0" "IconsVisible" 0 michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${If} ${AtLeastWin8} michael@0: ; Set the Start Menu Internet and Vista Registered App HKCU registry keys. michael@0: ${SetStartMenuInternet} "HKCU" michael@0: ${FixShellIconHandler} "HKCU" michael@0: michael@0: ; If we create either the desktop or start menu shortcuts, then michael@0: ; set IconsVisible to 1 otherwise to 0. michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" michael@0: ${If} $AddDesktopSC == 1 michael@0: ${OrIf} $AddStartMenuSC == 1 michael@0: WriteRegDWORD HKCU "$0" "IconsVisible" 1 michael@0: ${Else} michael@0: WriteRegDWORD HKCU "$0" "IconsVisible" 0 michael@0: ${EndIf} michael@0: !ifdef MOZ_METRO michael@0: ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: "$INSTDIR\CommandExecuteHandler.exe" \ michael@0: $AppUserModelID \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: !else michael@0: ; The metro browser is not enabled by the mozconfig. michael@0: ${If} ${AtLeastWin8} michael@0: ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: $AppUserModelID \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${EndIf} michael@0: !endif michael@0: ${EndIf} michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: ; If the maintenance service page was displayed then a value was already michael@0: ; explicitly selected for installing the maintenance service and michael@0: ; and so InstallMaintenanceService will already be 0 or 1. michael@0: ; If the maintenance service page was not displayed then michael@0: ; InstallMaintenanceService will be equal to "". michael@0: ${If} $InstallMaintenanceService == "" michael@0: Call IsUserAdmin michael@0: Pop $R0 michael@0: ${If} $R0 == "true" michael@0: ; Only proceed if we have HKLM write access michael@0: ${AndIf} $TmpVal == "HKLM" michael@0: ; On Windows 2000 we do not install the maintenance service. michael@0: ${AndIf} ${AtLeastWinXP} michael@0: ; The user is an admin so we should default to install service yes michael@0: StrCpy $InstallMaintenanceService "1" michael@0: ${Else} michael@0: ; The user is not admin so we should default to install service no michael@0: StrCpy $InstallMaintenanceService "0" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${If} $InstallMaintenanceService == "1" michael@0: ; The user wants to install the maintenance service, so execute michael@0: ; the pre-packaged maintenance service installer. michael@0: ; This option can only be turned on if the user is an admin so there michael@0: ; is no need to use ExecShell w/ verb runas to enforce elevated. michael@0: nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: ; These need special handling on uninstall since they may be overwritten by michael@0: ; an install into a different location. michael@0: StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" michael@0: ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0 michael@0: ${WriteRegStr2} $TmpVal "$0" "Path" "$INSTDIR" 0 michael@0: michael@0: StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9" michael@0: ${CreateRegKey} "$TmpVal" "$0" 0 michael@0: StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe" michael@0: ${CreateRegKey} "$TmpVal" "$0" 0 michael@0: michael@0: ${If} $TmpVal == "HKLM" michael@0: ; Set the permitted LSP Categories for WinVista and above michael@0: ${SetAppLSPCategories} ${LSP_CATEGORIES} michael@0: ${EndIf} michael@0: michael@0: ; Create shortcuts michael@0: ${LogHeader} "Adding Shortcuts" michael@0: michael@0: ; Remove the start menu shortcuts and directory if the SMPROGRAMS section michael@0: ; exists in the shortcuts_log.ini and the SMPROGRAMS. The installer's shortcut michael@0: ; creation code will create the shortcut in the root of the Start Menu michael@0: ; Programs directory. michael@0: ${RemoveStartMenuDir} michael@0: michael@0: ; Always add the application's shortcuts to the shortcuts log ini file. The michael@0: ; DeleteShortcuts macro will do the right thing on uninstall if the michael@0: ; shortcuts don't exist. michael@0: ${LogStartMenuShortcut} "${BrandFullName}.lnk" michael@0: ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" michael@0: ${LogDesktopShortcut} "${BrandFullName}.lnk" michael@0: michael@0: ; Best effort to update the Win7 taskbar and start menu shortcut app model michael@0: ; id's. The possible contexts are current user / system and the user that michael@0: ; elevated the installer. michael@0: Call FixShortcutAppModelIDs michael@0: ; If the current context is all also perform Win7 taskbar and start menu link michael@0: ; maintenance for the current user context. michael@0: ${If} $TmpVal == "HKLM" michael@0: SetShellVarContext current ; Set SHCTX to HKCU michael@0: Call FixShortcutAppModelIDs michael@0: SetShellVarContext all ; Set SHCTX to HKLM michael@0: ${EndIf} michael@0: michael@0: ; If running elevated also perform Win7 taskbar and start menu link michael@0: ; maintenance for the unelevated user context in case that is different than michael@0: ; the current user. michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${Unless} ${Errors} michael@0: GetFunctionAddress $0 FixShortcutAppModelIDs michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndUnless} michael@0: michael@0: ; UAC only allows elevating to an Admin account so there is no need to add michael@0: ; the Start Menu or Desktop shortcuts from the original unelevated process michael@0: ; since this will either add it for the user if unelevated or All Users if michael@0: ; elevated. michael@0: ${If} $AddStartMenuSC == 1 michael@0: CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" michael@0: ${Else} michael@0: ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${If} $AddDesktopSC == 1 michael@0: CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk" michael@0: ${Else} michael@0: ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandFullName}.lnk" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ; If elevated the Quick Launch shortcut must be added from the unelevated michael@0: ; original process. michael@0: ${If} $AddQuickLaunchSC == 1 michael@0: ${Unless} ${AtLeastWin7} michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${If} ${Errors} michael@0: Call AddQuickLaunchShortcut michael@0: ${LogMsg} "Added Shortcut: $QUICKLAUNCH\${BrandFullName}.lnk" michael@0: ${Else} michael@0: ; It is not possible to add a log entry from the unelevated process so michael@0: ; add the log entry without the path since there is no simple way to michael@0: ; know the correct full path. michael@0: ${LogMsg} "Added Quick Launch Shortcut: ${BrandFullName}.lnk" michael@0: GetFunctionAddress $0 AddQuickLaunchShortcut michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: ${If} $TmpVal == "HKLM" michael@0: ; Add the registry keys for allowed certificates. michael@0: ${AddMaintCertKeys} michael@0: ${EndIf} michael@0: !endif michael@0: SectionEnd michael@0: michael@0: ; Cleanup operations to perform at the end of the installation. michael@0: Section "-InstallEndCleanup" michael@0: SetDetailsPrint both michael@0: DetailPrint "$(STATUS_CLEANUP)" michael@0: SetDetailsPrint none michael@0: michael@0: ${Unless} ${Silent} michael@0: ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State" michael@0: ${If} "$0" == "1" michael@0: ${LogHeader} "Setting as the default browser" michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${If} ${Errors} michael@0: Call SetAsDefaultAppUserHKCU michael@0: ${Else} michael@0: GetFunctionAddress $0 SetAsDefaultAppUserHKCU michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). michael@0: ${MigrateTaskBarShortcut} michael@0: ${EndUnless} michael@0: michael@0: ${GetShortcutsLogPath} $0 michael@0: WriteIniStr "$0" "TASKBAR" "Migrated" "true" michael@0: michael@0: ; Refresh desktop icons michael@0: System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_DWORDFLUSH}, i 0, i 0)" michael@0: michael@0: ${InstallEndCleanupCommon} michael@0: michael@0: ${If} $PreventRebootRequired == "true" michael@0: SetRebootFlag false michael@0: ${EndIf} michael@0: michael@0: ${If} ${RebootFlag} michael@0: ; When a reboot is required give SHChangeNotify time to finish the michael@0: ; refreshing the icons so the OS doesn't display the icons from helper.exe michael@0: Sleep 10000 michael@0: ${LogHeader} "Reboot Required To Finish Installation" michael@0: ; ${FileMainEXE}.moz-upgrade should never exist but just in case... michael@0: ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" michael@0: Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" michael@0: ${EndUnless} michael@0: michael@0: ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" michael@0: ClearErrors michael@0: Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" michael@0: ${Unless} ${Errors} michael@0: Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" michael@0: CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" michael@0: FileOpen $0 "$INSTDIR\${FileMainEXE}" w michael@0: FileWrite $0 "Will be deleted on restart" michael@0: Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" michael@0: FileClose $0 michael@0: Delete "$INSTDIR\${FileMainEXE}" michael@0: Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: SectionEnd michael@0: michael@0: ################################################################################ michael@0: # Install Abort Survey Functions michael@0: michael@0: Function CustomAbort michael@0: ${If} "${AB_CD}" == "en-US" michael@0: ${AndIf} "$PageName" != "" michael@0: ${AndIf} ${FileExists} "$EXEDIR\core\distribution\distribution.ini" michael@0: ReadINIStr $0 "$EXEDIR\core\distribution\distribution.ini" "Global" "about" michael@0: ClearErrors michael@0: ${WordFind} "$0" "Funnelcake" "E#" $1 michael@0: ${Unless} ${Errors} michael@0: ; Yes = fill out the survey and exit, No = don't fill out survey and exit, michael@0: ; Cancel = don't exit. michael@0: MessageBox MB_YESNO|MB_ICONEXCLAMATION \ michael@0: "Would you like to tell us why you are canceling this installation?" \ michael@0: IDYes +1 IDNO CustomAbort_finish michael@0: ${If} "$PageName" == "Welcome" michael@0: GetFunctionAddress $0 AbortSurveyWelcome michael@0: ${ElseIf} "$PageName" == "Options" michael@0: GetFunctionAddress $0 AbortSurveyOptions michael@0: ${ElseIf} "$PageName" == "Directory" michael@0: GetFunctionAddress $0 AbortSurveyDirectory michael@0: ${ElseIf} "$PageName" == "Shortcuts" michael@0: GetFunctionAddress $0 AbortSurveyShortcuts michael@0: ${ElseIf} "$PageName" == "Summary" michael@0: GetFunctionAddress $0 AbortSurveySummary michael@0: ${EndIf} michael@0: ClearErrors michael@0: ${GetParameters} $1 michael@0: ${GetOptions} "$1" "/UAC:" $2 michael@0: ${If} ${Errors} michael@0: Call $0 michael@0: ${Else} michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: michael@0: CustomAbort_finish: michael@0: Return michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MOZ_MUI_TEXT_ABORTWARNING)" \ michael@0: IDYES +1 IDNO +2 michael@0: Return michael@0: Abort michael@0: FunctionEnd michael@0: michael@0: Function AbortSurveyWelcome michael@0: ExecShell "open" "${AbortSurveyURL}step1" michael@0: FunctionEnd michael@0: michael@0: Function AbortSurveyOptions michael@0: ExecShell "open" "${AbortSurveyURL}step2" michael@0: FunctionEnd michael@0: michael@0: Function AbortSurveyDirectory michael@0: ExecShell "open" "${AbortSurveyURL}step3" michael@0: FunctionEnd michael@0: michael@0: Function AbortSurveyShortcuts michael@0: ExecShell "open" "${AbortSurveyURL}step4" michael@0: FunctionEnd michael@0: michael@0: Function AbortSurveySummary michael@0: ExecShell "open" "${AbortSurveyURL}step5" michael@0: FunctionEnd michael@0: michael@0: ################################################################################ michael@0: # Helper Functions michael@0: michael@0: Function AddQuickLaunchShortcut michael@0: CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function CheckExistingInstall michael@0: ; If there is a pending file copy from a previous upgrade don't allow michael@0: ; installing until after the system has rebooted. michael@0: IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4 michael@0: MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2 michael@0: Reboot michael@0: Quit michael@0: michael@0: ; If there is a pending file deletion from a previous uninstall don't allow michael@0: ; installing until after the system has rebooted. michael@0: IfFileExists "$INSTDIR\${FileMainEXE}.moz-delete" +1 +4 michael@0: MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UNINSTALL)" IDNO +2 michael@0: Reboot michael@0: Quit michael@0: michael@0: ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" michael@0: ; Disable the next, cancel, and back buttons michael@0: GetDlgItem $0 $HWNDPARENT 1 ; Next button michael@0: EnableWindow $0 0 michael@0: GetDlgItem $0 $HWNDPARENT 2 ; Cancel button michael@0: EnableWindow $0 0 michael@0: GetDlgItem $0 $HWNDPARENT 3 ; Back button michael@0: EnableWindow $0 0 michael@0: michael@0: Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" michael@0: michael@0: ${If} "$TmpVal" == "FoundMessageWindow" michael@0: Sleep 5000 michael@0: ${EndIf} michael@0: michael@0: ${PushFilesToCheck} michael@0: michael@0: ; Store the return value in $TmpVal so it is less likely to be accidentally michael@0: ; overwritten elsewhere. michael@0: ${CheckForFilesInUse} $TmpVal michael@0: michael@0: Banner::destroy michael@0: michael@0: ; Enable the next, cancel, and back buttons michael@0: GetDlgItem $0 $HWNDPARENT 1 ; Next button michael@0: EnableWindow $0 1 michael@0: GetDlgItem $0 $HWNDPARENT 2 ; Cancel button michael@0: EnableWindow $0 1 michael@0: GetDlgItem $0 $HWNDPARENT 3 ; Back button michael@0: EnableWindow $0 1 michael@0: michael@0: ${If} "$TmpVal" == "true" michael@0: StrCpy $TmpVal "FoundMessageWindow" michael@0: ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" michael@0: StrCpy $TmpVal "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function LaunchApp michael@0: ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)" michael@0: michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $1 michael@0: ${If} ${Errors} michael@0: StrCpy $1 "0" michael@0: StrCpy $2 "0" michael@0: !ifdef MOZ_METRO michael@0: ; Check to see if this install location is currently set as the michael@0: ; default browser. michael@0: AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" michael@0: Pop $1 michael@0: ; Check for a last run type to see if metro was the last browser michael@0: ; front end in use. michael@0: ReadRegDWORD $2 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" michael@0: !endif michael@0: ${If} $1 == "1" michael@0: ${AndIf} $2 == "1" ; 1 equals AHE_IMMERSIVE michael@0: ; Launch into metro michael@0: Exec "$\"$INSTDIR\CommandExecuteHandler.exe$\" --launchmetro" michael@0: ${Else} michael@0: ; Launch into desktop michael@0: Exec "$\"$INSTDIR\${FileMainEXE}$\"" michael@0: ${EndIf} michael@0: ${Else} michael@0: GetFunctionAddress $0 LaunchAppFromElevatedProcess michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function LaunchAppFromElevatedProcess michael@0: ; Find the installation directory when launching using GetFunctionAddress michael@0: ; from an elevated installer since $INSTDIR will not be set in this installer michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $1 michael@0: ; Set our current working directory to the application's install directory michael@0: ; otherwise the 7-Zip temp directory will be in use and won't be deleted. michael@0: SetOutPath "$1" michael@0: StrCpy $2 "0" michael@0: StrCpy $3 "0" michael@0: !ifdef MOZ_METRO michael@0: ; Check to see if this install location is currently set as the michael@0: ; default browser. michael@0: AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" michael@0: Pop $2 michael@0: ; Check for a last run type to see if metro was the last browser michael@0: ; front end in use. michael@0: ReadRegDWORD $3 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" michael@0: !endif michael@0: ${If} $2 == "1" michael@0: ${AndIf} $3 == "1" ; 1 equals AHE_IMMERSIVE michael@0: ; Launch into metro michael@0: Exec "$\"$1\CommandExecuteHandler.exe$\" --launchmetro" michael@0: ${Else} michael@0: ; Launch into desktop michael@0: Exec "$\"$0$\"" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: ################################################################################ michael@0: # Language michael@0: michael@0: !insertmacro MOZ_MUI_LANGUAGE 'baseLocale' michael@0: !verbose push michael@0: !verbose 3 michael@0: !include "overrideLocale.nsh" michael@0: !include "customLocale.nsh" michael@0: !verbose pop michael@0: michael@0: ; Set this after the locale files to override it if it is in the locale michael@0: ; using " " for BrandingText will hide the "Nullsoft Install System..." branding michael@0: BrandingText " " michael@0: michael@0: ################################################################################ michael@0: # Page pre, show, and leave functions michael@0: michael@0: Function preWelcome michael@0: StrCpy $PageName "Welcome" michael@0: ${If} ${FileExists} "$EXEDIR\core\distribution\modern-wizard.bmp" michael@0: Delete "$PLUGINSDIR\modern-wizard.bmp" michael@0: CopyFiles /SILENT "$EXEDIR\core\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function preOptions michael@0: StrCpy $PageName "Options" michael@0: ${If} ${FileExists} "$EXEDIR\core\distribution\modern-header.bmp" michael@0: ${AndIf} $hHeaderBitmap == "" michael@0: Delete "$PLUGINSDIR\modern-header.bmp" michael@0: CopyFiles /SILENT "$EXEDIR\core\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" michael@0: ${ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" michael@0: ${EndIf} michael@0: !insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)" michael@0: !insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini" michael@0: FunctionEnd michael@0: michael@0: Function leaveOptions michael@0: ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State" michael@0: ${If} $0 != 0 michael@0: Abort michael@0: ${EndIf} michael@0: ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 2" "State" michael@0: StrCmp $R0 "1" +1 +2 michael@0: StrCpy $InstallType ${INSTALLTYPE_BASIC} michael@0: ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State" michael@0: StrCmp $R0 "1" +1 +2 michael@0: StrCpy $InstallType ${INSTALLTYPE_CUSTOM} michael@0: michael@0: ${LeaveOptionsCommon} michael@0: michael@0: ${If} $InstallType == ${INSTALLTYPE_BASIC} michael@0: Call CheckExistingInstall michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function preDirectory michael@0: StrCpy $PageName "Directory" michael@0: ${PreDirectoryCommon} michael@0: FunctionEnd michael@0: michael@0: Function leaveDirectory michael@0: ${If} $InstallType == ${INSTALLTYPE_BASIC} michael@0: Call CheckExistingInstall michael@0: ${EndIf} michael@0: ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)" michael@0: FunctionEnd michael@0: michael@0: Function preShortcuts michael@0: StrCpy $PageName "Shortcuts" michael@0: ${CheckCustomCommon} michael@0: !insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)" michael@0: !insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini" michael@0: FunctionEnd michael@0: michael@0: Function leaveShortcuts michael@0: ${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State" michael@0: ${If} $0 != 0 michael@0: Abort michael@0: ${EndIf} michael@0: ${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" michael@0: michael@0: ; If we have a Metro browser and are Win8, then we don't have a Field 3 michael@0: !ifdef MOZ_METRO michael@0: ${Unless} ${AtLeastWin8} michael@0: !endif michael@0: ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" michael@0: !ifdef MOZ_METRO michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: ; Don't install the quick launch shortcut on Windows 7 michael@0: ${Unless} ${AtLeastWin7} michael@0: ${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State" michael@0: ${EndUnless} michael@0: michael@0: ${If} $InstallType == ${INSTALLTYPE_CUSTOM} michael@0: Call CheckExistingInstall michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: Function preComponents michael@0: ; If the service already exists, don't show this page michael@0: ServicesHelper::IsInstalled "MozillaMaintenance" michael@0: Pop $R9 michael@0: ${If} $R9 == 1 michael@0: ; The service already exists so don't show this page. michael@0: Abort michael@0: ${EndIf} michael@0: michael@0: ; On Windows 2000 we do not install the maintenance service. michael@0: ${Unless} ${AtLeastWinXP} michael@0: Abort michael@0: ${EndUnless} michael@0: michael@0: ; Don't show the custom components page if the michael@0: ; user is not an admin michael@0: Call IsUserAdmin michael@0: Pop $R9 michael@0: ${If} $R9 != "true" michael@0: Abort michael@0: ${EndIf} michael@0: michael@0: ; Only show the maintenance service page if we have write access to HKLM michael@0: ClearErrors michael@0: WriteRegStr HKLM "Software\Mozilla" \ michael@0: "${BrandShortName}InstallerTest" "Write Test" michael@0: ${If} ${Errors} michael@0: ClearErrors michael@0: Abort michael@0: ${Else} michael@0: DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" michael@0: ${EndIf} michael@0: michael@0: StrCpy $PageName "Components" michael@0: ${CheckCustomCommon} michael@0: !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)" michael@0: !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini" michael@0: FunctionEnd michael@0: michael@0: Function leaveComponents michael@0: ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State" michael@0: ${If} $0 != 0 michael@0: Abort michael@0: ${EndIf} michael@0: ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State" michael@0: ${If} $InstallType == ${INSTALLTYPE_CUSTOM} michael@0: Call CheckExistingInstall michael@0: ${EndIf} michael@0: FunctionEnd michael@0: !endif michael@0: michael@0: Function preSummary michael@0: StrCpy $PageName "Summary" michael@0: ; Setup the summary.ini file for the Custom Summary Page michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "3" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Text "$(SUMMARY_INSTALLED_TO)" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Top "5" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Bottom "15" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Type "text" michael@0: ; The contents of this control must be set as follows in the pre function michael@0: ; ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" michael@0: ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" state "" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Top "17" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Bottom "30" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags "READONLY" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top "130" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150" michael@0: michael@0: ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_UPGRADE_CLICK)" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText "$(UPGRADE_BUTTON)" michael@0: ${Else} michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_INSTALL_CLICK)" michael@0: DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText michael@0: ${EndIf} michael@0: michael@0: michael@0: ; Remove the "Field 4" ini section in case the user hits back and changes the michael@0: ; installation directory which could change whether the make default checkbox michael@0: ; should be displayed. michael@0: DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4" michael@0: michael@0: ; Check if it is possible to write to HKLM michael@0: ClearErrors michael@0: WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" michael@0: ${Unless} ${Errors} michael@0: DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" michael@0: ; Check if Firefox is the http handler for this user. michael@0: SetShellVarContext current ; Set SHCTX to the current user michael@0: ${IsHandlerForInstallDir} "http" $R9 michael@0: ${If} $TmpVal == "HKLM" michael@0: SetShellVarContext all ; Set SHCTX to all users michael@0: ${EndIf} michael@0: ; If Firefox isn't the http handler for this user show the option to set michael@0: ; Firefox as the default browser. michael@0: ${If} "$R9" != "true" michael@0: ${AndIf} ${AtMostWin2008R2} michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "checkbox" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_TAKE_DEFAULTS)" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State "1" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "32" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53" michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: ${If} "$TmpVal" == "true" michael@0: ; If there is already a Type entry in the "Field 4" section with a value of michael@0: ; checkbox then the set as the default browser checkbox is displayed and michael@0: ; this text must be moved below it. michael@0: ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type" michael@0: ${If} "$0" == "checkbox" michael@0: StrCpy $0 "5" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "53" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68" michael@0: ${Else} michael@0: StrCpy $0 "4" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50" michael@0: ${EndIf} michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1" michael@0: ${EndIf} michael@0: michael@0: !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)" michael@0: michael@0: ; The Summary custom page has a textbox that will automatically receive michael@0: ; focus. This sets the focus to the Install button instead. michael@0: !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini" michael@0: GetDlgItem $0 $HWNDPARENT 1 michael@0: System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" michael@0: ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" michael@0: SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" michael@0: !insertmacro MUI_INSTALLOPTIONS_SHOW michael@0: FunctionEnd michael@0: michael@0: Function leaveSummary michael@0: ; Try to delete the app executable and if we can't delete it try to find the michael@0: ; app's message window and prompt the user to close the app. This allows michael@0: ; running an instance that is located in another directory. If for whatever michael@0: ; reason there is no message window we will just rename the app's files and michael@0: ; then remove them on restart. michael@0: ClearErrors michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${Errors} michael@0: ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: ; When we add an optional action to the finish page the cancel button is michael@0: ; enabled. This disables it and leaves the finish button as the only choice. michael@0: Function preFinish michael@0: StrCpy $PageName "" michael@0: ${EndInstallLog} "${BrandFullName}" michael@0: !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" michael@0: FunctionEnd michael@0: michael@0: ################################################################################ michael@0: # Initialization Functions michael@0: michael@0: Function .onInit michael@0: ; Remove the current exe directory from the search order. michael@0: ; This only effects LoadLibrary calls and not implicitly loaded DLLs. michael@0: System::Call 'kernel32::SetDllDirectoryW(w "")' michael@0: michael@0: StrCpy $PageName "" michael@0: StrCpy $LANGUAGE 0 michael@0: ${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini" michael@0: michael@0: ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)" michael@0: michael@0: ; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be michael@0: ; removed after we require NSIS 3.0a2 or greater. michael@0: !ifndef NSIS_PACKEDVERSION michael@0: ${If} ${AtLeastWinVista} michael@0: System::Call 'user32::SetProcessDPIAware()' michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: !insertmacro InitInstallOptionsFile "options.ini" michael@0: !insertmacro InitInstallOptionsFile "shortcuts.ini" michael@0: !insertmacro InitInstallOptionsFile "components.ini" michael@0: !insertmacro InitInstallOptionsFile "summary.ini" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "15" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67" michael@0: WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87" michael@0: michael@0: ; Setup the shortcuts.ini file for the Custom Shortcuts Page michael@0: ; Don't offer to install the quick launch shortcut on Windows 7 michael@0: ${If} ${AtLeastWin7} michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "3" michael@0: ${Else} michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "4" michael@0: ${EndIf} michael@0: michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Text "$(CREATE_ICONS_DESC)" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Top "5" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Bottom "15" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Type "checkbox" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Text "$(ICONS_DESKTOP)" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Top "20" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Bottom "30" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" State "1" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Flags "GROUP" michael@0: michael@0: ; Don't offer to install the start menu shortcut on Windows 8 michael@0: ; for Metro builds. michael@0: !ifdef MOZ_METRO michael@0: ${Unless} ${AtLeastWin8} michael@0: !endif michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Type "checkbox" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Text "$(ICONS_STARTMENU)" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Top "40" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1" michael@0: !ifdef MOZ_METRO michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: ; Don't offer to install the quick launch shortcut on Windows 7 michael@0: ${Unless} ${AtLeastWin7} michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70" michael@0: WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1" michael@0: ${EndUnless} michael@0: michael@0: ; Setup the components.ini file for the Components Page michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1" michael@0: WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP" michael@0: michael@0: ; There must always be a core directory. michael@0: ${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8 michael@0: SectionSetSize ${APP_IDX} $R5 michael@0: michael@0: ; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if michael@0: ; the user clicks the back button michael@0: StrCpy $hHeaderBitmap "" michael@0: FunctionEnd michael@0: michael@0: Function .onGUIEnd michael@0: ${OnEndCommon} michael@0: FunctionEnd