michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # Required Plugins: michael@0: # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in michael@0: # CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash michael@0: # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in michael@0: # UAC http://nsis.sourceforge.net/UAC_plug-in michael@0: michael@0: ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs michael@0: !verbose 3 michael@0: michael@0: ; 7-Zip provides better compression than the lzma from NSIS so we add the files michael@0: ; uncompressed and use 7-Zip to create a SFX archive of it michael@0: SetDatablockOptimize on michael@0: SetCompress off michael@0: CRCCheck on michael@0: michael@0: RequestExecutionLevel user michael@0: michael@0: ; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can michael@0: ; be removed after we require NSIS 3.0a2 or greater. michael@0: !ifdef NSIS_PACKEDVERSION michael@0: Unicode true michael@0: ManifestSupportedOS all michael@0: ManifestDPIAware true michael@0: !endif michael@0: michael@0: !addplugindir ./ michael@0: michael@0: ; On Vista and above attempt to elevate Standard Users in addition to users that michael@0: ; are a member of the Administrators group. michael@0: !define NONADMIN_ELEVATE michael@0: michael@0: ; prevents compiling of the reg write logging. michael@0: !define NO_LOG michael@0: michael@0: !define MaintUninstallKey \ michael@0: "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" michael@0: michael@0: Var TmpVal michael@0: Var MaintCertKey michael@0: michael@0: ; Other included files may depend upon these includes! michael@0: ; The following includes are provided by NSIS. michael@0: !include FileFunc.nsh michael@0: !include LogicLib.nsh michael@0: !include MUI.nsh michael@0: !include WinMessages.nsh michael@0: !include WinVer.nsh michael@0: !include WordFunc.nsh michael@0: michael@0: !insertmacro GetSize michael@0: !insertmacro StrFilter michael@0: !insertmacro WordReplace michael@0: michael@0: !insertmacro un.GetParent michael@0: michael@0: ; The following includes are custom. michael@0: !include branding.nsi michael@0: !include defines.nsi michael@0: !include common.nsh michael@0: !include locales.nsi michael@0: michael@0: ; This is named BrandShortName helper because we use this for software update michael@0: ; post update cleanup. michael@0: VIAddVersionKey "FileDescription" "${BrandShortName} Helper" michael@0: VIAddVersionKey "OriginalFilename" "helper.exe" michael@0: michael@0: !insertmacro AddDisabledDDEHandlerValues michael@0: !insertmacro CleanVirtualStore michael@0: !insertmacro ElevateUAC michael@0: !insertmacro GetLongPath michael@0: !insertmacro GetPathFromString michael@0: !insertmacro InitHashAppModelId michael@0: !insertmacro IsHandlerForInstallDir michael@0: !insertmacro IsPinnedToTaskBar michael@0: !insertmacro IsUserAdmin michael@0: !insertmacro LogDesktopShortcut michael@0: !insertmacro LogQuickLaunchShortcut michael@0: !insertmacro LogStartMenuShortcut michael@0: !insertmacro PinnedToStartMenuLnkCount michael@0: !insertmacro RegCleanAppHandler michael@0: !insertmacro RegCleanMain michael@0: !insertmacro RegCleanUninstall michael@0: !ifdef MOZ_METRO michael@0: !insertmacro RemoveDEHRegistrationIfMatching michael@0: !endif michael@0: !insertmacro SetAppLSPCategories michael@0: !insertmacro SetBrandNameVars michael@0: !insertmacro UpdateShortcutAppModelIDs michael@0: !insertmacro UnloadUAC michael@0: !insertmacro WriteRegDWORD2 michael@0: !insertmacro WriteRegStr2 michael@0: !insertmacro CheckIfRegistryKeyExists michael@0: michael@0: !insertmacro un.ChangeMUIHeaderImage michael@0: !insertmacro un.CheckForFilesInUse michael@0: !insertmacro un.CleanUpdateDirectories michael@0: !insertmacro un.CleanVirtualStore michael@0: !insertmacro un.DeleteShortcuts michael@0: !insertmacro un.GetLongPath michael@0: !insertmacro un.GetSecondInstallPath michael@0: !insertmacro un.InitHashAppModelId michael@0: !insertmacro un.ManualCloseAppPrompt michael@0: !insertmacro un.ParseUninstallLog michael@0: !insertmacro un.RegCleanAppHandler michael@0: !insertmacro un.RegCleanFileHandler michael@0: !insertmacro un.RegCleanMain michael@0: !insertmacro un.RegCleanUninstall michael@0: !insertmacro un.RegCleanProtocolHandler michael@0: !ifdef MOZ_METRO michael@0: !insertmacro un.RemoveDEHRegistrationIfMatching michael@0: !endif michael@0: !insertmacro un.RemoveQuotesFromPath michael@0: !insertmacro un.SetAppLSPCategories michael@0: !insertmacro un.SetBrandNameVars michael@0: michael@0: !include shared.nsh michael@0: michael@0: ; Helper macros for ui callbacks. Insert these after shared.nsh michael@0: !insertmacro OnEndCommon michael@0: !insertmacro UninstallOnInitCommon michael@0: michael@0: !insertmacro un.OnEndCommon michael@0: !insertmacro un.UninstallUnOnInitCommon michael@0: michael@0: Name "${BrandFullName}" michael@0: OutFile "helper.exe" michael@0: !ifdef HAVE_64BIT_OS michael@0: InstallDir "$PROGRAMFILES64\${BrandFullName}\" michael@0: !else michael@0: InstallDir "$PROGRAMFILES32\${BrandFullName}\" michael@0: !endif michael@0: ShowUnInstDetails nevershow michael@0: michael@0: ################################################################################ michael@0: # Modern User Interface - MUI michael@0: michael@0: !define MUI_ABORTWARNING michael@0: !define MUI_ICON setup.ico michael@0: !define MUI_UNICON setup.ico michael@0: !define MUI_WELCOMEPAGE_TITLE_3LINES michael@0: !define MUI_HEADERIMAGE michael@0: !define MUI_HEADERIMAGE_RIGHT michael@0: !define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp michael@0: michael@0: ; Use a right to left header image when the language is right to left michael@0: !ifdef ${AB_CD}_rtl michael@0: !define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp michael@0: !else michael@0: !define MUI_HEADERIMAGE_BITMAP wizHeader.bmp michael@0: !endif michael@0: michael@0: /** michael@0: * Uninstall Pages michael@0: */ michael@0: ; Welcome Page michael@0: !define MUI_PAGE_CUSTOMFUNCTION_PRE un.preWelcome michael@0: !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.leaveWelcome michael@0: !insertmacro MUI_UNPAGE_WELCOME michael@0: michael@0: ; Custom Uninstall Confirm Page michael@0: UninstPage custom un.preConfirm un.leaveConfirm michael@0: michael@0: ; Remove Files Page michael@0: !insertmacro MUI_UNPAGE_INSTFILES michael@0: michael@0: ; Finish Page michael@0: michael@0: ; Don't setup the survey controls, functions, etc. when the application has michael@0: ; defined NO_UNINSTALL_SURVEY michael@0: !ifndef NO_UNINSTALL_SURVEY michael@0: !define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish michael@0: !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED michael@0: !define MUI_FINISHPAGE_SHOWREADME "" michael@0: !define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT) michael@0: !define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey michael@0: !endif michael@0: michael@0: !insertmacro MUI_UNPAGE_FINISH michael@0: michael@0: ; Use the default dialog for IDD_VERIFY for a simple Banner michael@0: ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" michael@0: michael@0: ; This function is used to uninstall the maintenance service if the michael@0: ; application currently being uninstalled is the last application to use the michael@0: ; maintenance service. michael@0: Function un.UninstallServiceIfNotUsed michael@0: ; $0 will store if a subkey exists michael@0: ; $1 will store the first subkey if it exists or an empty string if it doesn't michael@0: ; Backup the old values michael@0: Push $0 michael@0: Push $1 michael@0: michael@0: ; The maintenance service always uses the 64-bit registry on x64 systems michael@0: ${If} ${RunningX64} michael@0: SetRegView 64 michael@0: ${EndIf} michael@0: michael@0: ; Figure out the number of subkeys michael@0: StrCpy $0 0 michael@0: loop: michael@0: EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0 michael@0: StrCmp $1 "" doneCount michael@0: IntOp $0 $0 + 1 michael@0: goto loop michael@0: doneCount: michael@0: ; Restore back the registry view michael@0: ${If} ${RunningX64} michael@0: SetRegView lastUsed michael@0: ${EndIf} michael@0: ${If} $0 == 0 michael@0: ; Get the path of the maintenance service uninstaller michael@0: ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" michael@0: michael@0: ; If the uninstall string does not exist, skip executing it michael@0: StrCmp $1 "" doneUninstall michael@0: michael@0: ; $1 is already a quoted string pointing to the install path michael@0: ; so we're already protected against paths with spaces michael@0: nsExec::Exec "$1 /S" michael@0: doneUninstall: michael@0: ${EndIf} michael@0: michael@0: ; Restore the old value of $1 and $0 michael@0: Pop $1 michael@0: Pop $0 michael@0: FunctionEnd michael@0: michael@0: ################################################################################ michael@0: # Install Sections michael@0: ; Empty section required for the installer to compile as an uninstaller michael@0: Section "" michael@0: SectionEnd michael@0: michael@0: ################################################################################ michael@0: # Uninstall Sections michael@0: michael@0: Section "Uninstall" michael@0: SetDetailsPrint textonly michael@0: DetailPrint $(STATUS_UNINSTALL_MAIN) michael@0: SetDetailsPrint none michael@0: michael@0: ; Delete the app exe to prevent launching the app while we are uninstalling. michael@0: ClearErrors michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${Errors} michael@0: ; If the user closed the application it can take several seconds for it to michael@0: ; shut down completely. If the application is being used by another user we michael@0: ; can still delete the files when the system is restarted. michael@0: Sleep 5000 michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ClearErrors michael@0: ${EndIf} michael@0: michael@0: ; setup the application model id registration value michael@0: ${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" michael@0: michael@0: SetShellVarContext current ; Set SHCTX to HKCU michael@0: ${un.RegCleanMain} "Software\Mozilla" michael@0: ${un.RegCleanUninstall} michael@0: ${un.DeleteShortcuts} michael@0: michael@0: ; Unregister resources associated with Win7 taskbar jump lists. michael@0: ${If} ${AtLeastWin7} michael@0: ${AndIf} "$AppUserModelID" != "" michael@0: ApplicationID::UninstallJumpLists "$AppUserModelID" michael@0: ${EndIf} michael@0: michael@0: ; Remove the updates directory for Vista and above michael@0: ${un.CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates" michael@0: michael@0: ; Remove any app model id's stored in the registry for this install path michael@0: DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR" michael@0: DeleteRegValue HKLM "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR" michael@0: michael@0: ClearErrors michael@0: WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" michael@0: ${If} ${Errors} michael@0: StrCpy $TmpVal "HKCU" ; used primarily for logging michael@0: ${Else} michael@0: SetShellVarContext all ; Set SHCTX to HKLM michael@0: DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" michael@0: StrCpy $TmpVal "HKLM" ; used primarily for logging michael@0: ${un.RegCleanMain} "Software\Mozilla" michael@0: ${un.RegCleanUninstall} michael@0: ${un.DeleteShortcuts} michael@0: ${un.SetAppLSPCategories} michael@0: ${EndIf} michael@0: michael@0: !ifdef MOZ_METRO michael@0: ${If} ${AtLeastWin8} michael@0: ${un.CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ michael@0: "FirefoxURL" \ michael@0: "FirefoxHTML" michael@0: ${EndIf} michael@0: ${ResetWin8PromptKeys} "HKCU" "" michael@0: ${ResetWin8MetroSplash} 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: michael@0: ${un.RegCleanAppHandler} "FirefoxURL" michael@0: ${un.RegCleanAppHandler} "FirefoxHTML" michael@0: ${un.RegCleanProtocolHandler} "ftp" michael@0: ${un.RegCleanProtocolHandler} "http" michael@0: ${un.RegCleanProtocolHandler} "https" michael@0: michael@0: ClearErrors michael@0: ReadRegStr $R9 HKCR "FirefoxHTML" "" michael@0: ; Don't clean up the file handlers if the FirefoxHTML key still exists since michael@0: ; there should be a second installation that may be the default file handler michael@0: ${If} ${Errors} michael@0: ${un.RegCleanFileHandler} ".htm" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".html" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".shtml" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".xht" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".xhtml" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".oga" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".ogg" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".ogv" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".pdf" "FirefoxHTML" michael@0: ${un.RegCleanFileHandler} ".webm" "FirefoxHTML" michael@0: ${EndIf} michael@0: michael@0: SetShellVarContext all ; Set SHCTX to HKLM michael@0: ${un.GetSecondInstallPath} "Software\Mozilla" $R9 michael@0: ${If} $R9 == "false" michael@0: SetShellVarContext current ; Set SHCTX to HKCU michael@0: ${un.GetSecondInstallPath} "Software\Mozilla" $R9 michael@0: ${EndIf} michael@0: michael@0: StrCpy $0 "Software\Clients\StartMenuInternet\${FileMainEXE}\shell\open\command" michael@0: ReadRegStr $R1 HKLM "$0" "" michael@0: ${un.RemoveQuotesFromPath} "$R1" $R1 michael@0: ${un.GetParent} "$R1" $R1 michael@0: michael@0: ; Only remove the StartMenuInternet key if it refers to this install location. michael@0: ; The StartMenuInternet registry key is independent of the default browser michael@0: ; settings. The XPInstall base un-installer always removes this key if it is michael@0: ; uninstalling the default browser and it will always replace the keys when michael@0: ; installing even if there is another install of Firefox that is set as the michael@0: ; default browser. Now the key is always updated on install but it is only michael@0: ; removed if it refers to this install location. michael@0: ${If} "$INSTDIR" == "$R1" michael@0: DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}" michael@0: DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}" michael@0: ${EndIf} michael@0: michael@0: ReadRegStr $R1 HKCU "$0" "" michael@0: ${un.RemoveQuotesFromPath} "$R1" $R1 michael@0: ${un.GetParent} "$R1" $R1 michael@0: michael@0: ; Only remove the StartMenuInternet key if it refers to this install location. michael@0: ; The StartMenuInternet registry key is independent of the default browser michael@0: ; settings. The XPInstall base un-installer always removes this key if it is michael@0: ; uninstalling the default browser and it will always replace the keys when michael@0: ; installing even if there is another install of Firefox that is set as the michael@0: ; default browser. Now the key is always updated on install but it is only michael@0: ; removed if it refers to this install location. michael@0: ${If} "$INSTDIR" == "$R1" michael@0: DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${FileMainEXE}" michael@0: DeleteRegValue HKCU "Software\RegisteredApplications" "${AppRegName}" michael@0: ${EndIf} michael@0: michael@0: StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" michael@0: ${If} $R9 == "false" michael@0: DeleteRegKey HKLM "$0" michael@0: DeleteRegKey HKCU "$0" michael@0: StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\${FileMainEXE}" michael@0: DeleteRegKey HKLM "$0" michael@0: DeleteRegKey HKCU "$0" michael@0: StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe" michael@0: DeleteRegKey HKLM "$0" michael@0: DeleteRegKey HKCU "$0" michael@0: StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=firefox" michael@0: DeleteRegKey HKLM "$0" michael@0: DeleteRegKey HKCU "$0" michael@0: ${Else} michael@0: ReadRegStr $R1 HKLM "$0" "" michael@0: ${un.RemoveQuotesFromPath} "$R1" $R1 michael@0: ${un.GetParent} "$R1" $R1 michael@0: ${If} "$INSTDIR" == "$R1" michael@0: WriteRegStr HKLM "$0" "" "$R9" michael@0: ${un.GetParent} "$R9" $R1 michael@0: WriteRegStr HKLM "$0" "Path" "$R1" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: michael@0: ; Remove directories and files we always control before parsing the uninstall michael@0: ; log so empty directories can be removed. michael@0: ${If} ${FileExists} "$INSTDIR\updates" michael@0: RmDir /r /REBOOTOK "$INSTDIR\updates" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\updated" michael@0: RmDir /r /REBOOTOK "$INSTDIR\updated" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\defaults\shortcuts" michael@0: RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\distribution" michael@0: RmDir /r /REBOOTOK "$INSTDIR\distribution" michael@0: ${EndIf} michael@0: ${If} ${FileExists} "$INSTDIR\removed-files" michael@0: Delete /REBOOTOK "$INSTDIR\removed-files" michael@0: ${EndIf} michael@0: michael@0: ; Remove files that may be left behind by the application in the michael@0: ; VirtualStore directory. michael@0: ${un.CleanVirtualStore} michael@0: michael@0: ; Parse the uninstall log to unregister dll's and remove all installed michael@0: ; files / directories this install is responsible for. michael@0: ${un.ParseUninstallLog} michael@0: michael@0: ; Remove the uninstall directory that we control michael@0: RmDir /r /REBOOTOK "$INSTDIR\uninstall" michael@0: michael@0: ; Explictly remove empty webapprt dir in case it exists michael@0: ; See bug 757978 michael@0: RmDir "$INSTDIR\webapprt\components" michael@0: RmDir "$INSTDIR\webapprt" michael@0: michael@0: RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" michael@0: michael@0: ; Remove the installation directory if it is empty michael@0: ${RemoveDir} "$INSTDIR" michael@0: michael@0: ; If firefox.exe was successfully deleted yet we still need to restart to michael@0: ; remove other files create a dummy firefox.exe.moz-delete to prevent the michael@0: ; installer from allowing an install without restart when it is required michael@0: ; to complete an uninstall. michael@0: ${If} ${RebootFlag} michael@0: ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete" michael@0: FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w michael@0: FileWrite $0 "Will be deleted on restart" michael@0: Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" michael@0: FileClose $0 michael@0: ${EndUnless} michael@0: ${EndIf} michael@0: michael@0: ; Refresh desktop icons otherwise the start menu internet item won't be michael@0: ; removed and other ugly things will happen like recreation of the app's michael@0: ; clients registry key by the OS under some conditions. michael@0: System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i 0, i 0, i 0)" michael@0: michael@0: !ifdef MOZ_MAINTENANCE_SERVICE michael@0: ; Get the path the allowed cert is at and remove it michael@0: ; Keep this block of code last since it modfies the reg view michael@0: ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" michael@0: Pop $MaintCertKey michael@0: ${If} $MaintCertKey != "" 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 "$MaintCertKey" michael@0: ${If} ${RunningX64} michael@0: SetRegView lastused michael@0: ${EndIf} michael@0: ${EndIf} michael@0: Call un.UninstallServiceIfNotUsed michael@0: !endif michael@0: michael@0: SectionEnd michael@0: michael@0: ################################################################################ michael@0: # Helper Functions michael@0: michael@0: ; Don't setup the survey controls, functions, etc. when the application has michael@0: ; defined NO_UNINSTALL_SURVEY michael@0: !ifndef NO_UNINSTALL_SURVEY michael@0: Function un.Survey michael@0: Exec "$\"$TmpVal$\" $\"${SurveyURL}$\"" michael@0: FunctionEnd michael@0: !endif michael@0: michael@0: ################################################################################ michael@0: # Language michael@0: michael@0: !insertmacro MOZ_MUI_LANGUAGE 'baseLocale' michael@0: !verbose push michael@0: !verbose 3 michael@0: !include "overrideLocale.nsh" michael@0: !include "customLocale.nsh" michael@0: !verbose pop michael@0: michael@0: ; Set this after the locale files to override it if it is in the locale. Using michael@0: ; " " for BrandingText will hide the "Nullsoft Install System..." branding. michael@0: BrandingText " " michael@0: michael@0: ################################################################################ michael@0: # Page pre, show, and leave functions michael@0: michael@0: Function un.preWelcome michael@0: ${If} ${FileExists} "$INSTDIR\distribution\modern-wizard.bmp" michael@0: Delete "$PLUGINSDIR\modern-wizard.bmp" michael@0: CopyFiles /SILENT "$INSTDIR\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function un.leaveWelcome michael@0: ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" michael@0: Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" michael@0: michael@0: ; If the message window has been found previously give the app an additional michael@0: ; five seconds to close. michael@0: ${If} "$TmpVal" == "FoundMessageWindow" michael@0: Sleep 5000 michael@0: ${EndIf} michael@0: michael@0: ${PushFilesToCheck} michael@0: michael@0: ${un.CheckForFilesInUse} $TmpVal michael@0: michael@0: Banner::destroy michael@0: michael@0: ; If there are files in use $TmpVal will be "true" michael@0: ${If} "$TmpVal" == "true" michael@0: ; If the message window is found the call to ManualCloseAppPrompt will michael@0: ; abort leaving the value of $TmpVal set to "FoundMessageWindow". michael@0: StrCpy $TmpVal "FoundMessageWindow" michael@0: ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)" michael@0: ; If the message window is not found set $TmpVal to "true" so the restart michael@0: ; required message is displayed. michael@0: StrCpy $TmpVal "true" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: Function un.preConfirm michael@0: ${If} ${FileExists} "$INSTDIR\distribution\modern-header.bmp" michael@0: ${AndIf} $hHeaderBitmap == "" michael@0: Delete "$PLUGINSDIR\modern-header.bmp" michael@0: CopyFiles /SILENT "$INSTDIR\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" michael@0: ${un.ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" michael@0: ${EndIf} michael@0: michael@0: ; Setup the unconfirm.ini file for the Custom Uninstall Confirm Page michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "3" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Top "5" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Bottom "15" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Type "text" michael@0: ; The contents of this control must be set as follows in the pre function michael@0: ; ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND" michael@0: ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" State "" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Top "17" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_CONFIRM_CLICK)" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "130" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "150" michael@0: michael@0: ${If} "$TmpVal" == "true" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "label" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "35" michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "45" michael@0: michael@0: WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "4" michael@0: ${EndIf} michael@0: michael@0: !insertmacro MUI_HEADER_TEXT "$(UN_CONFIRM_PAGE_TITLE)" "$(UN_CONFIRM_PAGE_SUBTITLE)" michael@0: ; The Summary custom page has a textbox that will automatically receive michael@0: ; focus. This sets the focus to the Install button instead. michael@0: !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "unconfirm.ini" michael@0: GetDlgItem $0 $HWNDPARENT 1 michael@0: System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" michael@0: ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND" michael@0: SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" michael@0: !insertmacro MUI_INSTALLOPTIONS_SHOW michael@0: FunctionEnd michael@0: michael@0: Function un.leaveConfirm michael@0: ; Try to delete the app executable and if we can't delete it try to find the michael@0: ; app's message window and prompt the user to close the app. This allows michael@0: ; running an instance that is located in another directory. If for whatever michael@0: ; reason there is no message window we will just rename the app's files and michael@0: ; then remove them on restart if they are in use. michael@0: ClearErrors michael@0: ${DeleteFile} "$INSTDIR\${FileMainEXE}" michael@0: ${If} ${Errors} michael@0: ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)" michael@0: ${EndIf} michael@0: FunctionEnd michael@0: michael@0: !ifndef NO_UNINSTALL_SURVEY michael@0: Function un.preFinish michael@0: ; Do not modify the finish page if there is a reboot pending michael@0: ${Unless} ${RebootFlag} michael@0: ; Setup the survey controls, functions, etc. michael@0: StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup" michael@0: ClearErrors michael@0: ReadRegStr $0 HKLM $TmpVal "Path" michael@0: ${If} ${Errors} michael@0: !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3" michael@0: ${Else} michael@0: ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles% michael@0: ${If} $0 != "\" michael@0: StrCpy $0 "$0\" michael@0: ${EndIf} michael@0: StrCpy $0 "$0\iexplore.exe" michael@0: ClearErrors michael@0: GetFullPathName $TmpVal $0 michael@0: ${If} ${Errors} michael@0: !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3" michael@0: ${Else} michael@0: ; When we add an optional action to the finish page the cancel button michael@0: ; is enabled. This disables it and leaves the finish button as the michael@0: ; only choice. michael@0: !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" michael@0: ${EndIf} michael@0: ${EndIf} michael@0: ${EndUnless} michael@0: FunctionEnd michael@0: !endif michael@0: michael@0: ################################################################################ michael@0: # Initialization Functions michael@0: michael@0: Function .onInit michael@0: ; Remove the current exe directory from the search order. michael@0: ; This only effects LoadLibrary calls and not implicitly loaded DLLs. michael@0: System::Call 'kernel32::SetDllDirectoryW(w "")' michael@0: michael@0: ; We need this set up for most of the helper.exe operations. michael@0: ${UninstallOnInitCommon} michael@0: FunctionEnd michael@0: michael@0: Function un.onInit michael@0: ; Remove the current exe directory from the search order. michael@0: ; This only effects LoadLibrary calls and not implicitly loaded DLLs. michael@0: System::Call 'kernel32::SetDllDirectoryW(w "")' michael@0: michael@0: StrCpy $LANGUAGE 0 michael@0: michael@0: ${un.UninstallUnOnInitCommon} michael@0: michael@0: ; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be michael@0: ; removed after we require NSIS 3.0a2 or greater. michael@0: !ifndef NSIS_PACKEDVERSION michael@0: ${If} ${AtLeastWinVista} michael@0: System::Call 'user32::SetProcessDPIAware()' michael@0: ${EndIf} michael@0: !endif michael@0: michael@0: !insertmacro InitInstallOptionsFile "unconfirm.ini" michael@0: FunctionEnd michael@0: michael@0: Function .onGUIEnd michael@0: ${OnEndCommon} michael@0: FunctionEnd michael@0: michael@0: Function un.onGUIEnd michael@0: ${un.OnEndCommon} michael@0: FunctionEnd