1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/installer/windows/nsis/installer.nsi Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,1259 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +# Required Plugins: 1.9 +# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in 1.10 +# ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in 1.11 +# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash 1.12 +# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in 1.13 +# UAC http://nsis.sourceforge.net/UAC_plug-in 1.14 +# ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis 1.15 + 1.16 +; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs 1.17 +!verbose 3 1.18 + 1.19 +; 7-Zip provides better compression than the lzma from NSIS so we add the files 1.20 +; uncompressed and use 7-Zip to create a SFX archive of it 1.21 +SetDatablockOptimize on 1.22 +SetCompress off 1.23 +CRCCheck on 1.24 + 1.25 +RequestExecutionLevel user 1.26 + 1.27 +; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can 1.28 +; be removed after we require NSIS 3.0a2 or greater. 1.29 +!ifdef NSIS_PACKEDVERSION 1.30 + Unicode true 1.31 + ManifestSupportedOS all 1.32 + ManifestDPIAware true 1.33 +!endif 1.34 + 1.35 +!addplugindir ./ 1.36 + 1.37 +Var TmpVal 1.38 +Var InstallType 1.39 +Var AddStartMenuSC 1.40 +Var AddQuickLaunchSC 1.41 +Var AddDesktopSC 1.42 +Var InstallMaintenanceService 1.43 +Var PageName 1.44 +Var PreventRebootRequired 1.45 + 1.46 +; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for 1.47 +; an application's Start Menu PROGRAMS directory and doesn't define the 1.48 +; StartMenuDir variable can use the common InstallOnInitCommon macro. 1.49 +!define NO_STARTMENU_DIR 1.50 + 1.51 +; On Vista and above attempt to elevate Standard Users in addition to users that 1.52 +; are a member of the Administrators group. 1.53 +!define NONADMIN_ELEVATE 1.54 + 1.55 +!define AbortSurveyURL "http://www.kampyle.com/feedback_form/ff-feedback-form.php?site_code=8166124&form_id=12116&url=" 1.56 + 1.57 +; Other included files may depend upon these includes! 1.58 +; The following includes are provided by NSIS. 1.59 +!include FileFunc.nsh 1.60 +!include LogicLib.nsh 1.61 +!include MUI.nsh 1.62 +!include WinMessages.nsh 1.63 +!include WinVer.nsh 1.64 +!include WordFunc.nsh 1.65 + 1.66 +!insertmacro GetOptions 1.67 +!insertmacro GetParameters 1.68 +!insertmacro GetSize 1.69 +!insertmacro StrFilter 1.70 +!insertmacro WordFind 1.71 +!insertmacro WordReplace 1.72 + 1.73 +; The following includes are custom. 1.74 +!include branding.nsi 1.75 +!include defines.nsi 1.76 +!include common.nsh 1.77 +!include locales.nsi 1.78 + 1.79 +VIAddVersionKey "FileDescription" "${BrandShortName} Installer" 1.80 +VIAddVersionKey "OriginalFilename" "setup.exe" 1.81 + 1.82 +; Must be inserted before other macros that use logging 1.83 +!insertmacro _LoggingCommon 1.84 + 1.85 +!insertmacro AddDisabledDDEHandlerValues 1.86 +!insertmacro ChangeMUIHeaderImage 1.87 +!insertmacro CheckForFilesInUse 1.88 +!insertmacro CleanUpdateDirectories 1.89 +!insertmacro CopyFilesFromDir 1.90 +!insertmacro CreateRegKey 1.91 +!insertmacro GetLongPath 1.92 +!insertmacro GetPathFromString 1.93 +!insertmacro GetParent 1.94 +!insertmacro InitHashAppModelId 1.95 +!insertmacro IsHandlerForInstallDir 1.96 +!insertmacro IsPinnedToTaskBar 1.97 +!insertmacro IsUserAdmin 1.98 +!insertmacro LogDesktopShortcut 1.99 +!insertmacro LogQuickLaunchShortcut 1.100 +!insertmacro LogStartMenuShortcut 1.101 +!insertmacro ManualCloseAppPrompt 1.102 +!insertmacro OnStubInstallUninstall 1.103 +!insertmacro PinnedToStartMenuLnkCount 1.104 +!insertmacro RegCleanAppHandler 1.105 +!insertmacro RegCleanMain 1.106 +!insertmacro RegCleanUninstall 1.107 +!ifdef MOZ_METRO 1.108 +!insertmacro RemoveDEHRegistrationIfMatching 1.109 +!endif 1.110 +!insertmacro SetAppLSPCategories 1.111 +!insertmacro SetBrandNameVars 1.112 +!insertmacro UpdateShortcutAppModelIDs 1.113 +!insertmacro UnloadUAC 1.114 +!insertmacro WriteRegStr2 1.115 +!insertmacro WriteRegDWORD2 1.116 +!insertmacro CheckIfRegistryKeyExists 1.117 + 1.118 +!include shared.nsh 1.119 + 1.120 +; Helper macros for ui callbacks. Insert these after shared.nsh 1.121 +!insertmacro CheckCustomCommon 1.122 +!insertmacro InstallEndCleanupCommon 1.123 +!insertmacro InstallOnInitCommon 1.124 +!insertmacro InstallStartCleanupCommon 1.125 +!insertmacro LeaveDirectoryCommon 1.126 +!insertmacro LeaveOptionsCommon 1.127 +!insertmacro OnEndCommon 1.128 +!insertmacro PreDirectoryCommon 1.129 + 1.130 +Name "${BrandFullName}" 1.131 +OutFile "setup.exe" 1.132 +!ifdef HAVE_64BIT_OS 1.133 + InstallDir "$PROGRAMFILES64\${BrandFullName}\" 1.134 +!else 1.135 + InstallDir "$PROGRAMFILES32\${BrandFullName}\" 1.136 +!endif 1.137 +ShowInstDetails nevershow 1.138 + 1.139 +################################################################################ 1.140 +# Modern User Interface - MUI 1.141 + 1.142 +!define MOZ_MUI_CUSTOM_ABORT 1.143 +!define MUI_CUSTOMFUNCTION_ABORT "CustomAbort" 1.144 +!define MUI_ICON setup.ico 1.145 +!define MUI_UNICON setup.ico 1.146 +!define MUI_WELCOMEPAGE_TITLE_3LINES 1.147 +!define MUI_HEADERIMAGE 1.148 +!define MUI_HEADERIMAGE_RIGHT 1.149 +!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp 1.150 + 1.151 +; Use a right to left header image when the language is right to left 1.152 +!ifdef ${AB_CD}_rtl 1.153 +!define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp 1.154 +!else 1.155 +!define MUI_HEADERIMAGE_BITMAP wizHeader.bmp 1.156 +!endif 1.157 + 1.158 +/** 1.159 + * Installation Pages 1.160 + */ 1.161 +; Welcome Page 1.162 +!define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcome 1.163 +!insertmacro MUI_PAGE_WELCOME 1.164 + 1.165 +; Custom Options Page 1.166 +Page custom preOptions leaveOptions 1.167 + 1.168 +; Select Install Directory Page 1.169 +!define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory 1.170 +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory 1.171 +!define MUI_DIRECTORYPAGE_VERIFYONLEAVE 1.172 +!insertmacro MUI_PAGE_DIRECTORY 1.173 + 1.174 +; Custom Components Page 1.175 +!ifdef MOZ_MAINTENANCE_SERVICE 1.176 +Page custom preComponents leaveComponents 1.177 +!endif 1.178 + 1.179 +; Custom Shortcuts Page 1.180 +Page custom preShortcuts leaveShortcuts 1.181 + 1.182 +; Custom Summary Page 1.183 +Page custom preSummary leaveSummary 1.184 + 1.185 +; Install Files Page 1.186 +!insertmacro MUI_PAGE_INSTFILES 1.187 + 1.188 +; Finish Page 1.189 +!define MUI_FINISHPAGE_TITLE_3LINES 1.190 +!define MUI_FINISHPAGE_RUN 1.191 +!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp 1.192 +!define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT) 1.193 +!define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish 1.194 +!insertmacro MUI_PAGE_FINISH 1.195 + 1.196 +; Use the default dialog for IDD_VERIFY for a simple Banner 1.197 +ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" 1.198 + 1.199 +################################################################################ 1.200 +# Install Sections 1.201 + 1.202 +; Cleanup operations to perform at the start of the installation. 1.203 +Section "-InstallStartCleanup" 1.204 + SetDetailsPrint both 1.205 + DetailPrint $(STATUS_CLEANUP) 1.206 + SetDetailsPrint none 1.207 + 1.208 + SetOutPath "$INSTDIR" 1.209 + ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}" 1.210 + 1.211 + StrCpy $PreventRebootRequired "false" 1.212 + ${GetParameters} $R8 1.213 + ${GetOptions} "$R8" "/INI=" $R7 1.214 + ${Unless} ${Errors} 1.215 + ; The configuration file must also exist 1.216 + ${If} ${FileExists} "$R7" 1.217 + ReadINIStr $R8 $R7 "Install" "PreventRebootRequired" 1.218 + ${If} $R8 == "true" 1.219 + StrCpy $PreventRebootRequired "true" 1.220 + StrCpy $R2 "false" 1.221 + StrCpy $R3 "false" 1.222 + ${OnStubInstallUninstall} "$R2" "$R3" 1.223 + ${EndIf} 1.224 + ${EndIf} 1.225 + ${EndUnless} 1.226 + 1.227 + ; Delete the app exe if present to prevent launching the app while we are 1.228 + ; installing. 1.229 + ClearErrors 1.230 + ${DeleteFile} "$INSTDIR\${FileMainEXE}" 1.231 + ${If} ${Errors} 1.232 + ; If the user closed the application it can take several seconds for it to 1.233 + ; shut down completely. If the application is being used by another user we 1.234 + ; can rename the file and then delete is when the system is restarted. 1.235 + Sleep 5000 1.236 + ${DeleteFile} "$INSTDIR\${FileMainEXE}" 1.237 + ClearErrors 1.238 + ${EndIf} 1.239 + 1.240 + ; setup the application model id registration value 1.241 + ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" 1.242 + 1.243 + ; Remove the updates directory for Vista and above 1.244 + ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates" 1.245 + 1.246 + ${RemoveDeprecatedFiles} 1.247 + 1.248 + ${InstallStartCleanupCommon} 1.249 +SectionEnd 1.250 + 1.251 +Section "-Application" APP_IDX 1.252 + ${StartUninstallLog} 1.253 + 1.254 + SetDetailsPrint both 1.255 + DetailPrint $(STATUS_INSTALL_APP) 1.256 + SetDetailsPrint none 1.257 + 1.258 + RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" 1.259 + 1.260 + ${LogHeader} "Installing Main Files" 1.261 + ${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \ 1.262 + "$(ERROR_CREATE_DIRECTORY_PREFIX)" \ 1.263 + "$(ERROR_CREATE_DIRECTORY_SUFFIX)" 1.264 + 1.265 + ; Register DLLs 1.266 + ; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but 1.267 + ; is only registered for the last application installed. When the last 1.268 + ; application installed is uninstalled AccessibleMarshal.dll will no longer be 1.269 + ; registered. bug 338878 1.270 + ${LogHeader} "DLL Registration" 1.271 + ClearErrors 1.272 + ${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll" 1.273 + ${If} ${Errors} 1.274 + ${LogMsg} "** ERROR Registering: $INSTDIR\AccessibleMarshal.dll **" 1.275 + ${Else} 1.276 + ${LogUninstall} "DLLReg: \AccessibleMarshal.dll" 1.277 + ${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll" 1.278 + ${EndIf} 1.279 + 1.280 + ; Write extra files created by the application to the uninstall log so they 1.281 + ; will be removed when the application is uninstalled. To remove an empty 1.282 + ; directory write a bogus filename to the deepest directory and all empty 1.283 + ; parent directories will be removed. 1.284 + ${LogUninstall} "File: \components\compreg.dat" 1.285 + ${LogUninstall} "File: \components\xpti.dat" 1.286 + ${LogUninstall} "File: \active-update.xml" 1.287 + ${LogUninstall} "File: \install.log" 1.288 + ${LogUninstall} "File: \install_status.log" 1.289 + ${LogUninstall} "File: \install_wizard.log" 1.290 + ${LogUninstall} "File: \updates.xml" 1.291 + 1.292 + ClearErrors 1.293 + 1.294 + ; Default for creating Start Menu shortcut 1.295 + ; (1 = create, 0 = don't create) 1.296 + ${If} $AddStartMenuSC == "" 1.297 + StrCpy $AddStartMenuSC "1" 1.298 + ${EndIf} 1.299 + 1.300 + ; Default for creating Quick Launch shortcut (1 = create, 0 = don't create) 1.301 + ${If} $AddQuickLaunchSC == "" 1.302 + ; Don't install the quick launch shortcut on Windows 7 1.303 + ${If} ${AtLeastWin7} 1.304 + StrCpy $AddQuickLaunchSC "0" 1.305 + ${Else} 1.306 + StrCpy $AddQuickLaunchSC "1" 1.307 + ${EndIf} 1.308 + ${EndIf} 1.309 + 1.310 + ; Default for creating Desktop shortcut (1 = create, 0 = don't create) 1.311 + ${If} $AddDesktopSC == "" 1.312 + StrCpy $AddDesktopSC "1" 1.313 + ${EndIf} 1.314 + 1.315 + ${LogHeader} "Adding Registry Entries" 1.316 + SetShellVarContext current ; Set SHCTX to HKCU 1.317 + ${RegCleanMain} "Software\Mozilla" 1.318 + ${RegCleanUninstall} 1.319 +!ifdef MOZ_METRO 1.320 + ${ResetWin8PromptKeys} "HKCU" "" 1.321 +!endif 1.322 + ${UpdateProtocolHandlers} 1.323 + 1.324 + ClearErrors 1.325 + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" 1.326 + ${If} ${Errors} 1.327 + StrCpy $TmpVal "HKCU" ; used primarily for logging 1.328 + ${Else} 1.329 + SetShellVarContext all ; Set SHCTX to HKLM 1.330 + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" 1.331 + StrCpy $TmpVal "HKLM" ; used primarily for logging 1.332 + ${RegCleanMain} "Software\Mozilla" 1.333 + ${RegCleanUninstall} 1.334 + ${UpdateProtocolHandlers} 1.335 + 1.336 + ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" 1.337 + ${If} "$0" != "${GREVersion}" 1.338 + WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" 1.339 + ${EndIf} 1.340 + ${EndIf} 1.341 + 1.342 + ${RemoveDeprecatedKeys} 1.343 + 1.344 + ; The previous installer adds several regsitry values to both HKLM and HKCU. 1.345 + ; We now try to add to HKLM and if that fails to HKCU 1.346 + 1.347 + ; The order that reg keys and values are added is important if you use the 1.348 + ; uninstall log to remove them on uninstall. When using the uninstall log you 1.349 + ; MUST add children first so they will be removed first on uninstall so they 1.350 + ; will be empty when the key is deleted. This allows the uninstaller to 1.351 + ; specify that only empty keys will be deleted. 1.352 + ${SetAppKeys} 1.353 + 1.354 + ${FixClassKeys} 1.355 + 1.356 + ; Uninstall keys can only exist under HKLM on some versions of windows. Since 1.357 + ; it doesn't cause problems always add them. 1.358 + ${SetUninstallKeys} 1.359 + 1.360 + ; On install always add the FirefoxHTML and FirefoxURL keys. 1.361 + ; An empty string is used for the 5th param because FirefoxHTML is not a 1.362 + ; protocol handler. 1.363 + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 1.364 + StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" 1.365 + 1.366 + ; In Win8, the delegate execute handler picks up the value in FirefoxURL and 1.367 + ; FirefoxHTML to launch the desktop browser when it needs to. 1.368 + ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ 1.369 + "${AppRegName} Document" "" 1.370 + ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ 1.371 + "true" 1.372 + 1.373 + ; For pre win8, the following keys should only be set if we can write to HKLM. 1.374 + ; For post win8, the keys below get set in both HKLM and HKCU. 1.375 + ${If} $TmpVal == "HKLM" 1.376 + ; Set the Start Menu Internet and Vista Registered App HKLM registry keys. 1.377 + ${SetStartMenuInternet} "HKLM" 1.378 + ${FixShellIconHandler} "HKLM" 1.379 + 1.380 + ; If we are writing to HKLM and create either the desktop or start menu 1.381 + ; shortcuts set IconsVisible to 1 otherwise to 0. 1.382 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.383 + StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" 1.384 + ${If} $AddDesktopSC == 1 1.385 + ${OrIf} $AddStartMenuSC == 1 1.386 + WriteRegDWORD HKLM "$0" "IconsVisible" 1 1.387 + ${Else} 1.388 + WriteRegDWORD HKLM "$0" "IconsVisible" 0 1.389 + ${EndIf} 1.390 + ${EndIf} 1.391 + 1.392 + ${If} ${AtLeastWin8} 1.393 + ; Set the Start Menu Internet and Vista Registered App HKCU registry keys. 1.394 + ${SetStartMenuInternet} "HKCU" 1.395 + ${FixShellIconHandler} "HKCU" 1.396 + 1.397 + ; If we create either the desktop or start menu shortcuts, then 1.398 + ; set IconsVisible to 1 otherwise to 0. 1.399 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.400 + StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" 1.401 + ${If} $AddDesktopSC == 1 1.402 + ${OrIf} $AddStartMenuSC == 1 1.403 + WriteRegDWORD HKCU "$0" "IconsVisible" 1 1.404 + ${Else} 1.405 + WriteRegDWORD HKCU "$0" "IconsVisible" 0 1.406 + ${EndIf} 1.407 +!ifdef MOZ_METRO 1.408 + ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.409 + "FirefoxURL" \ 1.410 + "FirefoxHTML" 1.411 + ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.412 + "$INSTDIR\CommandExecuteHandler.exe" \ 1.413 + $AppUserModelID \ 1.414 + "FirefoxURL" \ 1.415 + "FirefoxHTML" 1.416 +!else 1.417 + ; The metro browser is not enabled by the mozconfig. 1.418 + ${If} ${AtLeastWin8} 1.419 + ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.420 + $AppUserModelID \ 1.421 + "FirefoxURL" \ 1.422 + "FirefoxHTML" 1.423 + ${EndIf} 1.424 +!endif 1.425 + ${EndIf} 1.426 + 1.427 +!ifdef MOZ_MAINTENANCE_SERVICE 1.428 + ; If the maintenance service page was displayed then a value was already 1.429 + ; explicitly selected for installing the maintenance service and 1.430 + ; and so InstallMaintenanceService will already be 0 or 1. 1.431 + ; If the maintenance service page was not displayed then 1.432 + ; InstallMaintenanceService will be equal to "". 1.433 + ${If} $InstallMaintenanceService == "" 1.434 + Call IsUserAdmin 1.435 + Pop $R0 1.436 + ${If} $R0 == "true" 1.437 + ; Only proceed if we have HKLM write access 1.438 + ${AndIf} $TmpVal == "HKLM" 1.439 + ; On Windows 2000 we do not install the maintenance service. 1.440 + ${AndIf} ${AtLeastWinXP} 1.441 + ; The user is an admin so we should default to install service yes 1.442 + StrCpy $InstallMaintenanceService "1" 1.443 + ${Else} 1.444 + ; The user is not admin so we should default to install service no 1.445 + StrCpy $InstallMaintenanceService "0" 1.446 + ${EndIf} 1.447 + ${EndIf} 1.448 + 1.449 + ${If} $InstallMaintenanceService == "1" 1.450 + ; The user wants to install the maintenance service, so execute 1.451 + ; the pre-packaged maintenance service installer. 1.452 + ; This option can only be turned on if the user is an admin so there 1.453 + ; is no need to use ExecShell w/ verb runas to enforce elevated. 1.454 + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" 1.455 + ${EndIf} 1.456 +!endif 1.457 + 1.458 + ; These need special handling on uninstall since they may be overwritten by 1.459 + ; an install into a different location. 1.460 + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" 1.461 + ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0 1.462 + ${WriteRegStr2} $TmpVal "$0" "Path" "$INSTDIR" 0 1.463 + 1.464 + StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9" 1.465 + ${CreateRegKey} "$TmpVal" "$0" 0 1.466 + StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe" 1.467 + ${CreateRegKey} "$TmpVal" "$0" 0 1.468 + 1.469 + ${If} $TmpVal == "HKLM" 1.470 + ; Set the permitted LSP Categories for WinVista and above 1.471 + ${SetAppLSPCategories} ${LSP_CATEGORIES} 1.472 + ${EndIf} 1.473 + 1.474 + ; Create shortcuts 1.475 + ${LogHeader} "Adding Shortcuts" 1.476 + 1.477 + ; Remove the start menu shortcuts and directory if the SMPROGRAMS section 1.478 + ; exists in the shortcuts_log.ini and the SMPROGRAMS. The installer's shortcut 1.479 + ; creation code will create the shortcut in the root of the Start Menu 1.480 + ; Programs directory. 1.481 + ${RemoveStartMenuDir} 1.482 + 1.483 + ; Always add the application's shortcuts to the shortcuts log ini file. The 1.484 + ; DeleteShortcuts macro will do the right thing on uninstall if the 1.485 + ; shortcuts don't exist. 1.486 + ${LogStartMenuShortcut} "${BrandFullName}.lnk" 1.487 + ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" 1.488 + ${LogDesktopShortcut} "${BrandFullName}.lnk" 1.489 + 1.490 + ; Best effort to update the Win7 taskbar and start menu shortcut app model 1.491 + ; id's. The possible contexts are current user / system and the user that 1.492 + ; elevated the installer. 1.493 + Call FixShortcutAppModelIDs 1.494 + ; If the current context is all also perform Win7 taskbar and start menu link 1.495 + ; maintenance for the current user context. 1.496 + ${If} $TmpVal == "HKLM" 1.497 + SetShellVarContext current ; Set SHCTX to HKCU 1.498 + Call FixShortcutAppModelIDs 1.499 + SetShellVarContext all ; Set SHCTX to HKLM 1.500 + ${EndIf} 1.501 + 1.502 + ; If running elevated also perform Win7 taskbar and start menu link 1.503 + ; maintenance for the unelevated user context in case that is different than 1.504 + ; the current user. 1.505 + ClearErrors 1.506 + ${GetParameters} $0 1.507 + ${GetOptions} "$0" "/UAC:" $0 1.508 + ${Unless} ${Errors} 1.509 + GetFunctionAddress $0 FixShortcutAppModelIDs 1.510 + UAC::ExecCodeSegment $0 1.511 + ${EndUnless} 1.512 + 1.513 + ; UAC only allows elevating to an Admin account so there is no need to add 1.514 + ; the Start Menu or Desktop shortcuts from the original unelevated process 1.515 + ; since this will either add it for the user if unelevated or All Users if 1.516 + ; elevated. 1.517 + ${If} $AddStartMenuSC == 1 1.518 + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.519 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.520 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.521 + "$INSTDIR" 1.522 + ${If} ${AtLeastWin7} 1.523 + ${AndIf} "$AppUserModelID" != "" 1.524 + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.525 + ${EndIf} 1.526 + ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" 1.527 + ${Else} 1.528 + ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" 1.529 + ${EndIf} 1.530 + ${EndIf} 1.531 + 1.532 + ${If} $AddDesktopSC == 1 1.533 + CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.534 + ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.535 + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ 1.536 + "$INSTDIR" 1.537 + ${If} ${AtLeastWin7} 1.538 + ${AndIf} "$AppUserModelID" != "" 1.539 + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.540 + ${EndIf} 1.541 + ${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk" 1.542 + ${Else} 1.543 + ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandFullName}.lnk" 1.544 + ${EndIf} 1.545 + ${EndIf} 1.546 + 1.547 + ; If elevated the Quick Launch shortcut must be added from the unelevated 1.548 + ; original process. 1.549 + ${If} $AddQuickLaunchSC == 1 1.550 + ${Unless} ${AtLeastWin7} 1.551 + ClearErrors 1.552 + ${GetParameters} $0 1.553 + ${GetOptions} "$0" "/UAC:" $0 1.554 + ${If} ${Errors} 1.555 + Call AddQuickLaunchShortcut 1.556 + ${LogMsg} "Added Shortcut: $QUICKLAUNCH\${BrandFullName}.lnk" 1.557 + ${Else} 1.558 + ; It is not possible to add a log entry from the unelevated process so 1.559 + ; add the log entry without the path since there is no simple way to 1.560 + ; know the correct full path. 1.561 + ${LogMsg} "Added Quick Launch Shortcut: ${BrandFullName}.lnk" 1.562 + GetFunctionAddress $0 AddQuickLaunchShortcut 1.563 + UAC::ExecCodeSegment $0 1.564 + ${EndIf} 1.565 + ${EndUnless} 1.566 + ${EndIf} 1.567 + 1.568 +!ifdef MOZ_MAINTENANCE_SERVICE 1.569 + ${If} $TmpVal == "HKLM" 1.570 + ; Add the registry keys for allowed certificates. 1.571 + ${AddMaintCertKeys} 1.572 + ${EndIf} 1.573 +!endif 1.574 +SectionEnd 1.575 + 1.576 +; Cleanup operations to perform at the end of the installation. 1.577 +Section "-InstallEndCleanup" 1.578 + SetDetailsPrint both 1.579 + DetailPrint "$(STATUS_CLEANUP)" 1.580 + SetDetailsPrint none 1.581 + 1.582 + ${Unless} ${Silent} 1.583 + ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State" 1.584 + ${If} "$0" == "1" 1.585 + ${LogHeader} "Setting as the default browser" 1.586 + ClearErrors 1.587 + ${GetParameters} $0 1.588 + ${GetOptions} "$0" "/UAC:" $0 1.589 + ${If} ${Errors} 1.590 + Call SetAsDefaultAppUserHKCU 1.591 + ${Else} 1.592 + GetFunctionAddress $0 SetAsDefaultAppUserHKCU 1.593 + UAC::ExecCodeSegment $0 1.594 + ${EndIf} 1.595 + ${EndIf} 1.596 + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). 1.597 + ${MigrateTaskBarShortcut} 1.598 + ${EndUnless} 1.599 + 1.600 + ${GetShortcutsLogPath} $0 1.601 + WriteIniStr "$0" "TASKBAR" "Migrated" "true" 1.602 + 1.603 + ; Refresh desktop icons 1.604 + System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_DWORDFLUSH}, i 0, i 0)" 1.605 + 1.606 + ${InstallEndCleanupCommon} 1.607 + 1.608 + ${If} $PreventRebootRequired == "true" 1.609 + SetRebootFlag false 1.610 + ${EndIf} 1.611 + 1.612 + ${If} ${RebootFlag} 1.613 + ; When a reboot is required give SHChangeNotify time to finish the 1.614 + ; refreshing the icons so the OS doesn't display the icons from helper.exe 1.615 + Sleep 10000 1.616 + ${LogHeader} "Reboot Required To Finish Installation" 1.617 + ; ${FileMainEXE}.moz-upgrade should never exist but just in case... 1.618 + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" 1.619 + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" 1.620 + ${EndUnless} 1.621 + 1.622 + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" 1.623 + ClearErrors 1.624 + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" 1.625 + ${Unless} ${Errors} 1.626 + Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" 1.627 + ${EndUnless} 1.628 + ${EndIf} 1.629 + 1.630 + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" 1.631 + CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" 1.632 + FileOpen $0 "$INSTDIR\${FileMainEXE}" w 1.633 + FileWrite $0 "Will be deleted on restart" 1.634 + Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" 1.635 + FileClose $0 1.636 + Delete "$INSTDIR\${FileMainEXE}" 1.637 + Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" 1.638 + ${EndUnless} 1.639 + ${EndIf} 1.640 +SectionEnd 1.641 + 1.642 +################################################################################ 1.643 +# Install Abort Survey Functions 1.644 + 1.645 +Function CustomAbort 1.646 + ${If} "${AB_CD}" == "en-US" 1.647 + ${AndIf} "$PageName" != "" 1.648 + ${AndIf} ${FileExists} "$EXEDIR\core\distribution\distribution.ini" 1.649 + ReadINIStr $0 "$EXEDIR\core\distribution\distribution.ini" "Global" "about" 1.650 + ClearErrors 1.651 + ${WordFind} "$0" "Funnelcake" "E#" $1 1.652 + ${Unless} ${Errors} 1.653 + ; Yes = fill out the survey and exit, No = don't fill out survey and exit, 1.654 + ; Cancel = don't exit. 1.655 + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ 1.656 + "Would you like to tell us why you are canceling this installation?" \ 1.657 + IDYes +1 IDNO CustomAbort_finish 1.658 + ${If} "$PageName" == "Welcome" 1.659 + GetFunctionAddress $0 AbortSurveyWelcome 1.660 + ${ElseIf} "$PageName" == "Options" 1.661 + GetFunctionAddress $0 AbortSurveyOptions 1.662 + ${ElseIf} "$PageName" == "Directory" 1.663 + GetFunctionAddress $0 AbortSurveyDirectory 1.664 + ${ElseIf} "$PageName" == "Shortcuts" 1.665 + GetFunctionAddress $0 AbortSurveyShortcuts 1.666 + ${ElseIf} "$PageName" == "Summary" 1.667 + GetFunctionAddress $0 AbortSurveySummary 1.668 + ${EndIf} 1.669 + ClearErrors 1.670 + ${GetParameters} $1 1.671 + ${GetOptions} "$1" "/UAC:" $2 1.672 + ${If} ${Errors} 1.673 + Call $0 1.674 + ${Else} 1.675 + UAC::ExecCodeSegment $0 1.676 + ${EndIf} 1.677 + 1.678 + CustomAbort_finish: 1.679 + Return 1.680 + ${EndUnless} 1.681 + ${EndIf} 1.682 + 1.683 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MOZ_MUI_TEXT_ABORTWARNING)" \ 1.684 + IDYES +1 IDNO +2 1.685 + Return 1.686 + Abort 1.687 +FunctionEnd 1.688 + 1.689 +Function AbortSurveyWelcome 1.690 + ExecShell "open" "${AbortSurveyURL}step1" 1.691 +FunctionEnd 1.692 + 1.693 +Function AbortSurveyOptions 1.694 + ExecShell "open" "${AbortSurveyURL}step2" 1.695 +FunctionEnd 1.696 + 1.697 +Function AbortSurveyDirectory 1.698 + ExecShell "open" "${AbortSurveyURL}step3" 1.699 +FunctionEnd 1.700 + 1.701 +Function AbortSurveyShortcuts 1.702 + ExecShell "open" "${AbortSurveyURL}step4" 1.703 +FunctionEnd 1.704 + 1.705 +Function AbortSurveySummary 1.706 + ExecShell "open" "${AbortSurveyURL}step5" 1.707 +FunctionEnd 1.708 + 1.709 +################################################################################ 1.710 +# Helper Functions 1.711 + 1.712 +Function AddQuickLaunchShortcut 1.713 + CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.714 + ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" 1.715 + ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ 1.716 + "$INSTDIR" 1.717 + ${EndIf} 1.718 +FunctionEnd 1.719 + 1.720 +Function CheckExistingInstall 1.721 + ; If there is a pending file copy from a previous upgrade don't allow 1.722 + ; installing until after the system has rebooted. 1.723 + IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4 1.724 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2 1.725 + Reboot 1.726 + Quit 1.727 + 1.728 + ; If there is a pending file deletion from a previous uninstall don't allow 1.729 + ; installing until after the system has rebooted. 1.730 + IfFileExists "$INSTDIR\${FileMainEXE}.moz-delete" +1 +4 1.731 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UNINSTALL)" IDNO +2 1.732 + Reboot 1.733 + Quit 1.734 + 1.735 + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" 1.736 + ; Disable the next, cancel, and back buttons 1.737 + GetDlgItem $0 $HWNDPARENT 1 ; Next button 1.738 + EnableWindow $0 0 1.739 + GetDlgItem $0 $HWNDPARENT 2 ; Cancel button 1.740 + EnableWindow $0 0 1.741 + GetDlgItem $0 $HWNDPARENT 3 ; Back button 1.742 + EnableWindow $0 0 1.743 + 1.744 + Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" 1.745 + 1.746 + ${If} "$TmpVal" == "FoundMessageWindow" 1.747 + Sleep 5000 1.748 + ${EndIf} 1.749 + 1.750 + ${PushFilesToCheck} 1.751 + 1.752 + ; Store the return value in $TmpVal so it is less likely to be accidentally 1.753 + ; overwritten elsewhere. 1.754 + ${CheckForFilesInUse} $TmpVal 1.755 + 1.756 + Banner::destroy 1.757 + 1.758 + ; Enable the next, cancel, and back buttons 1.759 + GetDlgItem $0 $HWNDPARENT 1 ; Next button 1.760 + EnableWindow $0 1 1.761 + GetDlgItem $0 $HWNDPARENT 2 ; Cancel button 1.762 + EnableWindow $0 1 1.763 + GetDlgItem $0 $HWNDPARENT 3 ; Back button 1.764 + EnableWindow $0 1 1.765 + 1.766 + ${If} "$TmpVal" == "true" 1.767 + StrCpy $TmpVal "FoundMessageWindow" 1.768 + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" 1.769 + StrCpy $TmpVal "true" 1.770 + ${EndIf} 1.771 + ${EndIf} 1.772 +FunctionEnd 1.773 + 1.774 +Function LaunchApp 1.775 + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)" 1.776 + 1.777 + ClearErrors 1.778 + ${GetParameters} $0 1.779 + ${GetOptions} "$0" "/UAC:" $1 1.780 + ${If} ${Errors} 1.781 + StrCpy $1 "0" 1.782 + StrCpy $2 "0" 1.783 +!ifdef MOZ_METRO 1.784 + ; Check to see if this install location is currently set as the 1.785 + ; default browser. 1.786 + AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" 1.787 + Pop $1 1.788 + ; Check for a last run type to see if metro was the last browser 1.789 + ; front end in use. 1.790 + ReadRegDWORD $2 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" 1.791 +!endif 1.792 + ${If} $1 == "1" 1.793 + ${AndIf} $2 == "1" ; 1 equals AHE_IMMERSIVE 1.794 + ; Launch into metro 1.795 + Exec "$\"$INSTDIR\CommandExecuteHandler.exe$\" --launchmetro" 1.796 + ${Else} 1.797 + ; Launch into desktop 1.798 + Exec "$\"$INSTDIR\${FileMainEXE}$\"" 1.799 + ${EndIf} 1.800 + ${Else} 1.801 + GetFunctionAddress $0 LaunchAppFromElevatedProcess 1.802 + UAC::ExecCodeSegment $0 1.803 + ${EndIf} 1.804 +FunctionEnd 1.805 + 1.806 +Function LaunchAppFromElevatedProcess 1.807 + ; Find the installation directory when launching using GetFunctionAddress 1.808 + ; from an elevated installer since $INSTDIR will not be set in this installer 1.809 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.810 + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" 1.811 + ${GetPathFromString} "$0" $0 1.812 + ${GetParent} "$0" $1 1.813 + ; Set our current working directory to the application's install directory 1.814 + ; otherwise the 7-Zip temp directory will be in use and won't be deleted. 1.815 + SetOutPath "$1" 1.816 + StrCpy $2 "0" 1.817 + StrCpy $3 "0" 1.818 +!ifdef MOZ_METRO 1.819 + ; Check to see if this install location is currently set as the 1.820 + ; default browser. 1.821 + AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" 1.822 + Pop $2 1.823 + ; Check for a last run type to see if metro was the last browser 1.824 + ; front end in use. 1.825 + ReadRegDWORD $3 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" 1.826 +!endif 1.827 + ${If} $2 == "1" 1.828 + ${AndIf} $3 == "1" ; 1 equals AHE_IMMERSIVE 1.829 + ; Launch into metro 1.830 + Exec "$\"$1\CommandExecuteHandler.exe$\" --launchmetro" 1.831 + ${Else} 1.832 + ; Launch into desktop 1.833 + Exec "$\"$0$\"" 1.834 + ${EndIf} 1.835 +FunctionEnd 1.836 + 1.837 +################################################################################ 1.838 +# Language 1.839 + 1.840 +!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' 1.841 +!verbose push 1.842 +!verbose 3 1.843 +!include "overrideLocale.nsh" 1.844 +!include "customLocale.nsh" 1.845 +!verbose pop 1.846 + 1.847 +; Set this after the locale files to override it if it is in the locale 1.848 +; using " " for BrandingText will hide the "Nullsoft Install System..." branding 1.849 +BrandingText " " 1.850 + 1.851 +################################################################################ 1.852 +# Page pre, show, and leave functions 1.853 + 1.854 +Function preWelcome 1.855 + StrCpy $PageName "Welcome" 1.856 + ${If} ${FileExists} "$EXEDIR\core\distribution\modern-wizard.bmp" 1.857 + Delete "$PLUGINSDIR\modern-wizard.bmp" 1.858 + CopyFiles /SILENT "$EXEDIR\core\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" 1.859 + ${EndIf} 1.860 +FunctionEnd 1.861 + 1.862 +Function preOptions 1.863 + StrCpy $PageName "Options" 1.864 + ${If} ${FileExists} "$EXEDIR\core\distribution\modern-header.bmp" 1.865 + ${AndIf} $hHeaderBitmap == "" 1.866 + Delete "$PLUGINSDIR\modern-header.bmp" 1.867 + CopyFiles /SILENT "$EXEDIR\core\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" 1.868 + ${ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" 1.869 + ${EndIf} 1.870 + !insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)" 1.871 + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini" 1.872 +FunctionEnd 1.873 + 1.874 +Function leaveOptions 1.875 + ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State" 1.876 + ${If} $0 != 0 1.877 + Abort 1.878 + ${EndIf} 1.879 + ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 2" "State" 1.880 + StrCmp $R0 "1" +1 +2 1.881 + StrCpy $InstallType ${INSTALLTYPE_BASIC} 1.882 + ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State" 1.883 + StrCmp $R0 "1" +1 +2 1.884 + StrCpy $InstallType ${INSTALLTYPE_CUSTOM} 1.885 + 1.886 + ${LeaveOptionsCommon} 1.887 + 1.888 + ${If} $InstallType == ${INSTALLTYPE_BASIC} 1.889 + Call CheckExistingInstall 1.890 + ${EndIf} 1.891 +FunctionEnd 1.892 + 1.893 +Function preDirectory 1.894 + StrCpy $PageName "Directory" 1.895 + ${PreDirectoryCommon} 1.896 +FunctionEnd 1.897 + 1.898 +Function leaveDirectory 1.899 + ${If} $InstallType == ${INSTALLTYPE_BASIC} 1.900 + Call CheckExistingInstall 1.901 + ${EndIf} 1.902 + ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)" 1.903 +FunctionEnd 1.904 + 1.905 +Function preShortcuts 1.906 + StrCpy $PageName "Shortcuts" 1.907 + ${CheckCustomCommon} 1.908 + !insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)" 1.909 + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini" 1.910 +FunctionEnd 1.911 + 1.912 +Function leaveShortcuts 1.913 + ${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State" 1.914 + ${If} $0 != 0 1.915 + Abort 1.916 + ${EndIf} 1.917 + ${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" 1.918 + 1.919 + ; If we have a Metro browser and are Win8, then we don't have a Field 3 1.920 +!ifdef MOZ_METRO 1.921 + ${Unless} ${AtLeastWin8} 1.922 +!endif 1.923 + ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" 1.924 +!ifdef MOZ_METRO 1.925 + ${EndIf} 1.926 +!endif 1.927 + 1.928 + ; Don't install the quick launch shortcut on Windows 7 1.929 + ${Unless} ${AtLeastWin7} 1.930 + ${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State" 1.931 + ${EndUnless} 1.932 + 1.933 + ${If} $InstallType == ${INSTALLTYPE_CUSTOM} 1.934 + Call CheckExistingInstall 1.935 + ${EndIf} 1.936 +FunctionEnd 1.937 + 1.938 +!ifdef MOZ_MAINTENANCE_SERVICE 1.939 +Function preComponents 1.940 + ; If the service already exists, don't show this page 1.941 + ServicesHelper::IsInstalled "MozillaMaintenance" 1.942 + Pop $R9 1.943 + ${If} $R9 == 1 1.944 + ; The service already exists so don't show this page. 1.945 + Abort 1.946 + ${EndIf} 1.947 + 1.948 + ; On Windows 2000 we do not install the maintenance service. 1.949 + ${Unless} ${AtLeastWinXP} 1.950 + Abort 1.951 + ${EndUnless} 1.952 + 1.953 + ; Don't show the custom components page if the 1.954 + ; user is not an admin 1.955 + Call IsUserAdmin 1.956 + Pop $R9 1.957 + ${If} $R9 != "true" 1.958 + Abort 1.959 + ${EndIf} 1.960 + 1.961 + ; Only show the maintenance service page if we have write access to HKLM 1.962 + ClearErrors 1.963 + WriteRegStr HKLM "Software\Mozilla" \ 1.964 + "${BrandShortName}InstallerTest" "Write Test" 1.965 + ${If} ${Errors} 1.966 + ClearErrors 1.967 + Abort 1.968 + ${Else} 1.969 + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" 1.970 + ${EndIf} 1.971 + 1.972 + StrCpy $PageName "Components" 1.973 + ${CheckCustomCommon} 1.974 + !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)" 1.975 + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini" 1.976 +FunctionEnd 1.977 + 1.978 +Function leaveComponents 1.979 + ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State" 1.980 + ${If} $0 != 0 1.981 + Abort 1.982 + ${EndIf} 1.983 + ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State" 1.984 + ${If} $InstallType == ${INSTALLTYPE_CUSTOM} 1.985 + Call CheckExistingInstall 1.986 + ${EndIf} 1.987 +FunctionEnd 1.988 +!endif 1.989 + 1.990 +Function preSummary 1.991 + StrCpy $PageName "Summary" 1.992 + ; Setup the summary.ini file for the Custom Summary Page 1.993 + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "3" 1.994 + 1.995 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Type "label" 1.996 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Text "$(SUMMARY_INSTALLED_TO)" 1.997 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Left "0" 1.998 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Right "-1" 1.999 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Top "5" 1.1000 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Bottom "15" 1.1001 + 1.1002 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Type "text" 1.1003 + ; The contents of this control must be set as follows in the pre function 1.1004 + ; ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" 1.1005 + ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" 1.1006 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" state "" 1.1007 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Left "0" 1.1008 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Right "-1" 1.1009 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Top "17" 1.1010 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Bottom "30" 1.1011 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags "READONLY" 1.1012 + 1.1013 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type "label" 1.1014 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left "0" 1.1015 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right "-1" 1.1016 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top "130" 1.1017 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150" 1.1018 + 1.1019 + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" 1.1020 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_UPGRADE_CLICK)" 1.1021 + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText "$(UPGRADE_BUTTON)" 1.1022 + ${Else} 1.1023 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_INSTALL_CLICK)" 1.1024 + DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText 1.1025 + ${EndIf} 1.1026 + 1.1027 + 1.1028 + ; Remove the "Field 4" ini section in case the user hits back and changes the 1.1029 + ; installation directory which could change whether the make default checkbox 1.1030 + ; should be displayed. 1.1031 + DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4" 1.1032 + 1.1033 + ; Check if it is possible to write to HKLM 1.1034 + ClearErrors 1.1035 + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" 1.1036 + ${Unless} ${Errors} 1.1037 + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" 1.1038 + ; Check if Firefox is the http handler for this user. 1.1039 + SetShellVarContext current ; Set SHCTX to the current user 1.1040 + ${IsHandlerForInstallDir} "http" $R9 1.1041 + ${If} $TmpVal == "HKLM" 1.1042 + SetShellVarContext all ; Set SHCTX to all users 1.1043 + ${EndIf} 1.1044 + ; If Firefox isn't the http handler for this user show the option to set 1.1045 + ; Firefox as the default browser. 1.1046 + ${If} "$R9" != "true" 1.1047 + ${AndIf} ${AtMostWin2008R2} 1.1048 + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4" 1.1049 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "checkbox" 1.1050 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_TAKE_DEFAULTS)" 1.1051 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0" 1.1052 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1" 1.1053 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State "1" 1.1054 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "32" 1.1055 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53" 1.1056 + ${EndIf} 1.1057 + ${EndUnless} 1.1058 + 1.1059 + ${If} "$TmpVal" == "true" 1.1060 + ; If there is already a Type entry in the "Field 4" section with a value of 1.1061 + ; checkbox then the set as the default browser checkbox is displayed and 1.1062 + ; this text must be moved below it. 1.1063 + ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type" 1.1064 + ${If} "$0" == "checkbox" 1.1065 + StrCpy $0 "5" 1.1066 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "53" 1.1067 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68" 1.1068 + ${Else} 1.1069 + StrCpy $0 "4" 1.1070 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35" 1.1071 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50" 1.1072 + ${EndIf} 1.1073 + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0" 1.1074 + 1.1075 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label" 1.1076 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)" 1.1077 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0" 1.1078 + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1" 1.1079 + ${EndIf} 1.1080 + 1.1081 + !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)" 1.1082 + 1.1083 + ; The Summary custom page has a textbox that will automatically receive 1.1084 + ; focus. This sets the focus to the Install button instead. 1.1085 + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini" 1.1086 + GetDlgItem $0 $HWNDPARENT 1 1.1087 + System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" 1.1088 + ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" 1.1089 + SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" 1.1090 + !insertmacro MUI_INSTALLOPTIONS_SHOW 1.1091 +FunctionEnd 1.1092 + 1.1093 +Function leaveSummary 1.1094 + ; Try to delete the app executable and if we can't delete it try to find the 1.1095 + ; app's message window and prompt the user to close the app. This allows 1.1096 + ; running an instance that is located in another directory. If for whatever 1.1097 + ; reason there is no message window we will just rename the app's files and 1.1098 + ; then remove them on restart. 1.1099 + ClearErrors 1.1100 + ${DeleteFile} "$INSTDIR\${FileMainEXE}" 1.1101 + ${If} ${Errors} 1.1102 + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" 1.1103 + ${EndIf} 1.1104 +FunctionEnd 1.1105 + 1.1106 +; When we add an optional action to the finish page the cancel button is 1.1107 +; enabled. This disables it and leaves the finish button as the only choice. 1.1108 +Function preFinish 1.1109 + StrCpy $PageName "" 1.1110 + ${EndInstallLog} "${BrandFullName}" 1.1111 + !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" 1.1112 +FunctionEnd 1.1113 + 1.1114 +################################################################################ 1.1115 +# Initialization Functions 1.1116 + 1.1117 +Function .onInit 1.1118 + ; Remove the current exe directory from the search order. 1.1119 + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. 1.1120 + System::Call 'kernel32::SetDllDirectoryW(w "")' 1.1121 + 1.1122 + StrCpy $PageName "" 1.1123 + StrCpy $LANGUAGE 0 1.1124 + ${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini" 1.1125 + 1.1126 + ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)" 1.1127 + 1.1128 +; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be 1.1129 +; removed after we require NSIS 3.0a2 or greater. 1.1130 +!ifndef NSIS_PACKEDVERSION 1.1131 + ${If} ${AtLeastWinVista} 1.1132 + System::Call 'user32::SetProcessDPIAware()' 1.1133 + ${EndIf} 1.1134 +!endif 1.1135 + 1.1136 + !insertmacro InitInstallOptionsFile "options.ini" 1.1137 + !insertmacro InitInstallOptionsFile "shortcuts.ini" 1.1138 + !insertmacro InitInstallOptionsFile "components.ini" 1.1139 + !insertmacro InitInstallOptionsFile "summary.ini" 1.1140 + 1.1141 + WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5" 1.1142 + 1.1143 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label" 1.1144 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)" 1.1145 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0" 1.1146 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1" 1.1147 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0" 1.1148 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10" 1.1149 + 1.1150 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton" 1.1151 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)" 1.1152 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "0" 1.1153 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1" 1.1154 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25" 1.1155 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35" 1.1156 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1" 1.1157 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP" 1.1158 + 1.1159 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton" 1.1160 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)" 1.1161 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "0" 1.1162 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1" 1.1163 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55" 1.1164 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65" 1.1165 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0" 1.1166 + 1.1167 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label" 1.1168 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)" 1.1169 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15" 1.1170 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1" 1.1171 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37" 1.1172 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57" 1.1173 + 1.1174 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label" 1.1175 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)" 1.1176 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "15" 1.1177 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1" 1.1178 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67" 1.1179 + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87" 1.1180 + 1.1181 + ; Setup the shortcuts.ini file for the Custom Shortcuts Page 1.1182 + ; Don't offer to install the quick launch shortcut on Windows 7 1.1183 + ${If} ${AtLeastWin7} 1.1184 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "3" 1.1185 + ${Else} 1.1186 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "4" 1.1187 + ${EndIf} 1.1188 + 1.1189 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Type "label" 1.1190 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Text "$(CREATE_ICONS_DESC)" 1.1191 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Left "0" 1.1192 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Right "-1" 1.1193 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Top "5" 1.1194 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Bottom "15" 1.1195 + 1.1196 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Type "checkbox" 1.1197 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Text "$(ICONS_DESKTOP)" 1.1198 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Left "0" 1.1199 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Right "-1" 1.1200 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Top "20" 1.1201 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Bottom "30" 1.1202 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" State "1" 1.1203 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Flags "GROUP" 1.1204 + 1.1205 + ; Don't offer to install the start menu shortcut on Windows 8 1.1206 + ; for Metro builds. 1.1207 +!ifdef MOZ_METRO 1.1208 + ${Unless} ${AtLeastWin8} 1.1209 +!endif 1.1210 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Type "checkbox" 1.1211 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Text "$(ICONS_STARTMENU)" 1.1212 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Left "0" 1.1213 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Right "-1" 1.1214 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Top "40" 1.1215 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50" 1.1216 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1" 1.1217 +!ifdef MOZ_METRO 1.1218 + ${EndIf} 1.1219 +!endif 1.1220 + 1.1221 + ; Don't offer to install the quick launch shortcut on Windows 7 1.1222 + ${Unless} ${AtLeastWin7} 1.1223 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox" 1.1224 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)" 1.1225 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0" 1.1226 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1" 1.1227 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60" 1.1228 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70" 1.1229 + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1" 1.1230 + ${EndUnless} 1.1231 + 1.1232 + ; Setup the components.ini file for the Components Page 1.1233 + WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2" 1.1234 + 1.1235 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label" 1.1236 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)" 1.1237 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0" 1.1238 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1" 1.1239 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5" 1.1240 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25" 1.1241 + 1.1242 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox" 1.1243 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)" 1.1244 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0" 1.1245 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1" 1.1246 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27" 1.1247 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37" 1.1248 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1" 1.1249 + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP" 1.1250 + 1.1251 + ; There must always be a core directory. 1.1252 + ${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8 1.1253 + SectionSetSize ${APP_IDX} $R5 1.1254 + 1.1255 + ; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if 1.1256 + ; the user clicks the back button 1.1257 + StrCpy $hHeaderBitmap "" 1.1258 +FunctionEnd 1.1259 + 1.1260 +Function .onGUIEnd 1.1261 + ${OnEndCommon} 1.1262 +FunctionEnd