michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ; The registration ID of the COM server which is used for choosing wether michael@0: ; to launch the Win8 metro browser or desktop browser. michael@0: !define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} michael@0: ; michael@0: ; Defines for adjust token privs and for enumerating keys michael@0: !ifndef TOKEN_QUERY michael@0: !define TOKEN_QUERY 0x0008 michael@0: !endif michael@0: !ifndef TOKEN_ADJUST_PRIVILEGES michael@0: !define TOKEN_ADJUST_PRIVILEGES 0x0020 michael@0: !endif michael@0: !ifndef SE_RESTORE_NAME michael@0: !define SE_RESTORE_NAME SeRestorePrivilege michael@0: !endif michael@0: !ifndef SE_PRIVILEGE_ENABLED michael@0: !define SE_PRIVILEGE_ENABLED 0x00000002 michael@0: !endif michael@0: !ifndef HKEY_USERS michael@0: !define HKEY_USERS 0x80000003 michael@0: !endif michael@0: michael@0: ; Does metro registration for the command execute handler michael@0: Function RegisterCEH michael@0: !ifdef MOZ_METRO michael@0: ${If} ${AtLeastWin8} michael@0: ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: "$INSTDIR\CommandExecuteHandler.exe" \ michael@0: $AppUserModelID \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${EndIf} michael@0: !endif michael@0: FunctionEnd michael@0: michael@0: ; If we're in Win8 make sure we have a start menu shortcut and that it has michael@0: ; the correct AppuserModelID so that the Metro browser has a Metro tile. michael@0: Function RegisterStartMenuTile michael@0: !ifdef MOZ_METRO michael@0: ${If} ${AtLeastWin8} michael@0: CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !endif michael@0: FunctionEnd michael@0: michael@0: !macro PostUpdate michael@0: michael@0: ; PostUpdate is called from both session 0 and from the user session michael@0: ; for service updates, make sure that we only register with the user session michael@0: ; Otherwise ApplicationID::Set can fail intermittently with a file in use error. michael@0: System::Call "kernel32::GetCurrentProcessId() i.r0" michael@0: System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)" michael@0: michael@0: ; Determine if we're the protected UserChoice default or not. If so fix the michael@0: ; start menu tile. In case there are 2 Firefox installations, we only do michael@0: ; this if the application being updated is the default. michael@0: ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" michael@0: ${If} $0 == "FirefoxURL" michael@0: ${AndIf} $9 != 0 ; We're not running in session 0 michael@0: ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "" michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $0 michael@0: ${If} ${FileExists} "$0" michael@0: ${GetLongPath} "$0" $0 michael@0: ${EndIf} michael@0: ${If} "$0" == "$INSTDIR" michael@0: ; Win8 specific registration michael@0: Call RegisterStartMenuTile michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${CreateShortcutsLog} michael@0: michael@0: ; Remove registry entries for non-existent apps and for apps that point to our michael@0: ; install location in the Software\Mozilla key and uninstall registry entries michael@0: ; that point to our install location for both HKCU and HKLM. michael@0: SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) michael@0: ${RegCleanMain} "Software\Mozilla" michael@0: ${RegCleanUninstall} michael@0: ${UpdateProtocolHandlers} michael@0: michael@0: ; setup the application model id registration value michael@0: ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" michael@0: michael@0: ; Win7 taskbar and start menu link maintenance michael@0: Call FixShortcutAppModelIDs michael@0: michael@0: ClearErrors michael@0: WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" michael@0: ${If} ${Errors} michael@0: StrCpy $TmpVal "HKCU" ; used primarily for logging michael@0: ${Else} michael@0: SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) michael@0: DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" michael@0: StrCpy $TmpVal "HKLM" ; used primarily for logging michael@0: ${RegCleanMain} "Software\Mozilla" michael@0: ${RegCleanUninstall} michael@0: ${UpdateProtocolHandlers} michael@0: ${FixShellIconHandler} "HKLM" michael@0: ${SetAppLSPCategories} ${LSP_CATEGORIES} michael@0: michael@0: ; Win7 taskbar and start menu link maintenance michael@0: Call FixShortcutAppModelIDs michael@0: michael@0: ; Only update the Clients\StartMenuInternet registry key values in HKLM if michael@0: ; they don't exist or this installation is the same as the one set in those michael@0: ; keys. michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $1 michael@0: ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $0 michael@0: ${If} ${FileExists} "$0" michael@0: ${GetLongPath} "$0" $0 michael@0: ${EndIf} michael@0: ${If} "$0" == "$INSTDIR" michael@0: ${SetStartMenuInternet} "HKLM" michael@0: ${EndIf} michael@0: michael@0: ; Only update the Clients\StartMenuInternet registry key values in HKCU if michael@0: ; they don't exist or this installation is the same as the one set in those michael@0: ; keys. This is only done in Windows 8 to avoid a UAC prompt. michael@0: ${If} ${AtLeastWin8} michael@0: ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $0 michael@0: ${If} ${FileExists} "$0" michael@0: ${GetLongPath} "$0" $0 michael@0: ${EndIf} michael@0: ${If} "$0" == "$INSTDIR" michael@0: ${SetStartMenuInternet} "HKCU" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" michael@0: ${If} "$0" != "${GREVersion}" michael@0: WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ; Migrate the application's Start Menu directory to a single shortcut in the michael@0: ; root of the Start Menu Programs directory. michael@0: ${MigrateStartMenuShortcut} michael@0: michael@0: ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). michael@0: ${MigrateTaskBarShortcut} michael@0: michael@0: ${RemoveDeprecatedKeys} michael@0: michael@0: ${SetAppKeys} michael@0: ${FixClassKeys} michael@0: ${SetUninstallKeys} michael@0: michael@0: ; Remove files that may be left behind by the application in the michael@0: ; VirtualStore directory. michael@0: ${CleanVirtualStore} michael@0: michael@0: ${RemoveDeprecatedFiles} michael@0: michael@0: ; Fix the distribution.ini file if applicable michael@0: ${FixDistributionsINI} michael@0: michael@0: RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: Call IsUserAdmin michael@0: Pop $R0 michael@0: ${If} $R0 == "true" michael@0: ; Only proceed if we have HKLM write access michael@0: ${AndIf} $TmpVal == "HKLM" michael@0: ; On Windows 2000 we do not install the maintenance service. michael@0: ${AndIf} ${AtLeastWinXP} michael@0: ; Add the registry keys for allowed certificates. michael@0: ${AddMaintCertKeys} michael@0: michael@0: ; We check to see if the maintenance service install was already attempted. michael@0: ; Since the Maintenance service can be installed either x86 or x64, michael@0: ; always use the 64-bit registry for checking if an attempt was made. michael@0: ${If} ${RunningX64} michael@0: SetRegView 64 michael@0: ${EndIf} michael@0: ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" michael@0: ClearErrors michael@0: ${If} ${RunningX64} michael@0: SetRegView lastused michael@0: ${EndIf} michael@0: michael@0: ; If the maintenance service is already installed, do nothing. michael@0: ; The maintenance service will launch: michael@0: ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance michael@0: ; service if necessary. If the update was done from updater.exe without michael@0: ; the service (i.e. service is failing), updater.exe will do the update of michael@0: ; the service. The reasons we do not do it here is because we don't want michael@0: ; to have to prompt for limited user accounts when the service isn't used michael@0: ; and we currently call the PostUpdate twice, once for the user and once michael@0: ; for the SYSTEM account. Also, this would stop the maintenance service michael@0: ; and we need a return result back to the service when run that way. michael@0: ${If} $5 == "" michael@0: ; An install of maintenance service was never attempted. michael@0: ; We know we are an Admin and that we have write access into HKLM michael@0: ; based on the above checks, so attempt to just run the EXE. michael@0: ; In the worst case, in case there is some edge case with the michael@0: ; IsAdmin check and the permissions check, the maintenance service michael@0: ; will just fail to be attempted to be installed. michael@0: nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: ; Register the DEH michael@0: !ifdef MOZ_METRO michael@0: ${If} ${AtLeastWin8} michael@0: ${AndIf} $9 != 0 ; We're not running in session 0 michael@0: ; If RegisterCEH is called too close to changing the shortcut AppUserModelID michael@0: ; and if the tile image is not already in cache. Then Windows won't refresh michael@0: ; the tile image on the start screen. So wait before calling RegisterCEH. michael@0: ; We only need to do this when the DEH doesn't already exist. michael@0: ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "DelegateExecute" michael@0: ${If} $0 != ${DELEGATE_EXECUTE_HANDLER_ID} michael@0: Sleep 3000 michael@0: ${EndIf} michael@0: Call RegisterCEH michael@0: ${EndIf} michael@0: !else michael@0: ; The metro browser is not enabled by the mozconfig. michael@0: ${If} ${AtLeastWin8} michael@0: ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: $AppUserModelID \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${EndIf} michael@0: !endif michael@0: !macroend michael@0: !define PostUpdate "!insertmacro PostUpdate" michael@0: michael@0: !macro SetAsDefaultAppGlobal michael@0: ${RemoveDeprecatedKeys} ; Does not use SHCTX michael@0: michael@0: SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) michael@0: ${SetHandlers} ; Uses SHCTX michael@0: ${SetStartMenuInternet} "HKLM" michael@0: ${FixShellIconHandler} "HKLM" michael@0: ${ShowShortcuts} michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9" michael@0: !macroend michael@0: !define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal" michael@0: michael@0: ; Removes shortcuts for this installation. This should also remove the michael@0: ; application from Open With for the file types the application handles michael@0: ; (bug 370480). michael@0: !macro HideShortcuts michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $0 michael@0: StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" michael@0: WriteRegDWORD HKLM "$R1" "IconsVisible" 0 michael@0: ${If} ${AtLeastWin8} michael@0: WriteRegDWORD HKCU "$R1" "IconsVisible" 0 michael@0: ${EndIf} michael@0: michael@0: SetShellVarContext all ; Set $DESKTOP to All Users michael@0: ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: SetShellVarContext current ; Set $DESKTOP to the current user's desktop michael@0: ${EndUnless} michael@0: michael@0: ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${If} "$0" == "" michael@0: ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${GetLongPath} "$0" $0 michael@0: ${If} "$0" == "$INSTDIR\${FileMainEXE}" michael@0: Delete "$DESKTOP\${BrandFullName}.lnk" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: SetShellVarContext all ; Set $SMPROGRAMS to All Users michael@0: ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start michael@0: ; Menu Programs directory michael@0: ${EndUnless} michael@0: michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::GetShortCutArgs "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${If} "$0" == "" michael@0: ShellLink::GetShortCutTarget "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${GetLongPath} "$0" $0 michael@0: ${If} "$0" == "$INSTDIR\${FileMainEXE}" michael@0: Delete "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${If} "$0" == "" michael@0: ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: Pop $0 michael@0: ${GetLongPath} "$0" $0 michael@0: ${If} "$0" == "$INSTDIR\${FileMainEXE}" michael@0: Delete "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define HideShortcuts "!insertmacro HideShortcuts" michael@0: michael@0: ; Adds shortcuts for this installation. This should also add the application michael@0: ; to Open With for the file types the application handles (bug 370480). michael@0: !macro ShowShortcuts michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $0 michael@0: StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" michael@0: WriteRegDWORD HKLM "$R1" "IconsVisible" 1 michael@0: ${If} ${AtLeastWin8} michael@0: WriteRegDWORD HKCU "$R1" "IconsVisible" 1 michael@0: ${EndIf} michael@0: michael@0: SetShellVarContext all ; Set $DESKTOP to All Users michael@0: ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${Else} michael@0: SetShellVarContext current ; Set $DESKTOP to the current user's desktop michael@0: ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: SetShellVarContext all ; Set $SMPROGRAMS to All Users michael@0: ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${Else} michael@0: SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start michael@0: ; Menu Programs directory michael@0: ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: ; Windows 7 doesn't use the QuickLaunch directory michael@0: ${Unless} ${AtLeastWin7} michael@0: ${AndUnless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" \ michael@0: "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: !macroend michael@0: !define ShowShortcuts "!insertmacro ShowShortcuts" michael@0: michael@0: !macro AddAssociationIfNoneExist FILE_TYPE michael@0: ClearErrors michael@0: EnumRegKey $7 HKCR "${FILE_TYPE}" 0 michael@0: ${If} ${Errors} michael@0: WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: !macroend michael@0: !define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist" michael@0: michael@0: ; Adds the protocol and file handler registry entries for making Firefox the michael@0: ; default handler (uses SHCTX). michael@0: !macro SetHandlers michael@0: ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 michael@0: michael@0: StrCpy $0 "SOFTWARE\Classes" michael@0: StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" michael@0: michael@0: ; Associate the file handlers with FirefoxHTML michael@0: ReadRegStr $6 SHCTX "$0\.htm" "" michael@0: ${If} "$6" != "FirefoxHTML" michael@0: WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $6 SHCTX "$0\.html" "" michael@0: ${If} "$6" != "FirefoxHTML" michael@0: WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $6 SHCTX "$0\.shtml" "" michael@0: ${If} "$6" != "FirefoxHTML" michael@0: WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $6 SHCTX "$0\.xht" "" michael@0: ${If} "$6" != "FirefoxHTML" michael@0: WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $6 SHCTX "$0\.xhtml" "" michael@0: ${If} "$6" != "FirefoxHTML" michael@0: WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: ${AddAssociationIfNoneExist} ".pdf" michael@0: ${AddAssociationIfNoneExist} ".oga" michael@0: ${AddAssociationIfNoneExist} ".ogg" michael@0: ${AddAssociationIfNoneExist} ".ogv" michael@0: ${AddAssociationIfNoneExist} ".pdf" michael@0: ${AddAssociationIfNoneExist} ".webm" michael@0: michael@0: ; An empty string is used for the 5th param because FirefoxHTML is not a michael@0: ; protocol handler michael@0: ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ michael@0: "${AppRegName} HTML Document" "" michael@0: michael@0: ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ michael@0: "true" michael@0: Call RegisterCEH michael@0: michael@0: ; An empty string is used for the 4th & 5th params because the following michael@0: ; protocol handlers already have a display name and the additional keys michael@0: ; required for a protocol handler. michael@0: ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" michael@0: ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" michael@0: ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" michael@0: !macroend michael@0: !define SetHandlers "!insertmacro SetHandlers" michael@0: michael@0: ; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry michael@0: ; entries (does not use SHCTX). michael@0: ; michael@0: ; The values for StartMenuInternet are only valid under HKLM and there can only michael@0: ; be one installation registerred under StartMenuInternet per application since michael@0: ; the key name is derived from the main application executable. michael@0: ; http://support.microsoft.com/kb/297878 michael@0: ; michael@0: ; In Windows 8 this changes slightly, you can store StartMenuInternet entries in michael@0: ; HKCU. The icon in start menu for StartMenuInternet is deprecated as of Win7, michael@0: ; but the subkeys are what's important. Control panel default programs looks michael@0: ; for them only in HKLM pre win8. michael@0: ; michael@0: ; Note: we might be able to get away with using the full path to the michael@0: ; application executable for the key name in order to support multiple michael@0: ; installations. michael@0: !macro SetStartMenuInternet RegKey michael@0: ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 michael@0: ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 michael@0: michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: michael@0: StrCpy $0 "Software\Clients\StartMenuInternet\$R9" michael@0: michael@0: WriteRegStr ${RegKey} "$0" "" "${BrandFullName}" michael@0: michael@0: WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" michael@0: michael@0: ; The Reinstall Command is defined at michael@0: ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp michael@0: WriteRegStr ${RegKey} "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" michael@0: WriteRegStr ${RegKey} "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" michael@0: WriteRegStr ${RegKey} "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" michael@0: michael@0: ClearErrors michael@0: ReadRegDWORD $1 ${RegKey} "$0\InstallInfo" "IconsVisible" michael@0: ; If the IconsVisible name value pair doesn't exist add it otherwise the michael@0: ; application won't be displayed in Set Program Access and Defaults. michael@0: ${If} ${Errors} michael@0: ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" michael@0: WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1 michael@0: ${Else} michael@0: WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0 michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\"" michael@0: michael@0: WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" michael@0: WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -preferences" michael@0: michael@0: WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" michael@0: WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" michael@0: michael@0: ; Vista Capabilities registry keys michael@0: WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" michael@0: WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" michael@0: WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}" michael@0: michael@0: WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML" michael@0: michael@0: WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9" michael@0: michael@0: WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL" michael@0: WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL" michael@0: michael@0: ; Vista Registered Application michael@0: WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities" michael@0: !macroend michael@0: !define SetStartMenuInternet "!insertmacro SetStartMenuInternet" michael@0: michael@0: ; The IconHandler reference for FirefoxHTML can end up in an inconsistent state michael@0: ; due to changes not being detected by the IconHandler for side by side michael@0: ; installs (see bug 268512). The symptoms can be either an incorrect icon or no michael@0: ; icon being displayed for files associated with Firefox (does not use SHCTX). michael@0: !macro FixShellIconHandler RegKey michael@0: ClearErrors michael@0: ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\ShellEx\IconHandler" "" michael@0: ${Unless} ${Errors} michael@0: ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" michael@0: ${GetLongPath} "$INSTDIR\${FileMainEXE}" $2 michael@0: ${If} "$1" != "$2,1" michael@0: WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1" michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: !macroend michael@0: !define FixShellIconHandler "!insertmacro FixShellIconHandler" michael@0: michael@0: ; Add Software\Mozilla\ registry entries (uses SHCTX). michael@0: !macro SetAppKeys michael@0: ; Check if this is an ESR release and if so add registry values so it is michael@0: ; possible to determine that this is an ESR install (bug 726781). michael@0: ClearErrors michael@0: ${WordFind} "${UpdateChannel}" "esr" "E#" $3 michael@0: ${If} ${Errors} michael@0: StrCpy $3 "" michael@0: ${Else} michael@0: StrCpy $3 " ESR" michael@0: ${EndIf} michael@0: michael@0: ${GetLongPath} "$INSTDIR" $8 michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" michael@0: ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0 michael@0: ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Uninstall" michael@0: ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})" michael@0: ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 michael@0: ${If} "$3" == "" michael@0: DeleteRegValue SHCTX "$0" "ESR" michael@0: ${Else} michael@0: ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 michael@0: ${EndIf} michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\bin" michael@0: ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\extensions" michael@0: ${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0 michael@0: ${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0 michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3" michael@0: ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0 michael@0: ${If} "$3" == "" michael@0: DeleteRegValue SHCTX "$0" "ESR" michael@0: ${Else} michael@0: ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 michael@0: ${EndIf} michael@0: michael@0: StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}$3" michael@0: ${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0 michael@0: ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 michael@0: !macroend michael@0: !define SetAppKeys "!insertmacro SetAppKeys" michael@0: michael@0: ; Add uninstall registry entries. This macro tests for write access to determine michael@0: ; if the uninstall keys should be added to HKLM or HKCU. michael@0: !macro SetUninstallKeys michael@0: ; Check if this is an ESR release and if so add registry values so it is michael@0: ; possible to determine that this is an ESR install (bug 726781). michael@0: ClearErrors michael@0: ${WordFind} "${UpdateChannel}" "esr" "E#" $3 michael@0: ${If} ${Errors} michael@0: StrCpy $3 "" michael@0: ${Else} michael@0: StrCpy $3 " ESR" michael@0: ${EndIf} michael@0: michael@0: StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" michael@0: michael@0: StrCpy $2 "" michael@0: ClearErrors michael@0: WriteRegStr HKLM "$0" "${BrandShortName}InstallerTest" "Write Test" michael@0: ${If} ${Errors} michael@0: ; If the uninstall keys already exist in HKLM don't create them in HKCU michael@0: ClearErrors michael@0: ReadRegStr $2 "HKLM" $0 "DisplayName" michael@0: ${If} $2 == "" michael@0: ; Otherwise we don't have any keys for this product in HKLM so proceeed michael@0: ; to create them in HKCU. Better handling for this will be done in: michael@0: ; Bug 711044 - Better handling for 2 uninstall icons michael@0: StrCpy $1 "HKCU" michael@0: SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) michael@0: ${EndIf} michael@0: ClearErrors michael@0: ${Else} michael@0: StrCpy $1 "HKLM" michael@0: SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) michael@0: DeleteRegValue HKLM "$0" "${BrandShortName}InstallerTest" michael@0: ${EndIf} michael@0: michael@0: ${If} $2 == "" michael@0: ${GetLongPath} "$INSTDIR" $8 michael@0: michael@0: ; Write the uninstall registry keys michael@0: ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 michael@0: ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0 michael@0: ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 michael@0: ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 michael@0: ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 michael@0: ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 michael@0: ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 michael@0: ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 michael@0: DeleteRegValue SHCTX "$0" "URLInfoAbout" michael@0: ; Don't add URLUpdateInfo which is the release notes url except for the release michael@0: ; and esr channels since nightly, aurora, and beta do not have release notes. michael@0: ; Note: URLUpdateInfo is only defined in the official branding.nsi. michael@0: !ifdef URLUpdateInfo michael@0: !ifndef BETA_UPDATE_CHANNEL michael@0: ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0 michael@0: !endif michael@0: !endif michael@0: ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 michael@0: ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0 michael@0: ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0 michael@0: michael@0: ${GetSize} "$8" "/S=0K" $R2 $R3 $R4 michael@0: ${WriteRegDWORD2} $1 "$0" "EstimatedSize" $R2 0 michael@0: michael@0: ${If} "$TmpVal" == "HKLM" michael@0: SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) michael@0: ${Else} michael@0: SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define SetUninstallKeys "!insertmacro SetUninstallKeys" michael@0: michael@0: ; Due to a bug when associating some file handlers, only SHCTX was checked for michael@0: ; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on michael@0: ; whether the installer has write access to HKLM. The bug would happen when michael@0: ; HCKU was checked and didn't exist since programs aren't required to set the michael@0: ; HKCU Software\Classes keys when associating handlers. The fix uses the merged michael@0: ; view in HKCR to check for existance of an existing association. This macro michael@0: ; cleans affected installations by removing the HKLM and HKCU value if it is set michael@0: ; to FirefoxHTML when there is a value for PersistentHandler or by removing the michael@0: ; HKCU value when the HKLM value has a value other than an empty string. michael@0: !macro FixBadFileAssociation FILE_TYPE michael@0: ; Only delete the default value in case the key has values for OpenWithList, michael@0: ; OpenWithProgids, PersistentHandler, etc. michael@0: ReadRegStr $0 HKCU "Software\Classes\${FILE_TYPE}" "" michael@0: ReadRegStr $1 HKLM "Software\Classes\${FILE_TYPE}" "" michael@0: ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" "" michael@0: ${If} "$2" != "" michael@0: ; Since there is a persistent handler remove FirefoxHTML as the default michael@0: ; value from both HKCU and HKLM if it set to FirefoxHTML. michael@0: ${If} "$0" == "FirefoxHTML" michael@0: DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" michael@0: ${EndIf} michael@0: ${If} "$1" == "FirefoxHTML" michael@0: DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" "" michael@0: ${EndIf} michael@0: ${ElseIf} "$0" == "FirefoxHTML" michael@0: ; Since KHCU is set to FirefoxHTML remove FirefoxHTML as the default value michael@0: ; from HKCU if HKLM is set to a value other than an empty string. michael@0: ${If} "$1" != "" michael@0: DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define FixBadFileAssociation "!insertmacro FixBadFileAssociation" michael@0: michael@0: ; Add app specific handler registry entries under Software\Classes if they michael@0: ; don't exist (does not use SHCTX). michael@0: !macro FixClassKeys michael@0: StrCpy $1 "SOFTWARE\Classes" michael@0: michael@0: ; File handler keys and name value pairs that may need to be created during michael@0: ; install or upgrade. michael@0: ReadRegStr $0 HKCR ".shtml" "Content Type" michael@0: ${If} "$0" == "" michael@0: StrCpy $0 "$1\.shtml" michael@0: ${WriteRegStr2} $TmpVal "$1\.shtml" "" "shtmlfile" 0 michael@0: ${WriteRegStr2} $TmpVal "$1\.shtml" "Content Type" "text/html" 0 michael@0: ${WriteRegStr2} $TmpVal "$1\.shtml" "PerceivedType" "text" 0 michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $0 HKCR ".xht" "Content Type" michael@0: ${If} "$0" == "" michael@0: ${WriteRegStr2} $TmpVal "$1\.xht" "" "xhtfile" 0 michael@0: ${WriteRegStr2} $TmpVal "$1\.xht" "Content Type" "application/xhtml+xml" 0 michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $0 HKCR ".xhtml" "Content Type" michael@0: ${If} "$0" == "" michael@0: ${WriteRegStr2} $TmpVal "$1\.xhtml" "" "xhtmlfile" 0 michael@0: ${WriteRegStr2} $TmpVal "$1\.xhtml" "Content Type" "application/xhtml+xml" 0 michael@0: ${EndIf} michael@0: michael@0: ; Remove possibly badly associated file types michael@0: ${FixBadFileAssociation} ".pdf" michael@0: ${FixBadFileAssociation} ".oga" michael@0: ${FixBadFileAssociation} ".ogg" michael@0: ${FixBadFileAssociation} ".ogv" michael@0: ${FixBadFileAssociation} ".pdf" michael@0: ${FixBadFileAssociation} ".webm" michael@0: !macroend michael@0: !define FixClassKeys "!insertmacro FixClassKeys" michael@0: michael@0: ; Updates protocol handlers if their registry open command value is for this michael@0: ; install location (uses SHCTX). michael@0: !macro UpdateProtocolHandlers michael@0: ; Store the command to open the app with an url in a register for easy access. michael@0: ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 michael@0: StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" michael@0: michael@0: ; Only set the file and protocol handlers if the existing one under HKCR is michael@0: ; for this install location. michael@0: michael@0: ${IsHandlerForInstallDir} "FirefoxHTML" $R9 michael@0: ${If} "$R9" == "true" michael@0: ; An empty string is used for the 5th param because FirefoxHTML is not a michael@0: ; protocol handler. michael@0: ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ michael@0: "${AppRegName} HTML Document" "" michael@0: ${EndIf} michael@0: michael@0: ${IsHandlerForInstallDir} "FirefoxURL" $R9 michael@0: ${If} "$R9" == "true" michael@0: ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" \ michael@0: "${AppRegName} URL" "true" michael@0: ${EndIf} michael@0: michael@0: ; An empty string is used for the 4th & 5th params because the following michael@0: ; protocol handlers already have a display name and the additional keys michael@0: ; required for a protocol handler. michael@0: ${IsHandlerForInstallDir} "ftp" $R9 michael@0: ${If} "$R9" == "true" michael@0: ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" michael@0: ${EndIf} michael@0: michael@0: ${IsHandlerForInstallDir} "http" $R9 michael@0: ${If} "$R9" == "true" michael@0: ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" michael@0: ${EndIf} michael@0: michael@0: ${IsHandlerForInstallDir} "https" $R9 michael@0: ${If} "$R9" == "true" michael@0: ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" michael@0: ${EndIf} michael@0: !macroend michael@0: !define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers" michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: ; Adds maintenance service certificate keys for the install dir. michael@0: ; For the cert to work, it must also be signed by a trusted cert for the user. michael@0: !macro AddMaintCertKeys michael@0: Push $R0 michael@0: ; Allow main Mozilla cert information for updates michael@0: ; This call will push the needed key on the stack michael@0: ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" michael@0: Pop $R0 michael@0: ${If} $R0 != "" michael@0: ; More than one certificate can be specified in a different subfolder michael@0: ; for example: $R0\1, but each individual binary can be signed michael@0: ; with at most one certificate. A fallback certificate can only be used michael@0: ; if the binary is replaced with a different certificate. michael@0: ; We always use the 64bit registry for certs. michael@0: ${If} ${RunningX64} michael@0: SetRegView 64 michael@0: ${EndIf} michael@0: DeleteRegKey HKLM "$R0" michael@0: WriteRegStr HKLM "$R0" "prefetchProcessName" "FIREFOX" michael@0: WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}" michael@0: WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}" michael@0: ${If} ${RunningX64} michael@0: SetRegView lastused michael@0: ${EndIf} michael@0: ClearErrors michael@0: ${EndIf} michael@0: ; Restore the previously used value back michael@0: Pop $R0 michael@0: !macroend michael@0: !define AddMaintCertKeys "!insertmacro AddMaintCertKeys" michael@0: !endif michael@0: michael@0: ; Removes various registry entries for reasons noted below (does not use SHCTX). michael@0: !macro RemoveDeprecatedKeys michael@0: StrCpy $0 "SOFTWARE\Classes" michael@0: ; Remove support for launching gopher urls from the shell during install or michael@0: ; update if the DefaultIcon is from firefox.exe. michael@0: ${RegCleanAppHandler} "gopher" michael@0: michael@0: ; Remove support for launching chrome urls from the shell during install or michael@0: ; update if the DefaultIcon is from firefox.exe (Bug 301073). michael@0: ${RegCleanAppHandler} "chrome" michael@0: michael@0: ; Remove protocol handler registry keys added by the MS shim michael@0: DeleteRegKey HKLM "Software\Classes\Firefox.URL" michael@0: DeleteRegKey HKCU "Software\Classes\Firefox.URL" michael@0: michael@0: ; Delete gopher from Capabilities\URLAssociations if it is present. michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: StrCpy $0 "Software\Clients\StartMenuInternet\$R9" michael@0: ClearErrors michael@0: ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher" michael@0: ${Unless} ${Errors} michael@0: DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher" michael@0: ${EndUnless} michael@0: michael@0: ; Delete gopher from the user's UrlAssociations if it points to FirefoxURL. michael@0: StrCpy $0 "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher" michael@0: ReadRegStr $2 HKCU "$0\UserChoice" "Progid" michael@0: ${If} "$2" == "FirefoxURL" michael@0: DeleteRegKey HKCU "$0" michael@0: ${EndIf} michael@0: !macroend michael@0: !define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys" michael@0: michael@0: ; Resets Win8+ specific toast keys Windows sets. We call this on a michael@0: ; fresh install and on uninstall. michael@0: !macro ResetWin8PromptKeys KEY PREFIX michael@0: ${If} ${AtLeastWin8} michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.htm" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.html" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xht" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xhtml" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.shtml" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_ftp" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_http" michael@0: DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_https" michael@0: ${EndIf} michael@0: !macroend michael@0: !define ResetWin8PromptKeys "!insertmacro ResetWin8PromptKeys" michael@0: michael@0: !ifdef MOZ_METRO michael@0: ; Resets Win8+ Metro specific splash screen info. Relies michael@0: ; on AppUserModelID. michael@0: !macro ResetWin8MetroSplash michael@0: ${If} ${AtLeastWin8} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: DeleteRegKey HKCR "Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!$AppUserModelID" michael@0: ${EndIf} michael@0: !macroend michael@0: !define ResetWin8MetroSplash "!insertmacro ResetWin8MetroSplash" michael@0: !endif michael@0: michael@0: ; Adds SE_RESTORE_NAME privs michael@0: !macro AcquireSERestoreName michael@0: StrCpy $R1 0 michael@0: michael@0: System::Call "kernel32::GetCurrentProcess() i .R0" michael@0: System::Call "advapi32::OpenProcessToken(i R0, i ${TOKEN_QUERY}|${TOKEN_ADJUST_PRIVILEGES}, \ michael@0: *i R1R1) i .R0" michael@0: ${If} $R0 != 0 michael@0: System::Call "advapi32::LookupPrivilegeValue(t n, t '${SE_RESTORE_NAME}', *l .R2) i .R0" michael@0: ${If} $R0 != 0 michael@0: System::Call "*(i 1, l R2, i ${SE_PRIVILEGE_ENABLED}) i .R0" michael@0: System::Call "advapi32::AdjustTokenPrivileges(i R1, i 0, i R0, i 0, i 0, i 0)" michael@0: System::Free $R0 michael@0: ${EndIf} michael@0: System::Call "kernel32::CloseHandle(i R1)" michael@0: ${EndIf} michael@0: !macroend michael@0: !define AcquireSERestoreName "!insertmacro AcquireSERestoreName" michael@0: !define un.AcquireSERestoreName "!insertmacro AcquireSERestoreName" michael@0: michael@0: ; Mounts all user ntuser.dat files into the registry as a subkey of HKU michael@0: !macro MountRegistryIntoHKU michael@0: ; $0 is used as an index for HKEY_USERS enumeration michael@0: StrCpy $0 0 michael@0: ${Do} michael@0: EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 michael@0: ${If} $1 == "" michael@0: ${Break} michael@0: ${EndIf} michael@0: ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" michael@0: System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0', t '$2\ntuser.dat')" michael@0: System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes', t '$2\AppData\Local\Microsoft\Windows\UsrClass.dat')" michael@0: IntOp $0 $0 + 1 michael@0: ${Loop} michael@0: !macroend michael@0: !define MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" michael@0: !define un.MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" michael@0: ; michael@0: ; Unmounts all user ntuser.dat files into the registry as a subkey of HKU michael@0: !macro UnmountRegistryIntoHKU michael@0: ; $0 is used as an index for HKEY_USERS enumeration michael@0: StrCpy $0 0 michael@0: ${Do} michael@0: EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 michael@0: ${If} $1 == "" michael@0: ${Break} michael@0: ${EndIf} michael@0: ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" michael@0: System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0')" michael@0: System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes')" michael@0: IntOp $0 $0 + 1 michael@0: ${Loop} michael@0: !macroend michael@0: !define UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" michael@0: !define un.UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" michael@0: michael@0: ; Unconditionally removes the delegate execute handler registration used to michael@0: ; launch the metro browser and misc. metro related registry values. michael@0: !macro RemoveDEHRegistration DELEGATE_EXECUTE_HANDLER_ID \ michael@0: APP_USER_MODEL_ID \ michael@0: PROTOCOL_ACTIVATION_ID \ michael@0: FILE_ACTIVATION_ID michael@0: ${AcquireSERestoreName} michael@0: ${MountRegistryIntoHKU} michael@0: michael@0: ; $0 is used as an index for HKEY_USERS enumeration michael@0: StrCpy $0 0 michael@0: michael@0: ${Do} michael@0: EnumRegKey $1 HKU "" $0 michael@0: ${If} $1 == "" michael@0: ${Break} michael@0: ${EndIf} michael@0: michael@0: ClearErrors michael@0: ${WordFind} "$1" "_Classes" "E#" $3 michael@0: ${Unless} ${Errors} michael@0: ; remove the app user model id root registration. We don't need this michael@0: ; here anymore, we just use it for tray registrationdown in widget, michael@0: ; which we read out of the mozilla keys. michael@0: ${If} "${APP_USER_MODEL_ID}" != "" michael@0: ; The removal of this key intermittently fails, so do the best we can in cleanup michael@0: DeleteRegValue HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" michael@0: DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open" michael@0: DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell" michael@0: DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe" michael@0: DeleteRegKey HKU "$1\\${APP_USER_MODEL_ID}" michael@0: ${EndIf} michael@0: ; michael@0: ; Remove delegate execute handler clsid registration michael@0: DeleteRegKey HKU "$1\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" michael@0: michael@0: ; Remove protocol and file delegate execute handler id assoc michael@0: DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" michael@0: DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}" "AppUserModelID" michael@0: michael@0: ; Remove delegate execute application registry keys michael@0: DeleteRegKey HKU "$1\${PROTOCOL_ACTIVATION_ID}\Application" michael@0: DeleteRegKey HKU "$1\${FILE_ACTIVATION_ID}\Application" michael@0: michael@0: ; Remove misc. shell open info michael@0: DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" michael@0: DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open" "CommandId" michael@0: DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" michael@0: DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" michael@0: michael@0: ; remove metro browser splash image data michael@0: DeleteRegKey HKU "$1\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!${APP_USER_MODEL_ID}" michael@0: ${Else} michael@0: ; misc. Metro keys michael@0: DeleteRegKey HKU "$1\Software\Mozilla\Firefox\Metro" michael@0: DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "CEHDump" michael@0: DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroD3DAvailable" michael@0: DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroLastAHE" michael@0: ${ResetWin8PromptKeys} "HKU" "$1\" michael@0: ${EndIf} michael@0: IntOp $0 $0 + 1 michael@0: ${Loop} michael@0: ${UnmountRegistryIntoHKU} michael@0: michael@0: ; The removal of this key intermittently fails, so do the best we can in cleanup michael@0: ${If} "${APP_USER_MODEL_ID}" != "" michael@0: DeleteRegValue HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" michael@0: DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" michael@0: DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" michael@0: DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe" michael@0: DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}" michael@0: ${EndIf} michael@0: michael@0: ; Remove HKLM entries michael@0: DeleteRegKey HKLM "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" michael@0: DeleteRegKey HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" michael@0: DeleteRegKey HKLM "Software\Classes\${FILE_ACTIVATION_ID}\Application" michael@0: DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" michael@0: DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" michael@0: DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" michael@0: DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" michael@0: DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" michael@0: DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" michael@0: michael@0: ClearErrors michael@0: !macroend michael@0: michael@0: !define RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" michael@0: !define un.RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" michael@0: michael@0: ; Removes various directories and files for reasons noted below. michael@0: !macro RemoveDeprecatedFiles michael@0: ; Some users are ending up with unpacked chrome instead of omni.ja. This michael@0: ; causes Firefox to break badly after upgrading from Firefox 31, see bug michael@0: ; 1063052. Removing the chrome.manifest from the install directory causes michael@0: ; Firefox to use the updated omni.ja so it won't crash. michael@0: ${If} ${FileExists} "$INSTDIR\chrome.manifest" michael@0: Delete "$INSTDIR\chrome.manifest" michael@0: ${EndIf} michael@0: michael@0: ; Remove talkback if it is present (remove after bug 386760 is fixed) michael@0: ${If} ${FileExists} "$INSTDIR\extensions\talkback@mozilla.org" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org" michael@0: ${EndIf} michael@0: michael@0: ; Remove the Java Console extension (bug 597235) michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" michael@0: RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" michael@0: ${EndIf} michael@0: !macroend michael@0: !define RemoveDeprecatedFiles "!insertmacro RemoveDeprecatedFiles" michael@0: michael@0: ; Converts specific partner distribution.ini from ansi to utf-8 (bug 882989) michael@0: !macro FixDistributionsINI michael@0: StrCpy $1 "$INSTDIR\distribution\distribution.ini" michael@0: StrCpy $2 "$INSTDIR\distribution\utf8fix" michael@0: StrCpy $0 "0" ; Default to not attempting to fix michael@0: michael@0: ; Check if the distribution.ini settings are for a partner build that needs michael@0: ; to have its distribution.ini converted from ansi to utf-8. michael@0: ${If} ${FileExists} "$1" michael@0: ${Unless} ${FileExists} "$2" michael@0: ReadINIStr $3 "$1" "Preferences" "app.distributor" michael@0: ${If} "$3" == "yahoo" michael@0: ReadINIStr $3 "$1" "Preferences" "app.distributor.channel" michael@0: ${If} "$3" == "de" michael@0: ${OrIf} "$3" == "es" michael@0: ${OrIf} "$3" == "e1" michael@0: ${OrIf} "$3" == "mx" michael@0: StrCpy $0 "1" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ; Create the utf8fix so this only runs once michael@0: FileOpen $3 "$2" w michael@0: FileClose $3 michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: ${If} "$0" == "1" michael@0: StrCpy $0 "0" michael@0: ClearErrors michael@0: ReadINIStr $3 "$1" "Global" "version" michael@0: ${Unless} ${Errors} michael@0: StrCpy $4 "$3" 2 michael@0: ${If} "$4" == "1." michael@0: StrCpy $4 "$3" "" 2 ; Everything after "1." michael@0: ${If} $4 < 23 michael@0: StrCpy $0 "1" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: ${If} "$0" == "1" michael@0: ClearErrors michael@0: FileOpen $3 "$1" r michael@0: ${If} ${Errors} michael@0: FileClose $3 michael@0: ${Else} michael@0: StrCpy $2 "$INSTDIR\distribution\distribution.new" michael@0: ClearErrors michael@0: FileOpen $4 "$2" w michael@0: ${If} ${Errors} michael@0: FileClose $3 michael@0: FileClose $4 michael@0: ${Else} michael@0: StrCpy $0 "0" ; Default to not replacing the original distribution.ini michael@0: ${Do} michael@0: FileReadByte $3 $5 michael@0: ${If} $5 == "" michael@0: ${Break} michael@0: ${EndIf} michael@0: ${If} $5 == 233 ; ansi é michael@0: StrCpy $0 "1" michael@0: FileWriteByte $4 195 michael@0: FileWriteByte $4 169 michael@0: ${ElseIf} $5 == 241 ; ansi ñ michael@0: StrCpy $0 "1" michael@0: FileWriteByte $4 195 michael@0: FileWriteByte $4 177 michael@0: ${ElseIf} $5 == 252 ; ansi ü michael@0: StrCpy $0 "1" michael@0: FileWriteByte $4 195 michael@0: FileWriteByte $4 188 michael@0: ${ElseIf} $5 < 128 michael@0: FileWriteByte $4 $5 michael@0: ${EndIf} michael@0: ${Loop} michael@0: FileClose $3 michael@0: FileClose $4 michael@0: ${If} "$0" == "1" michael@0: ClearErrors michael@0: Rename "$1" "$1.bak" michael@0: ${Unless} ${Errors} michael@0: Rename "$2" "$1" michael@0: Delete "$1.bak" michael@0: ${EndUnless} michael@0: ${Else} michael@0: Delete "$2" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define FixDistributionsINI "!insertmacro FixDistributionsINI" michael@0: michael@0: ; Adds a pinned shortcut to Task Bar on update for Windows 7 and above if this michael@0: ; macro has never been called before and the application is default (see michael@0: ; PinToTaskBar for more details). michael@0: ; Since defaults handling is handled by Windows in Win8 and later, we always michael@0: ; attempt to pin a taskbar on that OS. If Windows sets the defaults at michael@0: ; installation time, then we don't get the opportunity to run this code at michael@0: ; that time. michael@0: !macro MigrateTaskBarShortcut michael@0: ${GetShortcutsLogPath} $0 michael@0: ${If} ${FileExists} "$0" michael@0: ClearErrors michael@0: ReadINIStr $1 "$0" "TASKBAR" "Migrated" michael@0: ${If} ${Errors} michael@0: ClearErrors michael@0: WriteIniStr "$0" "TASKBAR" "Migrated" "true" michael@0: ${If} ${AtLeastWin7} michael@0: ; No need to check the default on Win8 and later michael@0: ${If} ${AtMostWin2008R2} michael@0: ; Check if the Firefox is the http handler for this user michael@0: SetShellVarContext current ; Set SHCTX to the current user michael@0: ${IsHandlerForInstallDir} "http" $R9 michael@0: ${If} $TmpVal == "HKLM" michael@0: SetShellVarContext all ; Set SHCTX to all users michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${If} "$R9" == "true" michael@0: ${OrIf} ${AtLeastWin8} michael@0: ${PinToTaskBar} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define MigrateTaskBarShortcut "!insertmacro MigrateTaskBarShortcut" michael@0: michael@0: ; Adds a pinned Task Bar shortcut on Windows 7 if there isn't one for the main michael@0: ; application executable already. Existing pinned shortcuts for the same michael@0: ; application model ID must be removed first to prevent breaking the pinned michael@0: ; item's lists but multiple installations with the same application model ID is michael@0: ; an edgecase. If removing existing pinned shortcuts with the same application michael@0: ; model ID removes a pinned pinned Start Menu shortcut this will also add a michael@0: ; pinned Start Menu shortcut. michael@0: !macro PinToTaskBar michael@0: ${If} ${AtLeastWin7} michael@0: StrCpy $8 "false" ; Whether a shortcut had to be created michael@0: ${IsPinnedToTaskBar} "$INSTDIR\${FileMainEXE}" $R9 michael@0: ${If} "$R9" == "false" michael@0: ; Find an existing Start Menu shortcut or create one to use for pinning michael@0: ${GetShortcutsLogPath} $0 michael@0: ${If} ${FileExists} "$0" michael@0: ClearErrors michael@0: ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" michael@0: ${Unless} ${Errors} michael@0: SetShellVarContext all ; Set SHCTX to all users michael@0: ${Unless} ${FileExists} "$SMPROGRAMS\$1" michael@0: SetShellVarContext current ; Set SHCTX to the current user michael@0: ${Unless} ${FileExists} "$SMPROGRAMS\$1" michael@0: StrCpy $8 "true" michael@0: CreateShortCut "$SMPROGRAMS\$1" "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\$1" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \ michael@0: "$INSTDIR" michael@0: ${If} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndUnless} michael@0: michael@0: ${If} ${FileExists} "$SMPROGRAMS\$1" michael@0: ; Count of Start Menu pinned shortcuts before unpinning. michael@0: ${PinnedToStartMenuLnkCount} $R9 michael@0: michael@0: ; Having multiple shortcuts pointing to different installations with michael@0: ; the same AppUserModelID (e.g. side by side installations of the michael@0: ; same version) will make the TaskBar shortcut's lists into an bad michael@0: ; state where the lists are not shown. To prevent this first michael@0: ; uninstall the pinned item. michael@0: ApplicationID::UninstallPinnedItem "$SMPROGRAMS\$1" michael@0: michael@0: ; Count of Start Menu pinned shortcuts after unpinning. michael@0: ${PinnedToStartMenuLnkCount} $R8 michael@0: michael@0: ; If there is a change in the number of Start Menu pinned shortcuts michael@0: ; assume that unpinning unpinned a side by side installation from michael@0: ; the Start Menu and pin this installation to the Start Menu. michael@0: ${Unless} $R8 == $R9 michael@0: ; Pin the shortcut to the Start Menu. 5381 is the shell32.dll michael@0: ; resource id for the "Pin to Start Menu" string. michael@0: InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5381" michael@0: ${EndUnless} michael@0: michael@0: ; Pin the shortcut to the TaskBar. 5386 is the shell32.dll resource michael@0: ; id for the "Pin to Taskbar" string. michael@0: InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5386" michael@0: michael@0: ; Delete the shortcut if it was created michael@0: ${If} "$8" == "true" michael@0: Delete "$SMPROGRAMS\$1" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ${If} $TmpVal == "HKCU" michael@0: SetShellVarContext current ; Set SHCTX to the current user michael@0: ${Else} michael@0: SetShellVarContext all ; Set SHCTX to all users michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: !macroend michael@0: !define PinToTaskBar "!insertmacro PinToTaskBar" michael@0: michael@0: ; Adds a shortcut to the root of the Start Menu Programs directory if the michael@0: ; application's Start Menu Programs directory exists with a shortcut pointing to michael@0: ; this installation directory. This will also remove the old shortcuts and the michael@0: ; application's Start Menu Programs directory by calling the RemoveStartMenuDir michael@0: ; macro. michael@0: !macro MigrateStartMenuShortcut michael@0: ${GetShortcutsLogPath} $0 michael@0: ${If} ${FileExists} "$0" michael@0: ClearErrors michael@0: ReadINIStr $5 "$0" "SMPROGRAMS" "RelativePathToDir" michael@0: ${Unless} ${Errors} michael@0: ClearErrors michael@0: ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" michael@0: ${If} ${Errors} michael@0: ; The STARTMENU ini section doesn't exist. michael@0: ${LogStartMenuShortcut} "${BrandFullName}.lnk" michael@0: ${GetLongPath} "$SMPROGRAMS" $2 michael@0: ${GetLongPath} "$2\$5" $1 michael@0: ${If} "$1" != "" michael@0: ClearErrors michael@0: ReadINIStr $3 "$0" "SMPROGRAMS" "Shortcut0" michael@0: ${Unless} ${Errors} michael@0: ${If} ${FileExists} "$1\$3" michael@0: ShellLink::GetShortCutTarget "$1\$3" michael@0: Pop $4 michael@0: ${If} "$INSTDIR\${FileMainEXE}" == "$4" michael@0: CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" michael@0: ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$INSTDIR" michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" \ michael@0: "$AppUserModelID" "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ; Remove the application's Start Menu Programs directory, shortcuts, and michael@0: ; ini section. michael@0: ${RemoveStartMenuDir} michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: !macroend michael@0: !define MigrateStartMenuShortcut "!insertmacro MigrateStartMenuShortcut" michael@0: michael@0: ; Removes the application's start menu directory along with its shortcuts if michael@0: ; they exist and if they exist creates a start menu shortcut in the root of the michael@0: ; start menu directory (bug 598779). If the application's start menu directory michael@0: ; is not empty after removing the shortucts the directory will not be removed michael@0: ; since these additional items were not created by the installer (uses SHCTX). michael@0: !macro RemoveStartMenuDir michael@0: ${GetShortcutsLogPath} $0 michael@0: ${If} ${FileExists} "$0" michael@0: ; Delete Start Menu Programs shortcuts, directory if it is empty, and michael@0: ; parent directories if they are empty up to but not including the start michael@0: ; menu directory. michael@0: ${GetLongPath} "$SMPROGRAMS" $1 michael@0: ClearErrors michael@0: ReadINIStr $2 "$0" "SMPROGRAMS" "RelativePathToDir" michael@0: ${Unless} ${Errors} michael@0: ${GetLongPath} "$1\$2" $2 michael@0: ${If} "$2" != "" michael@0: ; Delete shortucts in the Start Menu Programs directory. michael@0: StrCpy $3 0 michael@0: ${Do} michael@0: ClearErrors michael@0: ReadINIStr $4 "$0" "SMPROGRAMS" "Shortcut$3" michael@0: ; Stop if there are no more entries michael@0: ${If} ${Errors} michael@0: ${ExitDo} michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$2\$4" michael@0: ShellLink::GetShortCutTarget "$2\$4" michael@0: Pop $5 michael@0: ${If} "$INSTDIR\${FileMainEXE}" == "$5" michael@0: Delete "$2\$4" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: IntOp $3 $3 + 1 ; Increment the counter michael@0: ${Loop} michael@0: ; Delete Start Menu Programs directory and parent directories michael@0: ${Do} michael@0: ; Stop if the current directory is the start menu directory michael@0: ${If} "$1" == "$2" michael@0: ${ExitDo} michael@0: ${EndIf} michael@0: ClearErrors michael@0: RmDir "$2" michael@0: ; Stop if removing the directory failed michael@0: ${If} ${Errors} michael@0: ${ExitDo} michael@0: ${EndIf} michael@0: ${GetParent} "$2" $2 michael@0: ${Loop} michael@0: ${EndIf} michael@0: DeleteINISec "$0" "SMPROGRAMS" michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: !macroend michael@0: !define RemoveStartMenuDir "!insertmacro RemoveStartMenuDir" michael@0: michael@0: ; Creates the shortcuts log ini file with the appropriate entries if it doesn't michael@0: ; already exist. michael@0: !macro CreateShortcutsLog michael@0: ${GetShortcutsLogPath} $0 michael@0: ${Unless} ${FileExists} "$0" michael@0: ${LogStartMenuShortcut} "${BrandFullName}.lnk" michael@0: ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" michael@0: ${LogDesktopShortcut} "${BrandFullName}.lnk" michael@0: ${EndUnless} michael@0: !macroend michael@0: !define CreateShortcutsLog "!insertmacro CreateShortcutsLog" michael@0: michael@0: ; The files to check if they are in use during (un)install so the restart is michael@0: ; required message is displayed. All files must be located in the $INSTDIR michael@0: ; directory. michael@0: !macro PushFilesToCheck michael@0: ; The first string to be pushed onto the stack MUST be "end" to indicate michael@0: ; that there are no more files to check in $INSTDIR and the last string michael@0: ; should be ${FileMainEXE} so if it is in use the CheckForFilesInUse macro michael@0: ; returns after the first check. michael@0: Push "end" michael@0: Push "AccessibleMarshal.dll" michael@0: Push "freebl3.dll" michael@0: Push "nssckbi.dll" michael@0: Push "nspr4.dll" michael@0: Push "nssdbm3.dll" michael@0: Push "mozsqlite3.dll" michael@0: !ifdef MOZ_CONTENT_SANDBOX michael@0: Push "sandboxbroker.dll" michael@0: !endif michael@0: Push "xpcom.dll" michael@0: Push "crashreporter.exe" michael@0: Push "updater.exe" michael@0: Push "${FileMainEXE}" michael@0: !macroend michael@0: !define PushFilesToCheck "!insertmacro PushFilesToCheck" michael@0: michael@0: ; Sets this installation as the default browser by setting the registry keys michael@0: ; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS michael@0: ; plugin for Vista and above. This is a function instead of a macro so it is michael@0: ; easily called from an elevated instance of the binary. Since this can be michael@0: ; called by an elevated instance logging is not performed in this function. michael@0: Function SetAsDefaultAppUserHKCU michael@0: ; Only set as the user's StartMenuInternet browser if the StartMenuInternet michael@0: ; registry keys are for this install. michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: ClearErrors michael@0: ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" michael@0: ${If} ${Errors} michael@0: ${OrIf} ${AtMostWin2008R2} michael@0: ClearErrors michael@0: ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" michael@0: ${EndIf} michael@0: ${Unless} ${Errors} michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $0 michael@0: ${If} ${FileExists} "$0" michael@0: ${GetLongPath} "$0" $0 michael@0: ${If} "$0" == "$INSTDIR" michael@0: WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) michael@0: michael@0: ${If} ${AtLeastWin8} michael@0: ${SetStartMenuInternet} "HKCU" michael@0: ${FixShellIconHandler} "HKCU" michael@0: ${FixClassKeys} ; Does not use SHCTX michael@0: Call RegisterStartMenuTile michael@0: ${EndIf} michael@0: michael@0: ${SetHandlers} michael@0: michael@0: ${If} ${AtLeastWinVista} michael@0: ; Only register as the handler on Vista and above if the app registry name michael@0: ; exists under the RegisteredApplications registry key. The protocol and michael@0: ; file handlers set previously at the user level will associate this install michael@0: ; as the default browser. michael@0: ClearErrors michael@0: ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}" michael@0: ${Unless} ${Errors} michael@0: ; This is all protected by a user choice hash in Windows 8 so it won't michael@0: ; help, but it also won't hurt. michael@0: AppAssocReg::SetAppAsDefaultAll "${AppRegName}" michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: ${RemoveDeprecatedKeys} michael@0: ${PinToTaskBar} michael@0: FunctionEnd michael@0: michael@0: ; Helper for updating the shortcut application model IDs. michael@0: Function FixShortcutAppModelIDs michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $0 michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: ; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to michael@0: ; this function only being used by the uninstaller.nsi. michael@0: !ifdef NO_LOG michael@0: michael@0: Function SetAsDefaultAppUser michael@0: ; On Win8, we want to avoid having a UAC prompt since we'll already have michael@0: ; another action for control panel default browser selection popping up michael@0: ; to the user. Win8 is the first OS where the start menu keys can be michael@0: ; added into HKCU. The call to SetAsDefaultAppUserHKCU will have already michael@0: ; set the HKCU keys for SetStartMenuInternet. michael@0: ${If} ${AtLeastWin8} michael@0: ; Check if this is running in an elevated process michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${If} ${Errors} ; Not elevated michael@0: Call SetAsDefaultAppUserHKCU michael@0: ${Else} ; Elevated - execute the function in the unelevated process michael@0: GetFunctionAddress $0 SetAsDefaultAppUserHKCU michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: Return ; Nothing more needs to be done michael@0: ${EndIf} michael@0: michael@0: ; Before Win8, it is only possible to set this installation of the application michael@0: ; as the StartMenuInternet handler if it was added to the HKLM michael@0: ; StartMenuInternet registry keys. michael@0: ; http://support.microsoft.com/kb/297878 michael@0: michael@0: ; Check if this install location registered as the StartMenuInternet client michael@0: ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 michael@0: ClearErrors michael@0: ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" michael@0: ${If} ${Errors} michael@0: ${OrIf} ${AtMostWin2008R2} michael@0: ClearErrors michael@0: ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" michael@0: ${EndIf} michael@0: michael@0: ${Unless} ${Errors} michael@0: ${GetPathFromString} "$0" $0 michael@0: ${GetParent} "$0" $0 michael@0: ${If} ${FileExists} "$0" michael@0: ${GetLongPath} "$0" $0 michael@0: ${If} "$0" == "$INSTDIR" michael@0: ; Check if this is running in an elevated process michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${If} ${Errors} ; Not elevated michael@0: Call SetAsDefaultAppUserHKCU michael@0: ${Else} ; Elevated - execute the function in the unelevated process michael@0: GetFunctionAddress $0 SetAsDefaultAppUserHKCU michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: Return ; Nothing more needs to be done michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: michael@0: ; The code after ElevateUAC won't be executed on Vista and above when the michael@0: ; user: michael@0: ; a) is a member of the administrators group (e.g. elevation is required) michael@0: ; b) is not a member of the administrators group and chooses to elevate michael@0: ${ElevateUAC} michael@0: michael@0: ${SetStartMenuInternet} "HKLM" michael@0: michael@0: SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) michael@0: michael@0: ${FixClassKeys} ; Does not use SHCTX michael@0: ${FixShellIconHandler} "HKLM" michael@0: ${RemoveDeprecatedKeys} ; Does not use SHCTX michael@0: michael@0: ClearErrors michael@0: ${GetParameters} $0 michael@0: ${GetOptions} "$0" "/UAC:" $0 michael@0: ${If} ${Errors} michael@0: Call SetAsDefaultAppUserHKCU michael@0: ${Else} michael@0: GetFunctionAddress $0 SetAsDefaultAppUserHKCU michael@0: UAC::ExecCodeSegment $0 michael@0: ${EndIf} michael@0: FunctionEnd michael@0: !define SetAsDefaultAppUser "Call SetAsDefaultAppUser" michael@0: michael@0: !endif ; NO_LOG