1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/installer/windows/nsis/shared.nsh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,1697 @@ 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 +; The registration ID of the COM server which is used for choosing wether 1.9 +; to launch the Win8 metro browser or desktop browser. 1.10 +!define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} 1.11 +; 1.12 +; Defines for adjust token privs and for enumerating keys 1.13 +!ifndef TOKEN_QUERY 1.14 + !define TOKEN_QUERY 0x0008 1.15 +!endif 1.16 +!ifndef TOKEN_ADJUST_PRIVILEGES 1.17 + !define TOKEN_ADJUST_PRIVILEGES 0x0020 1.18 +!endif 1.19 +!ifndef SE_RESTORE_NAME 1.20 + !define SE_RESTORE_NAME SeRestorePrivilege 1.21 +!endif 1.22 +!ifndef SE_PRIVILEGE_ENABLED 1.23 + !define SE_PRIVILEGE_ENABLED 0x00000002 1.24 +!endif 1.25 +!ifndef HKEY_USERS 1.26 + !define HKEY_USERS 0x80000003 1.27 +!endif 1.28 + 1.29 +; Does metro registration for the command execute handler 1.30 +Function RegisterCEH 1.31 +!ifdef MOZ_METRO 1.32 + ${If} ${AtLeastWin8} 1.33 + ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.34 + "FirefoxURL" \ 1.35 + "FirefoxHTML" 1.36 + ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.37 + "$INSTDIR\CommandExecuteHandler.exe" \ 1.38 + $AppUserModelID \ 1.39 + "FirefoxURL" \ 1.40 + "FirefoxHTML" 1.41 + ${EndIf} 1.42 +!endif 1.43 +FunctionEnd 1.44 + 1.45 +; If we're in Win8 make sure we have a start menu shortcut and that it has 1.46 +; the correct AppuserModelID so that the Metro browser has a Metro tile. 1.47 +Function RegisterStartMenuTile 1.48 +!ifdef MOZ_METRO 1.49 + ${If} ${AtLeastWin8} 1.50 + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.51 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.52 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.53 + "$INSTDIR" 1.54 + ${If} "$AppUserModelID" != "" 1.55 + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.56 + ${EndIf} 1.57 + ${EndIf} 1.58 + ${EndIf} 1.59 +!endif 1.60 +FunctionEnd 1.61 + 1.62 +!macro PostUpdate 1.63 + 1.64 + ; PostUpdate is called from both session 0 and from the user session 1.65 + ; for service updates, make sure that we only register with the user session 1.66 + ; Otherwise ApplicationID::Set can fail intermittently with a file in use error. 1.67 + System::Call "kernel32::GetCurrentProcessId() i.r0" 1.68 + System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)" 1.69 + 1.70 + ; Determine if we're the protected UserChoice default or not. If so fix the 1.71 + ; start menu tile. In case there are 2 Firefox installations, we only do 1.72 + ; this if the application being updated is the default. 1.73 + ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" 1.74 + ${If} $0 == "FirefoxURL" 1.75 + ${AndIf} $9 != 0 ; We're not running in session 0 1.76 + ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "" 1.77 + ${GetPathFromString} "$0" $0 1.78 + ${GetParent} "$0" $0 1.79 + ${If} ${FileExists} "$0" 1.80 + ${GetLongPath} "$0" $0 1.81 + ${EndIf} 1.82 + ${If} "$0" == "$INSTDIR" 1.83 + ; Win8 specific registration 1.84 + Call RegisterStartMenuTile 1.85 + ${EndIf} 1.86 + ${EndIf} 1.87 + 1.88 + ${CreateShortcutsLog} 1.89 + 1.90 + ; Remove registry entries for non-existent apps and for apps that point to our 1.91 + ; install location in the Software\Mozilla key and uninstall registry entries 1.92 + ; that point to our install location for both HKCU and HKLM. 1.93 + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) 1.94 + ${RegCleanMain} "Software\Mozilla" 1.95 + ${RegCleanUninstall} 1.96 + ${UpdateProtocolHandlers} 1.97 + 1.98 + ; setup the application model id registration value 1.99 + ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" 1.100 + 1.101 + ; Win7 taskbar and start menu link maintenance 1.102 + Call FixShortcutAppModelIDs 1.103 + 1.104 + ClearErrors 1.105 + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" 1.106 + ${If} ${Errors} 1.107 + StrCpy $TmpVal "HKCU" ; used primarily for logging 1.108 + ${Else} 1.109 + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) 1.110 + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" 1.111 + StrCpy $TmpVal "HKLM" ; used primarily for logging 1.112 + ${RegCleanMain} "Software\Mozilla" 1.113 + ${RegCleanUninstall} 1.114 + ${UpdateProtocolHandlers} 1.115 + ${FixShellIconHandler} "HKLM" 1.116 + ${SetAppLSPCategories} ${LSP_CATEGORIES} 1.117 + 1.118 + ; Win7 taskbar and start menu link maintenance 1.119 + Call FixShortcutAppModelIDs 1.120 + 1.121 + ; Only update the Clients\StartMenuInternet registry key values in HKLM if 1.122 + ; they don't exist or this installation is the same as the one set in those 1.123 + ; keys. 1.124 + ${StrFilter} "${FileMainEXE}" "+" "" "" $1 1.125 + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" 1.126 + ${GetPathFromString} "$0" $0 1.127 + ${GetParent} "$0" $0 1.128 + ${If} ${FileExists} "$0" 1.129 + ${GetLongPath} "$0" $0 1.130 + ${EndIf} 1.131 + ${If} "$0" == "$INSTDIR" 1.132 + ${SetStartMenuInternet} "HKLM" 1.133 + ${EndIf} 1.134 + 1.135 + ; Only update the Clients\StartMenuInternet registry key values in HKCU if 1.136 + ; they don't exist or this installation is the same as the one set in those 1.137 + ; keys. This is only done in Windows 8 to avoid a UAC prompt. 1.138 + ${If} ${AtLeastWin8} 1.139 + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" 1.140 + ${GetPathFromString} "$0" $0 1.141 + ${GetParent} "$0" $0 1.142 + ${If} ${FileExists} "$0" 1.143 + ${GetLongPath} "$0" $0 1.144 + ${EndIf} 1.145 + ${If} "$0" == "$INSTDIR" 1.146 + ${SetStartMenuInternet} "HKCU" 1.147 + ${EndIf} 1.148 + ${EndIf} 1.149 + 1.150 + ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" 1.151 + ${If} "$0" != "${GREVersion}" 1.152 + WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" 1.153 + ${EndIf} 1.154 + ${EndIf} 1.155 + 1.156 + ; Migrate the application's Start Menu directory to a single shortcut in the 1.157 + ; root of the Start Menu Programs directory. 1.158 + ${MigrateStartMenuShortcut} 1.159 + 1.160 + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). 1.161 + ${MigrateTaskBarShortcut} 1.162 + 1.163 + ${RemoveDeprecatedKeys} 1.164 + 1.165 + ${SetAppKeys} 1.166 + ${FixClassKeys} 1.167 + ${SetUninstallKeys} 1.168 + 1.169 + ; Remove files that may be left behind by the application in the 1.170 + ; VirtualStore directory. 1.171 + ${CleanVirtualStore} 1.172 + 1.173 + ${RemoveDeprecatedFiles} 1.174 + 1.175 + ; Fix the distribution.ini file if applicable 1.176 + ${FixDistributionsINI} 1.177 + 1.178 + RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" 1.179 + 1.180 +!ifdef MOZ_MAINTENANCE_SERVICE 1.181 + Call IsUserAdmin 1.182 + Pop $R0 1.183 + ${If} $R0 == "true" 1.184 + ; Only proceed if we have HKLM write access 1.185 + ${AndIf} $TmpVal == "HKLM" 1.186 + ; On Windows 2000 we do not install the maintenance service. 1.187 + ${AndIf} ${AtLeastWinXP} 1.188 + ; Add the registry keys for allowed certificates. 1.189 + ${AddMaintCertKeys} 1.190 + 1.191 + ; We check to see if the maintenance service install was already attempted. 1.192 + ; Since the Maintenance service can be installed either x86 or x64, 1.193 + ; always use the 64-bit registry for checking if an attempt was made. 1.194 + ${If} ${RunningX64} 1.195 + SetRegView 64 1.196 + ${EndIf} 1.197 + ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1.198 + ClearErrors 1.199 + ${If} ${RunningX64} 1.200 + SetRegView lastused 1.201 + ${EndIf} 1.202 + 1.203 + ; If the maintenance service is already installed, do nothing. 1.204 + ; The maintenance service will launch: 1.205 + ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance 1.206 + ; service if necessary. If the update was done from updater.exe without 1.207 + ; the service (i.e. service is failing), updater.exe will do the update of 1.208 + ; the service. The reasons we do not do it here is because we don't want 1.209 + ; to have to prompt for limited user accounts when the service isn't used 1.210 + ; and we currently call the PostUpdate twice, once for the user and once 1.211 + ; for the SYSTEM account. Also, this would stop the maintenance service 1.212 + ; and we need a return result back to the service when run that way. 1.213 + ${If} $5 == "" 1.214 + ; An install of maintenance service was never attempted. 1.215 + ; We know we are an Admin and that we have write access into HKLM 1.216 + ; based on the above checks, so attempt to just run the EXE. 1.217 + ; In the worst case, in case there is some edge case with the 1.218 + ; IsAdmin check and the permissions check, the maintenance service 1.219 + ; will just fail to be attempted to be installed. 1.220 + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" 1.221 + ${EndIf} 1.222 + ${EndIf} 1.223 +!endif 1.224 + 1.225 +; Register the DEH 1.226 +!ifdef MOZ_METRO 1.227 + ${If} ${AtLeastWin8} 1.228 + ${AndIf} $9 != 0 ; We're not running in session 0 1.229 + ; If RegisterCEH is called too close to changing the shortcut AppUserModelID 1.230 + ; and if the tile image is not already in cache. Then Windows won't refresh 1.231 + ; the tile image on the start screen. So wait before calling RegisterCEH. 1.232 + ; We only need to do this when the DEH doesn't already exist. 1.233 + ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "DelegateExecute" 1.234 + ${If} $0 != ${DELEGATE_EXECUTE_HANDLER_ID} 1.235 + Sleep 3000 1.236 + ${EndIf} 1.237 + Call RegisterCEH 1.238 + ${EndIf} 1.239 +!else 1.240 + ; The metro browser is not enabled by the mozconfig. 1.241 + ${If} ${AtLeastWin8} 1.242 + ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ 1.243 + $AppUserModelID \ 1.244 + "FirefoxURL" \ 1.245 + "FirefoxHTML" 1.246 + ${EndIf} 1.247 +!endif 1.248 +!macroend 1.249 +!define PostUpdate "!insertmacro PostUpdate" 1.250 + 1.251 +!macro SetAsDefaultAppGlobal 1.252 + ${RemoveDeprecatedKeys} ; Does not use SHCTX 1.253 + 1.254 + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) 1.255 + ${SetHandlers} ; Uses SHCTX 1.256 + ${SetStartMenuInternet} "HKLM" 1.257 + ${FixShellIconHandler} "HKLM" 1.258 + ${ShowShortcuts} 1.259 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.260 + WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9" 1.261 +!macroend 1.262 +!define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal" 1.263 + 1.264 +; Removes shortcuts for this installation. This should also remove the 1.265 +; application from Open With for the file types the application handles 1.266 +; (bug 370480). 1.267 +!macro HideShortcuts 1.268 + ${StrFilter} "${FileMainEXE}" "+" "" "" $0 1.269 + StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" 1.270 + WriteRegDWORD HKLM "$R1" "IconsVisible" 0 1.271 + ${If} ${AtLeastWin8} 1.272 + WriteRegDWORD HKCU "$R1" "IconsVisible" 0 1.273 + ${EndIf} 1.274 + 1.275 + SetShellVarContext all ; Set $DESKTOP to All Users 1.276 + ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.277 + SetShellVarContext current ; Set $DESKTOP to the current user's desktop 1.278 + ${EndUnless} 1.279 + 1.280 + ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.281 + ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk" 1.282 + Pop $0 1.283 + ${If} "$0" == "" 1.284 + ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk" 1.285 + Pop $0 1.286 + ${GetLongPath} "$0" $0 1.287 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" 1.288 + Delete "$DESKTOP\${BrandFullName}.lnk" 1.289 + ${EndIf} 1.290 + ${EndIf} 1.291 + ${EndIf} 1.292 + 1.293 + SetShellVarContext all ; Set $SMPROGRAMS to All Users 1.294 + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.295 + SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start 1.296 + ; Menu Programs directory 1.297 + ${EndUnless} 1.298 + 1.299 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.300 + ShellLink::GetShortCutArgs "$SMPROGRAMS\${BrandFullName}.lnk" 1.301 + Pop $0 1.302 + ${If} "$0" == "" 1.303 + ShellLink::GetShortCutTarget "$SMPROGRAMS\${BrandFullName}.lnk" 1.304 + Pop $0 1.305 + ${GetLongPath} "$0" $0 1.306 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" 1.307 + Delete "$SMPROGRAMS\${BrandFullName}.lnk" 1.308 + ${EndIf} 1.309 + ${EndIf} 1.310 + ${EndIf} 1.311 + 1.312 + ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" 1.313 + ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk" 1.314 + Pop $0 1.315 + ${If} "$0" == "" 1.316 + ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk" 1.317 + Pop $0 1.318 + ${GetLongPath} "$0" $0 1.319 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" 1.320 + Delete "$QUICKLAUNCH\${BrandFullName}.lnk" 1.321 + ${EndIf} 1.322 + ${EndIf} 1.323 + ${EndIf} 1.324 +!macroend 1.325 +!define HideShortcuts "!insertmacro HideShortcuts" 1.326 + 1.327 +; Adds shortcuts for this installation. This should also add the application 1.328 +; to Open With for the file types the application handles (bug 370480). 1.329 +!macro ShowShortcuts 1.330 + ${StrFilter} "${FileMainEXE}" "+" "" "" $0 1.331 + StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" 1.332 + WriteRegDWORD HKLM "$R1" "IconsVisible" 1 1.333 + ${If} ${AtLeastWin8} 1.334 + WriteRegDWORD HKCU "$R1" "IconsVisible" 1 1.335 + ${EndIf} 1.336 + 1.337 + SetShellVarContext all ; Set $DESKTOP to All Users 1.338 + ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.339 + CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.340 + ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.341 + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR" 1.342 + ${If} ${AtLeastWin7} 1.343 + ${AndIf} "$AppUserModelID" != "" 1.344 + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.345 + ${EndIf} 1.346 + ${Else} 1.347 + SetShellVarContext current ; Set $DESKTOP to the current user's desktop 1.348 + ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.349 + CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.350 + ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" 1.351 + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ 1.352 + "$INSTDIR" 1.353 + ${If} ${AtLeastWin7} 1.354 + ${AndIf} "$AppUserModelID" != "" 1.355 + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.356 + ${EndIf} 1.357 + ${EndIf} 1.358 + ${EndUnless} 1.359 + ${EndIf} 1.360 + ${EndUnless} 1.361 + 1.362 + SetShellVarContext all ; Set $SMPROGRAMS to All Users 1.363 + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.364 + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.365 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.366 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.367 + "$INSTDIR" 1.368 + ${If} ${AtLeastWin7} 1.369 + ${AndIf} "$AppUserModelID" != "" 1.370 + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.371 + ${EndIf} 1.372 + ${Else} 1.373 + SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start 1.374 + ; Menu Programs directory 1.375 + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.376 + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" 1.377 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.378 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.379 + "$INSTDIR" 1.380 + ${If} ${AtLeastWin7} 1.381 + ${AndIf} "$AppUserModelID" != "" 1.382 + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" 1.383 + ${EndIf} 1.384 + ${EndIf} 1.385 + ${EndUnless} 1.386 + ${EndIf} 1.387 + ${EndUnless} 1.388 + 1.389 + ; Windows 7 doesn't use the QuickLaunch directory 1.390 + ${Unless} ${AtLeastWin7} 1.391 + ${AndUnless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" 1.392 + CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" \ 1.393 + "$INSTDIR\${FileMainEXE}" 1.394 + ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" 1.395 + ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ 1.396 + "$INSTDIR" 1.397 + ${EndIf} 1.398 + ${EndUnless} 1.399 +!macroend 1.400 +!define ShowShortcuts "!insertmacro ShowShortcuts" 1.401 + 1.402 +!macro AddAssociationIfNoneExist FILE_TYPE 1.403 + ClearErrors 1.404 + EnumRegKey $7 HKCR "${FILE_TYPE}" 0 1.405 + ${If} ${Errors} 1.406 + WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML" 1.407 + ${EndIf} 1.408 +!macroend 1.409 +!define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist" 1.410 + 1.411 +; Adds the protocol and file handler registry entries for making Firefox the 1.412 +; default handler (uses SHCTX). 1.413 +!macro SetHandlers 1.414 + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 1.415 + 1.416 + StrCpy $0 "SOFTWARE\Classes" 1.417 + StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" 1.418 + 1.419 + ; Associate the file handlers with FirefoxHTML 1.420 + ReadRegStr $6 SHCTX "$0\.htm" "" 1.421 + ${If} "$6" != "FirefoxHTML" 1.422 + WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML" 1.423 + ${EndIf} 1.424 + 1.425 + ReadRegStr $6 SHCTX "$0\.html" "" 1.426 + ${If} "$6" != "FirefoxHTML" 1.427 + WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML" 1.428 + ${EndIf} 1.429 + 1.430 + ReadRegStr $6 SHCTX "$0\.shtml" "" 1.431 + ${If} "$6" != "FirefoxHTML" 1.432 + WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML" 1.433 + ${EndIf} 1.434 + 1.435 + ReadRegStr $6 SHCTX "$0\.xht" "" 1.436 + ${If} "$6" != "FirefoxHTML" 1.437 + WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML" 1.438 + ${EndIf} 1.439 + 1.440 + ReadRegStr $6 SHCTX "$0\.xhtml" "" 1.441 + ${If} "$6" != "FirefoxHTML" 1.442 + WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML" 1.443 + ${EndIf} 1.444 + 1.445 + ${AddAssociationIfNoneExist} ".pdf" 1.446 + ${AddAssociationIfNoneExist} ".oga" 1.447 + ${AddAssociationIfNoneExist} ".ogg" 1.448 + ${AddAssociationIfNoneExist} ".ogv" 1.449 + ${AddAssociationIfNoneExist} ".pdf" 1.450 + ${AddAssociationIfNoneExist} ".webm" 1.451 + 1.452 + ; An empty string is used for the 5th param because FirefoxHTML is not a 1.453 + ; protocol handler 1.454 + ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ 1.455 + "${AppRegName} HTML Document" "" 1.456 + 1.457 + ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ 1.458 + "true" 1.459 + Call RegisterCEH 1.460 + 1.461 + ; An empty string is used for the 4th & 5th params because the following 1.462 + ; protocol handlers already have a display name and the additional keys 1.463 + ; required for a protocol handler. 1.464 + ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" 1.465 + ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" 1.466 + ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" 1.467 +!macroend 1.468 +!define SetHandlers "!insertmacro SetHandlers" 1.469 + 1.470 +; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry 1.471 +; entries (does not use SHCTX). 1.472 +; 1.473 +; The values for StartMenuInternet are only valid under HKLM and there can only 1.474 +; be one installation registerred under StartMenuInternet per application since 1.475 +; the key name is derived from the main application executable. 1.476 +; http://support.microsoft.com/kb/297878 1.477 +; 1.478 +; In Windows 8 this changes slightly, you can store StartMenuInternet entries in 1.479 +; HKCU. The icon in start menu for StartMenuInternet is deprecated as of Win7, 1.480 +; but the subkeys are what's important. Control panel default programs looks 1.481 +; for them only in HKLM pre win8. 1.482 +; 1.483 +; Note: we might be able to get away with using the full path to the 1.484 +; application executable for the key name in order to support multiple 1.485 +; installations. 1.486 +!macro SetStartMenuInternet RegKey 1.487 + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 1.488 + ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 1.489 + 1.490 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.491 + 1.492 + StrCpy $0 "Software\Clients\StartMenuInternet\$R9" 1.493 + 1.494 + WriteRegStr ${RegKey} "$0" "" "${BrandFullName}" 1.495 + 1.496 + WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" 1.497 + 1.498 + ; The Reinstall Command is defined at 1.499 + ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp 1.500 + WriteRegStr ${RegKey} "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" 1.501 + WriteRegStr ${RegKey} "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" 1.502 + WriteRegStr ${RegKey} "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" 1.503 + 1.504 + ClearErrors 1.505 + ReadRegDWORD $1 ${RegKey} "$0\InstallInfo" "IconsVisible" 1.506 + ; If the IconsVisible name value pair doesn't exist add it otherwise the 1.507 + ; application won't be displayed in Set Program Access and Defaults. 1.508 + ${If} ${Errors} 1.509 + ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" 1.510 + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1 1.511 + ${Else} 1.512 + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0 1.513 + ${EndIf} 1.514 + ${EndIf} 1.515 + 1.516 + WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\"" 1.517 + 1.518 + WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" 1.519 + WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -preferences" 1.520 + 1.521 + WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" 1.522 + WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" 1.523 + 1.524 + ; Vista Capabilities registry keys 1.525 + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" 1.526 + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" 1.527 + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}" 1.528 + 1.529 + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML" 1.530 + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML" 1.531 + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML" 1.532 + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML" 1.533 + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML" 1.534 + 1.535 + WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9" 1.536 + 1.537 + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL" 1.538 + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL" 1.539 + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL" 1.540 + 1.541 + ; Vista Registered Application 1.542 + WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities" 1.543 +!macroend 1.544 +!define SetStartMenuInternet "!insertmacro SetStartMenuInternet" 1.545 + 1.546 +; The IconHandler reference for FirefoxHTML can end up in an inconsistent state 1.547 +; due to changes not being detected by the IconHandler for side by side 1.548 +; installs (see bug 268512). The symptoms can be either an incorrect icon or no 1.549 +; icon being displayed for files associated with Firefox (does not use SHCTX). 1.550 +!macro FixShellIconHandler RegKey 1.551 + ClearErrors 1.552 + ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\ShellEx\IconHandler" "" 1.553 + ${Unless} ${Errors} 1.554 + ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" 1.555 + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $2 1.556 + ${If} "$1" != "$2,1" 1.557 + WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1" 1.558 + ${EndIf} 1.559 + ${EndUnless} 1.560 +!macroend 1.561 +!define FixShellIconHandler "!insertmacro FixShellIconHandler" 1.562 + 1.563 +; Add Software\Mozilla\ registry entries (uses SHCTX). 1.564 +!macro SetAppKeys 1.565 + ; Check if this is an ESR release and if so add registry values so it is 1.566 + ; possible to determine that this is an ESR install (bug 726781). 1.567 + ClearErrors 1.568 + ${WordFind} "${UpdateChannel}" "esr" "E#" $3 1.569 + ${If} ${Errors} 1.570 + StrCpy $3 "" 1.571 + ${Else} 1.572 + StrCpy $3 " ESR" 1.573 + ${EndIf} 1.574 + 1.575 + ${GetLongPath} "$INSTDIR" $8 1.576 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" 1.577 + ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0 1.578 + ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 1.579 + 1.580 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Uninstall" 1.581 + ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 1.582 + 1.583 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})" 1.584 + ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 1.585 + ${If} "$3" == "" 1.586 + DeleteRegValue SHCTX "$0" "ESR" 1.587 + ${Else} 1.588 + ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 1.589 + ${EndIf} 1.590 + 1.591 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\bin" 1.592 + ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 1.593 + 1.594 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\extensions" 1.595 + ${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0 1.596 + ${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0 1.597 + 1.598 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3" 1.599 + ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0 1.600 + ${If} "$3" == "" 1.601 + DeleteRegValue SHCTX "$0" "ESR" 1.602 + ${Else} 1.603 + ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 1.604 + ${EndIf} 1.605 + 1.606 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}$3" 1.607 + ${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0 1.608 + ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 1.609 +!macroend 1.610 +!define SetAppKeys "!insertmacro SetAppKeys" 1.611 + 1.612 +; Add uninstall registry entries. This macro tests for write access to determine 1.613 +; if the uninstall keys should be added to HKLM or HKCU. 1.614 +!macro SetUninstallKeys 1.615 + ; Check if this is an ESR release and if so add registry values so it is 1.616 + ; possible to determine that this is an ESR install (bug 726781). 1.617 + ClearErrors 1.618 + ${WordFind} "${UpdateChannel}" "esr" "E#" $3 1.619 + ${If} ${Errors} 1.620 + StrCpy $3 "" 1.621 + ${Else} 1.622 + StrCpy $3 " ESR" 1.623 + ${EndIf} 1.624 + 1.625 + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 1.626 + 1.627 + StrCpy $2 "" 1.628 + ClearErrors 1.629 + WriteRegStr HKLM "$0" "${BrandShortName}InstallerTest" "Write Test" 1.630 + ${If} ${Errors} 1.631 + ; If the uninstall keys already exist in HKLM don't create them in HKCU 1.632 + ClearErrors 1.633 + ReadRegStr $2 "HKLM" $0 "DisplayName" 1.634 + ${If} $2 == "" 1.635 + ; Otherwise we don't have any keys for this product in HKLM so proceeed 1.636 + ; to create them in HKCU. Better handling for this will be done in: 1.637 + ; Bug 711044 - Better handling for 2 uninstall icons 1.638 + StrCpy $1 "HKCU" 1.639 + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) 1.640 + ${EndIf} 1.641 + ClearErrors 1.642 + ${Else} 1.643 + StrCpy $1 "HKLM" 1.644 + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) 1.645 + DeleteRegValue HKLM "$0" "${BrandShortName}InstallerTest" 1.646 + ${EndIf} 1.647 + 1.648 + ${If} $2 == "" 1.649 + ${GetLongPath} "$INSTDIR" $8 1.650 + 1.651 + ; Write the uninstall registry keys 1.652 + ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 1.653 + ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0 1.654 + ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 1.655 + ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 1.656 + ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 1.657 + ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 1.658 + ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 1.659 + ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 1.660 + DeleteRegValue SHCTX "$0" "URLInfoAbout" 1.661 +; Don't add URLUpdateInfo which is the release notes url except for the release 1.662 +; and esr channels since nightly, aurora, and beta do not have release notes. 1.663 +; Note: URLUpdateInfo is only defined in the official branding.nsi. 1.664 +!ifdef URLUpdateInfo 1.665 +!ifndef BETA_UPDATE_CHANNEL 1.666 + ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0 1.667 +!endif 1.668 +!endif 1.669 + ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 1.670 + ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0 1.671 + ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0 1.672 + 1.673 + ${GetSize} "$8" "/S=0K" $R2 $R3 $R4 1.674 + ${WriteRegDWORD2} $1 "$0" "EstimatedSize" $R2 0 1.675 + 1.676 + ${If} "$TmpVal" == "HKLM" 1.677 + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) 1.678 + ${Else} 1.679 + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) 1.680 + ${EndIf} 1.681 + ${EndIf} 1.682 +!macroend 1.683 +!define SetUninstallKeys "!insertmacro SetUninstallKeys" 1.684 + 1.685 +; Due to a bug when associating some file handlers, only SHCTX was checked for 1.686 +; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on 1.687 +; whether the installer has write access to HKLM. The bug would happen when 1.688 +; HCKU was checked and didn't exist since programs aren't required to set the 1.689 +; HKCU Software\Classes keys when associating handlers. The fix uses the merged 1.690 +; view in HKCR to check for existance of an existing association. This macro 1.691 +; cleans affected installations by removing the HKLM and HKCU value if it is set 1.692 +; to FirefoxHTML when there is a value for PersistentHandler or by removing the 1.693 +; HKCU value when the HKLM value has a value other than an empty string. 1.694 +!macro FixBadFileAssociation FILE_TYPE 1.695 + ; Only delete the default value in case the key has values for OpenWithList, 1.696 + ; OpenWithProgids, PersistentHandler, etc. 1.697 + ReadRegStr $0 HKCU "Software\Classes\${FILE_TYPE}" "" 1.698 + ReadRegStr $1 HKLM "Software\Classes\${FILE_TYPE}" "" 1.699 + ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" "" 1.700 + ${If} "$2" != "" 1.701 + ; Since there is a persistent handler remove FirefoxHTML as the default 1.702 + ; value from both HKCU and HKLM if it set to FirefoxHTML. 1.703 + ${If} "$0" == "FirefoxHTML" 1.704 + DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" 1.705 + ${EndIf} 1.706 + ${If} "$1" == "FirefoxHTML" 1.707 + DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" "" 1.708 + ${EndIf} 1.709 + ${ElseIf} "$0" == "FirefoxHTML" 1.710 + ; Since KHCU is set to FirefoxHTML remove FirefoxHTML as the default value 1.711 + ; from HKCU if HKLM is set to a value other than an empty string. 1.712 + ${If} "$1" != "" 1.713 + DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" 1.714 + ${EndIf} 1.715 + ${EndIf} 1.716 +!macroend 1.717 +!define FixBadFileAssociation "!insertmacro FixBadFileAssociation" 1.718 + 1.719 +; Add app specific handler registry entries under Software\Classes if they 1.720 +; don't exist (does not use SHCTX). 1.721 +!macro FixClassKeys 1.722 + StrCpy $1 "SOFTWARE\Classes" 1.723 + 1.724 + ; File handler keys and name value pairs that may need to be created during 1.725 + ; install or upgrade. 1.726 + ReadRegStr $0 HKCR ".shtml" "Content Type" 1.727 + ${If} "$0" == "" 1.728 + StrCpy $0 "$1\.shtml" 1.729 + ${WriteRegStr2} $TmpVal "$1\.shtml" "" "shtmlfile" 0 1.730 + ${WriteRegStr2} $TmpVal "$1\.shtml" "Content Type" "text/html" 0 1.731 + ${WriteRegStr2} $TmpVal "$1\.shtml" "PerceivedType" "text" 0 1.732 + ${EndIf} 1.733 + 1.734 + ReadRegStr $0 HKCR ".xht" "Content Type" 1.735 + ${If} "$0" == "" 1.736 + ${WriteRegStr2} $TmpVal "$1\.xht" "" "xhtfile" 0 1.737 + ${WriteRegStr2} $TmpVal "$1\.xht" "Content Type" "application/xhtml+xml" 0 1.738 + ${EndIf} 1.739 + 1.740 + ReadRegStr $0 HKCR ".xhtml" "Content Type" 1.741 + ${If} "$0" == "" 1.742 + ${WriteRegStr2} $TmpVal "$1\.xhtml" "" "xhtmlfile" 0 1.743 + ${WriteRegStr2} $TmpVal "$1\.xhtml" "Content Type" "application/xhtml+xml" 0 1.744 + ${EndIf} 1.745 + 1.746 + ; Remove possibly badly associated file types 1.747 + ${FixBadFileAssociation} ".pdf" 1.748 + ${FixBadFileAssociation} ".oga" 1.749 + ${FixBadFileAssociation} ".ogg" 1.750 + ${FixBadFileAssociation} ".ogv" 1.751 + ${FixBadFileAssociation} ".pdf" 1.752 + ${FixBadFileAssociation} ".webm" 1.753 +!macroend 1.754 +!define FixClassKeys "!insertmacro FixClassKeys" 1.755 + 1.756 +; Updates protocol handlers if their registry open command value is for this 1.757 +; install location (uses SHCTX). 1.758 +!macro UpdateProtocolHandlers 1.759 + ; Store the command to open the app with an url in a register for easy access. 1.760 + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 1.761 + StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" 1.762 + 1.763 + ; Only set the file and protocol handlers if the existing one under HKCR is 1.764 + ; for this install location. 1.765 + 1.766 + ${IsHandlerForInstallDir} "FirefoxHTML" $R9 1.767 + ${If} "$R9" == "true" 1.768 + ; An empty string is used for the 5th param because FirefoxHTML is not a 1.769 + ; protocol handler. 1.770 + ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ 1.771 + "${AppRegName} HTML Document" "" 1.772 + ${EndIf} 1.773 + 1.774 + ${IsHandlerForInstallDir} "FirefoxURL" $R9 1.775 + ${If} "$R9" == "true" 1.776 + ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" \ 1.777 + "${AppRegName} URL" "true" 1.778 + ${EndIf} 1.779 + 1.780 + ; An empty string is used for the 4th & 5th params because the following 1.781 + ; protocol handlers already have a display name and the additional keys 1.782 + ; required for a protocol handler. 1.783 + ${IsHandlerForInstallDir} "ftp" $R9 1.784 + ${If} "$R9" == "true" 1.785 + ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" 1.786 + ${EndIf} 1.787 + 1.788 + ${IsHandlerForInstallDir} "http" $R9 1.789 + ${If} "$R9" == "true" 1.790 + ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" 1.791 + ${EndIf} 1.792 + 1.793 + ${IsHandlerForInstallDir} "https" $R9 1.794 + ${If} "$R9" == "true" 1.795 + ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" 1.796 + ${EndIf} 1.797 +!macroend 1.798 +!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers" 1.799 + 1.800 +!ifdef MOZ_MAINTENANCE_SERVICE 1.801 +; Adds maintenance service certificate keys for the install dir. 1.802 +; For the cert to work, it must also be signed by a trusted cert for the user. 1.803 +!macro AddMaintCertKeys 1.804 + Push $R0 1.805 + ; Allow main Mozilla cert information for updates 1.806 + ; This call will push the needed key on the stack 1.807 + ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" 1.808 + Pop $R0 1.809 + ${If} $R0 != "" 1.810 + ; More than one certificate can be specified in a different subfolder 1.811 + ; for example: $R0\1, but each individual binary can be signed 1.812 + ; with at most one certificate. A fallback certificate can only be used 1.813 + ; if the binary is replaced with a different certificate. 1.814 + ; We always use the 64bit registry for certs. 1.815 + ${If} ${RunningX64} 1.816 + SetRegView 64 1.817 + ${EndIf} 1.818 + DeleteRegKey HKLM "$R0" 1.819 + WriteRegStr HKLM "$R0" "prefetchProcessName" "FIREFOX" 1.820 + WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}" 1.821 + WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}" 1.822 + ${If} ${RunningX64} 1.823 + SetRegView lastused 1.824 + ${EndIf} 1.825 + ClearErrors 1.826 + ${EndIf} 1.827 + ; Restore the previously used value back 1.828 + Pop $R0 1.829 +!macroend 1.830 +!define AddMaintCertKeys "!insertmacro AddMaintCertKeys" 1.831 +!endif 1.832 + 1.833 +; Removes various registry entries for reasons noted below (does not use SHCTX). 1.834 +!macro RemoveDeprecatedKeys 1.835 + StrCpy $0 "SOFTWARE\Classes" 1.836 + ; Remove support for launching gopher urls from the shell during install or 1.837 + ; update if the DefaultIcon is from firefox.exe. 1.838 + ${RegCleanAppHandler} "gopher" 1.839 + 1.840 + ; Remove support for launching chrome urls from the shell during install or 1.841 + ; update if the DefaultIcon is from firefox.exe (Bug 301073). 1.842 + ${RegCleanAppHandler} "chrome" 1.843 + 1.844 + ; Remove protocol handler registry keys added by the MS shim 1.845 + DeleteRegKey HKLM "Software\Classes\Firefox.URL" 1.846 + DeleteRegKey HKCU "Software\Classes\Firefox.URL" 1.847 + 1.848 + ; Delete gopher from Capabilities\URLAssociations if it is present. 1.849 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.850 + StrCpy $0 "Software\Clients\StartMenuInternet\$R9" 1.851 + ClearErrors 1.852 + ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher" 1.853 + ${Unless} ${Errors} 1.854 + DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher" 1.855 + ${EndUnless} 1.856 + 1.857 + ; Delete gopher from the user's UrlAssociations if it points to FirefoxURL. 1.858 + StrCpy $0 "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher" 1.859 + ReadRegStr $2 HKCU "$0\UserChoice" "Progid" 1.860 + ${If} "$2" == "FirefoxURL" 1.861 + DeleteRegKey HKCU "$0" 1.862 + ${EndIf} 1.863 +!macroend 1.864 +!define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys" 1.865 + 1.866 +; Resets Win8+ specific toast keys Windows sets. We call this on a 1.867 +; fresh install and on uninstall. 1.868 +!macro ResetWin8PromptKeys KEY PREFIX 1.869 + ${If} ${AtLeastWin8} 1.870 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.htm" 1.871 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.html" 1.872 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xht" 1.873 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xhtml" 1.874 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.shtml" 1.875 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_ftp" 1.876 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_http" 1.877 + DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_https" 1.878 + ${EndIf} 1.879 +!macroend 1.880 +!define ResetWin8PromptKeys "!insertmacro ResetWin8PromptKeys" 1.881 + 1.882 +!ifdef MOZ_METRO 1.883 +; Resets Win8+ Metro specific splash screen info. Relies 1.884 +; on AppUserModelID. 1.885 +!macro ResetWin8MetroSplash 1.886 + ${If} ${AtLeastWin8} 1.887 + ${AndIf} "$AppUserModelID" != "" 1.888 + DeleteRegKey HKCR "Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!$AppUserModelID" 1.889 + ${EndIf} 1.890 +!macroend 1.891 +!define ResetWin8MetroSplash "!insertmacro ResetWin8MetroSplash" 1.892 +!endif 1.893 + 1.894 +; Adds SE_RESTORE_NAME privs 1.895 +!macro AcquireSERestoreName 1.896 + StrCpy $R1 0 1.897 + 1.898 + System::Call "kernel32::GetCurrentProcess() i .R0" 1.899 + System::Call "advapi32::OpenProcessToken(i R0, i ${TOKEN_QUERY}|${TOKEN_ADJUST_PRIVILEGES}, \ 1.900 + *i R1R1) i .R0" 1.901 + ${If} $R0 != 0 1.902 + System::Call "advapi32::LookupPrivilegeValue(t n, t '${SE_RESTORE_NAME}', *l .R2) i .R0" 1.903 + ${If} $R0 != 0 1.904 + System::Call "*(i 1, l R2, i ${SE_PRIVILEGE_ENABLED}) i .R0" 1.905 + System::Call "advapi32::AdjustTokenPrivileges(i R1, i 0, i R0, i 0, i 0, i 0)" 1.906 + System::Free $R0 1.907 + ${EndIf} 1.908 + System::Call "kernel32::CloseHandle(i R1)" 1.909 + ${EndIf} 1.910 +!macroend 1.911 +!define AcquireSERestoreName "!insertmacro AcquireSERestoreName" 1.912 +!define un.AcquireSERestoreName "!insertmacro AcquireSERestoreName" 1.913 + 1.914 +; Mounts all user ntuser.dat files into the registry as a subkey of HKU 1.915 +!macro MountRegistryIntoHKU 1.916 + ; $0 is used as an index for HKEY_USERS enumeration 1.917 + StrCpy $0 0 1.918 + ${Do} 1.919 + EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 1.920 + ${If} $1 == "" 1.921 + ${Break} 1.922 + ${EndIf} 1.923 + ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 1.924 + System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0', t '$2\ntuser.dat')" 1.925 + System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes', t '$2\AppData\Local\Microsoft\Windows\UsrClass.dat')" 1.926 + IntOp $0 $0 + 1 1.927 + ${Loop} 1.928 +!macroend 1.929 +!define MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" 1.930 +!define un.MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" 1.931 +; 1.932 +; Unmounts all user ntuser.dat files into the registry as a subkey of HKU 1.933 +!macro UnmountRegistryIntoHKU 1.934 + ; $0 is used as an index for HKEY_USERS enumeration 1.935 + StrCpy $0 0 1.936 + ${Do} 1.937 + EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 1.938 + ${If} $1 == "" 1.939 + ${Break} 1.940 + ${EndIf} 1.941 + ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 1.942 + System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0')" 1.943 + System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes')" 1.944 + IntOp $0 $0 + 1 1.945 + ${Loop} 1.946 +!macroend 1.947 +!define UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" 1.948 +!define un.UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" 1.949 + 1.950 +; Unconditionally removes the delegate execute handler registration used to 1.951 +; launch the metro browser and misc. metro related registry values. 1.952 +!macro RemoveDEHRegistration DELEGATE_EXECUTE_HANDLER_ID \ 1.953 + APP_USER_MODEL_ID \ 1.954 + PROTOCOL_ACTIVATION_ID \ 1.955 + FILE_ACTIVATION_ID 1.956 + ${AcquireSERestoreName} 1.957 + ${MountRegistryIntoHKU} 1.958 + 1.959 + ; $0 is used as an index for HKEY_USERS enumeration 1.960 + StrCpy $0 0 1.961 + 1.962 + ${Do} 1.963 + EnumRegKey $1 HKU "" $0 1.964 + ${If} $1 == "" 1.965 + ${Break} 1.966 + ${EndIf} 1.967 + 1.968 + ClearErrors 1.969 + ${WordFind} "$1" "_Classes" "E#" $3 1.970 + ${Unless} ${Errors} 1.971 + ; remove the app user model id root registration. We don't need this 1.972 + ; here anymore, we just use it for tray registrationdown in widget, 1.973 + ; which we read out of the mozilla keys. 1.974 + ${If} "${APP_USER_MODEL_ID}" != "" 1.975 + ; The removal of this key intermittently fails, so do the best we can in cleanup 1.976 + DeleteRegValue HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" 1.977 + DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open" 1.978 + DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell" 1.979 + DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe" 1.980 + DeleteRegKey HKU "$1\\${APP_USER_MODEL_ID}" 1.981 + ${EndIf} 1.982 + ; 1.983 + ; Remove delegate execute handler clsid registration 1.984 + DeleteRegKey HKU "$1\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" 1.985 + 1.986 + ; Remove protocol and file delegate execute handler id assoc 1.987 + DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" 1.988 + DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}" "AppUserModelID" 1.989 + 1.990 + ; Remove delegate execute application registry keys 1.991 + DeleteRegKey HKU "$1\${PROTOCOL_ACTIVATION_ID}\Application" 1.992 + DeleteRegKey HKU "$1\${FILE_ACTIVATION_ID}\Application" 1.993 + 1.994 + ; Remove misc. shell open info 1.995 + DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" 1.996 + DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open" "CommandId" 1.997 + DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" 1.998 + DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" 1.999 + 1.1000 + ; remove metro browser splash image data 1.1001 + DeleteRegKey HKU "$1\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!${APP_USER_MODEL_ID}" 1.1002 + ${Else} 1.1003 + ; misc. Metro keys 1.1004 + DeleteRegKey HKU "$1\Software\Mozilla\Firefox\Metro" 1.1005 + DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "CEHDump" 1.1006 + DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroD3DAvailable" 1.1007 + DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroLastAHE" 1.1008 + ${ResetWin8PromptKeys} "HKU" "$1\" 1.1009 + ${EndIf} 1.1010 + IntOp $0 $0 + 1 1.1011 + ${Loop} 1.1012 + ${UnmountRegistryIntoHKU} 1.1013 + 1.1014 + ; The removal of this key intermittently fails, so do the best we can in cleanup 1.1015 + ${If} "${APP_USER_MODEL_ID}" != "" 1.1016 + DeleteRegValue HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" 1.1017 + DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" 1.1018 + DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" 1.1019 + DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe" 1.1020 + DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}" 1.1021 + ${EndIf} 1.1022 + 1.1023 + ; Remove HKLM entries 1.1024 + DeleteRegKey HKLM "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" 1.1025 + DeleteRegKey HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" 1.1026 + DeleteRegKey HKLM "Software\Classes\${FILE_ACTIVATION_ID}\Application" 1.1027 + DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" 1.1028 + DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" 1.1029 + DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" 1.1030 + DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" 1.1031 + DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" 1.1032 + DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" 1.1033 + 1.1034 + ClearErrors 1.1035 +!macroend 1.1036 + 1.1037 +!define RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" 1.1038 +!define un.RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" 1.1039 + 1.1040 +; Removes various directories and files for reasons noted below. 1.1041 +!macro RemoveDeprecatedFiles 1.1042 + ; Some users are ending up with unpacked chrome instead of omni.ja. This 1.1043 + ; causes Firefox to break badly after upgrading from Firefox 31, see bug 1.1044 + ; 1063052. Removing the chrome.manifest from the install directory causes 1.1045 + ; Firefox to use the updated omni.ja so it won't crash. 1.1046 + ${If} ${FileExists} "$INSTDIR\chrome.manifest" 1.1047 + Delete "$INSTDIR\chrome.manifest" 1.1048 + ${EndIf} 1.1049 + 1.1050 + ; Remove talkback if it is present (remove after bug 386760 is fixed) 1.1051 + ${If} ${FileExists} "$INSTDIR\extensions\talkback@mozilla.org" 1.1052 + RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org" 1.1053 + ${EndIf} 1.1054 + 1.1055 + ; Remove the Java Console extension (bug 597235) 1.1056 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" 1.1057 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" 1.1058 + ${EndIf} 1.1059 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" 1.1060 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" 1.1061 + ${EndIf} 1.1062 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" 1.1063 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" 1.1064 + ${EndIf} 1.1065 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" 1.1066 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" 1.1067 + ${EndIf} 1.1068 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" 1.1069 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" 1.1070 + ${EndIf} 1.1071 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" 1.1072 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" 1.1073 + ${EndIf} 1.1074 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" 1.1075 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" 1.1076 + ${EndIf} 1.1077 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" 1.1078 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" 1.1079 + ${EndIf} 1.1080 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" 1.1081 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" 1.1082 + ${EndIf} 1.1083 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" 1.1084 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" 1.1085 + ${EndIf} 1.1086 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" 1.1087 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" 1.1088 + ${EndIf} 1.1089 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" 1.1090 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" 1.1091 + ${EndIf} 1.1092 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" 1.1093 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" 1.1094 + ${EndIf} 1.1095 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" 1.1096 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" 1.1097 + ${EndIf} 1.1098 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" 1.1099 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" 1.1100 + ${EndIf} 1.1101 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" 1.1102 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" 1.1103 + ${EndIf} 1.1104 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" 1.1105 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" 1.1106 + ${EndIf} 1.1107 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" 1.1108 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" 1.1109 + ${EndIf} 1.1110 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" 1.1111 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" 1.1112 + ${EndIf} 1.1113 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" 1.1114 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" 1.1115 + ${EndIf} 1.1116 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" 1.1117 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" 1.1118 + ${EndIf} 1.1119 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" 1.1120 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" 1.1121 + ${EndIf} 1.1122 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" 1.1123 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" 1.1124 + ${EndIf} 1.1125 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" 1.1126 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" 1.1127 + ${EndIf} 1.1128 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" 1.1129 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" 1.1130 + ${EndIf} 1.1131 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" 1.1132 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" 1.1133 + ${EndIf} 1.1134 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" 1.1135 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" 1.1136 + ${EndIf} 1.1137 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" 1.1138 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" 1.1139 + ${EndIf} 1.1140 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" 1.1141 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" 1.1142 + ${EndIf} 1.1143 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" 1.1144 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" 1.1145 + ${EndIf} 1.1146 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" 1.1147 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" 1.1148 + ${EndIf} 1.1149 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" 1.1150 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" 1.1151 + ${EndIf} 1.1152 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" 1.1153 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" 1.1154 + ${EndIf} 1.1155 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" 1.1156 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" 1.1157 + ${EndIf} 1.1158 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" 1.1159 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" 1.1160 + ${EndIf} 1.1161 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" 1.1162 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" 1.1163 + ${EndIf} 1.1164 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" 1.1165 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" 1.1166 + ${EndIf} 1.1167 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" 1.1168 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" 1.1169 + ${EndIf} 1.1170 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" 1.1171 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" 1.1172 + ${EndIf} 1.1173 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" 1.1174 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" 1.1175 + ${EndIf} 1.1176 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" 1.1177 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" 1.1178 + ${EndIf} 1.1179 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" 1.1180 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" 1.1181 + ${EndIf} 1.1182 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" 1.1183 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" 1.1184 + ${EndIf} 1.1185 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" 1.1186 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" 1.1187 + ${EndIf} 1.1188 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" 1.1189 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" 1.1190 + ${EndIf} 1.1191 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" 1.1192 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" 1.1193 + ${EndIf} 1.1194 + ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" 1.1195 + RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" 1.1196 + ${EndIf} 1.1197 +!macroend 1.1198 +!define RemoveDeprecatedFiles "!insertmacro RemoveDeprecatedFiles" 1.1199 + 1.1200 +; Converts specific partner distribution.ini from ansi to utf-8 (bug 882989) 1.1201 +!macro FixDistributionsINI 1.1202 + StrCpy $1 "$INSTDIR\distribution\distribution.ini" 1.1203 + StrCpy $2 "$INSTDIR\distribution\utf8fix" 1.1204 + StrCpy $0 "0" ; Default to not attempting to fix 1.1205 + 1.1206 + ; Check if the distribution.ini settings are for a partner build that needs 1.1207 + ; to have its distribution.ini converted from ansi to utf-8. 1.1208 + ${If} ${FileExists} "$1" 1.1209 + ${Unless} ${FileExists} "$2" 1.1210 + ReadINIStr $3 "$1" "Preferences" "app.distributor" 1.1211 + ${If} "$3" == "yahoo" 1.1212 + ReadINIStr $3 "$1" "Preferences" "app.distributor.channel" 1.1213 + ${If} "$3" == "de" 1.1214 + ${OrIf} "$3" == "es" 1.1215 + ${OrIf} "$3" == "e1" 1.1216 + ${OrIf} "$3" == "mx" 1.1217 + StrCpy $0 "1" 1.1218 + ${EndIf} 1.1219 + ${EndIf} 1.1220 + ; Create the utf8fix so this only runs once 1.1221 + FileOpen $3 "$2" w 1.1222 + FileClose $3 1.1223 + ${EndUnless} 1.1224 + ${EndIf} 1.1225 + 1.1226 + ${If} "$0" == "1" 1.1227 + StrCpy $0 "0" 1.1228 + ClearErrors 1.1229 + ReadINIStr $3 "$1" "Global" "version" 1.1230 + ${Unless} ${Errors} 1.1231 + StrCpy $4 "$3" 2 1.1232 + ${If} "$4" == "1." 1.1233 + StrCpy $4 "$3" "" 2 ; Everything after "1." 1.1234 + ${If} $4 < 23 1.1235 + StrCpy $0 "1" 1.1236 + ${EndIf} 1.1237 + ${EndIf} 1.1238 + ${EndUnless} 1.1239 + ${EndIf} 1.1240 + 1.1241 + ${If} "$0" == "1" 1.1242 + ClearErrors 1.1243 + FileOpen $3 "$1" r 1.1244 + ${If} ${Errors} 1.1245 + FileClose $3 1.1246 + ${Else} 1.1247 + StrCpy $2 "$INSTDIR\distribution\distribution.new" 1.1248 + ClearErrors 1.1249 + FileOpen $4 "$2" w 1.1250 + ${If} ${Errors} 1.1251 + FileClose $3 1.1252 + FileClose $4 1.1253 + ${Else} 1.1254 + StrCpy $0 "0" ; Default to not replacing the original distribution.ini 1.1255 + ${Do} 1.1256 + FileReadByte $3 $5 1.1257 + ${If} $5 == "" 1.1258 + ${Break} 1.1259 + ${EndIf} 1.1260 + ${If} $5 == 233 ; ansi é 1.1261 + StrCpy $0 "1" 1.1262 + FileWriteByte $4 195 1.1263 + FileWriteByte $4 169 1.1264 + ${ElseIf} $5 == 241 ; ansi ñ 1.1265 + StrCpy $0 "1" 1.1266 + FileWriteByte $4 195 1.1267 + FileWriteByte $4 177 1.1268 + ${ElseIf} $5 == 252 ; ansi ü 1.1269 + StrCpy $0 "1" 1.1270 + FileWriteByte $4 195 1.1271 + FileWriteByte $4 188 1.1272 + ${ElseIf} $5 < 128 1.1273 + FileWriteByte $4 $5 1.1274 + ${EndIf} 1.1275 + ${Loop} 1.1276 + FileClose $3 1.1277 + FileClose $4 1.1278 + ${If} "$0" == "1" 1.1279 + ClearErrors 1.1280 + Rename "$1" "$1.bak" 1.1281 + ${Unless} ${Errors} 1.1282 + Rename "$2" "$1" 1.1283 + Delete "$1.bak" 1.1284 + ${EndUnless} 1.1285 + ${Else} 1.1286 + Delete "$2" 1.1287 + ${EndIf} 1.1288 + ${EndIf} 1.1289 + ${EndIf} 1.1290 + ${EndIf} 1.1291 +!macroend 1.1292 +!define FixDistributionsINI "!insertmacro FixDistributionsINI" 1.1293 + 1.1294 +; Adds a pinned shortcut to Task Bar on update for Windows 7 and above if this 1.1295 +; macro has never been called before and the application is default (see 1.1296 +; PinToTaskBar for more details). 1.1297 +; Since defaults handling is handled by Windows in Win8 and later, we always 1.1298 +; attempt to pin a taskbar on that OS. If Windows sets the defaults at 1.1299 +; installation time, then we don't get the opportunity to run this code at 1.1300 +; that time. 1.1301 +!macro MigrateTaskBarShortcut 1.1302 + ${GetShortcutsLogPath} $0 1.1303 + ${If} ${FileExists} "$0" 1.1304 + ClearErrors 1.1305 + ReadINIStr $1 "$0" "TASKBAR" "Migrated" 1.1306 + ${If} ${Errors} 1.1307 + ClearErrors 1.1308 + WriteIniStr "$0" "TASKBAR" "Migrated" "true" 1.1309 + ${If} ${AtLeastWin7} 1.1310 + ; No need to check the default on Win8 and later 1.1311 + ${If} ${AtMostWin2008R2} 1.1312 + ; Check if the Firefox is the http handler for this user 1.1313 + SetShellVarContext current ; Set SHCTX to the current user 1.1314 + ${IsHandlerForInstallDir} "http" $R9 1.1315 + ${If} $TmpVal == "HKLM" 1.1316 + SetShellVarContext all ; Set SHCTX to all users 1.1317 + ${EndIf} 1.1318 + ${EndIf} 1.1319 + ${If} "$R9" == "true" 1.1320 + ${OrIf} ${AtLeastWin8} 1.1321 + ${PinToTaskBar} 1.1322 + ${EndIf} 1.1323 + ${EndIf} 1.1324 + ${EndIf} 1.1325 + ${EndIf} 1.1326 +!macroend 1.1327 +!define MigrateTaskBarShortcut "!insertmacro MigrateTaskBarShortcut" 1.1328 + 1.1329 +; Adds a pinned Task Bar shortcut on Windows 7 if there isn't one for the main 1.1330 +; application executable already. Existing pinned shortcuts for the same 1.1331 +; application model ID must be removed first to prevent breaking the pinned 1.1332 +; item's lists but multiple installations with the same application model ID is 1.1333 +; an edgecase. If removing existing pinned shortcuts with the same application 1.1334 +; model ID removes a pinned pinned Start Menu shortcut this will also add a 1.1335 +; pinned Start Menu shortcut. 1.1336 +!macro PinToTaskBar 1.1337 + ${If} ${AtLeastWin7} 1.1338 + StrCpy $8 "false" ; Whether a shortcut had to be created 1.1339 + ${IsPinnedToTaskBar} "$INSTDIR\${FileMainEXE}" $R9 1.1340 + ${If} "$R9" == "false" 1.1341 + ; Find an existing Start Menu shortcut or create one to use for pinning 1.1342 + ${GetShortcutsLogPath} $0 1.1343 + ${If} ${FileExists} "$0" 1.1344 + ClearErrors 1.1345 + ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" 1.1346 + ${Unless} ${Errors} 1.1347 + SetShellVarContext all ; Set SHCTX to all users 1.1348 + ${Unless} ${FileExists} "$SMPROGRAMS\$1" 1.1349 + SetShellVarContext current ; Set SHCTX to the current user 1.1350 + ${Unless} ${FileExists} "$SMPROGRAMS\$1" 1.1351 + StrCpy $8 "true" 1.1352 + CreateShortCut "$SMPROGRAMS\$1" "$INSTDIR\${FileMainEXE}" 1.1353 + ${If} ${FileExists} "$SMPROGRAMS\$1" 1.1354 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \ 1.1355 + "$INSTDIR" 1.1356 + ${If} "$AppUserModelID" != "" 1.1357 + ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" "true" 1.1358 + ${EndIf} 1.1359 + ${EndIf} 1.1360 + ${EndUnless} 1.1361 + ${EndUnless} 1.1362 + 1.1363 + ${If} ${FileExists} "$SMPROGRAMS\$1" 1.1364 + ; Count of Start Menu pinned shortcuts before unpinning. 1.1365 + ${PinnedToStartMenuLnkCount} $R9 1.1366 + 1.1367 + ; Having multiple shortcuts pointing to different installations with 1.1368 + ; the same AppUserModelID (e.g. side by side installations of the 1.1369 + ; same version) will make the TaskBar shortcut's lists into an bad 1.1370 + ; state where the lists are not shown. To prevent this first 1.1371 + ; uninstall the pinned item. 1.1372 + ApplicationID::UninstallPinnedItem "$SMPROGRAMS\$1" 1.1373 + 1.1374 + ; Count of Start Menu pinned shortcuts after unpinning. 1.1375 + ${PinnedToStartMenuLnkCount} $R8 1.1376 + 1.1377 + ; If there is a change in the number of Start Menu pinned shortcuts 1.1378 + ; assume that unpinning unpinned a side by side installation from 1.1379 + ; the Start Menu and pin this installation to the Start Menu. 1.1380 + ${Unless} $R8 == $R9 1.1381 + ; Pin the shortcut to the Start Menu. 5381 is the shell32.dll 1.1382 + ; resource id for the "Pin to Start Menu" string. 1.1383 + InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5381" 1.1384 + ${EndUnless} 1.1385 + 1.1386 + ; Pin the shortcut to the TaskBar. 5386 is the shell32.dll resource 1.1387 + ; id for the "Pin to Taskbar" string. 1.1388 + InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5386" 1.1389 + 1.1390 + ; Delete the shortcut if it was created 1.1391 + ${If} "$8" == "true" 1.1392 + Delete "$SMPROGRAMS\$1" 1.1393 + ${EndIf} 1.1394 + ${EndIf} 1.1395 + 1.1396 + ${If} $TmpVal == "HKCU" 1.1397 + SetShellVarContext current ; Set SHCTX to the current user 1.1398 + ${Else} 1.1399 + SetShellVarContext all ; Set SHCTX to all users 1.1400 + ${EndIf} 1.1401 + ${EndUnless} 1.1402 + ${EndIf} 1.1403 + ${EndIf} 1.1404 + ${EndIf} 1.1405 +!macroend 1.1406 +!define PinToTaskBar "!insertmacro PinToTaskBar" 1.1407 + 1.1408 +; Adds a shortcut to the root of the Start Menu Programs directory if the 1.1409 +; application's Start Menu Programs directory exists with a shortcut pointing to 1.1410 +; this installation directory. This will also remove the old shortcuts and the 1.1411 +; application's Start Menu Programs directory by calling the RemoveStartMenuDir 1.1412 +; macro. 1.1413 +!macro MigrateStartMenuShortcut 1.1414 + ${GetShortcutsLogPath} $0 1.1415 + ${If} ${FileExists} "$0" 1.1416 + ClearErrors 1.1417 + ReadINIStr $5 "$0" "SMPROGRAMS" "RelativePathToDir" 1.1418 + ${Unless} ${Errors} 1.1419 + ClearErrors 1.1420 + ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" 1.1421 + ${If} ${Errors} 1.1422 + ; The STARTMENU ini section doesn't exist. 1.1423 + ${LogStartMenuShortcut} "${BrandFullName}.lnk" 1.1424 + ${GetLongPath} "$SMPROGRAMS" $2 1.1425 + ${GetLongPath} "$2\$5" $1 1.1426 + ${If} "$1" != "" 1.1427 + ClearErrors 1.1428 + ReadINIStr $3 "$0" "SMPROGRAMS" "Shortcut0" 1.1429 + ${Unless} ${Errors} 1.1430 + ${If} ${FileExists} "$1\$3" 1.1431 + ShellLink::GetShortCutTarget "$1\$3" 1.1432 + Pop $4 1.1433 + ${If} "$INSTDIR\${FileMainEXE}" == "$4" 1.1434 + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.1435 + "$INSTDIR\${FileMainEXE}" 1.1436 + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" 1.1437 + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.1438 + "$INSTDIR" 1.1439 + ${If} ${AtLeastWin7} 1.1440 + ${AndIf} "$AppUserModelID" != "" 1.1441 + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" \ 1.1442 + "$AppUserModelID" "true" 1.1443 + ${EndIf} 1.1444 + ${EndIf} 1.1445 + ${EndIf} 1.1446 + ${EndIf} 1.1447 + ${EndUnless} 1.1448 + ${EndIf} 1.1449 + ${EndIf} 1.1450 + ; Remove the application's Start Menu Programs directory, shortcuts, and 1.1451 + ; ini section. 1.1452 + ${RemoveStartMenuDir} 1.1453 + ${EndUnless} 1.1454 + ${EndIf} 1.1455 +!macroend 1.1456 +!define MigrateStartMenuShortcut "!insertmacro MigrateStartMenuShortcut" 1.1457 + 1.1458 +; Removes the application's start menu directory along with its shortcuts if 1.1459 +; they exist and if they exist creates a start menu shortcut in the root of the 1.1460 +; start menu directory (bug 598779). If the application's start menu directory 1.1461 +; is not empty after removing the shortucts the directory will not be removed 1.1462 +; since these additional items were not created by the installer (uses SHCTX). 1.1463 +!macro RemoveStartMenuDir 1.1464 + ${GetShortcutsLogPath} $0 1.1465 + ${If} ${FileExists} "$0" 1.1466 + ; Delete Start Menu Programs shortcuts, directory if it is empty, and 1.1467 + ; parent directories if they are empty up to but not including the start 1.1468 + ; menu directory. 1.1469 + ${GetLongPath} "$SMPROGRAMS" $1 1.1470 + ClearErrors 1.1471 + ReadINIStr $2 "$0" "SMPROGRAMS" "RelativePathToDir" 1.1472 + ${Unless} ${Errors} 1.1473 + ${GetLongPath} "$1\$2" $2 1.1474 + ${If} "$2" != "" 1.1475 + ; Delete shortucts in the Start Menu Programs directory. 1.1476 + StrCpy $3 0 1.1477 + ${Do} 1.1478 + ClearErrors 1.1479 + ReadINIStr $4 "$0" "SMPROGRAMS" "Shortcut$3" 1.1480 + ; Stop if there are no more entries 1.1481 + ${If} ${Errors} 1.1482 + ${ExitDo} 1.1483 + ${EndIf} 1.1484 + ${If} ${FileExists} "$2\$4" 1.1485 + ShellLink::GetShortCutTarget "$2\$4" 1.1486 + Pop $5 1.1487 + ${If} "$INSTDIR\${FileMainEXE}" == "$5" 1.1488 + Delete "$2\$4" 1.1489 + ${EndIf} 1.1490 + ${EndIf} 1.1491 + IntOp $3 $3 + 1 ; Increment the counter 1.1492 + ${Loop} 1.1493 + ; Delete Start Menu Programs directory and parent directories 1.1494 + ${Do} 1.1495 + ; Stop if the current directory is the start menu directory 1.1496 + ${If} "$1" == "$2" 1.1497 + ${ExitDo} 1.1498 + ${EndIf} 1.1499 + ClearErrors 1.1500 + RmDir "$2" 1.1501 + ; Stop if removing the directory failed 1.1502 + ${If} ${Errors} 1.1503 + ${ExitDo} 1.1504 + ${EndIf} 1.1505 + ${GetParent} "$2" $2 1.1506 + ${Loop} 1.1507 + ${EndIf} 1.1508 + DeleteINISec "$0" "SMPROGRAMS" 1.1509 + ${EndUnless} 1.1510 + ${EndIf} 1.1511 +!macroend 1.1512 +!define RemoveStartMenuDir "!insertmacro RemoveStartMenuDir" 1.1513 + 1.1514 +; Creates the shortcuts log ini file with the appropriate entries if it doesn't 1.1515 +; already exist. 1.1516 +!macro CreateShortcutsLog 1.1517 + ${GetShortcutsLogPath} $0 1.1518 + ${Unless} ${FileExists} "$0" 1.1519 + ${LogStartMenuShortcut} "${BrandFullName}.lnk" 1.1520 + ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" 1.1521 + ${LogDesktopShortcut} "${BrandFullName}.lnk" 1.1522 + ${EndUnless} 1.1523 +!macroend 1.1524 +!define CreateShortcutsLog "!insertmacro CreateShortcutsLog" 1.1525 + 1.1526 +; The files to check if they are in use during (un)install so the restart is 1.1527 +; required message is displayed. All files must be located in the $INSTDIR 1.1528 +; directory. 1.1529 +!macro PushFilesToCheck 1.1530 + ; The first string to be pushed onto the stack MUST be "end" to indicate 1.1531 + ; that there are no more files to check in $INSTDIR and the last string 1.1532 + ; should be ${FileMainEXE} so if it is in use the CheckForFilesInUse macro 1.1533 + ; returns after the first check. 1.1534 + Push "end" 1.1535 + Push "AccessibleMarshal.dll" 1.1536 + Push "freebl3.dll" 1.1537 + Push "nssckbi.dll" 1.1538 + Push "nspr4.dll" 1.1539 + Push "nssdbm3.dll" 1.1540 + Push "mozsqlite3.dll" 1.1541 +!ifdef MOZ_CONTENT_SANDBOX 1.1542 + Push "sandboxbroker.dll" 1.1543 +!endif 1.1544 + Push "xpcom.dll" 1.1545 + Push "crashreporter.exe" 1.1546 + Push "updater.exe" 1.1547 + Push "${FileMainEXE}" 1.1548 +!macroend 1.1549 +!define PushFilesToCheck "!insertmacro PushFilesToCheck" 1.1550 + 1.1551 +; Sets this installation as the default browser by setting the registry keys 1.1552 +; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS 1.1553 +; plugin for Vista and above. This is a function instead of a macro so it is 1.1554 +; easily called from an elevated instance of the binary. Since this can be 1.1555 +; called by an elevated instance logging is not performed in this function. 1.1556 +Function SetAsDefaultAppUserHKCU 1.1557 + ; Only set as the user's StartMenuInternet browser if the StartMenuInternet 1.1558 + ; registry keys are for this install. 1.1559 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.1560 + ClearErrors 1.1561 + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" 1.1562 + ${If} ${Errors} 1.1563 + ${OrIf} ${AtMostWin2008R2} 1.1564 + ClearErrors 1.1565 + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" 1.1566 + ${EndIf} 1.1567 + ${Unless} ${Errors} 1.1568 + ${GetPathFromString} "$0" $0 1.1569 + ${GetParent} "$0" $0 1.1570 + ${If} ${FileExists} "$0" 1.1571 + ${GetLongPath} "$0" $0 1.1572 + ${If} "$0" == "$INSTDIR" 1.1573 + WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9" 1.1574 + ${EndIf} 1.1575 + ${EndIf} 1.1576 + ${EndUnless} 1.1577 + 1.1578 + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) 1.1579 + 1.1580 + ${If} ${AtLeastWin8} 1.1581 + ${SetStartMenuInternet} "HKCU" 1.1582 + ${FixShellIconHandler} "HKCU" 1.1583 + ${FixClassKeys} ; Does not use SHCTX 1.1584 + Call RegisterStartMenuTile 1.1585 + ${EndIf} 1.1586 + 1.1587 + ${SetHandlers} 1.1588 + 1.1589 + ${If} ${AtLeastWinVista} 1.1590 + ; Only register as the handler on Vista and above if the app registry name 1.1591 + ; exists under the RegisteredApplications registry key. The protocol and 1.1592 + ; file handlers set previously at the user level will associate this install 1.1593 + ; as the default browser. 1.1594 + ClearErrors 1.1595 + ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}" 1.1596 + ${Unless} ${Errors} 1.1597 + ; This is all protected by a user choice hash in Windows 8 so it won't 1.1598 + ; help, but it also won't hurt. 1.1599 + AppAssocReg::SetAppAsDefaultAll "${AppRegName}" 1.1600 + ${EndUnless} 1.1601 + ${EndIf} 1.1602 + ${RemoveDeprecatedKeys} 1.1603 + ${PinToTaskBar} 1.1604 +FunctionEnd 1.1605 + 1.1606 +; Helper for updating the shortcut application model IDs. 1.1607 +Function FixShortcutAppModelIDs 1.1608 + ${If} ${AtLeastWin7} 1.1609 + ${AndIf} "$AppUserModelID" != "" 1.1610 + ${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $0 1.1611 + ${EndIf} 1.1612 +FunctionEnd 1.1613 + 1.1614 +; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to 1.1615 +; this function only being used by the uninstaller.nsi. 1.1616 +!ifdef NO_LOG 1.1617 + 1.1618 +Function SetAsDefaultAppUser 1.1619 + ; On Win8, we want to avoid having a UAC prompt since we'll already have 1.1620 + ; another action for control panel default browser selection popping up 1.1621 + ; to the user. Win8 is the first OS where the start menu keys can be 1.1622 + ; added into HKCU. The call to SetAsDefaultAppUserHKCU will have already 1.1623 + ; set the HKCU keys for SetStartMenuInternet. 1.1624 + ${If} ${AtLeastWin8} 1.1625 + ; Check if this is running in an elevated process 1.1626 + ClearErrors 1.1627 + ${GetParameters} $0 1.1628 + ${GetOptions} "$0" "/UAC:" $0 1.1629 + ${If} ${Errors} ; Not elevated 1.1630 + Call SetAsDefaultAppUserHKCU 1.1631 + ${Else} ; Elevated - execute the function in the unelevated process 1.1632 + GetFunctionAddress $0 SetAsDefaultAppUserHKCU 1.1633 + UAC::ExecCodeSegment $0 1.1634 + ${EndIf} 1.1635 + Return ; Nothing more needs to be done 1.1636 + ${EndIf} 1.1637 + 1.1638 + ; Before Win8, it is only possible to set this installation of the application 1.1639 + ; as the StartMenuInternet handler if it was added to the HKLM 1.1640 + ; StartMenuInternet registry keys. 1.1641 + ; http://support.microsoft.com/kb/297878 1.1642 + 1.1643 + ; Check if this install location registered as the StartMenuInternet client 1.1644 + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 1.1645 + ClearErrors 1.1646 + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" 1.1647 + ${If} ${Errors} 1.1648 + ${OrIf} ${AtMostWin2008R2} 1.1649 + ClearErrors 1.1650 + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" 1.1651 + ${EndIf} 1.1652 + 1.1653 + ${Unless} ${Errors} 1.1654 + ${GetPathFromString} "$0" $0 1.1655 + ${GetParent} "$0" $0 1.1656 + ${If} ${FileExists} "$0" 1.1657 + ${GetLongPath} "$0" $0 1.1658 + ${If} "$0" == "$INSTDIR" 1.1659 + ; Check if this is running in an elevated process 1.1660 + ClearErrors 1.1661 + ${GetParameters} $0 1.1662 + ${GetOptions} "$0" "/UAC:" $0 1.1663 + ${If} ${Errors} ; Not elevated 1.1664 + Call SetAsDefaultAppUserHKCU 1.1665 + ${Else} ; Elevated - execute the function in the unelevated process 1.1666 + GetFunctionAddress $0 SetAsDefaultAppUserHKCU 1.1667 + UAC::ExecCodeSegment $0 1.1668 + ${EndIf} 1.1669 + Return ; Nothing more needs to be done 1.1670 + ${EndIf} 1.1671 + ${EndIf} 1.1672 + ${EndUnless} 1.1673 + 1.1674 + ; The code after ElevateUAC won't be executed on Vista and above when the 1.1675 + ; user: 1.1676 + ; a) is a member of the administrators group (e.g. elevation is required) 1.1677 + ; b) is not a member of the administrators group and chooses to elevate 1.1678 + ${ElevateUAC} 1.1679 + 1.1680 + ${SetStartMenuInternet} "HKLM" 1.1681 + 1.1682 + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) 1.1683 + 1.1684 + ${FixClassKeys} ; Does not use SHCTX 1.1685 + ${FixShellIconHandler} "HKLM" 1.1686 + ${RemoveDeprecatedKeys} ; Does not use SHCTX 1.1687 + 1.1688 + ClearErrors 1.1689 + ${GetParameters} $0 1.1690 + ${GetOptions} "$0" "/UAC:" $0 1.1691 + ${If} ${Errors} 1.1692 + Call SetAsDefaultAppUserHKCU 1.1693 + ${Else} 1.1694 + GetFunctionAddress $0 SetAsDefaultAppUserHKCU 1.1695 + UAC::ExecCodeSegment $0 1.1696 + ${EndIf} 1.1697 +FunctionEnd 1.1698 +!define SetAsDefaultAppUser "Call SetAsDefaultAppUser" 1.1699 + 1.1700 +!endif ; NO_LOG