Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | # Required Plugins: |
michael@0 | 6 | # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in |
michael@0 | 7 | # ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in |
michael@0 | 8 | # CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash |
michael@0 | 9 | # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in |
michael@0 | 10 | # UAC http://nsis.sourceforge.net/UAC_plug-in |
michael@0 | 11 | # ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis |
michael@0 | 12 | |
michael@0 | 13 | ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs |
michael@0 | 14 | !verbose 3 |
michael@0 | 15 | |
michael@0 | 16 | ; 7-Zip provides better compression than the lzma from NSIS so we add the files |
michael@0 | 17 | ; uncompressed and use 7-Zip to create a SFX archive of it |
michael@0 | 18 | SetDatablockOptimize on |
michael@0 | 19 | SetCompress off |
michael@0 | 20 | CRCCheck on |
michael@0 | 21 | |
michael@0 | 22 | RequestExecutionLevel user |
michael@0 | 23 | |
michael@0 | 24 | ; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can |
michael@0 | 25 | ; be removed after we require NSIS 3.0a2 or greater. |
michael@0 | 26 | !ifdef NSIS_PACKEDVERSION |
michael@0 | 27 | Unicode true |
michael@0 | 28 | ManifestSupportedOS all |
michael@0 | 29 | ManifestDPIAware true |
michael@0 | 30 | !endif |
michael@0 | 31 | |
michael@0 | 32 | !addplugindir ./ |
michael@0 | 33 | |
michael@0 | 34 | Var TmpVal |
michael@0 | 35 | Var InstallType |
michael@0 | 36 | Var AddStartMenuSC |
michael@0 | 37 | Var AddQuickLaunchSC |
michael@0 | 38 | Var AddDesktopSC |
michael@0 | 39 | Var InstallMaintenanceService |
michael@0 | 40 | Var PageName |
michael@0 | 41 | Var PreventRebootRequired |
michael@0 | 42 | |
michael@0 | 43 | ; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for |
michael@0 | 44 | ; an application's Start Menu PROGRAMS directory and doesn't define the |
michael@0 | 45 | ; StartMenuDir variable can use the common InstallOnInitCommon macro. |
michael@0 | 46 | !define NO_STARTMENU_DIR |
michael@0 | 47 | |
michael@0 | 48 | ; On Vista and above attempt to elevate Standard Users in addition to users that |
michael@0 | 49 | ; are a member of the Administrators group. |
michael@0 | 50 | !define NONADMIN_ELEVATE |
michael@0 | 51 | |
michael@0 | 52 | !define AbortSurveyURL "http://www.kampyle.com/feedback_form/ff-feedback-form.php?site_code=8166124&form_id=12116&url=" |
michael@0 | 53 | |
michael@0 | 54 | ; Other included files may depend upon these includes! |
michael@0 | 55 | ; The following includes are provided by NSIS. |
michael@0 | 56 | !include FileFunc.nsh |
michael@0 | 57 | !include LogicLib.nsh |
michael@0 | 58 | !include MUI.nsh |
michael@0 | 59 | !include WinMessages.nsh |
michael@0 | 60 | !include WinVer.nsh |
michael@0 | 61 | !include WordFunc.nsh |
michael@0 | 62 | |
michael@0 | 63 | !insertmacro GetOptions |
michael@0 | 64 | !insertmacro GetParameters |
michael@0 | 65 | !insertmacro GetSize |
michael@0 | 66 | !insertmacro StrFilter |
michael@0 | 67 | !insertmacro WordFind |
michael@0 | 68 | !insertmacro WordReplace |
michael@0 | 69 | |
michael@0 | 70 | ; The following includes are custom. |
michael@0 | 71 | !include branding.nsi |
michael@0 | 72 | !include defines.nsi |
michael@0 | 73 | !include common.nsh |
michael@0 | 74 | !include locales.nsi |
michael@0 | 75 | |
michael@0 | 76 | VIAddVersionKey "FileDescription" "${BrandShortName} Installer" |
michael@0 | 77 | VIAddVersionKey "OriginalFilename" "setup.exe" |
michael@0 | 78 | |
michael@0 | 79 | ; Must be inserted before other macros that use logging |
michael@0 | 80 | !insertmacro _LoggingCommon |
michael@0 | 81 | |
michael@0 | 82 | !insertmacro AddDisabledDDEHandlerValues |
michael@0 | 83 | !insertmacro ChangeMUIHeaderImage |
michael@0 | 84 | !insertmacro CheckForFilesInUse |
michael@0 | 85 | !insertmacro CleanUpdateDirectories |
michael@0 | 86 | !insertmacro CopyFilesFromDir |
michael@0 | 87 | !insertmacro CreateRegKey |
michael@0 | 88 | !insertmacro GetLongPath |
michael@0 | 89 | !insertmacro GetPathFromString |
michael@0 | 90 | !insertmacro GetParent |
michael@0 | 91 | !insertmacro InitHashAppModelId |
michael@0 | 92 | !insertmacro IsHandlerForInstallDir |
michael@0 | 93 | !insertmacro IsPinnedToTaskBar |
michael@0 | 94 | !insertmacro IsUserAdmin |
michael@0 | 95 | !insertmacro LogDesktopShortcut |
michael@0 | 96 | !insertmacro LogQuickLaunchShortcut |
michael@0 | 97 | !insertmacro LogStartMenuShortcut |
michael@0 | 98 | !insertmacro ManualCloseAppPrompt |
michael@0 | 99 | !insertmacro OnStubInstallUninstall |
michael@0 | 100 | !insertmacro PinnedToStartMenuLnkCount |
michael@0 | 101 | !insertmacro RegCleanAppHandler |
michael@0 | 102 | !insertmacro RegCleanMain |
michael@0 | 103 | !insertmacro RegCleanUninstall |
michael@0 | 104 | !ifdef MOZ_METRO |
michael@0 | 105 | !insertmacro RemoveDEHRegistrationIfMatching |
michael@0 | 106 | !endif |
michael@0 | 107 | !insertmacro SetAppLSPCategories |
michael@0 | 108 | !insertmacro SetBrandNameVars |
michael@0 | 109 | !insertmacro UpdateShortcutAppModelIDs |
michael@0 | 110 | !insertmacro UnloadUAC |
michael@0 | 111 | !insertmacro WriteRegStr2 |
michael@0 | 112 | !insertmacro WriteRegDWORD2 |
michael@0 | 113 | !insertmacro CheckIfRegistryKeyExists |
michael@0 | 114 | |
michael@0 | 115 | !include shared.nsh |
michael@0 | 116 | |
michael@0 | 117 | ; Helper macros for ui callbacks. Insert these after shared.nsh |
michael@0 | 118 | !insertmacro CheckCustomCommon |
michael@0 | 119 | !insertmacro InstallEndCleanupCommon |
michael@0 | 120 | !insertmacro InstallOnInitCommon |
michael@0 | 121 | !insertmacro InstallStartCleanupCommon |
michael@0 | 122 | !insertmacro LeaveDirectoryCommon |
michael@0 | 123 | !insertmacro LeaveOptionsCommon |
michael@0 | 124 | !insertmacro OnEndCommon |
michael@0 | 125 | !insertmacro PreDirectoryCommon |
michael@0 | 126 | |
michael@0 | 127 | Name "${BrandFullName}" |
michael@0 | 128 | OutFile "setup.exe" |
michael@0 | 129 | !ifdef HAVE_64BIT_OS |
michael@0 | 130 | InstallDir "$PROGRAMFILES64\${BrandFullName}\" |
michael@0 | 131 | !else |
michael@0 | 132 | InstallDir "$PROGRAMFILES32\${BrandFullName}\" |
michael@0 | 133 | !endif |
michael@0 | 134 | ShowInstDetails nevershow |
michael@0 | 135 | |
michael@0 | 136 | ################################################################################ |
michael@0 | 137 | # Modern User Interface - MUI |
michael@0 | 138 | |
michael@0 | 139 | !define MOZ_MUI_CUSTOM_ABORT |
michael@0 | 140 | !define MUI_CUSTOMFUNCTION_ABORT "CustomAbort" |
michael@0 | 141 | !define MUI_ICON setup.ico |
michael@0 | 142 | !define MUI_UNICON setup.ico |
michael@0 | 143 | !define MUI_WELCOMEPAGE_TITLE_3LINES |
michael@0 | 144 | !define MUI_HEADERIMAGE |
michael@0 | 145 | !define MUI_HEADERIMAGE_RIGHT |
michael@0 | 146 | !define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp |
michael@0 | 147 | |
michael@0 | 148 | ; Use a right to left header image when the language is right to left |
michael@0 | 149 | !ifdef ${AB_CD}_rtl |
michael@0 | 150 | !define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp |
michael@0 | 151 | !else |
michael@0 | 152 | !define MUI_HEADERIMAGE_BITMAP wizHeader.bmp |
michael@0 | 153 | !endif |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * Installation Pages |
michael@0 | 157 | */ |
michael@0 | 158 | ; Welcome Page |
michael@0 | 159 | !define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcome |
michael@0 | 160 | !insertmacro MUI_PAGE_WELCOME |
michael@0 | 161 | |
michael@0 | 162 | ; Custom Options Page |
michael@0 | 163 | Page custom preOptions leaveOptions |
michael@0 | 164 | |
michael@0 | 165 | ; Select Install Directory Page |
michael@0 | 166 | !define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory |
michael@0 | 167 | !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory |
michael@0 | 168 | !define MUI_DIRECTORYPAGE_VERIFYONLEAVE |
michael@0 | 169 | !insertmacro MUI_PAGE_DIRECTORY |
michael@0 | 170 | |
michael@0 | 171 | ; Custom Components Page |
michael@0 | 172 | !ifdef MOZ_MAINTENANCE_SERVICE |
michael@0 | 173 | Page custom preComponents leaveComponents |
michael@0 | 174 | !endif |
michael@0 | 175 | |
michael@0 | 176 | ; Custom Shortcuts Page |
michael@0 | 177 | Page custom preShortcuts leaveShortcuts |
michael@0 | 178 | |
michael@0 | 179 | ; Custom Summary Page |
michael@0 | 180 | Page custom preSummary leaveSummary |
michael@0 | 181 | |
michael@0 | 182 | ; Install Files Page |
michael@0 | 183 | !insertmacro MUI_PAGE_INSTFILES |
michael@0 | 184 | |
michael@0 | 185 | ; Finish Page |
michael@0 | 186 | !define MUI_FINISHPAGE_TITLE_3LINES |
michael@0 | 187 | !define MUI_FINISHPAGE_RUN |
michael@0 | 188 | !define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp |
michael@0 | 189 | !define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT) |
michael@0 | 190 | !define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish |
michael@0 | 191 | !insertmacro MUI_PAGE_FINISH |
michael@0 | 192 | |
michael@0 | 193 | ; Use the default dialog for IDD_VERIFY for a simple Banner |
michael@0 | 194 | ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" |
michael@0 | 195 | |
michael@0 | 196 | ################################################################################ |
michael@0 | 197 | # Install Sections |
michael@0 | 198 | |
michael@0 | 199 | ; Cleanup operations to perform at the start of the installation. |
michael@0 | 200 | Section "-InstallStartCleanup" |
michael@0 | 201 | SetDetailsPrint both |
michael@0 | 202 | DetailPrint $(STATUS_CLEANUP) |
michael@0 | 203 | SetDetailsPrint none |
michael@0 | 204 | |
michael@0 | 205 | SetOutPath "$INSTDIR" |
michael@0 | 206 | ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}" |
michael@0 | 207 | |
michael@0 | 208 | StrCpy $PreventRebootRequired "false" |
michael@0 | 209 | ${GetParameters} $R8 |
michael@0 | 210 | ${GetOptions} "$R8" "/INI=" $R7 |
michael@0 | 211 | ${Unless} ${Errors} |
michael@0 | 212 | ; The configuration file must also exist |
michael@0 | 213 | ${If} ${FileExists} "$R7" |
michael@0 | 214 | ReadINIStr $R8 $R7 "Install" "PreventRebootRequired" |
michael@0 | 215 | ${If} $R8 == "true" |
michael@0 | 216 | StrCpy $PreventRebootRequired "true" |
michael@0 | 217 | StrCpy $R2 "false" |
michael@0 | 218 | StrCpy $R3 "false" |
michael@0 | 219 | ${OnStubInstallUninstall} "$R2" "$R3" |
michael@0 | 220 | ${EndIf} |
michael@0 | 221 | ${EndIf} |
michael@0 | 222 | ${EndUnless} |
michael@0 | 223 | |
michael@0 | 224 | ; Delete the app exe if present to prevent launching the app while we are |
michael@0 | 225 | ; installing. |
michael@0 | 226 | ClearErrors |
michael@0 | 227 | ${DeleteFile} "$INSTDIR\${FileMainEXE}" |
michael@0 | 228 | ${If} ${Errors} |
michael@0 | 229 | ; If the user closed the application it can take several seconds for it to |
michael@0 | 230 | ; shut down completely. If the application is being used by another user we |
michael@0 | 231 | ; can rename the file and then delete is when the system is restarted. |
michael@0 | 232 | Sleep 5000 |
michael@0 | 233 | ${DeleteFile} "$INSTDIR\${FileMainEXE}" |
michael@0 | 234 | ClearErrors |
michael@0 | 235 | ${EndIf} |
michael@0 | 236 | |
michael@0 | 237 | ; setup the application model id registration value |
michael@0 | 238 | ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" |
michael@0 | 239 | |
michael@0 | 240 | ; Remove the updates directory for Vista and above |
michael@0 | 241 | ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates" |
michael@0 | 242 | |
michael@0 | 243 | ${RemoveDeprecatedFiles} |
michael@0 | 244 | |
michael@0 | 245 | ${InstallStartCleanupCommon} |
michael@0 | 246 | SectionEnd |
michael@0 | 247 | |
michael@0 | 248 | Section "-Application" APP_IDX |
michael@0 | 249 | ${StartUninstallLog} |
michael@0 | 250 | |
michael@0 | 251 | SetDetailsPrint both |
michael@0 | 252 | DetailPrint $(STATUS_INSTALL_APP) |
michael@0 | 253 | SetDetailsPrint none |
michael@0 | 254 | |
michael@0 | 255 | RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" |
michael@0 | 256 | |
michael@0 | 257 | ${LogHeader} "Installing Main Files" |
michael@0 | 258 | ${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \ |
michael@0 | 259 | "$(ERROR_CREATE_DIRECTORY_PREFIX)" \ |
michael@0 | 260 | "$(ERROR_CREATE_DIRECTORY_SUFFIX)" |
michael@0 | 261 | |
michael@0 | 262 | ; Register DLLs |
michael@0 | 263 | ; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but |
michael@0 | 264 | ; is only registered for the last application installed. When the last |
michael@0 | 265 | ; application installed is uninstalled AccessibleMarshal.dll will no longer be |
michael@0 | 266 | ; registered. bug 338878 |
michael@0 | 267 | ${LogHeader} "DLL Registration" |
michael@0 | 268 | ClearErrors |
michael@0 | 269 | ${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll" |
michael@0 | 270 | ${If} ${Errors} |
michael@0 | 271 | ${LogMsg} "** ERROR Registering: $INSTDIR\AccessibleMarshal.dll **" |
michael@0 | 272 | ${Else} |
michael@0 | 273 | ${LogUninstall} "DLLReg: \AccessibleMarshal.dll" |
michael@0 | 274 | ${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll" |
michael@0 | 275 | ${EndIf} |
michael@0 | 276 | |
michael@0 | 277 | ; Write extra files created by the application to the uninstall log so they |
michael@0 | 278 | ; will be removed when the application is uninstalled. To remove an empty |
michael@0 | 279 | ; directory write a bogus filename to the deepest directory and all empty |
michael@0 | 280 | ; parent directories will be removed. |
michael@0 | 281 | ${LogUninstall} "File: \components\compreg.dat" |
michael@0 | 282 | ${LogUninstall} "File: \components\xpti.dat" |
michael@0 | 283 | ${LogUninstall} "File: \active-update.xml" |
michael@0 | 284 | ${LogUninstall} "File: \install.log" |
michael@0 | 285 | ${LogUninstall} "File: \install_status.log" |
michael@0 | 286 | ${LogUninstall} "File: \install_wizard.log" |
michael@0 | 287 | ${LogUninstall} "File: \updates.xml" |
michael@0 | 288 | |
michael@0 | 289 | ClearErrors |
michael@0 | 290 | |
michael@0 | 291 | ; Default for creating Start Menu shortcut |
michael@0 | 292 | ; (1 = create, 0 = don't create) |
michael@0 | 293 | ${If} $AddStartMenuSC == "" |
michael@0 | 294 | StrCpy $AddStartMenuSC "1" |
michael@0 | 295 | ${EndIf} |
michael@0 | 296 | |
michael@0 | 297 | ; Default for creating Quick Launch shortcut (1 = create, 0 = don't create) |
michael@0 | 298 | ${If} $AddQuickLaunchSC == "" |
michael@0 | 299 | ; Don't install the quick launch shortcut on Windows 7 |
michael@0 | 300 | ${If} ${AtLeastWin7} |
michael@0 | 301 | StrCpy $AddQuickLaunchSC "0" |
michael@0 | 302 | ${Else} |
michael@0 | 303 | StrCpy $AddQuickLaunchSC "1" |
michael@0 | 304 | ${EndIf} |
michael@0 | 305 | ${EndIf} |
michael@0 | 306 | |
michael@0 | 307 | ; Default for creating Desktop shortcut (1 = create, 0 = don't create) |
michael@0 | 308 | ${If} $AddDesktopSC == "" |
michael@0 | 309 | StrCpy $AddDesktopSC "1" |
michael@0 | 310 | ${EndIf} |
michael@0 | 311 | |
michael@0 | 312 | ${LogHeader} "Adding Registry Entries" |
michael@0 | 313 | SetShellVarContext current ; Set SHCTX to HKCU |
michael@0 | 314 | ${RegCleanMain} "Software\Mozilla" |
michael@0 | 315 | ${RegCleanUninstall} |
michael@0 | 316 | !ifdef MOZ_METRO |
michael@0 | 317 | ${ResetWin8PromptKeys} "HKCU" "" |
michael@0 | 318 | !endif |
michael@0 | 319 | ${UpdateProtocolHandlers} |
michael@0 | 320 | |
michael@0 | 321 | ClearErrors |
michael@0 | 322 | WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" |
michael@0 | 323 | ${If} ${Errors} |
michael@0 | 324 | StrCpy $TmpVal "HKCU" ; used primarily for logging |
michael@0 | 325 | ${Else} |
michael@0 | 326 | SetShellVarContext all ; Set SHCTX to HKLM |
michael@0 | 327 | DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" |
michael@0 | 328 | StrCpy $TmpVal "HKLM" ; used primarily for logging |
michael@0 | 329 | ${RegCleanMain} "Software\Mozilla" |
michael@0 | 330 | ${RegCleanUninstall} |
michael@0 | 331 | ${UpdateProtocolHandlers} |
michael@0 | 332 | |
michael@0 | 333 | ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" |
michael@0 | 334 | ${If} "$0" != "${GREVersion}" |
michael@0 | 335 | WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" |
michael@0 | 336 | ${EndIf} |
michael@0 | 337 | ${EndIf} |
michael@0 | 338 | |
michael@0 | 339 | ${RemoveDeprecatedKeys} |
michael@0 | 340 | |
michael@0 | 341 | ; The previous installer adds several regsitry values to both HKLM and HKCU. |
michael@0 | 342 | ; We now try to add to HKLM and if that fails to HKCU |
michael@0 | 343 | |
michael@0 | 344 | ; The order that reg keys and values are added is important if you use the |
michael@0 | 345 | ; uninstall log to remove them on uninstall. When using the uninstall log you |
michael@0 | 346 | ; MUST add children first so they will be removed first on uninstall so they |
michael@0 | 347 | ; will be empty when the key is deleted. This allows the uninstaller to |
michael@0 | 348 | ; specify that only empty keys will be deleted. |
michael@0 | 349 | ${SetAppKeys} |
michael@0 | 350 | |
michael@0 | 351 | ${FixClassKeys} |
michael@0 | 352 | |
michael@0 | 353 | ; Uninstall keys can only exist under HKLM on some versions of windows. Since |
michael@0 | 354 | ; it doesn't cause problems always add them. |
michael@0 | 355 | ${SetUninstallKeys} |
michael@0 | 356 | |
michael@0 | 357 | ; On install always add the FirefoxHTML and FirefoxURL keys. |
michael@0 | 358 | ; An empty string is used for the 5th param because FirefoxHTML is not a |
michael@0 | 359 | ; protocol handler. |
michael@0 | 360 | ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 |
michael@0 | 361 | StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" |
michael@0 | 362 | |
michael@0 | 363 | ; In Win8, the delegate execute handler picks up the value in FirefoxURL and |
michael@0 | 364 | ; FirefoxHTML to launch the desktop browser when it needs to. |
michael@0 | 365 | ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ |
michael@0 | 366 | "${AppRegName} Document" "" |
michael@0 | 367 | ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ |
michael@0 | 368 | "true" |
michael@0 | 369 | |
michael@0 | 370 | ; For pre win8, the following keys should only be set if we can write to HKLM. |
michael@0 | 371 | ; For post win8, the keys below get set in both HKLM and HKCU. |
michael@0 | 372 | ${If} $TmpVal == "HKLM" |
michael@0 | 373 | ; Set the Start Menu Internet and Vista Registered App HKLM registry keys. |
michael@0 | 374 | ${SetStartMenuInternet} "HKLM" |
michael@0 | 375 | ${FixShellIconHandler} "HKLM" |
michael@0 | 376 | |
michael@0 | 377 | ; If we are writing to HKLM and create either the desktop or start menu |
michael@0 | 378 | ; shortcuts set IconsVisible to 1 otherwise to 0. |
michael@0 | 379 | ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
michael@0 | 380 | StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" |
michael@0 | 381 | ${If} $AddDesktopSC == 1 |
michael@0 | 382 | ${OrIf} $AddStartMenuSC == 1 |
michael@0 | 383 | WriteRegDWORD HKLM "$0" "IconsVisible" 1 |
michael@0 | 384 | ${Else} |
michael@0 | 385 | WriteRegDWORD HKLM "$0" "IconsVisible" 0 |
michael@0 | 386 | ${EndIf} |
michael@0 | 387 | ${EndIf} |
michael@0 | 388 | |
michael@0 | 389 | ${If} ${AtLeastWin8} |
michael@0 | 390 | ; Set the Start Menu Internet and Vista Registered App HKCU registry keys. |
michael@0 | 391 | ${SetStartMenuInternet} "HKCU" |
michael@0 | 392 | ${FixShellIconHandler} "HKCU" |
michael@0 | 393 | |
michael@0 | 394 | ; If we create either the desktop or start menu shortcuts, then |
michael@0 | 395 | ; set IconsVisible to 1 otherwise to 0. |
michael@0 | 396 | ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
michael@0 | 397 | StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" |
michael@0 | 398 | ${If} $AddDesktopSC == 1 |
michael@0 | 399 | ${OrIf} $AddStartMenuSC == 1 |
michael@0 | 400 | WriteRegDWORD HKCU "$0" "IconsVisible" 1 |
michael@0 | 401 | ${Else} |
michael@0 | 402 | WriteRegDWORD HKCU "$0" "IconsVisible" 0 |
michael@0 | 403 | ${EndIf} |
michael@0 | 404 | !ifdef MOZ_METRO |
michael@0 | 405 | ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
michael@0 | 406 | "FirefoxURL" \ |
michael@0 | 407 | "FirefoxHTML" |
michael@0 | 408 | ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
michael@0 | 409 | "$INSTDIR\CommandExecuteHandler.exe" \ |
michael@0 | 410 | $AppUserModelID \ |
michael@0 | 411 | "FirefoxURL" \ |
michael@0 | 412 | "FirefoxHTML" |
michael@0 | 413 | !else |
michael@0 | 414 | ; The metro browser is not enabled by the mozconfig. |
michael@0 | 415 | ${If} ${AtLeastWin8} |
michael@0 | 416 | ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
michael@0 | 417 | $AppUserModelID \ |
michael@0 | 418 | "FirefoxURL" \ |
michael@0 | 419 | "FirefoxHTML" |
michael@0 | 420 | ${EndIf} |
michael@0 | 421 | !endif |
michael@0 | 422 | ${EndIf} |
michael@0 | 423 | |
michael@0 | 424 | !ifdef MOZ_MAINTENANCE_SERVICE |
michael@0 | 425 | ; If the maintenance service page was displayed then a value was already |
michael@0 | 426 | ; explicitly selected for installing the maintenance service and |
michael@0 | 427 | ; and so InstallMaintenanceService will already be 0 or 1. |
michael@0 | 428 | ; If the maintenance service page was not displayed then |
michael@0 | 429 | ; InstallMaintenanceService will be equal to "". |
michael@0 | 430 | ${If} $InstallMaintenanceService == "" |
michael@0 | 431 | Call IsUserAdmin |
michael@0 | 432 | Pop $R0 |
michael@0 | 433 | ${If} $R0 == "true" |
michael@0 | 434 | ; Only proceed if we have HKLM write access |
michael@0 | 435 | ${AndIf} $TmpVal == "HKLM" |
michael@0 | 436 | ; On Windows 2000 we do not install the maintenance service. |
michael@0 | 437 | ${AndIf} ${AtLeastWinXP} |
michael@0 | 438 | ; The user is an admin so we should default to install service yes |
michael@0 | 439 | StrCpy $InstallMaintenanceService "1" |
michael@0 | 440 | ${Else} |
michael@0 | 441 | ; The user is not admin so we should default to install service no |
michael@0 | 442 | StrCpy $InstallMaintenanceService "0" |
michael@0 | 443 | ${EndIf} |
michael@0 | 444 | ${EndIf} |
michael@0 | 445 | |
michael@0 | 446 | ${If} $InstallMaintenanceService == "1" |
michael@0 | 447 | ; The user wants to install the maintenance service, so execute |
michael@0 | 448 | ; the pre-packaged maintenance service installer. |
michael@0 | 449 | ; This option can only be turned on if the user is an admin so there |
michael@0 | 450 | ; is no need to use ExecShell w/ verb runas to enforce elevated. |
michael@0 | 451 | nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" |
michael@0 | 452 | ${EndIf} |
michael@0 | 453 | !endif |
michael@0 | 454 | |
michael@0 | 455 | ; These need special handling on uninstall since they may be overwritten by |
michael@0 | 456 | ; an install into a different location. |
michael@0 | 457 | StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" |
michael@0 | 458 | ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0 |
michael@0 | 459 | ${WriteRegStr2} $TmpVal "$0" "Path" "$INSTDIR" 0 |
michael@0 | 460 | |
michael@0 | 461 | StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9" |
michael@0 | 462 | ${CreateRegKey} "$TmpVal" "$0" 0 |
michael@0 | 463 | StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe" |
michael@0 | 464 | ${CreateRegKey} "$TmpVal" "$0" 0 |
michael@0 | 465 | |
michael@0 | 466 | ${If} $TmpVal == "HKLM" |
michael@0 | 467 | ; Set the permitted LSP Categories for WinVista and above |
michael@0 | 468 | ${SetAppLSPCategories} ${LSP_CATEGORIES} |
michael@0 | 469 | ${EndIf} |
michael@0 | 470 | |
michael@0 | 471 | ; Create shortcuts |
michael@0 | 472 | ${LogHeader} "Adding Shortcuts" |
michael@0 | 473 | |
michael@0 | 474 | ; Remove the start menu shortcuts and directory if the SMPROGRAMS section |
michael@0 | 475 | ; exists in the shortcuts_log.ini and the SMPROGRAMS. The installer's shortcut |
michael@0 | 476 | ; creation code will create the shortcut in the root of the Start Menu |
michael@0 | 477 | ; Programs directory. |
michael@0 | 478 | ${RemoveStartMenuDir} |
michael@0 | 479 | |
michael@0 | 480 | ; Always add the application's shortcuts to the shortcuts log ini file. The |
michael@0 | 481 | ; DeleteShortcuts macro will do the right thing on uninstall if the |
michael@0 | 482 | ; shortcuts don't exist. |
michael@0 | 483 | ${LogStartMenuShortcut} "${BrandFullName}.lnk" |
michael@0 | 484 | ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" |
michael@0 | 485 | ${LogDesktopShortcut} "${BrandFullName}.lnk" |
michael@0 | 486 | |
michael@0 | 487 | ; Best effort to update the Win7 taskbar and start menu shortcut app model |
michael@0 | 488 | ; id's. The possible contexts are current user / system and the user that |
michael@0 | 489 | ; elevated the installer. |
michael@0 | 490 | Call FixShortcutAppModelIDs |
michael@0 | 491 | ; If the current context is all also perform Win7 taskbar and start menu link |
michael@0 | 492 | ; maintenance for the current user context. |
michael@0 | 493 | ${If} $TmpVal == "HKLM" |
michael@0 | 494 | SetShellVarContext current ; Set SHCTX to HKCU |
michael@0 | 495 | Call FixShortcutAppModelIDs |
michael@0 | 496 | SetShellVarContext all ; Set SHCTX to HKLM |
michael@0 | 497 | ${EndIf} |
michael@0 | 498 | |
michael@0 | 499 | ; If running elevated also perform Win7 taskbar and start menu link |
michael@0 | 500 | ; maintenance for the unelevated user context in case that is different than |
michael@0 | 501 | ; the current user. |
michael@0 | 502 | ClearErrors |
michael@0 | 503 | ${GetParameters} $0 |
michael@0 | 504 | ${GetOptions} "$0" "/UAC:" $0 |
michael@0 | 505 | ${Unless} ${Errors} |
michael@0 | 506 | GetFunctionAddress $0 FixShortcutAppModelIDs |
michael@0 | 507 | UAC::ExecCodeSegment $0 |
michael@0 | 508 | ${EndUnless} |
michael@0 | 509 | |
michael@0 | 510 | ; UAC only allows elevating to an Admin account so there is no need to add |
michael@0 | 511 | ; the Start Menu or Desktop shortcuts from the original unelevated process |
michael@0 | 512 | ; since this will either add it for the user if unelevated or All Users if |
michael@0 | 513 | ; elevated. |
michael@0 | 514 | ${If} $AddStartMenuSC == 1 |
michael@0 | 515 | CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
michael@0 | 516 | ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
michael@0 | 517 | ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ |
michael@0 | 518 | "$INSTDIR" |
michael@0 | 519 | ${If} ${AtLeastWin7} |
michael@0 | 520 | ${AndIf} "$AppUserModelID" != "" |
michael@0 | 521 | ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" |
michael@0 | 522 | ${EndIf} |
michael@0 | 523 | ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" |
michael@0 | 524 | ${Else} |
michael@0 | 525 | ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" |
michael@0 | 526 | ${EndIf} |
michael@0 | 527 | ${EndIf} |
michael@0 | 528 | |
michael@0 | 529 | ${If} $AddDesktopSC == 1 |
michael@0 | 530 | CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
michael@0 | 531 | ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
michael@0 | 532 | ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ |
michael@0 | 533 | "$INSTDIR" |
michael@0 | 534 | ${If} ${AtLeastWin7} |
michael@0 | 535 | ${AndIf} "$AppUserModelID" != "" |
michael@0 | 536 | ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" |
michael@0 | 537 | ${EndIf} |
michael@0 | 538 | ${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk" |
michael@0 | 539 | ${Else} |
michael@0 | 540 | ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandFullName}.lnk" |
michael@0 | 541 | ${EndIf} |
michael@0 | 542 | ${EndIf} |
michael@0 | 543 | |
michael@0 | 544 | ; If elevated the Quick Launch shortcut must be added from the unelevated |
michael@0 | 545 | ; original process. |
michael@0 | 546 | ${If} $AddQuickLaunchSC == 1 |
michael@0 | 547 | ${Unless} ${AtLeastWin7} |
michael@0 | 548 | ClearErrors |
michael@0 | 549 | ${GetParameters} $0 |
michael@0 | 550 | ${GetOptions} "$0" "/UAC:" $0 |
michael@0 | 551 | ${If} ${Errors} |
michael@0 | 552 | Call AddQuickLaunchShortcut |
michael@0 | 553 | ${LogMsg} "Added Shortcut: $QUICKLAUNCH\${BrandFullName}.lnk" |
michael@0 | 554 | ${Else} |
michael@0 | 555 | ; It is not possible to add a log entry from the unelevated process so |
michael@0 | 556 | ; add the log entry without the path since there is no simple way to |
michael@0 | 557 | ; know the correct full path. |
michael@0 | 558 | ${LogMsg} "Added Quick Launch Shortcut: ${BrandFullName}.lnk" |
michael@0 | 559 | GetFunctionAddress $0 AddQuickLaunchShortcut |
michael@0 | 560 | UAC::ExecCodeSegment $0 |
michael@0 | 561 | ${EndIf} |
michael@0 | 562 | ${EndUnless} |
michael@0 | 563 | ${EndIf} |
michael@0 | 564 | |
michael@0 | 565 | !ifdef MOZ_MAINTENANCE_SERVICE |
michael@0 | 566 | ${If} $TmpVal == "HKLM" |
michael@0 | 567 | ; Add the registry keys for allowed certificates. |
michael@0 | 568 | ${AddMaintCertKeys} |
michael@0 | 569 | ${EndIf} |
michael@0 | 570 | !endif |
michael@0 | 571 | SectionEnd |
michael@0 | 572 | |
michael@0 | 573 | ; Cleanup operations to perform at the end of the installation. |
michael@0 | 574 | Section "-InstallEndCleanup" |
michael@0 | 575 | SetDetailsPrint both |
michael@0 | 576 | DetailPrint "$(STATUS_CLEANUP)" |
michael@0 | 577 | SetDetailsPrint none |
michael@0 | 578 | |
michael@0 | 579 | ${Unless} ${Silent} |
michael@0 | 580 | ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State" |
michael@0 | 581 | ${If} "$0" == "1" |
michael@0 | 582 | ${LogHeader} "Setting as the default browser" |
michael@0 | 583 | ClearErrors |
michael@0 | 584 | ${GetParameters} $0 |
michael@0 | 585 | ${GetOptions} "$0" "/UAC:" $0 |
michael@0 | 586 | ${If} ${Errors} |
michael@0 | 587 | Call SetAsDefaultAppUserHKCU |
michael@0 | 588 | ${Else} |
michael@0 | 589 | GetFunctionAddress $0 SetAsDefaultAppUserHKCU |
michael@0 | 590 | UAC::ExecCodeSegment $0 |
michael@0 | 591 | ${EndIf} |
michael@0 | 592 | ${EndIf} |
michael@0 | 593 | ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). |
michael@0 | 594 | ${MigrateTaskBarShortcut} |
michael@0 | 595 | ${EndUnless} |
michael@0 | 596 | |
michael@0 | 597 | ${GetShortcutsLogPath} $0 |
michael@0 | 598 | WriteIniStr "$0" "TASKBAR" "Migrated" "true" |
michael@0 | 599 | |
michael@0 | 600 | ; Refresh desktop icons |
michael@0 | 601 | System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_DWORDFLUSH}, i 0, i 0)" |
michael@0 | 602 | |
michael@0 | 603 | ${InstallEndCleanupCommon} |
michael@0 | 604 | |
michael@0 | 605 | ${If} $PreventRebootRequired == "true" |
michael@0 | 606 | SetRebootFlag false |
michael@0 | 607 | ${EndIf} |
michael@0 | 608 | |
michael@0 | 609 | ${If} ${RebootFlag} |
michael@0 | 610 | ; When a reboot is required give SHChangeNotify time to finish the |
michael@0 | 611 | ; refreshing the icons so the OS doesn't display the icons from helper.exe |
michael@0 | 612 | Sleep 10000 |
michael@0 | 613 | ${LogHeader} "Reboot Required To Finish Installation" |
michael@0 | 614 | ; ${FileMainEXE}.moz-upgrade should never exist but just in case... |
michael@0 | 615 | ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" |
michael@0 | 616 | Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" |
michael@0 | 617 | ${EndUnless} |
michael@0 | 618 | |
michael@0 | 619 | ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" |
michael@0 | 620 | ClearErrors |
michael@0 | 621 | Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" |
michael@0 | 622 | ${Unless} ${Errors} |
michael@0 | 623 | Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" |
michael@0 | 624 | ${EndUnless} |
michael@0 | 625 | ${EndIf} |
michael@0 | 626 | |
michael@0 | 627 | ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" |
michael@0 | 628 | CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" |
michael@0 | 629 | FileOpen $0 "$INSTDIR\${FileMainEXE}" w |
michael@0 | 630 | FileWrite $0 "Will be deleted on restart" |
michael@0 | 631 | Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" |
michael@0 | 632 | FileClose $0 |
michael@0 | 633 | Delete "$INSTDIR\${FileMainEXE}" |
michael@0 | 634 | Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" |
michael@0 | 635 | ${EndUnless} |
michael@0 | 636 | ${EndIf} |
michael@0 | 637 | SectionEnd |
michael@0 | 638 | |
michael@0 | 639 | ################################################################################ |
michael@0 | 640 | # Install Abort Survey Functions |
michael@0 | 641 | |
michael@0 | 642 | Function CustomAbort |
michael@0 | 643 | ${If} "${AB_CD}" == "en-US" |
michael@0 | 644 | ${AndIf} "$PageName" != "" |
michael@0 | 645 | ${AndIf} ${FileExists} "$EXEDIR\core\distribution\distribution.ini" |
michael@0 | 646 | ReadINIStr $0 "$EXEDIR\core\distribution\distribution.ini" "Global" "about" |
michael@0 | 647 | ClearErrors |
michael@0 | 648 | ${WordFind} "$0" "Funnelcake" "E#" $1 |
michael@0 | 649 | ${Unless} ${Errors} |
michael@0 | 650 | ; Yes = fill out the survey and exit, No = don't fill out survey and exit, |
michael@0 | 651 | ; Cancel = don't exit. |
michael@0 | 652 | MessageBox MB_YESNO|MB_ICONEXCLAMATION \ |
michael@0 | 653 | "Would you like to tell us why you are canceling this installation?" \ |
michael@0 | 654 | IDYes +1 IDNO CustomAbort_finish |
michael@0 | 655 | ${If} "$PageName" == "Welcome" |
michael@0 | 656 | GetFunctionAddress $0 AbortSurveyWelcome |
michael@0 | 657 | ${ElseIf} "$PageName" == "Options" |
michael@0 | 658 | GetFunctionAddress $0 AbortSurveyOptions |
michael@0 | 659 | ${ElseIf} "$PageName" == "Directory" |
michael@0 | 660 | GetFunctionAddress $0 AbortSurveyDirectory |
michael@0 | 661 | ${ElseIf} "$PageName" == "Shortcuts" |
michael@0 | 662 | GetFunctionAddress $0 AbortSurveyShortcuts |
michael@0 | 663 | ${ElseIf} "$PageName" == "Summary" |
michael@0 | 664 | GetFunctionAddress $0 AbortSurveySummary |
michael@0 | 665 | ${EndIf} |
michael@0 | 666 | ClearErrors |
michael@0 | 667 | ${GetParameters} $1 |
michael@0 | 668 | ${GetOptions} "$1" "/UAC:" $2 |
michael@0 | 669 | ${If} ${Errors} |
michael@0 | 670 | Call $0 |
michael@0 | 671 | ${Else} |
michael@0 | 672 | UAC::ExecCodeSegment $0 |
michael@0 | 673 | ${EndIf} |
michael@0 | 674 | |
michael@0 | 675 | CustomAbort_finish: |
michael@0 | 676 | Return |
michael@0 | 677 | ${EndUnless} |
michael@0 | 678 | ${EndIf} |
michael@0 | 679 | |
michael@0 | 680 | MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MOZ_MUI_TEXT_ABORTWARNING)" \ |
michael@0 | 681 | IDYES +1 IDNO +2 |
michael@0 | 682 | Return |
michael@0 | 683 | Abort |
michael@0 | 684 | FunctionEnd |
michael@0 | 685 | |
michael@0 | 686 | Function AbortSurveyWelcome |
michael@0 | 687 | ExecShell "open" "${AbortSurveyURL}step1" |
michael@0 | 688 | FunctionEnd |
michael@0 | 689 | |
michael@0 | 690 | Function AbortSurveyOptions |
michael@0 | 691 | ExecShell "open" "${AbortSurveyURL}step2" |
michael@0 | 692 | FunctionEnd |
michael@0 | 693 | |
michael@0 | 694 | Function AbortSurveyDirectory |
michael@0 | 695 | ExecShell "open" "${AbortSurveyURL}step3" |
michael@0 | 696 | FunctionEnd |
michael@0 | 697 | |
michael@0 | 698 | Function AbortSurveyShortcuts |
michael@0 | 699 | ExecShell "open" "${AbortSurveyURL}step4" |
michael@0 | 700 | FunctionEnd |
michael@0 | 701 | |
michael@0 | 702 | Function AbortSurveySummary |
michael@0 | 703 | ExecShell "open" "${AbortSurveyURL}step5" |
michael@0 | 704 | FunctionEnd |
michael@0 | 705 | |
michael@0 | 706 | ################################################################################ |
michael@0 | 707 | # Helper Functions |
michael@0 | 708 | |
michael@0 | 709 | Function AddQuickLaunchShortcut |
michael@0 | 710 | CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
michael@0 | 711 | ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" |
michael@0 | 712 | ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ |
michael@0 | 713 | "$INSTDIR" |
michael@0 | 714 | ${EndIf} |
michael@0 | 715 | FunctionEnd |
michael@0 | 716 | |
michael@0 | 717 | Function CheckExistingInstall |
michael@0 | 718 | ; If there is a pending file copy from a previous upgrade don't allow |
michael@0 | 719 | ; installing until after the system has rebooted. |
michael@0 | 720 | IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4 |
michael@0 | 721 | MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2 |
michael@0 | 722 | Reboot |
michael@0 | 723 | Quit |
michael@0 | 724 | |
michael@0 | 725 | ; If there is a pending file deletion from a previous uninstall don't allow |
michael@0 | 726 | ; installing until after the system has rebooted. |
michael@0 | 727 | IfFileExists "$INSTDIR\${FileMainEXE}.moz-delete" +1 +4 |
michael@0 | 728 | MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UNINSTALL)" IDNO +2 |
michael@0 | 729 | Reboot |
michael@0 | 730 | Quit |
michael@0 | 731 | |
michael@0 | 732 | ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" |
michael@0 | 733 | ; Disable the next, cancel, and back buttons |
michael@0 | 734 | GetDlgItem $0 $HWNDPARENT 1 ; Next button |
michael@0 | 735 | EnableWindow $0 0 |
michael@0 | 736 | GetDlgItem $0 $HWNDPARENT 2 ; Cancel button |
michael@0 | 737 | EnableWindow $0 0 |
michael@0 | 738 | GetDlgItem $0 $HWNDPARENT 3 ; Back button |
michael@0 | 739 | EnableWindow $0 0 |
michael@0 | 740 | |
michael@0 | 741 | Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" |
michael@0 | 742 | |
michael@0 | 743 | ${If} "$TmpVal" == "FoundMessageWindow" |
michael@0 | 744 | Sleep 5000 |
michael@0 | 745 | ${EndIf} |
michael@0 | 746 | |
michael@0 | 747 | ${PushFilesToCheck} |
michael@0 | 748 | |
michael@0 | 749 | ; Store the return value in $TmpVal so it is less likely to be accidentally |
michael@0 | 750 | ; overwritten elsewhere. |
michael@0 | 751 | ${CheckForFilesInUse} $TmpVal |
michael@0 | 752 | |
michael@0 | 753 | Banner::destroy |
michael@0 | 754 | |
michael@0 | 755 | ; Enable the next, cancel, and back buttons |
michael@0 | 756 | GetDlgItem $0 $HWNDPARENT 1 ; Next button |
michael@0 | 757 | EnableWindow $0 1 |
michael@0 | 758 | GetDlgItem $0 $HWNDPARENT 2 ; Cancel button |
michael@0 | 759 | EnableWindow $0 1 |
michael@0 | 760 | GetDlgItem $0 $HWNDPARENT 3 ; Back button |
michael@0 | 761 | EnableWindow $0 1 |
michael@0 | 762 | |
michael@0 | 763 | ${If} "$TmpVal" == "true" |
michael@0 | 764 | StrCpy $TmpVal "FoundMessageWindow" |
michael@0 | 765 | ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" |
michael@0 | 766 | StrCpy $TmpVal "true" |
michael@0 | 767 | ${EndIf} |
michael@0 | 768 | ${EndIf} |
michael@0 | 769 | FunctionEnd |
michael@0 | 770 | |
michael@0 | 771 | Function LaunchApp |
michael@0 | 772 | ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)" |
michael@0 | 773 | |
michael@0 | 774 | ClearErrors |
michael@0 | 775 | ${GetParameters} $0 |
michael@0 | 776 | ${GetOptions} "$0" "/UAC:" $1 |
michael@0 | 777 | ${If} ${Errors} |
michael@0 | 778 | StrCpy $1 "0" |
michael@0 | 779 | StrCpy $2 "0" |
michael@0 | 780 | !ifdef MOZ_METRO |
michael@0 | 781 | ; Check to see if this install location is currently set as the |
michael@0 | 782 | ; default browser. |
michael@0 | 783 | AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" |
michael@0 | 784 | Pop $1 |
michael@0 | 785 | ; Check for a last run type to see if metro was the last browser |
michael@0 | 786 | ; front end in use. |
michael@0 | 787 | ReadRegDWORD $2 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" |
michael@0 | 788 | !endif |
michael@0 | 789 | ${If} $1 == "1" |
michael@0 | 790 | ${AndIf} $2 == "1" ; 1 equals AHE_IMMERSIVE |
michael@0 | 791 | ; Launch into metro |
michael@0 | 792 | Exec "$\"$INSTDIR\CommandExecuteHandler.exe$\" --launchmetro" |
michael@0 | 793 | ${Else} |
michael@0 | 794 | ; Launch into desktop |
michael@0 | 795 | Exec "$\"$INSTDIR\${FileMainEXE}$\"" |
michael@0 | 796 | ${EndIf} |
michael@0 | 797 | ${Else} |
michael@0 | 798 | GetFunctionAddress $0 LaunchAppFromElevatedProcess |
michael@0 | 799 | UAC::ExecCodeSegment $0 |
michael@0 | 800 | ${EndIf} |
michael@0 | 801 | FunctionEnd |
michael@0 | 802 | |
michael@0 | 803 | Function LaunchAppFromElevatedProcess |
michael@0 | 804 | ; Find the installation directory when launching using GetFunctionAddress |
michael@0 | 805 | ; from an elevated installer since $INSTDIR will not be set in this installer |
michael@0 | 806 | ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
michael@0 | 807 | ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" |
michael@0 | 808 | ${GetPathFromString} "$0" $0 |
michael@0 | 809 | ${GetParent} "$0" $1 |
michael@0 | 810 | ; Set our current working directory to the application's install directory |
michael@0 | 811 | ; otherwise the 7-Zip temp directory will be in use and won't be deleted. |
michael@0 | 812 | SetOutPath "$1" |
michael@0 | 813 | StrCpy $2 "0" |
michael@0 | 814 | StrCpy $3 "0" |
michael@0 | 815 | !ifdef MOZ_METRO |
michael@0 | 816 | ; Check to see if this install location is currently set as the |
michael@0 | 817 | ; default browser. |
michael@0 | 818 | AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective" |
michael@0 | 819 | Pop $2 |
michael@0 | 820 | ; Check for a last run type to see if metro was the last browser |
michael@0 | 821 | ; front end in use. |
michael@0 | 822 | ReadRegDWORD $3 HKCU "Software\Mozilla\Firefox" "MetroLastAHE" |
michael@0 | 823 | !endif |
michael@0 | 824 | ${If} $2 == "1" |
michael@0 | 825 | ${AndIf} $3 == "1" ; 1 equals AHE_IMMERSIVE |
michael@0 | 826 | ; Launch into metro |
michael@0 | 827 | Exec "$\"$1\CommandExecuteHandler.exe$\" --launchmetro" |
michael@0 | 828 | ${Else} |
michael@0 | 829 | ; Launch into desktop |
michael@0 | 830 | Exec "$\"$0$\"" |
michael@0 | 831 | ${EndIf} |
michael@0 | 832 | FunctionEnd |
michael@0 | 833 | |
michael@0 | 834 | ################################################################################ |
michael@0 | 835 | # Language |
michael@0 | 836 | |
michael@0 | 837 | !insertmacro MOZ_MUI_LANGUAGE 'baseLocale' |
michael@0 | 838 | !verbose push |
michael@0 | 839 | !verbose 3 |
michael@0 | 840 | !include "overrideLocale.nsh" |
michael@0 | 841 | !include "customLocale.nsh" |
michael@0 | 842 | !verbose pop |
michael@0 | 843 | |
michael@0 | 844 | ; Set this after the locale files to override it if it is in the locale |
michael@0 | 845 | ; using " " for BrandingText will hide the "Nullsoft Install System..." branding |
michael@0 | 846 | BrandingText " " |
michael@0 | 847 | |
michael@0 | 848 | ################################################################################ |
michael@0 | 849 | # Page pre, show, and leave functions |
michael@0 | 850 | |
michael@0 | 851 | Function preWelcome |
michael@0 | 852 | StrCpy $PageName "Welcome" |
michael@0 | 853 | ${If} ${FileExists} "$EXEDIR\core\distribution\modern-wizard.bmp" |
michael@0 | 854 | Delete "$PLUGINSDIR\modern-wizard.bmp" |
michael@0 | 855 | CopyFiles /SILENT "$EXEDIR\core\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" |
michael@0 | 856 | ${EndIf} |
michael@0 | 857 | FunctionEnd |
michael@0 | 858 | |
michael@0 | 859 | Function preOptions |
michael@0 | 860 | StrCpy $PageName "Options" |
michael@0 | 861 | ${If} ${FileExists} "$EXEDIR\core\distribution\modern-header.bmp" |
michael@0 | 862 | ${AndIf} $hHeaderBitmap == "" |
michael@0 | 863 | Delete "$PLUGINSDIR\modern-header.bmp" |
michael@0 | 864 | CopyFiles /SILENT "$EXEDIR\core\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" |
michael@0 | 865 | ${ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" |
michael@0 | 866 | ${EndIf} |
michael@0 | 867 | !insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)" |
michael@0 | 868 | !insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini" |
michael@0 | 869 | FunctionEnd |
michael@0 | 870 | |
michael@0 | 871 | Function leaveOptions |
michael@0 | 872 | ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State" |
michael@0 | 873 | ${If} $0 != 0 |
michael@0 | 874 | Abort |
michael@0 | 875 | ${EndIf} |
michael@0 | 876 | ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 2" "State" |
michael@0 | 877 | StrCmp $R0 "1" +1 +2 |
michael@0 | 878 | StrCpy $InstallType ${INSTALLTYPE_BASIC} |
michael@0 | 879 | ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State" |
michael@0 | 880 | StrCmp $R0 "1" +1 +2 |
michael@0 | 881 | StrCpy $InstallType ${INSTALLTYPE_CUSTOM} |
michael@0 | 882 | |
michael@0 | 883 | ${LeaveOptionsCommon} |
michael@0 | 884 | |
michael@0 | 885 | ${If} $InstallType == ${INSTALLTYPE_BASIC} |
michael@0 | 886 | Call CheckExistingInstall |
michael@0 | 887 | ${EndIf} |
michael@0 | 888 | FunctionEnd |
michael@0 | 889 | |
michael@0 | 890 | Function preDirectory |
michael@0 | 891 | StrCpy $PageName "Directory" |
michael@0 | 892 | ${PreDirectoryCommon} |
michael@0 | 893 | FunctionEnd |
michael@0 | 894 | |
michael@0 | 895 | Function leaveDirectory |
michael@0 | 896 | ${If} $InstallType == ${INSTALLTYPE_BASIC} |
michael@0 | 897 | Call CheckExistingInstall |
michael@0 | 898 | ${EndIf} |
michael@0 | 899 | ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)" |
michael@0 | 900 | FunctionEnd |
michael@0 | 901 | |
michael@0 | 902 | Function preShortcuts |
michael@0 | 903 | StrCpy $PageName "Shortcuts" |
michael@0 | 904 | ${CheckCustomCommon} |
michael@0 | 905 | !insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)" |
michael@0 | 906 | !insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini" |
michael@0 | 907 | FunctionEnd |
michael@0 | 908 | |
michael@0 | 909 | Function leaveShortcuts |
michael@0 | 910 | ${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State" |
michael@0 | 911 | ${If} $0 != 0 |
michael@0 | 912 | Abort |
michael@0 | 913 | ${EndIf} |
michael@0 | 914 | ${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" |
michael@0 | 915 | |
michael@0 | 916 | ; If we have a Metro browser and are Win8, then we don't have a Field 3 |
michael@0 | 917 | !ifdef MOZ_METRO |
michael@0 | 918 | ${Unless} ${AtLeastWin8} |
michael@0 | 919 | !endif |
michael@0 | 920 | ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" |
michael@0 | 921 | !ifdef MOZ_METRO |
michael@0 | 922 | ${EndIf} |
michael@0 | 923 | !endif |
michael@0 | 924 | |
michael@0 | 925 | ; Don't install the quick launch shortcut on Windows 7 |
michael@0 | 926 | ${Unless} ${AtLeastWin7} |
michael@0 | 927 | ${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State" |
michael@0 | 928 | ${EndUnless} |
michael@0 | 929 | |
michael@0 | 930 | ${If} $InstallType == ${INSTALLTYPE_CUSTOM} |
michael@0 | 931 | Call CheckExistingInstall |
michael@0 | 932 | ${EndIf} |
michael@0 | 933 | FunctionEnd |
michael@0 | 934 | |
michael@0 | 935 | !ifdef MOZ_MAINTENANCE_SERVICE |
michael@0 | 936 | Function preComponents |
michael@0 | 937 | ; If the service already exists, don't show this page |
michael@0 | 938 | ServicesHelper::IsInstalled "MozillaMaintenance" |
michael@0 | 939 | Pop $R9 |
michael@0 | 940 | ${If} $R9 == 1 |
michael@0 | 941 | ; The service already exists so don't show this page. |
michael@0 | 942 | Abort |
michael@0 | 943 | ${EndIf} |
michael@0 | 944 | |
michael@0 | 945 | ; On Windows 2000 we do not install the maintenance service. |
michael@0 | 946 | ${Unless} ${AtLeastWinXP} |
michael@0 | 947 | Abort |
michael@0 | 948 | ${EndUnless} |
michael@0 | 949 | |
michael@0 | 950 | ; Don't show the custom components page if the |
michael@0 | 951 | ; user is not an admin |
michael@0 | 952 | Call IsUserAdmin |
michael@0 | 953 | Pop $R9 |
michael@0 | 954 | ${If} $R9 != "true" |
michael@0 | 955 | Abort |
michael@0 | 956 | ${EndIf} |
michael@0 | 957 | |
michael@0 | 958 | ; Only show the maintenance service page if we have write access to HKLM |
michael@0 | 959 | ClearErrors |
michael@0 | 960 | WriteRegStr HKLM "Software\Mozilla" \ |
michael@0 | 961 | "${BrandShortName}InstallerTest" "Write Test" |
michael@0 | 962 | ${If} ${Errors} |
michael@0 | 963 | ClearErrors |
michael@0 | 964 | Abort |
michael@0 | 965 | ${Else} |
michael@0 | 966 | DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" |
michael@0 | 967 | ${EndIf} |
michael@0 | 968 | |
michael@0 | 969 | StrCpy $PageName "Components" |
michael@0 | 970 | ${CheckCustomCommon} |
michael@0 | 971 | !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)" |
michael@0 | 972 | !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini" |
michael@0 | 973 | FunctionEnd |
michael@0 | 974 | |
michael@0 | 975 | Function leaveComponents |
michael@0 | 976 | ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State" |
michael@0 | 977 | ${If} $0 != 0 |
michael@0 | 978 | Abort |
michael@0 | 979 | ${EndIf} |
michael@0 | 980 | ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State" |
michael@0 | 981 | ${If} $InstallType == ${INSTALLTYPE_CUSTOM} |
michael@0 | 982 | Call CheckExistingInstall |
michael@0 | 983 | ${EndIf} |
michael@0 | 984 | FunctionEnd |
michael@0 | 985 | !endif |
michael@0 | 986 | |
michael@0 | 987 | Function preSummary |
michael@0 | 988 | StrCpy $PageName "Summary" |
michael@0 | 989 | ; Setup the summary.ini file for the Custom Summary Page |
michael@0 | 990 | WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "3" |
michael@0 | 991 | |
michael@0 | 992 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Type "label" |
michael@0 | 993 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Text "$(SUMMARY_INSTALLED_TO)" |
michael@0 | 994 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Left "0" |
michael@0 | 995 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Right "-1" |
michael@0 | 996 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Top "5" |
michael@0 | 997 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Bottom "15" |
michael@0 | 998 | |
michael@0 | 999 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Type "text" |
michael@0 | 1000 | ; The contents of this control must be set as follows in the pre function |
michael@0 | 1001 | ; ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" |
michael@0 | 1002 | ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" |
michael@0 | 1003 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" state "" |
michael@0 | 1004 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Left "0" |
michael@0 | 1005 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Right "-1" |
michael@0 | 1006 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Top "17" |
michael@0 | 1007 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Bottom "30" |
michael@0 | 1008 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags "READONLY" |
michael@0 | 1009 | |
michael@0 | 1010 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type "label" |
michael@0 | 1011 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left "0" |
michael@0 | 1012 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right "-1" |
michael@0 | 1013 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top "130" |
michael@0 | 1014 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150" |
michael@0 | 1015 | |
michael@0 | 1016 | ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" |
michael@0 | 1017 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_UPGRADE_CLICK)" |
michael@0 | 1018 | WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText "$(UPGRADE_BUTTON)" |
michael@0 | 1019 | ${Else} |
michael@0 | 1020 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_INSTALL_CLICK)" |
michael@0 | 1021 | DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText |
michael@0 | 1022 | ${EndIf} |
michael@0 | 1023 | |
michael@0 | 1024 | |
michael@0 | 1025 | ; Remove the "Field 4" ini section in case the user hits back and changes the |
michael@0 | 1026 | ; installation directory which could change whether the make default checkbox |
michael@0 | 1027 | ; should be displayed. |
michael@0 | 1028 | DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4" |
michael@0 | 1029 | |
michael@0 | 1030 | ; Check if it is possible to write to HKLM |
michael@0 | 1031 | ClearErrors |
michael@0 | 1032 | WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" |
michael@0 | 1033 | ${Unless} ${Errors} |
michael@0 | 1034 | DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" |
michael@0 | 1035 | ; Check if Firefox is the http handler for this user. |
michael@0 | 1036 | SetShellVarContext current ; Set SHCTX to the current user |
michael@0 | 1037 | ${IsHandlerForInstallDir} "http" $R9 |
michael@0 | 1038 | ${If} $TmpVal == "HKLM" |
michael@0 | 1039 | SetShellVarContext all ; Set SHCTX to all users |
michael@0 | 1040 | ${EndIf} |
michael@0 | 1041 | ; If Firefox isn't the http handler for this user show the option to set |
michael@0 | 1042 | ; Firefox as the default browser. |
michael@0 | 1043 | ${If} "$R9" != "true" |
michael@0 | 1044 | ${AndIf} ${AtMostWin2008R2} |
michael@0 | 1045 | WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4" |
michael@0 | 1046 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "checkbox" |
michael@0 | 1047 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_TAKE_DEFAULTS)" |
michael@0 | 1048 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0" |
michael@0 | 1049 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1" |
michael@0 | 1050 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State "1" |
michael@0 | 1051 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "32" |
michael@0 | 1052 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53" |
michael@0 | 1053 | ${EndIf} |
michael@0 | 1054 | ${EndUnless} |
michael@0 | 1055 | |
michael@0 | 1056 | ${If} "$TmpVal" == "true" |
michael@0 | 1057 | ; If there is already a Type entry in the "Field 4" section with a value of |
michael@0 | 1058 | ; checkbox then the set as the default browser checkbox is displayed and |
michael@0 | 1059 | ; this text must be moved below it. |
michael@0 | 1060 | ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type" |
michael@0 | 1061 | ${If} "$0" == "checkbox" |
michael@0 | 1062 | StrCpy $0 "5" |
michael@0 | 1063 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "53" |
michael@0 | 1064 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68" |
michael@0 | 1065 | ${Else} |
michael@0 | 1066 | StrCpy $0 "4" |
michael@0 | 1067 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35" |
michael@0 | 1068 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50" |
michael@0 | 1069 | ${EndIf} |
michael@0 | 1070 | WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0" |
michael@0 | 1071 | |
michael@0 | 1072 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label" |
michael@0 | 1073 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)" |
michael@0 | 1074 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0" |
michael@0 | 1075 | WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1" |
michael@0 | 1076 | ${EndIf} |
michael@0 | 1077 | |
michael@0 | 1078 | !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)" |
michael@0 | 1079 | |
michael@0 | 1080 | ; The Summary custom page has a textbox that will automatically receive |
michael@0 | 1081 | ; focus. This sets the focus to the Install button instead. |
michael@0 | 1082 | !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini" |
michael@0 | 1083 | GetDlgItem $0 $HWNDPARENT 1 |
michael@0 | 1084 | System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" |
michael@0 | 1085 | ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" |
michael@0 | 1086 | SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" |
michael@0 | 1087 | !insertmacro MUI_INSTALLOPTIONS_SHOW |
michael@0 | 1088 | FunctionEnd |
michael@0 | 1089 | |
michael@0 | 1090 | Function leaveSummary |
michael@0 | 1091 | ; Try to delete the app executable and if we can't delete it try to find the |
michael@0 | 1092 | ; app's message window and prompt the user to close the app. This allows |
michael@0 | 1093 | ; running an instance that is located in another directory. If for whatever |
michael@0 | 1094 | ; reason there is no message window we will just rename the app's files and |
michael@0 | 1095 | ; then remove them on restart. |
michael@0 | 1096 | ClearErrors |
michael@0 | 1097 | ${DeleteFile} "$INSTDIR\${FileMainEXE}" |
michael@0 | 1098 | ${If} ${Errors} |
michael@0 | 1099 | ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" |
michael@0 | 1100 | ${EndIf} |
michael@0 | 1101 | FunctionEnd |
michael@0 | 1102 | |
michael@0 | 1103 | ; When we add an optional action to the finish page the cancel button is |
michael@0 | 1104 | ; enabled. This disables it and leaves the finish button as the only choice. |
michael@0 | 1105 | Function preFinish |
michael@0 | 1106 | StrCpy $PageName "" |
michael@0 | 1107 | ${EndInstallLog} "${BrandFullName}" |
michael@0 | 1108 | !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" |
michael@0 | 1109 | FunctionEnd |
michael@0 | 1110 | |
michael@0 | 1111 | ################################################################################ |
michael@0 | 1112 | # Initialization Functions |
michael@0 | 1113 | |
michael@0 | 1114 | Function .onInit |
michael@0 | 1115 | ; Remove the current exe directory from the search order. |
michael@0 | 1116 | ; This only effects LoadLibrary calls and not implicitly loaded DLLs. |
michael@0 | 1117 | System::Call 'kernel32::SetDllDirectoryW(w "")' |
michael@0 | 1118 | |
michael@0 | 1119 | StrCpy $PageName "" |
michael@0 | 1120 | StrCpy $LANGUAGE 0 |
michael@0 | 1121 | ${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini" |
michael@0 | 1122 | |
michael@0 | 1123 | ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)" |
michael@0 | 1124 | |
michael@0 | 1125 | ; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be |
michael@0 | 1126 | ; removed after we require NSIS 3.0a2 or greater. |
michael@0 | 1127 | !ifndef NSIS_PACKEDVERSION |
michael@0 | 1128 | ${If} ${AtLeastWinVista} |
michael@0 | 1129 | System::Call 'user32::SetProcessDPIAware()' |
michael@0 | 1130 | ${EndIf} |
michael@0 | 1131 | !endif |
michael@0 | 1132 | |
michael@0 | 1133 | !insertmacro InitInstallOptionsFile "options.ini" |
michael@0 | 1134 | !insertmacro InitInstallOptionsFile "shortcuts.ini" |
michael@0 | 1135 | !insertmacro InitInstallOptionsFile "components.ini" |
michael@0 | 1136 | !insertmacro InitInstallOptionsFile "summary.ini" |
michael@0 | 1137 | |
michael@0 | 1138 | WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5" |
michael@0 | 1139 | |
michael@0 | 1140 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label" |
michael@0 | 1141 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)" |
michael@0 | 1142 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0" |
michael@0 | 1143 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1" |
michael@0 | 1144 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0" |
michael@0 | 1145 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10" |
michael@0 | 1146 | |
michael@0 | 1147 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton" |
michael@0 | 1148 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)" |
michael@0 | 1149 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "0" |
michael@0 | 1150 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1" |
michael@0 | 1151 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25" |
michael@0 | 1152 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35" |
michael@0 | 1153 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1" |
michael@0 | 1154 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP" |
michael@0 | 1155 | |
michael@0 | 1156 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton" |
michael@0 | 1157 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)" |
michael@0 | 1158 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "0" |
michael@0 | 1159 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1" |
michael@0 | 1160 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55" |
michael@0 | 1161 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65" |
michael@0 | 1162 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0" |
michael@0 | 1163 | |
michael@0 | 1164 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label" |
michael@0 | 1165 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)" |
michael@0 | 1166 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15" |
michael@0 | 1167 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1" |
michael@0 | 1168 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37" |
michael@0 | 1169 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57" |
michael@0 | 1170 | |
michael@0 | 1171 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label" |
michael@0 | 1172 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)" |
michael@0 | 1173 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "15" |
michael@0 | 1174 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1" |
michael@0 | 1175 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67" |
michael@0 | 1176 | WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87" |
michael@0 | 1177 | |
michael@0 | 1178 | ; Setup the shortcuts.ini file for the Custom Shortcuts Page |
michael@0 | 1179 | ; Don't offer to install the quick launch shortcut on Windows 7 |
michael@0 | 1180 | ${If} ${AtLeastWin7} |
michael@0 | 1181 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "3" |
michael@0 | 1182 | ${Else} |
michael@0 | 1183 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "4" |
michael@0 | 1184 | ${EndIf} |
michael@0 | 1185 | |
michael@0 | 1186 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Type "label" |
michael@0 | 1187 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Text "$(CREATE_ICONS_DESC)" |
michael@0 | 1188 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Left "0" |
michael@0 | 1189 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Right "-1" |
michael@0 | 1190 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Top "5" |
michael@0 | 1191 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Bottom "15" |
michael@0 | 1192 | |
michael@0 | 1193 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Type "checkbox" |
michael@0 | 1194 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Text "$(ICONS_DESKTOP)" |
michael@0 | 1195 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Left "0" |
michael@0 | 1196 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Right "-1" |
michael@0 | 1197 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Top "20" |
michael@0 | 1198 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Bottom "30" |
michael@0 | 1199 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" State "1" |
michael@0 | 1200 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Flags "GROUP" |
michael@0 | 1201 | |
michael@0 | 1202 | ; Don't offer to install the start menu shortcut on Windows 8 |
michael@0 | 1203 | ; for Metro builds. |
michael@0 | 1204 | !ifdef MOZ_METRO |
michael@0 | 1205 | ${Unless} ${AtLeastWin8} |
michael@0 | 1206 | !endif |
michael@0 | 1207 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Type "checkbox" |
michael@0 | 1208 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Text "$(ICONS_STARTMENU)" |
michael@0 | 1209 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Left "0" |
michael@0 | 1210 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Right "-1" |
michael@0 | 1211 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Top "40" |
michael@0 | 1212 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50" |
michael@0 | 1213 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1" |
michael@0 | 1214 | !ifdef MOZ_METRO |
michael@0 | 1215 | ${EndIf} |
michael@0 | 1216 | !endif |
michael@0 | 1217 | |
michael@0 | 1218 | ; Don't offer to install the quick launch shortcut on Windows 7 |
michael@0 | 1219 | ${Unless} ${AtLeastWin7} |
michael@0 | 1220 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox" |
michael@0 | 1221 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)" |
michael@0 | 1222 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0" |
michael@0 | 1223 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1" |
michael@0 | 1224 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60" |
michael@0 | 1225 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70" |
michael@0 | 1226 | WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1" |
michael@0 | 1227 | ${EndUnless} |
michael@0 | 1228 | |
michael@0 | 1229 | ; Setup the components.ini file for the Components Page |
michael@0 | 1230 | WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2" |
michael@0 | 1231 | |
michael@0 | 1232 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label" |
michael@0 | 1233 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)" |
michael@0 | 1234 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0" |
michael@0 | 1235 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1" |
michael@0 | 1236 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5" |
michael@0 | 1237 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25" |
michael@0 | 1238 | |
michael@0 | 1239 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox" |
michael@0 | 1240 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)" |
michael@0 | 1241 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0" |
michael@0 | 1242 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1" |
michael@0 | 1243 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27" |
michael@0 | 1244 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37" |
michael@0 | 1245 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1" |
michael@0 | 1246 | WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP" |
michael@0 | 1247 | |
michael@0 | 1248 | ; There must always be a core directory. |
michael@0 | 1249 | ${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8 |
michael@0 | 1250 | SectionSetSize ${APP_IDX} $R5 |
michael@0 | 1251 | |
michael@0 | 1252 | ; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if |
michael@0 | 1253 | ; the user clicks the back button |
michael@0 | 1254 | StrCpy $hHeaderBitmap "" |
michael@0 | 1255 | FunctionEnd |
michael@0 | 1256 | |
michael@0 | 1257 | Function .onGUIEnd |
michael@0 | 1258 | ${OnEndCommon} |
michael@0 | 1259 | FunctionEnd |