From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- comm/mail/installer/Makefile.in | 214 +++ comm/mail/installer/allowed-dupes.mn | 81 + comm/mail/installer/moz.build | 4 + comm/mail/installer/package-manifest.in | 516 +++++++ comm/mail/installer/removed-files.in | 92 ++ comm/mail/installer/windows/Makefile.in | 59 + comm/mail/installer/windows/app.tag | 4 + comm/mail/installer/windows/docs/MSIX.rst | 23 + comm/mail/installer/windows/moz.build | 12 + comm/mail/installer/windows/msi/installer.wxs | 104 ++ .../installer/windows/msix/AppxManifest.xml.in | 150 ++ comm/mail/installer/windows/msix/Resources.pri | Bin 0 -> 2280 bytes .../windows/msix/distribution/distribution.ini | 12 + comm/mail/installer/windows/msix/msix-all-locales | 361 +++++ comm/mail/installer/windows/msix/priconfig.xml | 38 + comm/mail/installer/windows/nsis/defines.nsi.in | 86 ++ comm/mail/installer/windows/nsis/installer.nsi | 1316 ++++++++++++++++ .../windows/nsis/maintenanceservice_installer.nsi | 343 +++++ comm/mail/installer/windows/nsis/shared.nsh | 1617 ++++++++++++++++++++ comm/mail/installer/windows/nsis/uninstaller.nsi | 683 +++++++++ .../mail/installer/windows/nsis/updater_append.ini | 12 + 21 files changed, 5727 insertions(+) create mode 100644 comm/mail/installer/Makefile.in create mode 100644 comm/mail/installer/allowed-dupes.mn create mode 100644 comm/mail/installer/moz.build create mode 100644 comm/mail/installer/package-manifest.in create mode 100644 comm/mail/installer/removed-files.in create mode 100644 comm/mail/installer/windows/Makefile.in create mode 100644 comm/mail/installer/windows/app.tag create mode 100644 comm/mail/installer/windows/docs/MSIX.rst create mode 100644 comm/mail/installer/windows/moz.build create mode 100644 comm/mail/installer/windows/msi/installer.wxs create mode 100644 comm/mail/installer/windows/msix/AppxManifest.xml.in create mode 100644 comm/mail/installer/windows/msix/Resources.pri create mode 100644 comm/mail/installer/windows/msix/distribution/distribution.ini create mode 100644 comm/mail/installer/windows/msix/msix-all-locales create mode 100644 comm/mail/installer/windows/msix/priconfig.xml create mode 100755 comm/mail/installer/windows/nsis/defines.nsi.in create mode 100755 comm/mail/installer/windows/nsis/installer.nsi create mode 100644 comm/mail/installer/windows/nsis/maintenanceservice_installer.nsi create mode 100755 comm/mail/installer/windows/nsis/shared.nsh create mode 100755 comm/mail/installer/windows/nsis/uninstaller.nsi create mode 100644 comm/mail/installer/windows/nsis/updater_append.ini (limited to 'comm/mail/installer') diff --git a/comm/mail/installer/Makefile.in b/comm/mail/installer/Makefile.in new file mode 100644 index 0000000000..01b10d3fde --- /dev/null +++ b/comm/mail/installer/Makefile.in @@ -0,0 +1,214 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +STANDALONE_MAKEFILE := 1 +# DIST_SUBDIR := mail # Not sure why TB is not using this + +include $(topsrcdir)/config/rules.mk + +MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in + +MOZ_PKG_MANIFEST = $(srcdir)/package-manifest.in +# Some files have been already bundled with xulrunner +ifndef SYSTEM_LIBXUL +MOZ_PKG_FATAL_WARNINGS = 1 +endif + +# When packaging an artifact build not all xpt files expected by the +# packager will be present. +ifdef MOZ_ARTIFACT_BUILDS +MOZ_PKG_FATAL_WARNINGS = +endif + +DEFINES += -DPKG_LOCALE_MANIFEST=$(topobjdir)/comm/mail/installer/locale-manifest.in +MOZ_CHROME_LOCALE_ENTRIES=@RESPATH@/chrome/ + +MOZ_PKG_DUPEFLAGS = \ + -f $(srcdir)/allowed-dupes.mn \ + $(NULL) + +MOZ_NONLOCALIZED_PKG_LIST = \ + xpcom \ + mail \ + newsblog \ + offline \ + $(NULL) + +MOZ_LOCALIZED_PKG_LIST = $(AB_CD) + +DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR) + +ifdef NIGHTLY_BUILD +DEFINES += -DNIGHTLY_BUILD=1 +endif + +ifdef MOZ_DEBUG +DEFINES += -DMOZ_DEBUG=1 +endif + +ifeq ($(MOZ_WIDGET_TOOLKIT),gtk) +DEFINES += -DMOZ_GTK=1 +endif + +ifdef MOZ_SYSTEM_NSPR +DEFINES += -DMOZ_SYSTEM_NSPR=1 +endif + +ifdef MOZ_SYSTEM_NSS +DEFINES += -DMOZ_SYSTEM_NSS=1 +endif + +ifdef MOZ_ARTIFACT_BUILDS +DEFINES += -DMOZ_ARTIFACT_BUILDS=1 +DEFINES += -DMZLA_LIBRNP=1 +endif + +DEFINES += -DJAREXT= + +ifdef MOZ_ANGLE_RENDERER +DEFINES += -DMOZ_ANGLE_RENDERER=$(MOZ_ANGLE_RENDERER) +ifdef MOZ_D3DCOMPILER_VISTA_DLL +DEFINES += -DMOZ_D3DCOMPILER_VISTA_DLL=$(MOZ_D3DCOMPILER_VISTA_DLL) +endif +endif + +ifdef MOZ_UPDATER +DEFINES += -DMOZ_UPDATER=1 +endif + +DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) + +# Set MSVC dlls version to package, if any. +ifdef MOZ_NO_DEBUG_RTL +ifdef WIN32_REDIST_DIR +DEFINES += -DMOZ_PACKAGE_MSVC_DLLS=1 +DEFINES += -DMSVC_C_RUNTIME_DLL=$(MSVC_C_RUNTIME_DLL) +ifdef MSVC_C_RUNTIME_1_DLL +DEFINES += -DMSVC_C_RUNTIME_1_DLL=$(MSVC_C_RUNTIME_1_DLL) +endif +DEFINES += -DMSVC_CXX_RUNTIME_DLL=$(MSVC_CXX_RUNTIME_DLL) +endif +ifdef WIN_UCRT_REDIST_DIR +DEFINES += -DMOZ_PACKAGE_WIN_UCRT_DLLS=1 +endif +endif + +ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET))) +DEFINES += -DMOZ_SHARED_MOZGLUE=1 +endif + +ifdef NECKO_WIFI +DEFINES += -DNECKO_WIFI +endif + +ifdef MOZ_BUNDLED_FONTS +DEFINES += -DMOZ_BUNDLED_FONTS=1 +endif + +ifdef MAKENSISU +DEFINES += -DHAVE_MAKENSISU=1 +endif + +ifdef MOZ_BACKGROUNDTASKS +DEFINES += -DMOZ_BACKGROUNDTASKS=1 +endif + +ifdef MOZ_PREF_EXTENSIONS +DEFINES += -DMOZ_PREF_EXTENSIONS=1 +endif + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +MOZ_PKG_MAC_DSSTORE=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/dsstore +MOZ_PKG_MAC_BACKGROUND=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/background.png +MOZ_PKG_MAC_ICON=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/disk.icns +MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ ' +endif + +# The packager minifies two different types of files: non-JS (mostly property +# files for l10n), and JS. Setting MOZ_PACKAGER_MINIFY only minifies the +# former. We don't yet minify JS, due to concerns about debuggability. +# +# Also, the JS minification setup really only works correctly on Android: +# we need extra setup to use the newly-built shell for Linux and Windows, +# and Mac requires some extra care due to cross-compilation. +MOZ_PACKAGER_MINIFY=1 + +NON_OMNIJAR_FILES = defaults/messenger/mailViews.dat + +UPLOAD_EXTRA_FILES = $(MOZ_BUILT_FROM_FILE) +include $(topsrcdir)/toolkit/mozapps/installer/packager.mk + +ifeq (Darwin,$(OS_TARGET)) +BINPATH = $(_BINPATH) +DEFINES += -DAPPNAME='$(_APPNAME)' +else +# Every other platform just winds up in dist/bin +BINPATH = bin +endif +DEFINES += -DBINPATH='$(BINPATH)' + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +RESPATH = $(_RESPATH) +else +RESPATH = $(BINPATH) +endif +DEFINES += -DRESPATH='$(RESPATH)' + +LPROJ_ROOT = $(firstword $(subst -, ,$(AB_CD))) +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +ifeq (zh-TW,$(AB_CD)) +LPROJ_ROOT := $(subst -,_,$(AB_CD)) +endif +endif +DEFINES += -DLPROJ_ROOT=$(LPROJ_ROOT) + +ifdef MOZ_SYSTEM_ICU +DEFINES += -DMOZ_SYSTEM_ICU +endif + +ifdef CLANG_CXX +DEFINES += -DCLANG_CXX +endif +ifdef CLANG_CL +DEFINES += -DCLANG_CL +endif + +ifdef LLVM_SYMBOLIZER +DEFINES += -DLLVM_SYMBOLIZER=$(notdir $(LLVM_SYMBOLIZER)) +endif +ifdef MOZ_CLANG_RT_ASAN_LIB_PATH +DEFINES += -DMOZ_CLANG_RT_ASAN_LIB=$(notdir $(MOZ_CLANG_RT_ASAN_LIB_PATH)) +endif + +ifdef TB_LIBOTR_PREBUILT +DEFINES += -DTB_LIBOTR_PREBUILT +endif + +libs:: + $(MAKE) -C $(DEPTH)/comm/mail/locales langpack + +ifeq (WINNT,$(OS_ARCH)) +PKGCOMP_FIND_OPTS = +else +PKGCOMP_FIND_OPTS = -L +endif +ifeq (Darwin, $(OS_ARCH)) +FINDPATH = $(_APPNAME)/Contents/MacOS +else +FINDPATH=bin +endif + +package-compare:: $(MOZ_PKG_MANIFEST) + cd $(DIST); find $(PKGCOMP_FIND_OPTS) '$(FINDPATH)' -type f | sort > bin-list.txt + $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $(MOZ_PKG_MANIFEST)) | grep '^$(BINPATH)' | sed -e 's/^\///' | sort > $(DIST)/pack-list.txt + -diff -u $(DIST)/pack-list.txt $(DIST)/bin-list.txt + rm -f $(DIST)/pack-list.txt $(DIST)/bin-list.txt + +# Overwrite the one made by Firefox with our own. +make-sourcestamp-file:: + $(PYTHON3) $(commtopsrcdir)/build/source_repos.py gen_sourcestamp > $(MOZ_SOURCESTAMP_FILE) + +ifdef ENABLE_WEBDRIVER +DEFINES += -DENABLE_WEBDRIVER=1 +endif diff --git a/comm/mail/installer/allowed-dupes.mn b/comm/mail/installer/allowed-dupes.mn new file mode 100644 index 0000000000..11c53e5919 --- /dev/null +++ b/comm/mail/installer/allowed-dupes.mn @@ -0,0 +1,81 @@ +# Known duplicate files +# This file is ideally removed, but some existing files will be grandfathered in +# See bug 1303184, bug 1313670 +# +# PLEASE DO NOT ADD MORE EXCEPTIONS TO THIS LIST +# + +# browser (see bug 1451050, bug 1476934, 1818999) +defaults/settings/main/anti-tracking-url-decoration.json +defaults/settings/thunderbird/anti-tracking-url-decoration.json + +# mail +chrome/classic/skin/classic/messenger/icons/addon-install-confirm.svg +chrome/classic/skin/classic/messenger/icons/new-mail-alert.png +chrome/classic/skin/classic/messenger/icons/connection-insecure.svg +chrome/classic/skin/classic/messenger/icons/message-encrypted-notok.svg +chrome/classic/skin/classic/messenger/icons/new/compact/compress.svg +chrome/classic/skin/classic/messenger/icons/new/compact/density-compact.svg +chrome/messenger/content/branding/icon32.png +chrome/messenger/content/branding/icon48.png +chrome/messenger/content/branding/icon64.png +chrome/messenger/content/branding/icon128.png +chrome/messenger/content/branding/icon256.png +chrome/messenger/content/messenger/extension.svg +chrome/messenger/skin/classic/messenger/messages/simple/Variants/Normal.css +chrome/messenger/skin/classic/messenger/messages/simple/Incoming/Context.html +chrome/messenger/skin/classic/messenger/messages/simple/Incoming/NextContext.html +chrome/messenger/skin/classic/messenger/messages/mail/Incoming/buddy_icon.svg +chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/buddy_icon.svg +chrome/icons/default/default32.png +chrome/icons/default/default48.png +chrome/icons/default/default64.png +chrome/icons/default/default128.png +chrome/icons/default/default256.png + +#ifdef XP_MACOSX +LaunchServices/org.mozilla.updater +updater.app/Contents/MacOS/org.mozilla.updater + +plugin-container.app/Contents/PkgInfo +updater.app/Contents/PkgInfo + +crashreporter.app/Contents/Resources/English.lproj/MainMenu.nib/classes.nib +crashreporter.app/Contents/Resources/English.lproj/MainMenuRTL.nib/classes.nib +#endif + +# Variants of paths in mozilla/browser/installer/allowed-dupes.mn: +# bug 658850 +@MOZ_APP_NAME@ +@MOZ_APP_NAME@-bin + +# Row and column icons are duplicated +res/table-remove-column-active.gif +res/table-remove-row-active.gif +res/table-remove-column-hover.gif +res/table-remove-row-hover.gif +res/table-remove-column.gif +res/table-remove-row.gif + +res/multilocale.txt +update.locale + +# Bug 1496075 - Switch searchplugins to Web Extensions +chrome/messenger/search-extensions/amazon/favicon.ico +chrome/messenger/search-extensions/amazondotcn/favicon.ico +chrome/messenger/search-extensions/amazondotcom/favicon.ico +chrome/messenger/search-extensions/mercadolibre/favicon.ico +chrome/messenger/search-extensions/mercadolivre/favicon.ico + +# Windows artifact builds hack - bug 1714650 +chrome/remote/content/server/HTTPD.jsm +components/httpd.js + +# Bug 1723628 - Empty files to stop the tests crashing +chrome/messenger/skin/classic/messenger/messages/mail/Footer.html +chrome/messenger/skin/classic/messenger/messages/mail/Header.html +chrome/messenger/skin/classic/messenger/messages/mail/Incoming/NextContext.html +chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/Content.html +chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/Context.html +chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/NextContent.html +chrome/messenger/skin/classic/messenger/messages/mail/Outgoing/NextContext.html diff --git a/comm/mail/installer/moz.build b/comm/mail/installer/moz.build new file mode 100644 index 0000000000..89251dc396 --- /dev/null +++ b/comm/mail/installer/moz.build @@ -0,0 +1,4 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/comm/mail/installer/package-manifest.in b/comm/mail/installer/package-manifest.in new file mode 100644 index 0000000000..f846fe9766 --- /dev/null +++ b/comm/mail/installer/package-manifest.in @@ -0,0 +1,516 @@ +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. + +; Package file for the Thunderbird build. +; +; Packaging manifest is used to copy files from dist/bin +; to the staging directory. +; Some other files are built in the staging directory directly, +; so they will be implicitly packaged too. +; +; File format: +; +; [] designates a toplevel component. Example: [xpcom] +; * wildcard support to recursively copy the entire directory +; ; file comment +; + +; Due to Apple Mac OS X packaging requirements, files that are in the same +; directory on other platforms must be located in different directories on +; Mac OS X. The following defines allow specifying the Mac OS X bundle +; location which also work on other platforms. +; +; @BINPATH@ +; Equals Contents/MacOS/ on Mac OS X and is the path to the main binary on other +; platforms. +; +; @RESPATH@ +; Equals Contents/Resources/ on Mac OS X and is equivalent to @BINPATH@ on other +; platforms. + +#filter substitution + +#ifdef XP_UNIX +#ifndef XP_MACOSX +#define UNIX_BUT_NOT_MAC +#endif +#endif + +#ifdef XP_MACOSX +; Mac bundle stuff +@APPNAME@/Contents/Info.plist +#ifdef MOZ_UPDATER +@APPNAME@/Contents/Library/LaunchServices +#endif +@APPNAME@/Contents/PkgInfo +@APPNAME@/Contents/Library/Spotlight/thunderbird.mdimporter/ +@RESPATH@/thunderbird.icns +@RESPATH@/@LPROJ_ROOT@.lproj/* +#endif + +[@AB_CD@] +@RESPATH@/@PREF_DIR@/all-l10n.js +@RESPATH@/dictionaries/* +@RESPATH@/localization/* +#ifdef MOZ_BUNDLED_FONTS +@RESPATH@/fonts/* +#endif +@RESPATH@/hyphenation/* +#ifdef HAVE_MAKENSISU +@BINPATH@/uninstall/helper.exe +#endif +#ifdef MOZ_UPDATER +@RESPATH@/update.locale +@RESPATH@/updater.ini +#endif + +#ifdef LLVM_SYMBOLIZER +@BINPATH@/@LLVM_SYMBOLIZER@ +#endif + +#ifdef MOZ_CLANG_RT_ASAN_LIB +@BINPATH@/@MOZ_CLANG_RT_ASAN_LIB@ +#endif + +#ifdef MOZ_DMD +; DMD +@RESPATH@/dmd.py +@RESPATH@/fix_stacks.py +#endif + +#ifdef PKG_LOCALE_MANIFEST +#include @PKG_LOCALE_MANIFEST@ +#endif + +[xpcom] +@RESPATH@/dependentlibs.list +#ifdef MOZ_SHARED_MOZGLUE +@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@ +#endif +#ifndef MOZ_STATIC_JS +@BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@ +#endif +#ifndef MOZ_SYSTEM_NSPR +#ifndef MOZ_FOLD_LIBS +@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@ +#endif +#endif +#ifdef XP_MACOSX +@BINPATH@/XUL +#else +@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@ +#endif +#ifdef XP_MACOSX +@BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/ +#else +@BINPATH@/@MOZ_CHILD_PROCESS_NAME@ +#endif +#ifdef XP_WIN +#if MOZ_PACKAGE_MSVC_DLLS +@BINPATH@/@MSVC_C_RUNTIME_DLL@ +#ifdef MSVC_C_RUNTIME_1_DLL +@BINPATH@/@MSVC_C_RUNTIME_1_DLL@ +#endif +@BINPATH@/@MSVC_CXX_RUNTIME_DLL@ +#endif +#if MOZ_PACKAGE_WIN_UCRT_DLLS +@BINPATH@/api-ms-win-*.dll +@BINPATH@/ucrtbase.dll +#endif +#endif +#ifdef MOZ_GTK +@BINPATH@/glxtest +@BINPATH@/@DLL_PREFIX@mozgtk@DLL_SUFFIX@ +#ifdef MOZ_WAYLAND +@BINPATH@/@DLL_PREFIX@mozwayland@DLL_SUFFIX@ +@BINPATH@/vaapitest +#endif +#endif + +; We don't have a complete view of which dlls to expect when doing an artifact +; build because we haven't run the relevant parts of configure, so we guess +; here and trust what came from our source build. +#if defined(MOZ_ARTIFACT_BUILDS) && defined(XP_WIN) +@BINPATH@/api-ms-win-*.dll +@BINPATH@/ucrtbase.dll +@BINPATH@/vcruntime*.dll +@BINPATH@/msvcp*.dll +@BINPATH@/libEGL.dll +@BINPATH@/libGLESv2.dll +#endif + +; Optional RSS extension +[newsblog] +@RESPATH@/chrome/newsblog@JAREXT@ +@RESPATH@/chrome/newsblog.manifest + +[mail] +#ifndef XP_UNIX +@BINPATH@/@MOZ_APP_NAME@.exe +@BINPATH@/thunderbird.VisualElementsManifest.xml +@BINPATH@/VisualElements/VisualElements_150.png +@BINPATH@/VisualElements/VisualElements_70.png +#else +@BINPATH@/@MOZ_APP_NAME@-bin +@BINPATH@/@MOZ_APP_NAME@ +#endif +@RESPATH@/application.ini +#ifdef MOZ_UPDATER +@RESPATH@/update-settings.ini +#endif +@BINPATH@/@DLL_PREFIX@lgpllibs@DLL_SUFFIX@ +#ifdef MOZ_FFVPX +@BINPATH@/@DLL_PREFIX@mozavutil@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@mozavcodec@DLL_SUFFIX@ +#endif +@RESPATH@/platform.ini +#ifndef MOZ_FOLD_LIBS +@RESPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@ +#endif +#ifdef UNIX_BUT_NOT_MAC +#ifdef MOZ_UPDATER +@RESPATH@/icons/*.png +#endif +#endif +#ifdef XP_WIN +#ifdef _AMD64_ +@BINPATH@/@DLL_PREFIX@qipcap64@DLL_SUFFIX@ +#else +@BINPATH@/@DLL_PREFIX@qipcap@DLL_SUFFIX@ +#endif +#endif + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Mail Specific Files +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +@RESPATH@/defaults/messenger/mailViews.dat + +@RESPATH@/isp/* + +; interfaces.manifest doesn't get packaged because it is dynamically +; re-created at packaging time when linking the xpts that will actually +; go into the package, so the test related interfaces aren't included. +@RESPATH@/components/msgMime.manifest +@RESPATH@/components/MailComponents.manifest +@RESPATH@/chrome/toolkit@JAREXT@ +@RESPATH@/chrome/toolkit.manifest +@RESPATH@/chrome/comm@JAREXT@ +@RESPATH@/chrome/comm.manifest +; Browser: Hack to get built_in_addons.json packaged +@RESPATH@/chrome/browser@JAREXT@ +@RESPATH@/chrome/browser.manifest +@RESPATH@/chrome/messenger@JAREXT@ +@RESPATH@/chrome/messenger.manifest +@RESPATH@/chrome/pdfjs.manifest +@RESPATH@/chrome/pdfjs/* +#ifndef XP_UNIX +@RESPATH@/chrome/icons/default/messengerWindow.ico +@RESPATH@/chrome/icons/default/msgcomposeWindow.ico +@RESPATH@/chrome/icons/default/calendar-alarm-dialog.ico +@RESPATH@/chrome/icons/default/calendar-general-dialog.ico +#elifdef UNIX_BUT_NOT_MAC +@RESPATH@/chrome/icons/default/*.png +#endif + +; Gloda +@RESPATH@/chrome/gloda@JAREXT@ +@RESPATH@/chrome/gloda.manifest + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Mail Extensions (smime, etc.) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +#ifdef MOZ_MAPI_SUPPORT +@BINPATH@/MapiProxy.dll +@BINPATH@/mozMapi32.dll +#endif + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; instant messaging +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +@RESPATH@/@PREF_DIR@/chat-prefs.js +@RESPATH@/chrome/chat@JAREXT@ +@RESPATH@/chrome/chat.manifest + +; Thunderbird specific +@RESPATH@/@PREF_DIR@/all-im.js + +; OTR libraries +#ifdef TB_LIBOTR_PREBUILT +#ifdef XP_WIN +@BINPATH@/libssp-0@DLL_SUFFIX@ +@BINPATH@/libotr@DLL_SUFFIX@ +#else +@BINPATH@/@DLL_PREFIX@otr@DLL_SUFFIX@ +#endif +#endif + +; OpenPGP (librnp) +#ifdef MZLA_LIBRNP +@BINPATH@/@DLL_PREFIX@rnp@DLL_SUFFIX@ +@BINPATH@/rnp-cli@BIN_SUFFIX@ +@BINPATH@/rnpkeys@BIN_SUFFIX@ +#endif + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Chrome Files +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@RESPATH@/chrome/classic@JAREXT@ +@RESPATH@/chrome/classic.manifest + +; [DevTools Startup Files] +@RESPATH@/chrome/devtools-startup@JAREXT@ +@RESPATH@/chrome/devtools-startup.manifest + +; DevTools +@RESPATH@/chrome/devtools@JAREXT@ +@RESPATH@/chrome/devtools.manifest +@RESPATH@/@PREF_DIR@/debugger.js + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Default Profile Settings +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; default pref files +@RESPATH@/defaults/pref/all-thunderbird.js +@RESPATH@/defaults/pref/channel-prefs.js +@RESPATH@/defaults/pref/composer.js +@RESPATH@/defaults/pref/mailnews.js +@RESPATH@/defaults/pref/mdn.js +@RESPATH@/defaults/pref/e2e-prefs.js +@RESPATH@/defaults/pref/thunderbird-branding.js +@RESPATH@/defaults/permissions +@RESPATH@/greprefs.js + +; Remote Settings JSON dumps +@RESPATH@/defaults/settings/last_modified.json +@RESPATH@/defaults/settings/blocklists +@RESPATH@/defaults/settings/main +@RESPATH@/defaults/settings/security-state +@RESPATH@/defaults/settings/thunderbird + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; App extensions to Mail +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +@RESPATH@/chrome/openpgp@JAREXT@ +@RESPATH@/chrome/openpgp.manifest + +; misson control, autoconfig +#ifdef MOZ_PREF_EXTENSIONS +@RESPATH@/defaults/autoconfig/prefcalls.js +#endif + +; Windows Search integration +; the module is included as part of the "Modules" rule +#ifdef XP_WIN +@BINPATH@/WSEnable.exe +#endif + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Base Package Files +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; accessibility (out of process API support) +#ifdef ACCESSIBILITY +#ifdef XP_WIN +@BINPATH@/AccessibleMarshal.dll +#endif +#endif + +; toolkit +@RESPATH@/components/extensions.manifest +#ifdef MOZ_UPDATER +@RESPATH@/components/nsUpdateService.manifest +#endif +@RESPATH@/components/ProcessSingleton.manifest + +[calendar] +@RESPATH@/chrome/calendar@JAREXT@ +@RESPATH@/chrome/calendar.manifest + +@RESPATH@/@PREF_DIR@/calendar.js + +# Files added to components directory via `FINAL_TARGET_FILES.components`. +@RESPATH@/components/calCachedCalendar.js +@RESPATH@/components/calICSService-worker.js +@RESPATH@/components/calItemBase.js + +@RESPATH@/components/SyncComponents.manifest +@RESPATH@/components/servicesComponents.manifest +@RESPATH@/components/servicesSettings.manifest +@RESPATH@/components/cryptoComponents.manifest +@RESPATH@/components/TelemetryStartup.manifest +@RESPATH@/components/Push.manifest + +@RESPATH@/components/l10n-registry.manifest + +; WebDriver (Marionette, Remote Agent) remote protocols +#ifdef ENABLE_WEBDRIVER +@RESPATH@/chrome/remote@JAREXT@ +@RESPATH@/chrome/remote.manifest +#endif + +; Phishing Protection + +; Modules +@RESPATH@/modules/* +@RESPATH@/actors/* + +; ANGLE GLES-on-D3D rendering library +#ifdef MOZ_ANGLE_RENDERER +@BINPATH@/libEGL.dll +@BINPATH@/libGLESv2.dll + +#ifdef MOZ_D3DCOMPILER_VISTA_DLL +@BINPATH@/@MOZ_D3DCOMPILER_VISTA_DLL@ +#endif +#endif # MOZ_ANGLE_RENDERER + +; Background tasks-specific preferences. These are in the GRE +; location since they apply to all tasks at this time. +#ifdef MOZ_BACKGROUNDTASKS +@RESPATH@/defaults/backgroundtasks/backgroundtasks.js +#endif + +; [Layout Engine Resources] +; Style Sheets, Graphics and other Resources used by the layout engine. +@RESPATH@/res/EditorOverride.css +@RESPATH@/res/contenteditable.css +@RESPATH@/res/designmode.css +@RESPATH@/res/table-add-column-after-active.gif +@RESPATH@/res/table-add-column-after-hover.gif +@RESPATH@/res/table-add-column-after.gif +@RESPATH@/res/table-add-column-before-active.gif +@RESPATH@/res/table-add-column-before-hover.gif +@RESPATH@/res/table-add-column-before.gif +@RESPATH@/res/table-add-row-after-active.gif +@RESPATH@/res/table-add-row-after-hover.gif +@RESPATH@/res/table-add-row-after.gif +@RESPATH@/res/table-add-row-before-active.gif +@RESPATH@/res/table-add-row-before-hover.gif +@RESPATH@/res/table-add-row-before.gif +@RESPATH@/res/table-remove-column-active.gif +@RESPATH@/res/table-remove-column-hover.gif +@RESPATH@/res/table-remove-column.gif +@RESPATH@/res/table-remove-row-active.gif +@RESPATH@/res/table-remove-row-hover.gif +@RESPATH@/res/table-remove-row.gif +@RESPATH@/res/grabber.gif +#ifdef XP_MACOSX +@RESPATH@/res/cursors/* +#endif +@RESPATH@/res/fonts/* +@RESPATH@/res/dtd/* +@RESPATH@/res/language.properties +@RESPATH@/res/locale/layout/HtmlForm.properties +@RESPATH@/res/locale/layout/MediaDocument.properties +@RESPATH@/res/locale/layout/xmlparser.properties +@RESPATH@/res/locale/dom/dom.properties +#ifdef XP_MACOSX +@RESPATH@/res/MainMenu.nib/ +#endif + +; Content-accessible resources. +@RESPATH@/contentaccessible/* + +; svg +@RESPATH@/res/svg.css + +; [Extensions] +@RESPATH@/components/extensions-toolkit.manifest +@RESPATH@/components/extensions-mail.manifest + +; [Personal Security Manager] +; +; NSS libraries are signed in the staging directory, +; meaning their .chk files are created there directly. +; +#ifndef MOZ_SYSTEM_NSS +#if defined(XP_LINUX) && !defined(ANDROID) +@BINPATH@/@DLL_PREFIX@freeblpriv3@DLL_SUFFIX@ +#elif defined(XP_SOLARIS) && defined(SPARC64) +@BINPATH@/@DLL_PREFIX@freebl_64fpu_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl_64int_3@DLL_SUFFIX@ +#else +@BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ +#endif +@BINPATH@/@DLL_PREFIX@nss3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@nssckbi@DLL_SUFFIX@ +#ifndef MOZ_FOLD_LIBS +@BINPATH@/@DLL_PREFIX@nssutil3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@smime3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@ssl3@DLL_SUFFIX@ +#endif +@BINPATH@/@DLL_PREFIX@softokn3@DLL_SUFFIX@ +#endif +@RESPATH@/chrome/pippki@JAREXT@ +@RESPATH@/chrome/pippki.manifest + +; preprocessor.py doesn't handle parentheses, so while the following could be +; expressed in a single line, it's more clear to break them up. +#if defined(XP_WIN) || defined(XP_MACOSX) +#if !defined(_ARM64_) +@BINPATH@/@DLL_PREFIX@osclientcerts@DLL_SUFFIX@ +#endif +#endif + +; For process sandboxing +#if defined(MOZ_SANDBOX) +#if defined(XP_LINUX) +@BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@ +#endif +#endif + +; [Updater] +; +#ifdef MOZ_UPDATER +#ifdef XP_MACOSX +@BINPATH@/updater.app/ +#else +@BINPATH@/updater@BIN_SUFFIX@ +#endif +#endif + +; [MaintenanceService] +; +#ifdef MOZ_MAINTENANCE_SERVICE +@BINPATH@/maintenanceservice.exe +@BINPATH@/maintenanceservice_installer.exe +#endif + +; [Crash Reporter] +; +#ifdef MOZ_CRASHREPORTER +#ifdef XP_MACOSX +@BINPATH@/crashreporter.app/ +#else +@BINPATH@/crashreporter@BIN_SUFFIX@ +@RESPATH@/crashreporter.ini +#ifdef XP_UNIX +@RESPATH@/Throbber-small.gif +#elif defined(XP_WIN) +@BINPATH@/@DLL_PREFIX@mozwer@DLL_SUFFIX@ +#endif +#endif +#ifdef MOZ_CRASHREPORTER_INJECTOR +@RESPATH@/crashreporter-override.ini +@BINPATH@/breakpadinjector.dll +#endif +#endif + +; [ minidump-analyzer ] +; +#ifdef MOZ_CRASHREPORTER +@BINPATH@/minidump-analyzer@BIN_SUFFIX@ +#endif + +; [ Ping Sender ] +; +@BINPATH@/pingsender@BIN_SUFFIX@ + +; Shutdown Terminator +@RESPATH@/components/terminator.manifest diff --git a/comm/mail/installer/removed-files.in b/comm/mail/installer/removed-files.in new file mode 100644 index 0000000000..ecf3520e23 --- /dev/null +++ b/comm/mail/installer/removed-files.in @@ -0,0 +1,92 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# The removed-files.in file specifies files and directories to be removed during +# an application update that are not automatically removed by the application +# update process. The application update process handles the vast majority of +# file and directory removals automatically so this file should not be used in +# the vast majority of cases. + +# When to use removed-files.in file to remove files and directories: +# * Files and directories located in the installation's "distribution/" and +# "extensions/" directories that were added before Thunderbird 27. Files and +# directories located in these directories were not included in the +# application update file removals for a complete update prior to Thunderbird 27. +# * Empty directories that were accidentally added to the installation +# directory. +# * Third party files and directories that were added to the installation +# directory. Under normal circumstances this should only be done after release +# drivers have approved the removal of these third party files. + +# If you are not sure whether a file or directory should be removed using the +# removed-files.in file please contact one of the developers that work on +# application update. + +# Note: the "distribution/" and "browser/extensions/" directories should never +# be removed recursively since these directories are used by Partner builds and +# custom installations. + +# To specify a file to be removed add the path to the file. +# * If the file doesn't exist the update will succeed. +# * If the file exists and can't be removed (e.g. the file is locked) the +# update will fail. +# +# Example: path/to/file + +# To specify a directory to be removed only if it is empty add the path to the +# directory with a trailing forward slash. +# * If the directory doesn't exist the update will succeed. +# * If the directory can't be removed (e.g. the directory is locked, contains +# files, etc.) the update will succeed. +# +# Example: path/to/dir/ + +# To specify a directory that should be recursively removed add the path to the +# directory with a trailing forward slash and "*". +# * If the directory doesn't exist the update will succeed. +# * If all of the files the directory contains can be removed but the directory +# or a subdirectory can't be removed (e.g. the directory is locked) the update +# will succeed. +# * If a file within the directory can't be removed the update will fail. +# +# Example: path/to/dir/* + +# Due to Apple Mac OS X packaging requirements files that are in the same +# directory on other platforms must be located in different directories on +# Mac OS X. The following defines allow specifying the Mac OS X bundle +# location which will also work on other platforms. +# +# @DIR_MACOS@ +# Equals Contents/MacOS/ on Mac OX X and is an empty string on other platforms. +# +# @DIR_RESOURCES@ +# Equals Contents/Resources/ on Mac OX X and is an empty string on other +# platforms. + +# An update watershed was required to update to Thunderbird 56 for LZMA and SHA384 +# support. This made it possible to delete all of the removal instructions in +# this file. + +# Since then, the following were added: + +# Remove lightning extension. +#ifdef NIGHTLY_BUILD +@DIR_RESOURCES@extensions/ +@DIR_RESOURCES@extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/* +@DIR_RESOURCES@extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}.xpi +#else +@DIR_RESOURCES@distribution/ +@DIR_RESOURCES@distribution/extensions/ +@DIR_RESOURCES@distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/* +@DIR_RESOURCES@distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}.xpi +#endif + +# Remove erroneous files left over from broken Mac signing process +#ifdef XP_MACOSX +Contents/Library/Spotlight/thunderbird.mdimporter/Contents/_CodeSignature/._CodeResources +Contents/Library/Spotlight/thunderbird.mdimporter/Contents/._Info.plist +Contents/Library/Spotlight/thunderbird.mdimporter/Contents/Resources/._schema.xml +Contents/Library/Spotlight/thunderbird.mdimporter/Contents/Resources/English.lproj/._InfoPlist.strings +Contents/Library/Spotlight/thunderbird.mdimporter/Contents/Resources/English.lproj/._schema.strings +#endif diff --git a/comm/mail/installer/windows/Makefile.in b/comm/mail/installer/windows/Makefile.in new file mode 100644 index 0000000000..2a1f518bbf --- /dev/null +++ b/comm/mail/installer/windows/Makefile.in @@ -0,0 +1,59 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk + +CONFIG_DIR = instgen +SFX_MODULE = $(commtopsrcdir)/other-licenses/7zstub/thunderbird/7zSD.sfx + +INSTALLER_FILES = \ + app.tag \ + nsis/installer.nsi \ + nsis/uninstaller.nsi \ + nsis/shared.nsh \ + $(NULL) + +ifdef MOZ_MAINTENANCE_SERVICE +INSTALLER_FILES += \ + nsis/maintenanceservice_installer.nsi \ + $(NULL) +endif + +BRANDING_FILES = \ + branding.nsi \ + wizHeader.bmp \ + wizHeaderRTL.bmp \ + wizWatermark.bmp \ + $(NULL) + +LOCALE_TOPDIR=$(commtopsrcdir) +LOCALE_RELATIVEDIR=mail/installer/windows + +include $(topsrcdir)/config/config.mk + +ifdef IS_LANGUAGE_REPACK +PPL_LOCALE_ARGS = \ + --l10n-dir=$(REAL_LOCALE_MERGEDIR)/mail/installer \ + --l10n-dir=$(call EXPAND_LOCALE_SRCDIR,mail/locales)/installer \ + --l10n-dir=$(commtopsrcdir)/mail/locales/en-US/installer \ + $(NULL) +else +PPL_LOCALE_ARGS=$(call EXPAND_LOCALE_SRCDIR,mail/locales)/installer +endif + +$(CONFIG_DIR)/setup.exe:: + $(RM) -r $(CONFIG_DIR) + $(MKDIR) $(CONFIG_DIR) + $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) + $(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR) + $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ + $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi) + $(PYTHON3) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \ + --preprocess-locale $(topsrcdir) \ + $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR) + +GARBARGE_DIRS += instgen + +include $(topsrcdir)/config/rules.mk +include $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/makensis.mk diff --git a/comm/mail/installer/windows/app.tag b/comm/mail/installer/windows/app.tag new file mode 100644 index 0000000000..324c2c72b7 --- /dev/null +++ b/comm/mail/installer/windows/app.tag @@ -0,0 +1,4 @@ +;!@Install@!UTF-8! +Title="Mozilla Thunderbird" +RunProgram="setup.exe" +;!@InstallEnd@! \ No newline at end of file diff --git a/comm/mail/installer/windows/docs/MSIX.rst b/comm/mail/installer/windows/docs/MSIX.rst new file mode 100644 index 0000000000..13dbd93a74 --- /dev/null +++ b/comm/mail/installer/windows/docs/MSIX.rst @@ -0,0 +1,23 @@ +MSIX Package +============ + +See the Firefox MSIX installer docs. + +resources.pri +''''''''''''' + +Generate a new ``resources.pri`` file on a Windows machine using +``makepri.exe`` from the Windows SDK, like: + +:: + + C:\> makepri.exe new ^ + -IndexName thunderbird ^ + -ConfigXml comm\mail\installer\windows\msix\priconfig.xml ^ + -ProjectRoot comm\mail\branding\nightly\msix ^ + -OutputFile comm\mail\installer\windows\msix\resources.pri ^ + -Overwrite + +The choice of channel (i.e., +``comm\mail\branding\{thunderbird,nightly}``) should +not matter. diff --git a/comm/mail/installer/windows/moz.build b/comm/mail/installer/windows/moz.build new file mode 100644 index 0000000000..712024b1e0 --- /dev/null +++ b/comm/mail/installer/windows/moz.build @@ -0,0 +1,12 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DEFINES["APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] + +DEFINES["MOZ_APP_NAME"] = CONFIG["MOZ_APP_NAME"] +DEFINES["MOZ_APP_DISPLAYNAME"] = CONFIG["MOZ_APP_DISPLAYNAME"] +DEFINES["MOZILLA_VERSION"] = CONFIG["MOZILLA_VERSION"] +DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] +DEFINES["PRE_RELEASE_SUFFIX"] = "" diff --git a/comm/mail/installer/windows/msi/installer.wxs b/comm/mail/installer/windows/msi/installer.wxs new file mode 100644 index 0000000000..255bd81e86 --- /dev/null +++ b/comm/mail/installer/windows/msi/installer.wxs @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "__DEFAULT__") AND + (INSTALL_DIRECTORY_NAME = "__DEFAULT__") AND + (EXTRACT_DIR = "__DEFAULT__") + ]]> + + + "__DEFAULT__") AND + (EXTRACT_DIR = "__DEFAULT__") + ]]> + + + "__DEFAULT__" + ]]> + + + + + diff --git a/comm/mail/installer/windows/msix/AppxManifest.xml.in b/comm/mail/installer/windows/msix/AppxManifest.xml.in new file mode 100644 index 0000000000..80b86f4624 --- /dev/null +++ b/comm/mail/installer/windows/msix/AppxManifest.xml.in @@ -0,0 +1,150 @@ + + + + + + + + @APPX_DISPLAYNAME@ + @APPX_PUBLISHER_DISPLAY_NAME@ + @APPX_DESCRIPTION@ + Assets\StoreLogo.png + + + + + + @APPX_RESOURCE_LANGUAGE_LIST@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .eml + + Assets\Email44x44.png + + open + + + + + + + + .ics + + Assets\Calendar44x44.png + + open + + + + + + mailto + Assets\Email44x44.png + + + + + mid + Assets\Email44x44.png + + + + + nntp + Assets\News44x44.png + + + + + news + Assets\News44x44.png + + + + + snews + Assets\News44x44.png + + + + + webcal + Assets\Calendar44x44.png + + + + + webcals + Assets\Calendar44x44.png + + + + + + + + + + + + + + + + + diff --git a/comm/mail/installer/windows/msix/Resources.pri b/comm/mail/installer/windows/msix/Resources.pri new file mode 100644 index 0000000000..aefbf20b1a Binary files /dev/null and b/comm/mail/installer/windows/msix/Resources.pri differ diff --git a/comm/mail/installer/windows/msix/distribution/distribution.ini b/comm/mail/installer/windows/msix/distribution/distribution.ini new file mode 100644 index 0000000000..192a41637e --- /dev/null +++ b/comm/mail/installer/windows/msix/distribution/distribution.ini @@ -0,0 +1,12 @@ +# Partner Distribution Configuration File +# Author: MZLA Technologies +# Date: 2022-09-05 + +[Global] +id=thunderbird-MSIX +version=1.0 +about=Thunderbird Windows MSIX package + +[Preferences] +intl.locale.requested="" +intl.multilingual.enabled=true diff --git a/comm/mail/installer/windows/msix/msix-all-locales b/comm/mail/installer/windows/msix/msix-all-locales new file mode 100644 index 0000000000..8d73ee6312 --- /dev/null +++ b/comm/mail/installer/windows/msix/msix-all-locales @@ -0,0 +1,361 @@ +# Locale codes supported by Microsoft Windows and MSIX packages. +# +# From https://docs.microsoft.com/en-us/windows/uwp/publish/supported-languages. +# Fetched on September 15, 2021. +# +# The following codes are listed as supported but for reasons unknown, Windows won't install +# packages advertising them: +# +# sr* (Serbian) +# uz* (Uzbek) + +af +af-za +am +am-et +ar +ar-ae +ar-bh +ar-dz +ar-eg +ar-iq +ar-jo +ar-kw +ar-lb +ar-ly +ar-ma +ar-om +ar-qa +ar-sa +ar-sy +ar-tn +ar-ye +as +as-in +az-arab +az-arab-az +az-cyrl +az-cyrl-az +az-latn +az-latn-az +be +be-by +bg +bg-bg +bn +bn-bd +bn-in +bs +bs-cyrl +bs-cyrl-ba +bs-latn +bs-latn-ba +ca +ca-es +ca-es-valencia +chr-cher +chr-cher-us +chr-latn +cs +cs-cz +cy +cy-gb +da +da-dk +de +de-at +de-ch +de-de +de-li +de-lu +el +el-gr +en +en-011 +en-014 +en-018 +en-021 +en-029 +en-053 +en-au +en-bz +en-ca +en-gb +en-hk +en-id +en-ie +en-in +en-jm +en-kz +en-mt +en-my +en-nz +en-ph +en-pk +en-sg +en-tt +en-us +en-vn +en-za +en-zw +es +es-019 +es-419 +es-ar +es-bo +es-cl +es-co +es-cr +es-do +es-ec +es-es +es-gt +es-hn +es-mx +es-ni +es-pa +es-pe +es-pr +es-py +es-sv +es-us +es-uy +es-ve +et +et-ee +eu +eu-es +fa +fa-ir +fi +fi-fi +fil +fil-latn +fil-ph +fr +fr-011 +fr-015 +fr-021 +fr-029 +fr-155 +fr-be +fr-ca +fr-cd +fr-ch +fr-ci +fr-cm +fr-fr +fr-ht +fr-lu +fr-ma +fr-mc +fr-ml +fr-re +frc-latn +frp-latn +ga +ga-ie +gd-gb +gd-latn +gl +gl-es +gu +gu-in +ha +ha-latn +ha-latn-ng +he +he-il +hi +hi-in +hr +hr-ba +hr-hr +hu +hu-hu +hy +hy-am +id +id-id +ig-latn +ig-ng +is +is-is +it +it-ch +it-it +iu-cans +iu-latn +iu-latn-ca +ja +ja-jp +ka +ka-ge +kk +kk-kz +km +km-kh +kn +kn-in +ko +ko-kr +kok +kok-in +ku-arab +ku-arab-iq +ky-cyrl +ky-kg +lb +lb-lu +lo +lo-la +lt +lt-lt +lv +lv-lv +mi +mi-latn +mi-nz +mk +mk-mk +ml +ml-in +mn-cyrl +mn-mn +mn-mong +mn-phag +mr +mr-in +ms +ms-bn +ms-my +mt +mt-mt +nb +nb-no +ne +ne-np +nl +nl-be +nl-nl +nn +nn-no +no +no-no +nso +nso-za +or +or-in +pa +pa-arab +pa-arab-pk +pa-deva +pa-in +pl +pl-pl +prs +prs-af +prs-arab +pt +pt-br +pt-pt +quc-latn +qut-gt +qut-latn +quz +quz-bo +quz-ec +quz-pe +ro +ro-ro +ru +ru-ru +rw +rw-rw +sd-arab +sd-arab-pk +sd-deva +si +si-lk +sk +sk-sk +sl +sl-si +sq +sq-al +# sr # For reasons unknown, Windows won't install packages advertising these locales. +# sr-Latn +# sr-cyrl +# sr-cyrl-ba +# sr-cyrl-cs +# sr-cyrl-me +# sr-cyrl-rs +# sr-latn-ba +# sr-latn-cs +# sr-latn-me +# sr-latn-rs +sv +sv-fi +sv-se +sw +sw-ke +ta +ta-in +te +te-in +tg-arab +tg-cyrl +tg-cyrl-tj +tg-latn +th +th-th +ti +ti-et +tk-cyrl +tk-cyrl-tr +tk-latn +tk-latn-tr +tk-tm +tn +tn-bw +tn-za +tr +tr-tr +tt-arab +tt-cyrl +tt-latn +tt-ru +ug-arab +ug-cn +ug-cyrl +ug-latn +uk +uk-ua +ur +ur-pk +# uz # For reasons unknown, Windows won't install packages advertising these locales. +# uz-cyrl +# uz-latn +# uz-latn-uz +vi +vi-vn +wo +wo-sn +xh +xh-za +yo-latn +yo-ng +zh-Hans +zh-Hant +zh-cn +zh-hans-cn +zh-hans-sg +zh-hant-hk +zh-hant-mo +zh-hant-tw +zh-hk +zh-mo +zh-sg +zh-tw +zu +zu-za diff --git a/comm/mail/installer/windows/msix/priconfig.xml b/comm/mail/installer/windows/msix/priconfig.xml new file mode 100644 index 0000000000..62f0668d5f --- /dev/null +++ b/comm/mail/installer/windows/msix/priconfig.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/comm/mail/installer/windows/nsis/defines.nsi.in b/comm/mail/installer/windows/nsis/defines.nsi.in new file mode 100755 index 0000000000..0862c8b050 --- /dev/null +++ b/comm/mail/installer/windows/nsis/defines.nsi.in @@ -0,0 +1,86 @@ +#filter substitution +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +# These defines should match application.ini settings +!define AppName "Thunderbird" +!define AppVersion "@MOZ_APP_VERSION@" + +!define GREVersion @MOZILLA_VERSION@ +!define AB_CD "@AB_CD@" + +!define FileMainEXE "@MOZ_APP_NAME@.exe" +!define WindowClass "ThunderbirdMessageWindow" + +!define AppRegNameMail "Thunderbird" +!define AppRegNameNews "Thunderbird (News)" +!define AppRegNameCalendar "Thunderbird (Calendar)" + +!define ClientsRegName "Mozilla Thunderbird" + +!define BrandProductName "Thunderbird" +!define BrandShortName "@MOZ_APP_DISPLAYNAME@" +!ifndef BrandFullName +!define BrandFullName "${BrandFullNameInternal}" +!endif + +# Due to official and beta using the same branding (and`thus the same install +# directory), this is used to differentiate between them. +!if "@MOZ_UPDATE_CHANNEL@" == "beta" +!undef BrandFullName +!define BrandFullName "${BrandFullNameInternal} Beta" +# NO_INSTDIR_FROM_REG is defined for Beta to prevent finding a non-default +# installation directory in the registry and using that as the default. This +# prevents Beta releases built with official branding from finding an existing +# install of an official release and defaulting to its installation directory. +!define NO_INSTDIR_FROM_REG +!endif +!define InstDirName "${BrandFullName}" + +!define CERTIFICATE_NAME "Mozilla Corporation" +!define CERTIFICATE_ISSUER "DigiCert SHA2 Assured ID Code Signing CA" +; Changing the name or issuer requires us to have both the old and the new +; in the registry at the same time, temporarily. +!define CERTIFICATE_NAME_PREVIOUS "Mozilla Corporation" +!define CERTIFICATE_ISSUER_PREVIOUS "DigiCert Assured ID Code Signing CA-1" + +# ARCH is used when it is necessary to differentiate the x64 registry keys from +# the x86 registry keys (e.g. the uninstall registry key). +#ifdef HAVE_64BIT_BUILD +!define HAVE_64BIT_BUILD +#ifdef _ARM64_ +!define ARCH "AArch64" +!define MinSupportedVer "Microsoft Windows 10 for ARM" +#else +!define ARCH "x64" +!define MinSupportedVer "Microsoft Windows 7 x64" +#endif +#else +!define MinSupportedVer "Microsoft Windows 7" +!define ARCH "x86" +#endif + +!define MinSupportedCPU "SSE2" + +#ifdef MOZ_MAINTENANCE_SERVICE +!define MOZ_MAINTENANCE_SERVICE +#endif + +#ifdef MOZ_BITS_DOWNLOAD +!define MOZ_BITS_DOWNLOAD +#endif + +# File details shared by both the installer and uninstaller +VIProductVersion "1.0.0.0" +VIAddVersionKey "ProductName" "${BrandShortName}" +VIAddVersionKey "CompanyName" "${CompanyName}" +#ifdef MOZ_OFFICIAL_BRANDING +VIAddVersionKey "LegalTrademarks" "${BrandShortName} is a Trademark of The Mozilla Foundation." +#endif +VIAddVersionKey "LegalCopyright" "${CompanyName}" +VIAddVersionKey "FileVersion" "${AppVersion}" +VIAddVersionKey "ProductVersion" "${AppVersion}" +# Comments is not used but left below commented out for future reference +# VIAddVersionKey "Comments" "Comments" diff --git a/comm/mail/installer/windows/nsis/installer.nsi b/comm/mail/installer/windows/nsis/installer.nsi new file mode 100755 index 0000000000..75b22b0d08 --- /dev/null +++ b/comm/mail/installer/windows/nsis/installer.nsi @@ -0,0 +1,1316 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Required Plugins: +# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in +# ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in +# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash +# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in +# UAC http://nsis.sourceforge.net/UAC_plug-in +# ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis + +; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs +!verbose 3 + +; 7-Zip provides better compression than the lzma from NSIS so we add the files +; uncompressed and use 7-Zip to create a SFX archive of it +SetDatablockOptimize on +SetCompress off +CRCCheck on + +RequestExecutionLevel user + +Unicode true +ManifestSupportedOS all +ManifestDPIAware true + +!addplugindir ./ + +Var TmpVal +Var InstallType +Var AddStartMenuSC +Var AddTaskbarSC +Var AddQuickLaunchSC +Var AddDesktopSC +Var InstallMaintenanceService +Var InstallOptionalExtensions +Var PageName +Var PreventRebootRequired +Var RegisterDefaultAgent + +; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for +; an application's Start Menu PROGRAMS directory and doesn't define the +; StartMenuDir variable can use the common InstallOnInitCommon macro. +!define NO_STARTMENU_DIR + +; Attempt to elevate Standard Users in addition to users that +; are a member of the Administrators group. +!define NONADMIN_ELEVATE + +!define AbortSurveyURL "https://live.thunderbird.net/survey/cancel/?page=" + +; Other included files may depend upon these includes! +; The following includes are provided by NSIS. +!include FileFunc.nsh +!include LogicLib.nsh +!include MUI.nsh +!include WinMessages.nsh +!include WinVer.nsh +!include WordFunc.nsh + +!insertmacro GetOptions +!insertmacro GetParameters +!insertmacro GetSize +!insertmacro StrFilter +!insertmacro WordFind +!insertmacro WordReplace + +; The following includes are custom. +!include branding.nsi +!include defines.nsi +!include common.nsh +!include locales.nsi + +VIAddVersionKey "FileDescription" "${BrandShortName} Installer" +VIAddVersionKey "OriginalFilename" "setup.exe" + +; Must be inserted before other macros that use logging +!insertmacro _LoggingCommon + +!insertmacro AddHandlerValues +!insertmacro ChangeMUIHeaderImage +!insertmacro CheckForFilesInUse +!insertmacro CleanMaintenanceServiceLogs +!insertmacro CopyFilesFromDir +!insertmacro CreateRegKey +!insertmacro GetLongPath +!insertmacro GetPathFromString +!insertmacro GetParent +!insertmacro InitHashAppModelId +!insertmacro IsHandlerForInstallDir +!insertmacro IsPinnedToTaskBar +!insertmacro IsUserAdmin +!insertmacro LogDesktopShortcut +!insertmacro LogQuickLaunchShortcut +!insertmacro LogStartMenuShortcut +!insertmacro ManualCloseAppPrompt +!insertmacro PinnedToStartMenuLnkCount +!insertmacro RegCleanAppHandler +!insertmacro RegCleanMain +!insertmacro RegCleanUninstall +!insertmacro RemovePrecompleteEntries +!insertmacro SetAppLSPCategories +!insertmacro SetBrandNameVars +!insertmacro UpdateShortcutAppModelIDs +!insertmacro UnloadUAC +!insertmacro WriteRegStr2 +!insertmacro WriteRegDWORD2 + +; This needs to be inserted after InitHashAppModelId because it uses +; $AppUserModelID and the compiler can't handle using variables lexically before +; they've been declared. +!insertmacro GetInstallerRegistryPref + +!include shared.nsh + +; Helper macros for ui callbacks. Insert these after shared.nsh +!insertmacro CheckCustomCommon +!insertmacro InstallEndCleanupCommon +!insertmacro InstallOnInitCommon +!insertmacro InstallStartCleanupCommon +!insertmacro LeaveDirectoryCommon +!insertmacro LeaveOptionsCommon +!insertmacro OnEndCommon +!insertmacro PreDirectoryCommon + +Name "${BrandFullName}" +OutFile "setup.exe" +!ifdef HAVE_64BIT_BUILD + InstallDir "$PROGRAMFILES64\${InstDirName}\" +!else + InstallDir "$PROGRAMFILES32\${InstDirName}\" +!endif +ShowInstDetails nevershow + +################################################################################ +# Modern User Interface - MUI + +!define MOZ_MUI_CUSTOM_ABORT +!define MUI_CUSTOMFUNCTION_ABORT "CustomAbort" +!define MUI_ICON setup.ico +!define MUI_UNICON setup.ico +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp +; By default MUI_BGCOLOR is hardcoded to FFFFFF, which is only correct if the +; Windows theme or high-contrast mode hasn't changed it, so we need to +; override that with GetSysColor(COLOR_WINDOW) (this string ends up getting +; passed to SetCtlColors, which uses this custom syntax to mean that). +!define MUI_BGCOLOR SYSCLR:WINDOW + +; Use a right to left header image when the language is right to left +!ifdef ${AB_CD}_rtl +!define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp +!else +!define MUI_HEADERIMAGE_BITMAP wizHeader.bmp +!endif + +/** + * Installation Pages + */ +; Welcome Page +!define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcome +!define MUI_PAGE_CUSTOMFUNCTION_SHOW showWelcome +!insertmacro MUI_PAGE_WELCOME + +; Custom Options Page +Page custom preOptions leaveOptions + +; Select Install Directory Page +!define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory +!define MUI_DIRECTORYPAGE_VERIFYONLEAVE +!insertmacro MUI_PAGE_DIRECTORY + +; Custom Components Page +!ifdef MOZ_MAINTENANCE_SERVICE +Page custom preComponents leaveComponents +!endif + +; Custom Shortcuts Page +Page custom preShortcuts leaveShortcuts + +; Custom Summary Page +Page custom preSummary leaveSummary + +; Install Files Page +!insertmacro MUI_PAGE_INSTFILES + +; Finish Page +!define MUI_FINISHPAGE_TITLE_3LINES +!define MUI_FINISHPAGE_RUN +!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp +!define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT) +!define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish +!define MUI_PAGE_CUSTOMFUNCTION_SHOW showFinish +!insertmacro MUI_PAGE_FINISH + +; Use the default dialog for IDD_VERIFY for a simple Banner +ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" + +################################################################################ +# Install Sections + +; Cleanup operations to perform at the start of the installation. +Section "-InstallStartCleanup" + SetDetailsPrint both + DetailPrint $(STATUS_CLEANUP) + SetDetailsPrint none + + SetOutPath "$INSTDIR" + ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}" + + StrCpy $R9 "true" + StrCpy $PreventRebootRequired "false" + ${GetParameters} $R8 + ${GetOptions} "$R8" "/INI=" $R7 + ${Unless} ${Errors} + ; The configuration file must also exist + ${If} ${FileExists} "$R7" + ReadINIStr $R9 $R7 "Install" "RemoveDistributionDir" + ReadINIStr $R8 $R7 "Install" "PreventRebootRequired" + ${If} $R8 == "true" + StrCpy $PreventRebootRequired "true" + ${EndIf} + ${EndIf} + ${EndUnless} + + ${GetParameters} $R8 + ${InstallGetOption} $R8 "RemoveDistributionDir" $R9 + ${If} $R9 == "0" + StrCpy $R9 "false" + ${EndIf} + ${InstallGetOption} $R8 "PreventRebootRequired" $PreventRebootRequired + ${If} $PreventRebootRequired == "1" + StrCpy $PreventRebootRequired "true" + ${EndIf} + + ; Remove directories and files we always control before parsing the uninstall + ; log so empty directories can be removed. + ${If} ${FileExists} "$INSTDIR\updates" + RmDir /r "$INSTDIR\updates" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\updated" + RmDir /r "$INSTDIR\updated" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\shortcuts" + RmDir /r "$INSTDIR\defaults\shortcuts" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\distribution" + ${AndIf} $R9 != "false" + RmDir /r "$INSTDIR\distribution" + ${EndIf} + + ; Delete the app exe if present to prevent launching the app while we are + ; installing. + ClearErrors + ${DeleteFile} "$INSTDIR\${FileMainEXE}" + ${If} ${Errors} + ; If the user closed the application it can take several seconds for it to + ; shut down completely. If the application is being used by another user we + ; can rename the file and then delete is when the system is restarted. + Sleep 5000 + ${DeleteFile} "$INSTDIR\${FileMainEXE}" + ClearErrors + ${EndIf} + + ; setup the application model id registration value + ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" + + ; Clean up old maintenance service logs + ${CleanMaintenanceServiceLogs} "Thunderbird" + + ${RemovePrecompleteEntries} "false" + + ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js" + Delete "$INSTDIR\defaults\pref\channel-prefs.js" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\pref" + RmDir "$INSTDIR\defaults\pref" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults" + RmDir "$INSTDIR\defaults" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\uninstall" + ; Remove the uninstall directory that we control + RmDir /r "$INSTDIR\uninstall" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\update-settings.ini" + Delete "$INSTDIR\update-settings.ini" + ${EndIf} + + ; Upgrade the copies of the MAPI DLL's + ${UpgradeMapiDLLs} + + ; Delete two files installed by Kaspersky Anti-Spam extension that are only + ; compatible with Thunderbird 2 (bug 533692). + ${If} ${FileExists} "$INSTDIR\components\klthbplg.dll" + Delete /REBOOTOK "$INSTDIR\components\klthbplg.dll" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\components\IKLAntiSpam.xpt" + Delete /REBOOTOK "$INSTDIR\components\IKLAntiSpam.xpt" + ${EndIf} + + ${InstallStartCleanupCommon} +SectionEnd + +Section "-Application" APP_IDX + ${StartUninstallLog} + + SetDetailsPrint both + DetailPrint $(STATUS_INSTALL_APP) + SetDetailsPrint none + + ${LogHeader} "Installing Main Files" + ${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \ + "$(ERROR_CREATE_DIRECTORY_PREFIX)" \ + "$(ERROR_CREATE_DIRECTORY_SUFFIX)" + + + ; The MAPI DLL's are copied and the copies are then registered to lessen + ; file in use errors on application update. + ClearErrors + ${DeleteFile} "$INSTDIR\MapiProxy_InUse.dll" + ${If} ${Errors} + ; Clear the way for the new file and delete the old file on reboot + Rename "$INSTDIR\MapiProxy_InUse.dll" "$INSTDIR\MapiProxy_InUse.dll.moz-delete" + Delete /REBOOTOK "$INSTDIR\MapiProxy_InUse.dll.moz-delete" + ${EndIf} + CopyFiles /SILENT "$EXEDIR\core\MapiProxy.dll" "$INSTDIR\MapiProxy_InUse.dll" + ${LogMsg} "Installed File: $INSTDIR\MapiProxy_InUse.dll" + ${LogUninstall} "File: \MapiProxy_InUse.dll" + + ClearErrors + ${DeleteFile} "$INSTDIR\mozMapi32_InUse.dll" + ${If} ${Errors} + ; Clear the way for the new file and delete the old file on reboot + Rename "$INSTDIR\mozMapi32_InUse.dll" "$INSTDIR\mozMapi32_InUse.dll.moz-delete" + Delete /REBOOTOK "$INSTDIR\mozMapi32_InUse.dll.moz-delete" + ${EndIf} + CopyFiles /SILENT "$EXEDIR\core\mozMapi32.dll" "$INSTDIR\mozMapi32_InUse.dll" + ${LogMsg} "Installed File: $INSTDIR\mozMapi32_InUse.dll" + ${LogUninstall} "File: \mozMapi32_InUse.dll" + + ; Register DLLs + ; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but + ; is only registered for the last application installed. When the last + ; application installed is uninstalled AccessibleMarshal.dll will no longer be + ; registered. bug 338878 + ${LogHeader} "DLL Registration" + ClearErrors + ${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll" + ${If} ${Errors} + ${LogMsg} "** ERROR Registering: $INSTDIR\AccessibleMarshal.dll **" + ${Else} + ${LogUninstall} "DLLReg: \AccessibleMarshal.dll" + ${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll" + ${EndIf} + + ClearErrors + + ; Record the Windows Error Reporting module + WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\RuntimeExceptionHelperModules" "$INSTDIR\mozwer.dll" 0 + ${If} ${Errors} + ${LogMsg} "** ERROR Recording: $INSTDIR\mozwer.dll **" + ${Else} + ${LogMsg} "Recorded: $INSTDIR\mozwer.dll" + ${EndIf} + + ClearErrors + + ; Default for creating Start Menu shortcut + ; (1 = create, 0 = don't create) + ${If} $AddStartMenuSC == "" + StrCpy $AddStartMenuSC "1" + ${EndIf} + + ; Default for creating Quick Launch shortcut (1 = create, 0 = don't create) + ${If} $AddQuickLaunchSC == "" + ; Don't install the quick launch shortcut on Windows 7 + ${If} ${AtLeastWin7} + StrCpy $AddQuickLaunchSC "0" + ${Else} + StrCpy $AddQuickLaunchSC "1" + ${EndIf} + ${EndIf} + + ; Default for creating Desktop shortcut (1 = create, 0 = don't create) + ${If} $AddDesktopSC == "" + StrCpy $AddDesktopSC "1" + ${EndIf} + + ; Default for adding a Taskbar pin (1 = pin, 0 = don't pin) + ${If} $AddTaskbarSC == "" + ${GetPinningSupportedByWindowsVersionWithoutSystemPopup} $AddTaskbarSC + ${EndIf} + + ${LogHeader} "Adding Registry Entries" + SetShellVarContext current ; Set SHCTX to HKCU + ${RegCleanMain} "Software\Mozilla" + ${RegCleanUninstall} + ${UpdateProtocolHandlers} + + ClearErrors + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + StrCpy $TmpVal "HKCU" ; used primarily for logging + ${Else} + SetShellVarContext all ; Set SHCTX to HKLM + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" + StrCpy $TmpVal "HKLM" ; used primarily for logging + ${RegCleanMain} "Software\Mozilla" + ${RegCleanUninstall} + ${UpdateProtocolHandlers} + ${EndIf} + + ${RemoveDeprecatedKeys} + ${Set32to64DidMigrateReg} + + ; The previous installer adds several regsitry values to both HKLM and HKCU. + ; We now try to add to HKLM and if that fails to HKCU + + ; The order that reg keys and values are added is important if you use the + ; uninstall log to remove them on uninstall. When using the uninstall log you + ; MUST add children first so they will be removed first on uninstall so they + ; will be empty when the key is deleted. This allows the uninstaller to + ; specify that only empty keys will be deleted. + ${SetAppKeys} + + ; Uninstall keys can only exist under HKLM on some versions of windows. Since + ; it doesn't cause problems always add them. + ${SetUninstallKeys} + + ; On install always add the ThunderbirdEML, Thunderbird.Url.mailto, + ; Thunderbird.Url.mid, Thunderbird.Url.news, Thunderbird.webcal and + ; ThunderbirdICS keys. + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + StrCpy $0 "SOFTWARE\Classes" + StrCpy $1 "$\"$8$\" $\"%1$\"" + StrCpy $2 "$\"$8$\" -osint -compose $\"%1$\"" + StrCpy $3 "$\"$8$\" -osint -mail $\"%1$\"" + + ; An empty string is used for the 5th param because ThunderbirdEML is not a + ; protocol handler + ${AddHandlerValues} "$0\ThunderbirdEML" "$1" "$8,0" \ + "${AppRegNameMail} Document" "" "" + ${AddHandlerValues} "$0\Thunderbird.Url.mailto" "$2" "$8,0" \ + "${AppRegNameMail} URL" "delete" "" + ${AddHandlerValues} "$0\Thunderbird.Url.news" "$3" "$8,0" \ + "${AppRegNameNews} URL" "delete" "" + ${AddHandlerValues} "$0\Thunderbird.Url.mid" "$1" "$8,0" \ + "${AppRegNameMail} URL" "delete" "" + ${AddHandlerValues} "$0\Thunderbird.Url.webcal" "$1" "$8,0" \ + "${AppRegNameCalendar} URL" "delete" "" + ; An empty string is used for the 5th param because ThunderbirdICS is not a + ; protocol handler + ${AddHandlerValues} "$0\ThunderbirdICS" "$1" "$8,0" \ + "${AppRegNameCalendar} Document" "" "" + + ; For pre win8, the following keys should only be set if we can write to HKLM. + ; For post win8, the keys below can be set in HKCU if needed. + ${If} $TmpVal == "HKLM" + ; Set the Start Menu Mail/News and Registered App HKLM registry keys. + ${SetClientsMail} "HKLM" + ${SetClientsNews} "HKLM" + ${SetClientsCalendar} "HKLM" + ${ElseIf} ${AtLeastWin8} + ; Set the Start Menu Mail/News and Registered App HKCU registry keys. + ${SetClientsMail} "HKCU" + ${SetClientsNews} "HKCU" + ${SetClientsCalendar} "HKCU" + ${EndIf} + +!ifdef MOZ_MAINTENANCE_SERVICE + ; If the maintenance service page was displayed then a value was already + ; explicitly selected for installing the maintenance service and + ; and so InstallMaintenanceService will already be 0 or 1. + ; If the maintenance service page was not displayed then + ; InstallMaintenanceService will be equal to "". + ${If} $InstallMaintenanceService == "" + Call IsUserAdmin + Pop $R0 + ${If} $R0 == "true" + ; Only proceed if we have HKLM write access + ${AndIf} $TmpVal == "HKLM" + ; The user is an admin, so we should default to installing the service. + StrCpy $InstallMaintenanceService "1" + ${Else} + ; The user is not admin, so we can't install the service. + StrCpy $InstallMaintenanceService "0" + ${EndIf} + ${EndIf} + + ${If} $InstallMaintenanceService == "1" + ; The user wants to install the maintenance service, so execute + ; the pre-packaged maintenance service installer. + ; This option can only be turned on if the user is an admin so there + ; is no need to use ExecShell w/ verb runas to enforce elevated. + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" + ${EndIf} +!endif + + ; These need special handling on uninstall since they may be overwritten by + ; an install into a different location. + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" + ${WriteRegStr2} $TmpVal "$0" "" "$INSTDIR\${FileMainEXE}" 0 + ${WriteRegStr2} $TmpVal "$0" "Path" "$INSTDIR" 0 + + ; Create shortcuts + ${LogHeader} "Adding Shortcuts" + + ; Remove the start menu shortcuts and directory if the SMPROGRAMS section + ; exists in the shortcuts_log.ini and the SMPROGRAMS. The installer's shortcut + ; creation code will create the shortcut in the root of the Start Menu + ; Programs directory. + ${RemoveStartMenuDir} + + ; Always add the application's shortcuts to the shortcuts log ini file. The + ; DeleteShortcuts macro will do the right thing on uninstall if the + ; shortcuts don't exist. + ${LogStartMenuShortcut} "${BrandShortName}.lnk" + ${LogQuickLaunchShortcut} "${BrandShortName}.lnk" + ${LogDesktopShortcut} "${BrandShortName}.lnk" + + ; Best effort to update the Win7 taskbar and start menu shortcut app model + ; id's. The possible contexts are current user / system and the user that + ; elevated the installer. + Call FixShortcutAppModelIDs + ; If the current context is all also perform Win7 taskbar and start menu link + ; maintenance for the current user context. + ${If} $TmpVal == "HKLM" + SetShellVarContext current ; Set SHCTX to HKCU + Call FixShortcutAppModelIDs + SetShellVarContext all ; Set SHCTX to HKLM + ${EndIf} + + ; If running elevated also perform Win7 taskbar and start menu link + ; maintenance for the unelevated user context in case that is different than + ; the current user. + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${Unless} ${Errors} + GetFunctionAddress $0 FixShortcutAppModelIDs + UAC::ExecCodeSegment $0 + ${EndUnless} + + ; UAC only allows elevating to an Admin account so there is no need to add + ; the Start Menu or Desktop shortcuts from the original unelevated process + ; since this will either add it for the user if unelevated or All Users if + ; elevated. + ${If} $AddStartMenuSC == 1 + CreateShortCut "$SMPROGRAMS\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" + ${Else} + ${LogMsg} "** ERROR Adding Shortcut: $SMPROGRAMS\${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + + ; Update lastwritetime of the Start Menu shortcut to clear the tile cache. + ; Do this for both shell contexts in case the user has shortcuts in multiple + ; locations, then restore the previous context at the end. + ${If} ${AtLeastWin8} + SetShellVarContext all + ${TouchStartMenuShortcut} + SetShellVarContext current + ${TouchStartMenuShortcut} + ${If} $TmpVal == "HKLM" + SetShellVarContext all + ${ElseIf} $TmpVal == "HKCU" + SetShellVarContext current + ${EndIf} + ${EndIf} + + ${If} $AddDesktopSC == 1 + CreateShortCut "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$DESKTOP\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${LogMsg} "Added Shortcut: $DESKTOP\${BrandShortName}.lnk" + ${Else} + ${LogMsg} "** ERROR Adding Shortcut: $DESKTOP\${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + + ; If elevated the Quick Launch shortcut must be added from the unelevated + ; original process. + ${If} $AddQuickLaunchSC == 1 + ${Unless} ${AtLeastWin7} + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} + Call AddQuickLaunchShortcut + ${LogMsg} "Added Shortcut: $QUICKLAUNCH\${BrandShortName}.lnk" + ${Else} + ; It is not possible to add a log entry from the unelevated process so + ; add the log entry without the path since there is no simple way to + ; know the correct full path. + ${LogMsg} "Added Quick Launch Shortcut: ${BrandShortName}.lnk" + GetFunctionAddress $0 AddQuickLaunchShortcut + UAC::ExecCodeSegment $0 + ${EndIf} + ${EndUnless} + ${EndIf} + +!ifdef MOZ_MAINTENANCE_SERVICE + ${If} $TmpVal == "HKLM" + ; Add the registry keys for allowed certificates. + ${AddMaintCertKeys} + ${EndIf} +!endif +SectionEnd + +; Cleanup operations to perform at the end of the installation. +Section "-InstallEndCleanup" + SetDetailsPrint both + DetailPrint "$(STATUS_CLEANUP)" + SetDetailsPrint none + + ${Unless} ${Silent} + ClearErrors + ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State" + ${If} "$0" == "1" + ${LogHeader} "Setting as the default mail application" + ; AddTaskbarSC is needed by MigrateTaskBarShortcut, which is called by + ; SetAsDefaultAppUserHKCU. If this is called via ExecCodeSegment, + ; MigrateTaskBarShortcut will not see the value of AddTaskbarSC, so we + ; send it via a register instead. + StrCpy $R0 $AddTaskbarSC + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} + Call SetAsDefaultMailAppUserHKCU + ${Else} + GetFunctionAddress $0 SetAsDefaultMailAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndIf} + ${EndIf} + ${EndUnless} + + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). + ${MigrateTaskBarShortcut} "$AddTaskbarSC" + + ; Refresh desktop icons + ${RefreshShellIcons} + + ${InstallEndCleanupCommon} + + ${If} $PreventRebootRequired == "true" + SetRebootFlag false + ${EndIf} + + ${If} ${RebootFlag} + ; Admin is required to delete files on reboot so only add the moz-delete if + ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the + ; user is an admin. + UAC::IsAdmin + ${If} "$0" == "1" + ; When a reboot is required give RefreshShellIcons time to finish the + ; refreshing the icons so the OS doesn't display the icons from helper.exe + Sleep 10000 + ${LogHeader} "Reboot Required To Finish Installation" + ; ${FileMainEXE}.moz-upgrade should never exist but just in case... + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade" + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade" + ${EndUnless} + + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" + ClearErrors + Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete" + ${Unless} ${Errors} + Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" + ${EndUnless} + ${EndIf} + + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" + CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR" + FileOpen $0 "$INSTDIR\${FileMainEXE}" w + FileWrite $0 "Will be deleted on restart" + Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}" + FileClose $0 + Delete "$INSTDIR\${FileMainEXE}" + Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}" + ${EndUnless} + ${EndIf} + ${EndIf} +SectionEnd + +################################################################################ +# Install Abort Survey Functions + +Function CustomAbort + ${If} "${AB_CD}" == "en-US" + ${AndIf} "$PageName" != "" + ${AndIf} ${FileExists} "$EXEDIR\core\distribution\distribution.ini" + ReadINIStr $0 "$EXEDIR\core\distribution\distribution.ini" "Global" "about" + ClearErrors + ${WordFind} "$0" "Funnelcake" "E#" $1 + ${Unless} ${Errors} + ; Yes = fill out the survey and exit, No = don't fill out survey and exit, + ; Cancel = don't exit. + MessageBox MB_YESNO|MB_ICONEXCLAMATION \ + "Would you like to tell us why you are canceling this installation?" \ + IDYes +1 IDNO CustomAbort_finish + ${If} "$PageName" == "Welcome" + GetFunctionAddress $0 AbortSurveyWelcome + ${ElseIf} "$PageName" == "Options" + GetFunctionAddress $0 AbortSurveyOptions + ${ElseIf} "$PageName" == "Directory" + GetFunctionAddress $0 AbortSurveyDirectory + ${ElseIf} "$PageName" == "Shortcuts" + GetFunctionAddress $0 AbortSurveyShortcuts + ${ElseIf} "$PageName" == "Summary" + GetFunctionAddress $0 AbortSurveySummary + ${EndIf} + ClearErrors + ${GetParameters} $1 + ${GetOptions} "$1" "/UAC:" $2 + ${If} ${Errors} + Call $0 + ${Else} + UAC::ExecCodeSegment $0 + ${EndIf} + + CustomAbort_finish: + Return + ${EndUnless} + ${EndIf} + + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(MOZ_MUI_TEXT_ABORTWARNING)" \ + IDYES +1 IDNO +2 + Return + Abort +FunctionEnd + +Function AbortSurveyWelcome + ExecShell "open" "${AbortSurveyURL}step1" +FunctionEnd + +Function AbortSurveyOptions + ExecShell "open" "${AbortSurveyURL}step2" +FunctionEnd + +Function AbortSurveyDirectory + ExecShell "open" "${AbortSurveyURL}step3" +FunctionEnd + +Function AbortSurveyShortcuts + ExecShell "open" "${AbortSurveyURL}step4" +FunctionEnd + +Function AbortSurveySummary + ExecShell "open" "${AbortSurveyURL}step5" +FunctionEnd + +################################################################################ +# Helper Functions + +Function AddQuickLaunchShortcut + CreateShortCut "$QUICKLAUNCH\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandShortName}.lnk" \ + "$INSTDIR" + ${EndIf} +FunctionEnd + +Function CheckExistingInstall + ; If there is a pending file copy from a previous upgrade don't allow + ; installing until after the system has rebooted. + IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2 + Reboot + Quit + + ; If there is a pending file deletion from a previous uninstall don't allow + ; installing until after the system has rebooted. + IfFileExists "$INSTDIR\${FileMainEXE}.moz-delete" +1 +4 + MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UNINSTALL)" IDNO +2 + Reboot + Quit + + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" + ; Disable the next, cancel, and back buttons + GetDlgItem $0 $HWNDPARENT 1 ; Next button + EnableWindow $0 0 + GetDlgItem $0 $HWNDPARENT 2 ; Cancel button + EnableWindow $0 0 + GetDlgItem $0 $HWNDPARENT 3 ; Back button + EnableWindow $0 0 + + Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" + + ${If} "$TmpVal" == "FoundMessageWindow" + Sleep 5000 + ${EndIf} + + ${PushFilesToCheck} + + ; Store the return value in $TmpVal so it is less likely to be accidentally + ; overwritten elsewhere. + ${CheckForFilesInUse} $TmpVal + + Banner::destroy + + ; Enable the next, cancel, and back buttons + GetDlgItem $0 $HWNDPARENT 1 ; Next button + EnableWindow $0 1 + GetDlgItem $0 $HWNDPARENT 2 ; Cancel button + EnableWindow $0 1 + GetDlgItem $0 $HWNDPARENT 3 ; Back button + EnableWindow $0 1 + + ${If} "$TmpVal" == "true" + StrCpy $TmpVal "FoundMessageWindow" + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" + StrCpy $TmpVal "true" + ${EndIf} + ${EndIf} +FunctionEnd + +Function LaunchApp + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)" + + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $1 + ${If} ${Errors} + Exec "$\"$INSTDIR\${FileMainEXE}$\"" + ${Else} + GetFunctionAddress $0 LaunchAppFromElevatedProcess + UAC::ExecCodeSegment $0 + ${EndIf} +FunctionEnd + +Function LaunchAppFromElevatedProcess + ; Set our current working directory to the application's install directory + ; otherwise the 7-Zip temp directory will be in use and won't be deleted. + SetOutPath "$INSTDIR" + Exec "$\"$INSTDIR\${FileMainEXE}$\"" +FunctionEnd + +################################################################################ +# Language + +!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' +!verbose push +!verbose 3 +!include "overrideLocale.nsh" +!include "customLocale.nsh" +!verbose pop + +; Set this after the locale files to override it if it is in the locale +; using " " for BrandingText will hide the "Nullsoft Install System..." branding +BrandingText " " + +################################################################################ +# Page pre, show, and leave functions + +Function preWelcome + StrCpy $PageName "Welcome" + ${If} ${FileExists} "$EXEDIR\core\distribution\modern-wizard.bmp" + Delete "$PLUGINSDIR\modern-wizard.bmp" + CopyFiles /SILENT "$EXEDIR\core\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" + ${EndIf} +FunctionEnd + +Function showWelcome + ; The welcome and finish pages don't get the correct colors for their labels + ; like the other pages do, presumably because they're built by filling in an + ; InstallOptions .ini file instead of from a dialog resource like the others. + ; Field 2 is the header and Field 3 is the body text. + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 2" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 3" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW +FunctionEnd + +Function preOptions + ; The header and subheader on the wizard pages don't get the correct text + ; color by default for some reason, even though the other controls do. + GetDlgItem $0 $HWNDPARENT 1037 + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + GetDlgItem $0 $HWNDPARENT 1038 + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + StrCpy $PageName "Options" + ${If} ${FileExists} "$EXEDIR\core\distribution\modern-header.bmp" + ${AndIf} $hHeaderBitmap == "" + Delete "$PLUGINSDIR\modern-header.bmp" + CopyFiles /SILENT "$EXEDIR\core\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" + ${ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" + ${EndIf} + !insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini" +FunctionEnd + +Function leaveOptions + ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State" + ${If} $0 != 0 + Abort + ${EndIf} + ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 2" "State" + StrCmp $R0 "1" +1 +2 + StrCpy $InstallType ${INSTALLTYPE_BASIC} + ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State" + StrCmp $R0 "1" +1 +2 + StrCpy $InstallType ${INSTALLTYPE_CUSTOM} + + ${LeaveOptionsCommon} + + ${If} $InstallType == ${INSTALLTYPE_BASIC} + Call CheckExistingInstall + ${EndIf} +FunctionEnd + +Function preDirectory + StrCpy $PageName "Directory" + ${PreDirectoryCommon} +FunctionEnd + +Function leaveDirectory + ${If} $InstallType == ${INSTALLTYPE_BASIC} + Call CheckExistingInstall + ${EndIf} + ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)" +FunctionEnd + +Function preShortcuts + StrCpy $PageName "Shortcuts" + ${CheckCustomCommon} + !insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini" +FunctionEnd + +Function leaveShortcuts + ${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State" + ${If} $0 != 0 + Abort + ${EndIf} + ${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State" + ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State" + + ${If} ${IsPinningSupportedByWindowsVersionWithoutSystemPopup} + ${MUI_INSTALLOPTIONS_READ} $AddTaskbarSC "shortcuts.ini" "Field 4" "State" + ${EndIf} + + ${If} $InstallType == ${INSTALLTYPE_CUSTOM} + Call CheckExistingInstall + ${EndIf} +FunctionEnd + +!ifdef MOZ_MAINTENANCE_SERVICE +Function preComponents + ; If the service already exists, don't show this page + ServicesHelper::IsInstalled "MozillaMaintenance" + Pop $R9 + ${If} $R9 == 1 + ; The service already exists so don't show this page. + Abort + ${EndIf} + + ; Don't show the custom components page if the + ; user is not an admin + Call IsUserAdmin + Pop $R9 + ${If} $R9 != "true" + Abort + ${EndIf} + + ; Only show the maintenance service page if we have write access to HKLM + ClearErrors + WriteRegStr HKLM "Software\Mozilla" \ + "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + ClearErrors + Abort + ${Else} + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" + ${EndIf} + + StrCpy $PageName "Components" + ${CheckCustomCommon} + !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini" +FunctionEnd + +Function leaveComponents + ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State" + ${If} $0 != 0 + Abort + ${EndIf} + ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State" + ${If} $InstallType == ${INSTALLTYPE_CUSTOM} + Call CheckExistingInstall + ${EndIf} +FunctionEnd +!endif + +Function preSummary + StrCpy $PageName "Summary" + ; Setup the summary.ini file for the Custom Summary Page + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "3" + + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Text "$(SUMMARY_INSTALLED_TO)" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Top "5" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Bottom "15" + + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Type "text" + ; The contents of this control must be set as follows in the pre function + ; ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" + ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" state "" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Top "17" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Bottom "30" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags "READONLY" + + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type "label" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left "0" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right "-1" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top "130" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150" + + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_UPGRADE_CLICK)" + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText "$(UPGRADE_BUTTON)" + ${Else} + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_INSTALL_CLICK)" + DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText + ${EndIf} + + ; Remove the "Field 4" ini section in case the user hits back and changes the + ; installation directory which could change whether the make default checkbox + ; should be displayed. + DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4" + + ; Check if it is possible to write to HKLM + ClearErrors + WriteRegStr HKLM "Software\Thunderbird" "${BrandShortName}InstallerTest" "Write Test" + ${Unless} ${Errors} + DeleteRegValue HKLM "Software\Thunderbird" "${BrandShortName}InstallerTest" + ; Check if Firefox is already the handler for http. This is set on all + ; versions of Windows. + ${IsHandlerForInstallDir} "http" $R9 + ${If} "$R9" != "true" + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "checkbox" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_TAKE_DEFAULTS)" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State "1" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "32" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53" + ${EndIf} + ${EndUnless} + + ${If} "$TmpVal" == "true" + ; If there is already a Type entry in the "Field 4" section with a value of + ; checkbox then the set as the default mail client checkbox is displayed and + ; this text must be moved below it. + ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type" + ${If} "$0" == "checkbox" + StrCpy $0 "5" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "53" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68" + ${Else} + StrCpy $0 "4" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50" + ${EndIf} + WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0" + + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0" + WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1" + ${EndIf} + + !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)" + + ; The Summary custom page has a textbox that will automatically receive + ; focus. This sets the focus to the Install button instead. + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini" + GetDlgItem $0 $HWNDPARENT 1 + System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" + ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND" + SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" + !insertmacro MUI_INSTALLOPTIONS_SHOW +FunctionEnd + +Function leaveSummary + ; Try to delete the app executable and if we can't delete it try to find the + ; app's message window and prompt the user to close the app. This allows + ; running an instance that is located in another directory. If for whatever + ; reason there is no message window we will just rename the app's files and + ; then remove them on restart. + ClearErrors + ${DeleteFile} "$INSTDIR\${FileMainEXE}" + ${If} ${Errors} + ${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_INSTALL)" + ${EndIf} +FunctionEnd + +; When we add an optional action to the finish page the cancel button is +; enabled. This disables it and leaves the finish button as the only choice. +Function preFinish + StrCpy $PageName "" + ${EndInstallLog} "${BrandFullName}" + !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0" +FunctionEnd + +Function showFinish + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 2" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 3" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ; Field 4 is the launch checkbox. Since it's a checkbox, we need to + ; clear the theme from it before we can set its background color. + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 4" "HWND" + System::Call 'uxtheme::SetWindowTheme(i $0, w " ", w " ")' + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW +FunctionEnd + +################################################################################ +# Initialization Functions + +Function .onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + StrCpy $PageName "" + StrCpy $LANGUAGE 0 + ${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini" + + ; Don't install on systems that don't support SSE2. The parameter value of + ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the + ; SSE2 instruction set is available. Result returned in $R7. + System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7" + + ; Windows NT 6.0 (Vista/Server 2008) and lower are not supported. + ${Unless} ${AtLeastWin7} + ${If} "$R7" == "0" + strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" + ${Else} + strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_MSG)" + ${EndIf} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$R7" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndUnless} + + ; SSE2 CPU support + ${If} "$R7" == "0" + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_CPU_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndIf} + +!ifdef HAVE_64BIT_BUILD + ${If} "${ARCH}" == "AArch64" + ${IfNot} ${IsNativeARM64} + ${OrIfNot} ${AtLeastWin10} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndIf} + ${ElseIfNot} ${RunningX64} + MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2 + ExecShell "open" "${URLSystemRequirements}" + Quit + ${EndIf} + SetRegView 64 +!endif + + ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)" + + !insertmacro InitInstallOptionsFile "options.ini" + !insertmacro InitInstallOptionsFile "shortcuts.ini" + !insertmacro InitInstallOptionsFile "components.ini" + !insertmacro InitInstallOptionsFile "summary.ini" + + WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5" + + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10" + + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP" + + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "0" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0" + + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57" + + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "15" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67" + WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87" + + ${If} ${IsPinningSupportedByWindowsVersionWithoutSystemPopup} + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "4" + ${Else} + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "3" + ${EndIf} + + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Text "$(CREATE_ICONS_DESC)" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Top "5" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Bottom "15" + + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Type "checkbox" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Text "$(ICONS_DESKTOP)" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Top "20" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Bottom "30" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" State "1" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Flags "GROUP" + + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Type "checkbox" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Text "$(ICONS_STARTMENU)" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Left "0" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Right "-1" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Top "40" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1" + + ${If} ${IsPinningSupportedByWindowsVersionWithoutSystemPopup} + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_TASKBAR)" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "0" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70" + WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1" + ${EndIf} + + ; Setup the components.ini file for the Components Page + WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2" + + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25" + + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1" + WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP" + + ; There must always be a core directory. + ${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8 + ; Add 1024 Kb to the diskspace requirement since the installer makes a copy + ; of the MAPI dll's (around 20 Kb)... also, see Bug 434338. + IntOp $R5 $R5 + 1024 + SectionSetSize ${APP_IDX} $R5 + + ; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if + ; the user clicks the back button + StrCpy $hHeaderBitmap "" +FunctionEnd + +Function .onGUIEnd + ${OnEndCommon} +FunctionEnd diff --git a/comm/mail/installer/windows/nsis/maintenanceservice_installer.nsi b/comm/mail/installer/windows/nsis/maintenanceservice_installer.nsi new file mode 100644 index 0000000000..081b70b4cb --- /dev/null +++ b/comm/mail/installer/windows/nsis/maintenanceservice_installer.nsi @@ -0,0 +1,343 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs +!verbose 3 + +; 7-Zip provides better compression than the lzma from NSIS so we add the files +; uncompressed and use 7-Zip to create a SFX archive of it +SetDatablockOptimize on +SetCompress off +CRCCheck on + +RequestExecutionLevel admin + +Unicode true +ManifestSupportedOS all +ManifestDPIAware true + +!addplugindir ./ + +; Variables +Var TempMaintServiceName +Var BrandFullNameDA +Var BrandFullName + +; Other included files may depend upon these includes! +; The following includes are provided by NSIS. +!include FileFunc.nsh +!include LogicLib.nsh +!include MUI.nsh +!include WinMessages.nsh +!include WinVer.nsh +!include WordFunc.nsh + +!insertmacro GetOptions +!insertmacro GetParameters +!insertmacro GetSize + +; The test machines use this fallback key to run tests. +; And anyone that wants to run tests themselves should already have +; this installed. +!define FallbackKey \ + "SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4" + +!define CompanyName "Mozilla Corporation" +!define BrandFullNameInternal "" + +; The following includes are custom. +!include defines.nsi +; We keep defines.nsi defined so that we get other things like +; the version number, but we redefine BrandFullName +!define MaintFullName "Mozilla Maintenance Service" +!ifdef BrandFullName +!undef BrandFullName +!endif +!define BrandFullName "${MaintFullName}" + +!include common.nsh +!include locales.nsi + +VIAddVersionKey "FileDescription" "${MaintFullName} Installer" +VIAddVersionKey "OriginalFilename" "maintenanceservice_installer.exe" + +Name "${MaintFullName}" +OutFile "maintenanceservice_installer.exe" + +; Get installation folder from registry if available +InstallDirRegKey HKLM "Software\Mozilla\MaintenanceService" "" + +SetOverwrite on + +; serviceinstall.cpp also uses this key, in case the path is changed, update +; there too. +!define MaintUninstallKey \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" + +; Always install into the 32-bit location even if we have a 64-bit build. +; This is because we use only 1 service for all Firefox channels. +; Allow either x86 and x64 builds to exist at this location, depending on +; what is the latest build. +InstallDir "$PROGRAMFILES32\${MaintFullName}\" +ShowUnInstDetails nevershow + +################################################################################ +# Modern User Interface - MUI + +!define MUI_ICON setup.ico +!define MUI_UNICON setup.ico +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp + +;Interface Settings +!define MUI_ABORTWARNING + +; Uninstaller Pages +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +################################################################################ +# Language + +!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' +!verbose push +!verbose 3 +!include "overrideLocale.nsh" +!include "customLocale.nsh" +!verbose pop + +; Set this after the locale files to override it if it is in the locale +; using " " for BrandingText will hide the "Nullsoft Install System..." branding +BrandingText " " + +Function .onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + SetSilent silent + + ${Unless} ${AtLeastWin7} + Abort + ${EndUnless} +FunctionEnd + +Function un.onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + StrCpy $BrandFullNameDA "${MaintFullName}" + StrCpy $BrandFullName "${MaintFullName}" +FunctionEnd + +Section "MaintenanceService" + AllowSkipFiles off + + CreateDirectory $INSTDIR + SetOutPath $INSTDIR + + ; If the service already exists, then it will be stopped when upgrading it + ; via the maintenanceservice_tmp.exe command executed below. + ; The maintenanceservice_tmp.exe command will rename the file to + ; maintenanceservice.exe if maintenanceservice_tmp.exe is newer. + ; If the service does not exist yet, we install it and drop the file on + ; disk as maintenanceservice.exe directly. + StrCpy $TempMaintServiceName "maintenanceservice.exe" + IfFileExists "$INSTDIR\maintenanceservice.exe" 0 skipAlreadyExists + StrCpy $TempMaintServiceName "maintenanceservice_tmp.exe" + skipAlreadyExists: + + ; We always write out a copy and then decide whether to install it or + ; not via calling its 'install' cmdline which works by version comparison. + CopyFiles /SILENT "$EXEDIR\maintenanceservice.exe" "$INSTDIR\$TempMaintServiceName" + + ; The updater.ini file is only used when performing an install or upgrade, + ; and only if that install or upgrade is successful. If an old updater.ini + ; happened to be copied into the maintenance service installation directory + ; but the service was not newer, the updater.ini file would be unused. + ; It is used to fill the description of the service on success. + CopyFiles /SILENT "$EXEDIR\updater.ini" "$INSTDIR\updater.ini" + + ; Install the application maintenance service. + ; If a service already exists, the command line parameter will stop the + ; service and only install itself if it is newer than the already installed + ; service. If successful it will remove the old maintenanceservice.exe + ; and replace it with maintenanceservice_tmp.exe. + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/Upgrade" $0 + ${If} ${Errors} + ExecWait '"$INSTDIR\$TempMaintServiceName" install' + ${Else} + ; The upgrade cmdline is the same as install except + ; It will fail if the service isn't already installed. + ExecWait '"$INSTDIR\$TempMaintServiceName" upgrade' + ${EndIf} + + WriteUninstaller "$INSTDIR\Uninstall.exe" + + ; Since the Maintenance service can be installed either x86 or x64, + ; always use the 64-bit registry. + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + ; Previous versions always created the uninstall key in the 32-bit registry. + ; Clean those old entries out if they still exist. + SetRegView 32 + DeleteRegKey HKLM "${MaintUninstallKey}" + ; Preserve the lastused value before we switch to 64. + SetRegView lastused + + SetRegView 64 + ${EndIf} + + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayName" "${MaintFullName}" + WriteRegStr HKLM "${MaintUninstallKey}" "UninstallString" \ + '"$INSTDIR\uninstall.exe"' + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayIcon" \ + "$INSTDIR\Uninstall.exe,0" + WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}" + WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla" + WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}" + WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1 + ${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4 + WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2 + + ; Write out that a maintenance service was attempted. + ; We do this because on upgrades we will check this value and we only + ; want to install once on the first upgrade to maintenance service. + ; Also write out that we are currently installed, preferences will check + ; this value to determine if we should show the service update pref. + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1 + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Installed" 1 + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" + + ; Included here for debug purposes only. + ; These keys are used to bypass the installation dir is a valid installation + ; check from the service so that tests can be run. + ; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation" + ; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA" + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastused + ${EndIf} +SectionEnd + +; By renaming before deleting we improve things slightly in case +; there is a file in use error. In this case a new install can happen. +Function un.RenameDelete + Pop $9 + ; If the .moz-delete file already exists previously, delete it + ; If it doesn't exist, the call is ignored. + ; We don't need to pass /REBOOTOK here since it was already marked that way + ; if it exists. + Delete "$9.moz-delete" + Rename "$9" "$9.moz-delete" + ${If} ${Errors} + Delete /REBOOTOK "$9" + ${Else} + Delete /REBOOTOK "$9.moz-delete" + ${EndIf} + ClearErrors +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; NOTE: The maintenance service uninstaller does not currently get updated when +; the service itself does during application updates. Under normal use, only +; running the Thunderbird installer will generate a new maintenance service +; uninstaller. That means anything added here will not be seen by users until +; they run a new Thunderbird installer. Fixing this is tracked in +; https://bugzilla.mozilla.org/show_bug.cgi?id=1665193 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Section "Uninstall" + ; Delete the service so that no updates will be attempted + ExecWait '"$INSTDIR\maintenanceservice.exe" uninstall' + + Push "$INSTDIR\updater.ini" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice.exe" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice_tmp.exe" + Call un.RenameDelete + Push "$INSTDIR\maintenanceservice.old" + Call un.RenameDelete + Push "$INSTDIR\Uninstall.exe" + Call un.RenameDelete + Push "$INSTDIR\update\updater.ini" + Call un.RenameDelete + Push "$INSTDIR\update\updater.exe" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-1.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-2.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-3.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-4.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-5.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-6.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-7.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-8.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-9.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-10.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-install.log" + Call un.RenameDelete + Push "$INSTDIR\logs\maintenanceservice-uninstall.log" + Call un.RenameDelete + SetShellVarContext all + Push "$APPDATA\Mozilla\logs\maintenanceservice.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-1.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-2.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-3.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-4.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-5.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-6.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-7.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-8.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-9.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-10.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-install.log" + Call un.RenameDelete + Push "$APPDATA\Mozilla\logs\maintenanceservice-uninstall.log" + Call un.RenameDelete + RMDir /REBOOTOK "$APPDATA\Mozilla\logs" + RMDir /REBOOTOK "$APPDATA\Mozilla" + RMDir /REBOOTOK "$INSTDIR\logs" + RMDir /REBOOTOK "$INSTDIR\update" + RMDir /REBOOTOK "$INSTDIR\UpdateLogs" + RMDir /REBOOTOK "$INSTDIR" + + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + DeleteRegKey HKLM "${MaintUninstallKey}" + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed" + DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled" + DeleteRegKey HKLM "${FallbackKey}\" + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastused + ${EndIf} +SectionEnd diff --git a/comm/mail/installer/windows/nsis/shared.nsh b/comm/mail/installer/windows/nsis/shared.nsh new file mode 100755 index 0000000000..8ac38ddd3b --- /dev/null +++ b/comm/mail/installer/windows/nsis/shared.nsh @@ -0,0 +1,1617 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +!macro PostUpdate + ; PostUpdate is called from both session 0 and from the user session + ; for service updates, make sure that we only register with the user session + ; Otherwise ApplicationID::Set can fail intermittently with a file in use error. + System::Call "kernel32::GetCurrentProcessId() i.r0" + System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)" + + ${CreateShortcutsLog} + + ; Remove registry entries for non-existent apps and for apps that point to our + ; install location in the Software\Mozilla key and uninstall registry entries + ; that point to our install location for both HKCU and HKLM. + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + ${RegCleanMain} "Software\Mozilla" + ${RegCleanUninstall} + ${UpdateProtocolHandlers} + + ; setup the application model id registration value + ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" + + ; Upgrade the copies of the MAPI DLL's + ${UpgradeMapiDLLs} + + ClearErrors + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + StrCpy $TmpVal "HKCU" + ${Else} + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" + StrCpy $TmpVal "HKLM" + ${RegCleanMain} "Software\Mozilla" + ${RegCleanUninstall} + ${UpdateProtocolHandlers} + ${SetAppLSPCategories} ${LSP_CATEGORIES} + + ; Only update the Clients\Mail registry key values if they don't exist or + ; this installation is the same as the one set in those keys. + ReadRegStr $0 HKLM "Software\Clients\Mail\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${EndIf} + ${If} "$0" == "$INSTDIR" + ${SetClientsMail} "HKLM" + ${EndIf} + + ; Only update the Clients\News registry key values if they don't exist or + ; this installation is the same as the one set in those keys. + ReadRegStr $0 HKLM "Software\Clients\News\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${EndIf} + ${If} "$0" == "$INSTDIR" + ${SetClientsNews} "HKLM" + ${EndIf} + + ; Only update the Clients\Calendar registry key values if they don't exist or + ; this installation is the same as the one set in those keys. + ReadRegStr $0 HKLM "Software\Clients\Calendar\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${EndIf} + ${If} "$0" == "$INSTDIR" + ${SetClientsCalendar} "HKLM" + ${EndIf} + ${EndIf} + + ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). + ; When we enabled this feature for Windows 10 & 11 we decided _not_ to pin + ; during an update (even once) because we already offered to do when the + ; the user originally installed, and we don't want to go against their + ; explicit wishes. + ; For Windows 7 and 8, we've been doing this ~forever, and those users may + ; not have experienced the onboarding offer to pin to taskbar, so we're + ; leaving it enabled there. + ${If} ${AtMostWin2012R2} + ${MigrateTaskBarShortcut} "$AddTaskbarSC" + ${EndIf} + + ; Update the name/icon/AppModelID of our shortcuts as needed, then update the + ; lastwritetime of the Start Menu shortcut to clear the tile icon cache. + ; Do this for both shell contexts in case the user has shortcuts in multiple + ; locations, then restore the previous context at the end. + SetShellVarContext all + ${UpdateShortcutsBranding} + ${If} ${AtLeastWin8} + ${TouchStartMenuShortcut} + ${EndIf} + Call FixShortcutAppModelIDs + SetShellVarContext current + ${UpdateShortcutsBranding} + ${If} ${AtLeastWin8} + ${TouchStartMenuShortcut} + ${EndIf} + Call FixShortcutAppModelIDs + ${If} $TmpVal == "HKLM" + SetShellVarContext all + ${ElseIf} $TmpVal == "HKCU" + SetShellVarContext current + ${EndIf} + + ${RemoveDeprecatedKeys} + ${Set32to64DidMigrateReg} + + ${SetAppKeys} + ${SetUninstallKeys} + + ; Remove files that may be left behind by the application in the + ; VirtualStore directory. + ${CleanVirtualStore} + + RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" + + ; Register AccessibleMarshal.dll with COM (this requires write access to HKLM) + ${RegisterAccessibleMarshal} + + ; Record the Windows Error Reporting module + WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\RuntimeExceptionHelperModules" "$INSTDIR\mozwer.dll" 0 + +!ifdef MOZ_MAINTENANCE_SERVICE + Call IsUserAdmin + Pop $R0 + ${If} $R0 == "true" + ; Only proceed if we have HKLM write access + ${AndIf} $TmpVal == "HKLM" + ; We check to see if the maintenance service install was already attempted. + ; Since the Maintenance service can be installed either x86 or x64, + ; always use the 64-bit registry for checking if an attempt was made. + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" + ClearErrors + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastused + ${EndIf} + + ; Add the registry keys for allowed certificates. + ${AddMaintCertKeys} + + ; If the maintenance service is already installed, do nothing. + ; The maintenance service will launch: + ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance + ; service if necessary. If the update was done from updater.exe without + ; the service (i.e. service is failing), updater.exe will do the update of + ; the service. The reasons we do not do it here is because we don't want + ; to have to prompt for limited user accounts when the service isn't used + ; and we currently call the PostUpdate twice, once for the user and once + ; for the SYSTEM account. Also, this would stop the maintenance service + ; and we need a return result back to the service when run that way. + ${If} $5 == "" + ; An install of maintenance service was never attempted. + ; We know we are an Admin and that we have write access into HKLM + ; based on the above checks, so attempt to just run the EXE. + ; In the worst case, in case there is some edge case with the + ; IsAdmin check and the permissions check, the maintenance service + ; will just fail to be attempted to be installed. + nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" + ${EndIf} + ${EndIf} +!endif +!macroend +!define PostUpdate "!insertmacro PostUpdate" + +; Update the last modified time on the Start Menu shortcut, so that its icon +; gets refreshed. Should be called on Win8+ after UpdateShortcutBranding. +!macro TouchStartMenuShortcut + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + FileOpen $0 "$SMPROGRAMS\${BrandShortName}.lnk" a + ${IfNot} ${Errors} + System::Call '*(i, i) p .r1' + System::Call 'kernel32::GetSystemTimeAsFileTime(p r1)' + System::Call 'kernel32::SetFileTime(p r0, i 0, i 0, p r1) i .r2' + System::Free $1 + FileClose $0 + ${EndIf} + ${EndIf} +!macroend +!define TouchStartMenuShortcut "!insertmacro TouchStartMenuShortcut" + +!macro SetAsDefaultAppGlobal + ${RemoveDeprecatedKeys} ; Does not use SHCTX + + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) + ${SetHandlersMail} ; Uses SHCTX + ${SetHandlersNews} ; Uses SHCTX + ${SetClientsMail} "HKLM" + ${SetClientsNews} "HKLM" + ${SetClientsCalendar} "HKLM" + ${SetMailClientForMapi} "HKLM" + ${ShowShortcuts} +!macroend +!define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal" + +!macro SetMailClientForMapi RegKey + WriteRegStr ${RegKey} "Software\Clients\Mail" "" "${ClientsRegName}" +!macroend +!define SetMailClientForMapi "!insertmacro SetMailClientForMapi" + +!macro HideShortcuts + StrCpy $R1 "Software\Clients\Mail\${ClientsRegName}\InstallInfo" + WriteRegDWORD HKLM "$R1" "IconsVisible" 0 + ${If} ${AtLeastWin8} + WriteRegDWORD HKCU "$R1" "IconsVisible" 0 + ${EndIf} + + SetShellVarContext all ; Set $DESKTOP to All Users + ${Unless} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + SetShellVarContext current ; Set $DESKTOP to the current user's desktop + ${EndUnless} + + ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + ShellLink::GetShortCutArgs "$DESKTOP\${BrandShortName}.lnk" + Pop $0 + ${If} "$0" == "" + ShellLink::GetShortCutTarget "$DESKTOP\${BrandShortName}.lnk" + Pop $0 + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" + Delete "$DESKTOP\${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + ${EndIf} + + SetShellVarContext all ; Set $SMPROGRAMS to All Users + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start + ; Menu Programs directory + ${EndUnless} + + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + ShellLink::GetShortCutArgs "$SMPROGRAMS\${BrandShortName}.lnk" + Pop $0 + ${If} "$0" == "" + ShellLink::GetShortCutTarget "$SMPROGRAMS\${BrandShortName}.lnk" + Pop $0 + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" + Delete "$SMPROGRAMS\${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + ${EndIf} + + ${If} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk" + ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandShortName}.lnk" + Pop $0 + ${If} "$0" == "" + ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandShortName}.lnk" + Pop $0 + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR\${FileMainEXE}" + Delete "$QUICKLAUNCH\${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + ${EndIf} +!macroend +!define HideShortcuts "!insertmacro HideShortcuts" + +; Adds shortcuts for this installation. This should also add the application +; to Open With for the file types the application handles (bug 370480). +!macro ShowShortcuts + StrCpy $R1 "Software\Clients\Mail\${ClientsRegName}\InstallInfo" + WriteRegDWORD HKLM "$R1" "IconsVisible" 1 + ${If} ${AtLeastWin8} + WriteRegDWORD HKCU "$R1" "IconsVisible" 1 + ${EndIf} + + SetShellVarContext all ; Set $DESKTOP to All Users + ${Unless} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + CreateShortCut "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$DESKTOP\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${Else} + SetShellVarContext current ; Set $DESKTOP to the current user's desktop + ${Unless} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + CreateShortCut "$DESKTOP\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$DESKTOP\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$DESKTOP\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${EndIf} + ${EndUnless} + ${EndIf} + ${EndUnless} + + SetShellVarContext all ; Set $SMPROGRAMS to All Users + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + CreateShortCut "$SMPROGRAMS\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${Else} + SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start + ; Menu Programs directory + ${Unless} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + CreateShortCut "$SMPROGRAMS\${BrandShortName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandShortName}.lnk" \ + "$INSTDIR" + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\${BrandShortName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${EndIf} + ${EndUnless} + ${EndIf} + ${EndUnless} + + ; Windows 7 doesn't use the QuickLaunch directory + ${Unless} ${AtLeastWin7} + ${AndUnless} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk" + CreateShortCut "$QUICKLAUNCH\${BrandShortName}.lnk" \ + "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandShortName}.lnk" \ + "$INSTDIR" + ${EndIf} + ${EndUnless} +!macroend +!define ShowShortcuts "!insertmacro ShowShortcuts" + +; Update the branding name on all shortcuts our installer created +; to convert from BrandFullName (which is what we used to name shortcuts) +; to BrandShortName (which is what we now name shortcuts). We only rename +; desktop and start menu shortcuts, because touching taskbar pins often +; (but inconsistently) triggers various broken behaviors in the shell. +; This assumes SHCTX is set correctly. +!macro UpdateShortcutsBranding + ${UpdateOneShortcutBranding} "STARTMENU" "$SMPROGRAMS" + ${UpdateOneShortcutBranding} "DESKTOP" "$DESKTOP" +!macroend +!define UpdateShortcutsBranding "!insertmacro UpdateShortcutsBranding" + +!macro UpdateOneShortcutBranding LOG_SECTION SHORTCUT_DIR + ; Only try to rename the shortcuts found in the shortcuts log, to avoid + ; blowing away a name that the user created. + ${GetLongPath} "$INSTDIR\uninstall\${SHORTCUTS_LOG}" $R9 + ${If} ${FileExists} "$R9" + ClearErrors + ; The shortcuts log contains a numbered list of entries for each section, + ; but we never actually create more than one. + ReadINIStr $R8 "$R9" "${LOG_SECTION}" "Shortcut0" + ${IfNot} ${Errors} + ${If} ${FileExists} "${SHORTCUT_DIR}\$R8" + ShellLink::GetShortCutTarget "${SHORTCUT_DIR}\$R8" + Pop $R7 + ${GetLongPath} "$R7" $R7 + ${If} $R7 == "$INSTDIR\${FileMainEXE}" + ${AndIf} $R8 != "${BrandShortName}.lnk" + ${AndIfNot} ${FileExists} "${SHORTCUT_DIR}\${BrandShortName}.lnk" + ClearErrors + Rename "${SHORTCUT_DIR}\$R8" "${SHORTCUT_DIR}\${BrandShortName}.lnk" + ${IfNot} ${Errors} + ; Update the shortcut log manually instead of calling LogShortcut + ; because it would add a Shortcut1 entry, and we really do want to + ; overwrite the existing entry 0, since we just renamed the file. + WriteINIStr "$R9" "${LOG_SECTION}" "Shortcut0" \ + "${BrandShortName}.lnk" + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} +!macroend +!define UpdateOneShortcutBranding "!insertmacro UpdateOneShortcutBranding" + +!macro SetHandlersMail + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + + StrCpy $0 "SOFTWARE\Classes" + StrCpy $1 "$\"$8$\" $\"%1$\"" + StrCpy $2 "$\"$8$\" -osint -compose $\"%1$\"" + + ; An empty string is used for the 5th param because ThunderbirdEML is not a + ; protocol handler + ${AddHandlerValues} "$0\ThunderbirdEML" "$1" "$8,0" \ + "${AppRegNameMail} Document" "" "" + ${AddHandlerValues} "$0\Thunderbird.Url.mailto" "$2" "$8,0" "${AppRegNameMail} URL" "delete" "" + ${AddHandlerValues} "$0\mailto" "$2" "$8,0" "${AppRegNameMail} URL" "true" "" + ${AddHandlerValues} "$0\Thunderbird.Url.mid" "$1" "$8,0" "${AppRegNameMail} URL" "delete" "" + ${AddHandlerValues} "$0\mid" "$1" "$8,0" "${AppRegNameMail} URL" "true" "" + + ; Associate the file handlers with ThunderbirdEML + ReadRegStr $6 SHCTX ".eml" "" + ${If} "$6" != "ThunderbirdEML" + WriteRegStr SHCTX "$0\.eml" "" "ThunderbirdEML" + ${EndIf} +!macroend +!define SetHandlersMail "!insertmacro SetHandlersMail" + +!macro SetHandlersNews + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + StrCpy $0 "SOFTWARE\Classes" + StrCpy $1 "$\"$8$\" -osint -mail $\"%1$\"" + + ${AddHandlerValues} "$0\Thunderbird.Url.news" "$1" "$8,0" \ + "${AppRegNameNews} URL" "delete" "" + ${AddHandlerValues} "$0\news" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" + ${AddHandlerValues} "$0\nntp" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" + ${AddHandlerValues} "$0\snews" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" +!macroend +!define SetHandlersNews "!insertmacro SetHandlersNews" + +!macro SetHandlersCalendar + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + + StrCpy $0 "SOFTWARE\Classes" + StrCpy $1 "$\"$8$\" $\"%1$\"" + + ${AddHandlerValues} "$0\Thunderbird.Url.webcal" "$1" "$8,0" "${AppRegNameCalendar} URL" "delete" "" + ${AddHandlerValues} "$0\webcal" "$1" "$8,0" "${AppRegNameCalendar} URL" "true" "" + ${AddHandlerValues} "$0\webcals" "$1" "$8,0" "${AppRegNameCalendar} URL" "true" "" + ; An empty string is used for the 5th param because ThunderbirdICS is not a + ; protocol handler + ${AddHandlerValues} "$0\ThunderbirdICS" "$1" "$8,0" \ + "${AppRegNameCalendar} Document" "" "" + + ;; Associate the file handlers with ThunderbirdICS + ReadRegStr $6 SHCTX ".ics" "" + ${If} "$6" != "ThunderbirdICS" + WriteRegStr SHCTX "$0\.ics" "" "ThunderbirdICS" + ${EndIf} +!macroend +!define SetHandlersCalendar "!insertmacro SetHandlersCalendar" + +; XXXrstrong - there are several values that will be overwritten by and +; overwrite other installs of the same application. +!macro SetClientsMail RegKey + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 + ${GetLongPath} "$INSTDIR\mozMapi32_InUse.dll" $6 + + StrCpy $0 "Software\Clients\Mail\${ClientsRegName}" + + WriteRegStr ${RegKey} "$0" "" "${ClientsRegName}" + WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" + WriteRegStr ${RegKey} "$0" "DLLPath" "$6" + + ; The MapiProxy dll can exist in multiple installs of the application. + ; Registration occurs as follows with the last action to occur being the one + ; that wins: + ; On install and software update when helper.exe runs with the /PostUpdate + ; argument. On setting the application as the system's default application + ; using Window's "Set program access and defaults". + + !ifndef NO_LOG + ${LogHeader} "DLL Registration" + !endif + ClearErrors + ${RegisterDLL} "$INSTDIR\MapiProxy_InUse.dll" + !ifndef NO_LOG + ${If} ${Errors} + ${LogMsg} "** ERROR Registering: $INSTDIR\MapiProxy_InUse.dll **" + ${Else} + ${LogUninstall} "DLLReg: \MapiProxy_InUse.dll" + ${LogMsg} "Registered: $INSTDIR\MapiProxy_InUse.dll" + ${EndIf} + !endif + + StrCpy $1 "Software\Classes\CLSID\{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + WriteRegStr ${RegKey} "$1\LocalServer32" "" "$\"$8$\" /MAPIStartup" + WriteRegStr ${RegKey} "$1\ProgID" "" "MozillaMapi.1" + WriteRegStr ${RegKey} "$1\VersionIndependentProgID" "" "MozillaMAPI" + StrCpy $1 "SOFTWARE\Classes" + WriteRegStr ${RegKey} "$1\MozillaMapi" "" "Mozilla MAPI" + WriteRegStr ${RegKey} "$1\MozillaMapi\CLSID" "" "{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + WriteRegStr ${RegKey} "$1\MozillaMapi\CurVer" "" "MozillaMapi.1" + WriteRegStr ${RegKey} "$1\MozillaMapi.1" "" "Mozilla MAPI" + WriteRegStr ${RegKey} "$1\MozillaMapi.1\CLSID" "" "{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + + ; The Reinstall Command is defined at + ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp + WriteRegStr ${RegKey} "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" + WriteRegStr ${RegKey} "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" + WriteRegStr ${RegKey} "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" + + ClearErrors + ReadRegDWORD $1 ${RegKey} "$0\InstallInfo" "IconsVisible" + ; If the IconsVisible name value pair doesn't exist add it otherwise the + ; application won't be displayed in Set Program Access and Defaults. + ${If} ${Errors} + ${If} ${FileExists} "$QUICKLAUNCH\${BrandShortName}.lnk" + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1 + ${Else} + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0 + ${EndIf} + ${EndIf} + + WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\" -mail" + + WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" + WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -options" + + WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" + WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" + + ; Protocols + StrCpy $1 "$\"$8$\" -osint -compose $\"%1$\"" + StrCpy $2 "$\"$8$\" $\"%1$\"" + ${AddHandlerValues} "$0\Protocols\mailto" "$1" "$8,0" "${AppRegNameMail} URL" "true" "" + ${AddHandlerValues} "$0\Protocols\mid" "$2" "$8,0" "${AppRegNameMail} URL" "true" "" + + ; Capabilities registry keys + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${AppRegNameMail}" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".eml" "ThunderbirdEML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".wdseml" "ThunderbirdEML" + WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "Mail" "${ClientsRegName}" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "mailto" "Thunderbird.Url.mailto" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "mid" "Thunderbird.Url.mid" + + ; Registered Application + WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegNameMail}" "$0\Capabilities" +!macroend +!define SetClientsMail "!insertmacro SetClientsMail" + +; Add registry keys to support the Thunderbird 32 bit to 64 bit migration. +; These registry entries are not removed on uninstall at this time. After the +; Thunderbird 32 bit to 64 bit migration effort is completed these registry +; entries can be removed during install, post update, and uninstall. +!macro Set32to64DidMigrateReg + ${GetLongPath} "$INSTDIR" $1 + ; These registry keys are always in the 32 bit hive since they are never + ; needed by a Thunderbird 64 bit install unless it has been updated from + ; Thunderbird 32 bit. + SetRegView 32 + +!ifdef HAVE_64BIT_BUILD + + ; Running Thunderbird 64 bit on Windows 64 bit + ClearErrors + ReadRegDWORD $2 HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" + ; If there were no errors then the system was updated from Thunderbird 32 bit + ; to Thunderbird 64 bit and if the value is already 1 then the registry value + ; has already been updated in the HKLM registry. + ${IfNot} ${Errors} + ${AndIf} $2 != 1 + ClearErrors + WriteRegDWORD HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" 1 + ${If} ${Errors} + ; There was an error writing to HKLM so just write it to HKCU + WriteRegDWORD HKCU "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" 1 + ${Else} + ; This will delete the value from HKCU if it exists + DeleteRegValue HKCU "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" + ${EndIf} + ${EndIf} + + ClearErrors + ReadRegDWORD $2 HKCU "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" + ; If there were no errors then the system was updated from Thunderbird 32 bit + ; to Thunderbird 64 bit and if the value is already 1 then the registry value + ; has already been updated in the HKCU registry. + ${IfNot} ${Errors} + ${AndIf} $2 != 1 + WriteRegDWORD HKCU "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" 1 + ${EndIf} + +!else + + ; Running Thunderbird 32 bit + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + ; Running Thunderbird 32 bit on a Windows 64 bit system + ClearErrors + ReadRegDWORD $2 HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" + ; If there were errors the value doesn't exist yet. + ${If} ${Errors} + ClearErrors + WriteRegDWORD HKLM "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" 0 + ; If there were errors write the value in HKCU. + ${If} ${Errors} + WriteRegDWORD HKCU "Software\Mozilla\${AppName}\32to64DidMigrate" "$1" 0 + ${EndIf} + ${EndIf} + ${EndIf} + +!endif + + ClearErrors + SetRegView lastused +!macroend +!define Set32to64DidMigrateReg "!insertmacro Set32to64DidMigrateReg" + +; XXXrstrong - there are several values that will be overwritten by and +; overwrite other installs of the same application. +!macro SetClientsNews RegKey + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 + ${GetLongPath} "$INSTDIR\mozMapi32_InUse.dll" $6 + + StrCpy $0 "Software\Clients\News\${ClientsRegName}" + + WriteRegStr ${RegKey} "$0" "" "${ClientsRegName}" + WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" + WriteRegStr ${RegKey} "$0" "DLLPath" "$6" + + ; The MapiProxy dll can exist in multiple installs of the application. + ; Registration occurs as follows with the last action to occur being the one + ; that wins: + ; On install and software update when helper.exe runs with the /PostUpdate + ; argument. On setting the application as the system's default application + ; using Window's "Set program access and defaults". + + !ifndef NO_LOG + ${LogHeader} "DLL Registration" + !endif + ClearErrors + ${RegisterDLL} "$INSTDIR\MapiProxy_InUse.dll" + !ifndef NO_LOG + ${If} ${Errors} + ${LogMsg} "** ERROR Registering: $INSTDIR\MapiProxy_InUse.dll **" + ${Else} + ${LogUninstall} "DLLReg: \MapiProxy_InUse.dll" + ${LogMsg} "Registered: $INSTDIR\MapiProxy_InUse.dll" + ${EndIf} + !endif + + StrCpy $1 "Software\Classes\CLSID\{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + WriteRegStr ${RegKey} "$1\LocalServer32" "" "$\"$8$\" /MAPIStartup" + WriteRegStr ${RegKey} "$1\ProgID" "" "MozillaMapi.1" + WriteRegStr ${RegKey} "$1\VersionIndependentProgID" "" "MozillaMAPI" + StrCpy $1 "SOFTWARE\Classes" + WriteRegStr ${RegKey} "$1\MozillaMapi" "" "Mozilla MAPI" + WriteRegStr ${RegKey} "$1\MozillaMapi\CLSID" "" "{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + WriteRegStr ${RegKey} "$1\MozillaMapi\CurVer" "" "MozillaMapi.1" + WriteRegStr ${RegKey} "$1\MozillaMapi.1" "" "Mozilla MAPI" + WriteRegStr ${RegKey} "$1\MozillaMapi.1\CLSID" "" "{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7}" + + ; Mail shell/open/command + WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\" -mail" + + ; Capabilities registry keys + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${AppRegNameNews}" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "nntp" "Thunderbird.Url.news" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "news" "Thunderbird.Url.news" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "snews" "Thunderbird.Url.news" + + ; Protocols + StrCpy $1 "$\"$8$\" -osint -mail $\"%1$\"" + ${AddHandlerValues} "$0\Protocols\nntp" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" + ${AddHandlerValues} "$0\Protocols\news" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" + ${AddHandlerValues} "$0\Protocols\snews" "$1" "$8,0" "${AppRegNameNews} URL" "true" "" + + ; Registered Application + WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegNameNews}" "$0\Capabilities" +!macroend +!define SetClientsNews "!insertmacro SetClientsNews" + +!macro SetClientsCalendar RegKey + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 + ${GetLongPath} "$INSTDIR\mozMapi32_InUse.dll" $6 + + StrCpy $0 "Software\Clients\Calendar\${ClientsRegName}" + + WriteRegStr ${RegKey} "$0" "" "${ClientsRegName}" + WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" + WriteRegStr ${RegKey} "$0" "DLLPath" "$6" + + WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\"" + + WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" + WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -options" + + WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" + WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" + + ; Protocols + StrCpy $1 "$\"$8$\" $\"%1$\"" + ${AddHandlerValues} "$0\Protocols\webcal" "$1" "$8,0" "${AppRegNameCalendar} URL" "true" "" + ${AddHandlerValues} "$0\Protocols\webcals" "$1" "$8,0" "${AppRegNameCalendar} URL" "true" "" + + ; Capabilities registry keys + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${AppRegNameCalendar}" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".ics" "ThunderbirdICS" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "webcal" "Thunderbird.Url.webcal" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "webcals" "Thunderbird.Url.webcal" + + ; Registered Application + WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegNameCalendar}" "$0\Capabilities" +!macroend +!define SetClientsCalendar "!insertmacro SetClientsCalendar" + +; Add Software\Mozilla\ registry entries (uses SHCTX). +!macro SetAppKeys + ${GetLongPath} "$INSTDIR" $8 + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main" + ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0 + ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Uninstall" + ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})" + ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion} (${AB_CD})" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\bin" + ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\extensions" + ${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0 + ${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}" + ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0 + + StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}" + ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}" 0 + ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion} (${AB_CD})" 0 + ${WriteRegStr2} $TmpVal "$0" "GeckoVersion" "${GREVersion}" 0 +!macroend +!define SetAppKeys "!insertmacro SetAppKeys" + +; Add uninstall registry entries. This macro tests for write access to determine +; if the uninstall keys should be added to HKLM or HKCU. +!macro SetUninstallKeys + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" + + StrCpy $2 "" + ClearErrors + WriteRegStr HKLM "$0" "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + ; If the uninstall keys already exist in HKLM don't create them in HKCU + ClearErrors + ReadRegStr $2 "HKLM" $0 "DisplayName" + ${If} $2 == "" + ; Otherwise we don't have any keys for this product in HKLM so proceed + ; to create them in HKCU. Better handling for this will be done in: + ; Bug 711044 - Better handling for 2 uninstall icons + StrCpy $1 "HKCU" + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + ${EndIf} + ClearErrors + ${Else} + StrCpy $1 "HKLM" + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) + DeleteRegValue HKLM "$0" "${BrandShortName}InstallerTest" + ${EndIf} + + ${If} $2 == "" + ${GetLongPath} "$INSTDIR" $8 + + + ; Write the uninstall registry keys + ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0 + ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0 + ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0 + ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 + ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 + ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 + ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 + ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 + ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0 + ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0 + ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0 + + ${GetSize} "$8" "/S=0K" $R2 $R3 $R4 + ${WriteRegDWORD2} $1 "$0" "EstimatedSize" $R2 0 + + ${If} "$TmpVal" == "HKLM" + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) + ${Else} + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + ${EndIf} + ${EndIf} +!macroend +!define SetUninstallKeys "!insertmacro SetUninstallKeys" + +; Updates protocol handlers if their registry open command value is for this +; install location (uses SHCTX). +!macro UpdateProtocolHandlers + ; Store the command to open the app with an url in a register for easy access. + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + StrCpy $0 "SOFTWARE\Classes" + StrCpy $1 "$\"$8$\" -osint -compose $\"%1$\"" + StrCpy $2 "$\"$8$\" -osint -mail $\"%1$\"" + StrCpy $3 "$\"$8$\" $\"%1$\"" + + ; Only set the file and protocol handlers if the existing one under HKCR is + ; for this install location. + ${IsHandlerForInstallDir} "ThunderbirdEML" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\ThunderbirdEML" "$3" "$8,0" \ + "${AppRegNameMail} Document" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "Thunderbird.Url.mailto" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\Thunderbird.Url.mailto" "$1" "$8,0" \ + "${AppRegNameMail} URL" "delete" "" + ${EndIf} + + ${IsHandlerForInstallDir} "mailto" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\mailto" "$1" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "Thunderbird.Url.mid" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\Thunderbird.Url.mid" "$3" "$8,0" \ + "${AppRegNameMail} URL" "delete" "" + ${EndIf} + + ${IsHandlerForInstallDir} "mid" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\mid" "$3" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "Thunderbird.Url.news" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\Thunderbird.Url.news" "$2" "$8,0" \ + "${AppRegNameNews} URL" "delete" "" + ${EndIf} + + ${IsHandlerForInstallDir} "news" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\news" "$2" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "snews" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\snews" "$2" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "nntp" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\nntp" "$2" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "Thunderbird.Url.webcal" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\Thunderbird.Url.webcal" "$3" "$8,0" \ + "${AppRegNameCalendar} URL" "delete" "" + ${EndIf} + + ${IsHandlerForInstallDir} "webcal" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\webcal" "$3" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "webcals" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\webcals" "$3" "$8,0" "" "" "" + ${EndIf} + + ${IsHandlerForInstallDir} "ThunderbirdICS" $R9 + ${If} "$R9" == "true" + ${AddHandlerValues} "SOFTWARE\Classes\ThunderbirdICS" "$3" "$8,0" \ + "${AppRegNameCalendar} Document" "" "" + ${EndIf} +!macroend +!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers" + +!ifdef MOZ_MAINTENANCE_SERVICE +; Adds maintenance service certificate keys for the install dir. +; For the cert to work, it must also be signed by a trusted cert for the user. +!macro AddMaintCertKeys + Push $R0 + ; Allow main Mozilla cert information for updates + ; This call will push the needed key on the stack + ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" + Pop $R0 + ${If} $R0 != "" + ; More than one certificate can be specified in a different subfolder + ; for example: $R0\1, but each individual binary can be signed + ; with at most one certificate. A fallback certificate can only be used + ; if the binary is replaced with a different certificate. + ; We always use the 64bit registry for certs. + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + DeleteRegKey HKLM "$R0" + + ; Setting the Attempted value will ensure that a new Maintenance Service + ; install will never be attempted again after this from updates. The value + ; is used only to see if updates should attempt new service installs. + WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1 + + ; These values associate the allowed certificates for the current + ; installation. + WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}" + WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}" + ; These values associate the allowed certificates for the previous + ; installation, so that we can update from it cleanly using the + ; old updater.exe (which will still have this signature). + WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}" + WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}" + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastused + ${EndIf} + ClearErrors + ${EndIf} + ; Restore the previously used value back + Pop $R0 +!macroend +!define AddMaintCertKeys "!insertmacro AddMaintCertKeys" +!endif + +!macro RegisterAccessibleMarshal + ${RegisterDLL} "$INSTDIR\AccessibleMarshal.dll" +!macroend +!define RegisterAccessibleMarshal "!insertmacro RegisterAccessibleMarshal" + +; Removes various registry entries for reasons noted below (does not use SHCTX). +!macro RemoveDeprecatedKeys + StrCpy $0 "SOFTWARE\Classes" + + ; remove DI and SOC from the .eml class if it exists and contains + ; thunderbird.exe + ClearErrors + ReadRegStr $1 HKLM "$0\.eml\shell\open\command" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKLM "$0\.eml\shell\open\command" + ${EndUnless} + + ClearErrors + ReadRegStr $1 HKCU "$0\.eml\shell\open\command" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKCU "$0\.eml\shell\open\command" + ${EndUnless} + + ClearErrors + ReadRegStr $1 HKLM "$0\.eml\DefaultIcon" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKLM "$0\.eml\DefaultIcon" + ${EndUnless} + + ClearErrors + ReadRegStr $1 HKCU "$0\.eml\DefaultIcon" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKCU "$0\.eml\DefaultIcon" + ${EndUnless} + + ; Remove the Shredder clients key if its default icon contains thunderbird.exe + ClearErrors + ReadRegStr $1 HKLM "SOFTWARE\clients\mail\Shredder\DefaultIcon" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKLM "SOFTWARE\clients\mail\Shredder" + ${EndUnless} + + ClearErrors + ReadRegStr $1 HKLM "SOFTWARE\clients\news\Shredder\DefaultIcon" "" + ${WordFind} "$1" "${FileMainEXE}" "E+1{" $R1 + ${Unless} ${Errors} + DeleteRegKey HKLM "SOFTWARE\clients\news\Shredder" + ${EndUnless} + + ; The shim for 1.5.0.10 writes out a set of bogus keys which we need to + ; cleanup. Intentionally hard coding Mozilla Thunderbird here + ; as this is the string used by the shim. + DeleteRegKey HKLM "$0\Mozilla Thunderbird.Url.mailto" + DeleteRegValue HKLM "Software\RegisteredApplications" "Mozilla Thunderbird" + + ; Remove the app compatibility registry key + StrCpy $0 "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" + DeleteRegValue HKLM "$0" "$INSTDIR\${FileMainEXE}" + DeleteRegValue HKCU "$0" "$INSTDIR\${FileMainEXE}" + + ; Remove the SupportUTF8 registry value as it causes MAPI issues on some locales + ; with non-ASCII characters in file names. + StrCpy $0 "Software\Clients\Mail\${ClientsRegName}" + DeleteRegValue HKLM $0 "SupportUTF8" + + ; Unregister deprecated AccessibleHandler.dll. + ${If} ${FileExists} "$INSTDIR\AccessibleHandler.dll" + ${UnregisterDLL} "$INSTDIR\AccessibleHandler.dll" + ${EndIf} +!macroend +!define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys" + +; For updates, adds a pinned shortcut to Task Bar on update for Windows 7 +; and 8 if this macro has never been called before and the application +; is default (see PinToTaskBar for more details). This doesn't get called +; for Windows 10 and 11 on updates, so we will never pin on update there. +; +; For installs, adds a taskbar pin if SHOULD_PIN is 1. (Defaults to 1, +; but is controllable through the UI, ini file, and command line flags.) +!macro MigrateTaskBarShortcut SHOULD_PIN + ${GetShortcutsLogPath} $0 + ${If} ${FileExists} "$0" + ClearErrors + ReadINIStr $1 "$0" "TASKBAR" "Migrated" + ${If} ${Errors} + ClearErrors + WriteIniStr "$0" "TASKBAR" "Migrated" "true" + WriteRegDWORD HKCU \ + "Software\Mozilla\${AppName}\Installer\$AppUserModelID" \ + "WasPinnedToTaskbar" 1 + ${If} ${AtLeastWin7} + ${If} "${SHOULD_PIN}" == "1" + ${PinToTaskBar} + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} +!macroend +!define MigrateTaskBarShortcut "!insertmacro MigrateTaskBarShortcut" + +!define GetPinningSupportedByWindowsVersionWithoutSystemPopup "!insertmacro GetPinningSupportedByWindowsVersionWithoutSystemPopup " + +; Starting with a version of Windows 11 (10.0.22621), the OS will show a system popup +; when trying to pin to the taskbar. +; +; Pass in the variable to put the output into. A '1' means pinning is supported on this +; OS without generating a popup, a '0' means pinning will generate a system popup. +; +; +; More info: a version of Windows was released that introduced a system popup when +; an exe (such as setup.exe) attempts to pin an app to the taskbar. +; We already handle pinning in the onboarding process once Firefox +; launches so we don't want to also attempt to pin it in the installer +; and have the OS ask the user for confirmation without the full context. +; +; The number for that version of windows is still unclear (it might be 22H2 or 23H2) +; and it's not supported by the version of WinVer.nsh we have anyways, +; so instead we are confirming that it's a build of Windows that is less +; than 10.0 BuildNumber: 22621 to do pinning in the installer. +!macro GetPinningSupportedByWindowsVersionWithoutSystemPopup outvar + !define pin_lbl lbl_GPSBWVWSP_${__COUNTER__} + + Push $0 + Push $1 + Push $2 + Push $3 + + ${WinVerGetMajor} $0 + ${WinVerGetMinor} $1 + ${WinVerGetBuild} $2 + + ; Get the UBR; only documented way I could figure out how to get this reliably + ClearErrors + ReadRegDWORD $3 HKLM \ + "Software\Microsoft\Windows NT\CurrentVersion" \ + "UBR" + + ; It's not obvious how to use LogicLib itself within a LogicLib custom + ; operator, so we do everything by hand with `IntCmp`. The below lines + ; translate to: + ; StrCpy ${outvar} '0' ; default to false + ; ${If} $0 <= 10 + ; ${If} $1 <= 0 + ; ${If} $2 < 22621 + ; StrCpy ${outvar} '1' + ; ${ElseIf} $2 == 22621 + ; ${If} $3 < 2361 + ; StrCpy ${outvar} '1' + ; ${Endif} + ; ${EndIf} + ; ${Endif} + ; ${EndIf} + + StrCpy ${outvar} '0' ; default to false on pinning + + ; If the major version is greater than 10, no pinning in setup + IntCmp $0 10 "" "" ${pin_lbl}_bad + + ; If the minor version is greater than 0, no pinning in setup + IntCmp $1 0 "" "" ${pin_lbl}_bad + + ; If the build number is less than 22621, jump to pinning; if greater than, no pinning + IntCmp $2 22621 "" ${pin_lbl}_good ${pin_lbl}_bad + + ; Only if the version is 10.0.22621 do we fall through to here + ; If the UBR is greater than or equal to 2361, jump to no pinning + IntCmp $3 2361 ${pin_lbl}_bad "" ${pin_lbl}_bad + + ${pin_lbl}_good: + + StrCpy ${outvar} '1' + + ${pin_lbl}_bad: + !undef pin_lbl + + Pop $3 + Pop $2 + Pop $1 + Pop $0 +!macroend + +!macro _PinningSupportedByWindowsVersionWithoutSystemPopup _ignore _ignore2 _t _f + !insertmacro _LOGICLIB_TEMP + ${GetPinningSupportedByWindowsVersionWithoutSystemPopup} $_LOGICLIB_TEMP + !insertmacro _= $_LOGICLIB_TEMP "1" `${_t}` `${_f}` +!macroend + +; The following is to make if statements for the functionality easier. When using an if statement, +; Use IsPinningSupportedByWindowsVersionWithoutSystemPopup like so, instead of GetPinningSupportedByWindowsVersionWithoutSystemPopup: +; +; ${If} ${IsPinningSupportedByWindowsVersionWithoutSystemPopup} +; ; do something +; ${EndIf} +; +!define IsPinningSupportedByWindowsVersionWithoutSystemPopup `"" PinningSupportedByWindowsVersionWithoutSystemPopup "" ` + +; Adds a pinned Task Bar shortcut on Windows 7 if there isn't one for the main +; application executable already. Existing pinned shortcuts for the same +; application model ID must be removed first to prevent breaking the pinned +; item's lists but multiple installations with the same application model ID is +; an edgecase. If removing existing pinned shortcuts with the same application +; model ID removes a pinned pinned Start Menu shortcut this will also add a +; pinned Start Menu shortcut. +!macro PinToTaskBar + ${If} ${AtLeastWin7} + StrCpy $8 "false" ; Whether a shortcut had to be created + ${IsPinnedToTaskBar} "$INSTDIR\${FileMainEXE}" $R9 + ${If} "$R9" == "false" + ; Find an existing Start Menu shortcut or create one to use for pinning + ${GetShortcutsLogPath} $0 + ${If} ${FileExists} "$0" + ClearErrors + ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" + ${Unless} ${Errors} + SetShellVarContext all ; Set SHCTX to all users + ${Unless} ${FileExists} "$SMPROGRAMS\$1" + SetShellVarContext current ; Set SHCTX to the current user + ${Unless} ${FileExists} "$SMPROGRAMS\$1" + StrCpy $8 "true" + CreateShortCut "$SMPROGRAMS\$1" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\$1" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \ + "$INSTDIR" + ${If} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" "true" + ${EndIf} + ${EndIf} + ${EndUnless} + ${EndUnless} + + ${If} ${FileExists} "$SMPROGRAMS\$1" + ; Count of Start Menu pinned shortcuts before unpinning. + ${PinnedToStartMenuLnkCount} $R9 + + ; Having multiple shortcuts pointing to different installations with + ; the same AppUserModelID (e.g. side by side installations of the + ; same version) will make the TaskBar shortcut's lists into an bad + ; state where the lists are not shown. To prevent this first + ; uninstall the pinned item. + ApplicationID::UninstallPinnedItem "$SMPROGRAMS\$1" + + ; Count of Start Menu pinned shortcuts after unpinning. + ${PinnedToStartMenuLnkCount} $R8 + + ; If there is a change in the number of Start Menu pinned shortcuts + ; assume that unpinning unpinned a side by side installation from + ; the Start Menu and pin this installation to the Start Menu. + ${Unless} $R8 == $R9 + ; Pin the shortcut to the Start Menu. 5381 is the shell32.dll + ; resource id for the "Pin to Start Menu" string. + InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5381" + ${EndUnless} + + ${If} ${AtMostWin2012R2} + ; Pin the shortcut to the TaskBar. 5386 is the shell32.dll + ; resource id for the "Pin to Taskbar" string. + InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5386" + ${ElseIf} ${AtMostWaaS} 1809 + ; In Windows 10 the "Pin to Taskbar" resource was removed, so we + ; can't access the verb that way anymore. We have a create a + ; command key using the GUID that's assigned to this action and + ; then invoke that as a verb. This works up until build 1809. + ReadRegStr $R9 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.taskbarpin" \ + "ExplorerCommandHandler" + WriteRegStr HKCU "Software\Classes\*\shell\${AppRegNameMail}-$AppUserModelID" "ExplorerCommandHandler" $R9 + InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "${AppRegNameMail}-$AppUserModelID" + DeleteRegKey HKCU "Software\Classes\*\shell\${AppRegNameMail}-$AppUserModelID" + ${Else} + ; In Windows 10 1903 and up, and Windows 11 prior to 22H2, the above no + ; longer works. We have yet another method for these versions + ; which is detailed in the PinToTaskbar plugin code. + ${If} ${IsPinningSupportedByWindowsVersionWithoutSystemPopup} + PinToTaskbar::Pin "$SMPROGRAMS\$1" + ${EndIf} + ${EndIf} + + ; Delete the shortcut if it was created + ${If} "$8" == "true" + Delete "$SMPROGRAMS\$1" + ${EndIf} + ${EndIf} + + ${If} $TmpVal == "HKCU" + SetShellVarContext current ; Set SHCTX to the current user + ${Else} + SetShellVarContext all ; Set SHCTX to all users + ${EndIf} + ${EndUnless} + ${EndIf} + ${EndIf} + ${EndIf} +!macroend +!define PinToTaskBar "!insertmacro PinToTaskBar" + +; Removes the application's start menu directory along with its shortcuts if +; they exist and if they exist creates a start menu shortcut in the root of the +; start menu directory (bug 598779). If the application's start menu directory +; is not empty after removing the shortucts the directory will not be removed +; since these additional items were not created by the installer (uses SHCTX). +!macro RemoveStartMenuDir + ${GetShortcutsLogPath} $0 + ${If} ${FileExists} "$0" + ; Delete Start Menu Programs shortcuts, directory if it is empty, and + ; parent directories if they are empty up to but not including the start + ; menu directory. + ${GetLongPath} "$SMPROGRAMS" $1 + ClearErrors + ReadINIStr $2 "$0" "SMPROGRAMS" "RelativePathToDir" + ${Unless} ${Errors} + ${GetLongPath} "$1\$2" $2 + ${If} "$2" != "" + ; Delete shortucts in the Start Menu Programs directory. + StrCpy $3 0 + ${Do} + ClearErrors + ReadINIStr $4 "$0" "SMPROGRAMS" "Shortcut$3" + ; Stop if there are no more entries + ${If} ${Errors} + ${ExitDo} + ${EndIf} + ${If} ${FileExists} "$2\$4" + ShellLink::GetShortCutTarget "$2\$4" + Pop $5 + ${If} "$INSTDIR\${FileMainEXE}" == "$5" + Delete "$2\$4" + ${EndIf} + ${EndIf} + IntOp $3 $3 + 1 ; Increment the counter + ${Loop} + ; Delete Start Menu Programs directory and parent directories + ${Do} + ; Stop if the current directory is the start menu directory + ${If} "$1" == "$2" + ${ExitDo} + ${EndIf} + ClearErrors + RmDir "$2" + ; Stop if removing the directory failed + ${If} ${Errors} + ${ExitDo} + ${EndIf} + ${GetParent} "$2" $2 + ${Loop} + ${EndIf} + DeleteINISec "$0" "SMPROGRAMS" + ${EndUnless} + ${EndIf} +!macroend +!define RemoveStartMenuDir "!insertmacro RemoveStartMenuDir" + +; Creates the shortcuts log ini file with the appropriate entries if it doesn't +; already exist. +!macro CreateShortcutsLog + ${GetShortcutsLogPath} $0 + ${Unless} ${FileExists} "$0" + ${LogStartMenuShortcut} "${BrandShortName}.lnk" + ${LogQuickLaunchShortcut} "${BrandShortName}.lnk" + ${LogDesktopShortcut} "${BrandShortName}.lnk" + ${EndUnless} +!macroend +!define CreateShortcutsLog "!insertmacro CreateShortcutsLog" + +; The MAPI DLL's are copied and the copies are used for the MAPI registration +; to lessen file in use errors on application update. +!macro UpgradeMapiDLLs + ClearErrors + ${DeleteFile} "$INSTDIR\MapiProxy_InUse.dll" + ${If} ${Errors} + ${DeleteFile} "$INSTDIR\MapiProxy_InUse.dll.moz-delete" ; shouldn't exist + Rename "$INSTDIR\MapiProxy_InUse.dll" "$INSTDIR\MapiProxy_InUse.dll.moz-delete" + Delete /REBOOTOK "$INSTDIR\MapiProxy_InUse.dll.moz-delete" + ${EndIf} + CopyFiles /SILENT "$INSTDIR\MapiProxy.dll" "$INSTDIR\MapiProxy_InUse.dll" + + ClearErrors + ${DeleteFile} "$INSTDIR\mozMapi32_InUse.dll" + ${If} ${Errors} + ${DeleteFile} "$INSTDIR\mozMapi32_InUse.dll.moz-delete" ; shouldn't exist + Rename "$INSTDIR\mozMapi32_InUse.dll" "$INSTDIR\mozMapi32_InUse.dll.moz-delete" + Delete /REBOOTOK "$INSTDIR\mozMapi32_InUse.dll.moz-delete" + ${EndIf} + CopyFiles /SILENT "$INSTDIR\mozMapi32.dll" "$INSTDIR\mozMapi32_InUse.dll" +!macroend +!define UpgradeMapiDLLs "!insertmacro UpgradeMapiDLLs" + +; The files to check if they are in use during (un)install so the restart is +; required message is displayed. All files must be located in the $INSTDIR +; directory. +!macro PushFilesToCheck + ; The first string to be pushed onto the stack MUST be "end" to indicate + ; that there are no more files to check in $INSTDIR and the last string + ; should be ${FileMainEXE} so if it is in use the CheckForFilesInUse macro + ; returns after the first check. + Push "end" + Push "AccessibleMarshal.dll" + Push "freebl3.dll" + Push "nssckbi.dll" + Push "nspr4.dll" + Push "nssdbm3.dll" + Push "sqlite3.dll" + Push "mozsqlite3.dll" + Push "xpcom.dll" + Push "crashreporter.exe" + Push "minidump-analyzer.exe" + Push "pingsender.exe" + Push "updater.exe" + Push "mozwer.dll" + Push "xpicleanup.exe" + Push "MapiProxy.dll" + Push "MapiProxy_InUse.dll" + Push "mozMapi32.dll" + Push "mozMapi32_InUse.dll" + Push "${FileMainEXE}" +!macroend +!define PushFilesToCheck "!insertmacro PushFilesToCheck" + +; Helper for updating the shortcut application model IDs. +Function FixShortcutAppModelIDs + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $0 + ${EndIf} +FunctionEnd + +; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to +; this function only being used by the uninstaller.nsi. +!ifdef NO_LOG + +Function SetAsDefaultAppUser + ; AddTaskbarSC is needed by MigrateTaskBarShortcut, which is called by + ; SetAsDefaultAppUserHKCU. If this is called via ExecCodeSegment, + ; MigrateTaskBarShortcut will not see the value of AddTaskbarSC, so we + ; send it via a register instead. + StrCpy $R0 $AddTaskbarSC + ; It is only possible to set this installation of the application as the + ; Mail handler if it was added to the HKLM Mail + ; registry keys. + ; http://support.microsoft.com/kb/297878 + ${GetParameters} $R0 + + ClearErrors + ${GetOptions} "$R0" "Mail" $R1 + ${Unless} ${Errors} + ; Check if this install location registered as the Mail client + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\Mail\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + ; Check if this is running in an elevated process + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} ; Not elevated + Call SetAsDefaultMailAppUserHKCU + ${Else} ; Elevated - execute the function in the unelevated process + GetFunctionAddress $0 SetAsDefaultMailAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndIf} + + ; Do we also set TB as default News client? If not we can return + ClearErrors + ${GetOptions} "$R0" "News" $R1 + ${If} ${Errors} + Return + ${EndIf} + ${EndIf} + ${EndIf} + ${EndUnless} + + ClearErrors + ${GetOptions} "$R0" "News" $R1 + ${Unless} ${Errors} + ; Check if this install location registered as the News client + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\News\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + ; Check if this is running in an elevated process + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} ; Not elevated + Call SetAsDefaultNewsAppUserHKCU + ${Else} ; Elevated - execute the function in the unelevated process + GetFunctionAddress $0 SetAsDefaultNewsAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndIf} + Return ; Nothing more needs to be done + ${EndIf} + ${EndIf} + ${EndUnless} + + ClearErrors + ${GetOptions} "$R0" "Calendar" $R1 + ${Unless} ${Errors} + ; Check if this install location registered as the Calendar client + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\Calendar\${ClientsRegName}\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + ; Check if this is running in an elevated process + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} ; Not elevated + Call SetAsDefaultCalendarAppUserHKCU + ${Else} ; Elevated - execute the function in the unelevated process + GetFunctionAddress $0 SetAsDefaultCalendarAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndIf} + Return ; Nothing more needs to be done + ${EndIf} + ${EndIf} + ${EndUnless} + + ; The code after ElevateUAC won't be executed when the user: + ; a) is a member of the administrators group (e.g. elevation is required) + ; b) is not a member of the administrators group and chooses to elevate + ${ElevateUAC} + + SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) + ${SetClientsMail} "HKLM" + ${SetClientsNews} "HKLM" + ${SetClientsCalendar} "HKLM" + + ${RemoveDeprecatedKeys} + ${MigrateTaskBarShortcut} "$R0" + + ClearErrors + ${GetParameters} $0 + ${GetOptions} "$0" "/UAC:" $0 + ${If} ${Errors} + ClearErrors + ${GetOptions} "$R0" "Mail" $R1 + ${Unless} ${Errors} + Call SetAsDefaultMailAppUserHKCU + ${EndUnless} + ClearErrors + ${GetOptions} "$R0" "News" $R1 + ${Unless} ${Errors} + Call SetAsDefaultNewsAppUserHKCU + ${EndUnless} + ${Else} + ${GetOptions} "$R0" "Mail" $R1 + ${Unless} ${Errors} + GetFunctionAddress $0 SetAsDefaultMailAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndUnless} + ClearErrors + ${GetOptions} "$R0" "News" $R1 + ${Unless} ${Errors} + GetFunctionAddress $0 SetAsDefaultNewsAppUserHKCU + UAC::ExecCodeSegment $0 + ${EndUnless} + ${EndIf} +FunctionEnd +!define SetAsDefaultAppUser "Call SetAsDefaultAppUser" + +!endif + +; Sets this installation as the default mailer by setting the registry keys +; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS +; plugin. This is a function instead of a macro so it is +; easily called from an elevated instance of the binary. Since this can be +; called by an elevated instance logging is not performed in this function. +Function SetAsDefaultMailAppUserHKCU + ; Only set as the user's Mail client if the StartMenuInternet + ; registry keys are for this install. + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\Mail\${ClientsRegName}\DefaultIcon" "" + ${Unless} ${Errors} + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + WriteRegStr HKCU "Software\Clients\Mail" "" "${ClientsRegName}" + ${EndIf} + ${EndIf} + ${EndUnless} + + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + + ${If} ${AtLeastWin8} + ${SetHandlersMail} + ${EndIf} + + ClearErrors + ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegNameMail}" + ; Only register as the handler if the app registry name exists + ; under the RegisteredApplications registry key. + ${Unless} ${Errors} + AppAssocReg::SetAppAsDefaultAll "${AppRegNameMail}" + ${EndUnless} +FunctionEnd + +; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to +; this function only being used by SetAsDefaultAppUser. +!ifdef NO_LOG + +; Sets this installation as the default news client by setting the registry keys +; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS +; plugin. This is a function instead of a macro so it is +; easily called from an elevated instance of the binary. Since this can be +; called by an elevated instance logging is not performed in this function. +Function SetAsDefaultNewsAppUserHKCU + ; Only set as the user's News client if the StartMenuInternet + ; registry keys are for this install. + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\News\${ClientsRegName}\DefaultIcon" "" + ${Unless} ${Errors} + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + WriteRegStr HKCU "Software\Clients\News" "" "${ClientsRegName}" + ${EndIf} + ${EndIf} + ${EndUnless} + + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + + ${If} ${AtLeastWin8} + ${SetHandlersNews} + ${EndIf} + + ClearErrors + ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegNameNews}" + ; Only register as the handler if the app registry name exists + ; under the RegisteredApplications registry key. + ${Unless} ${Errors} + AppAssocReg::SetAppAsDefaultAll "${AppRegNameNews}" + ${EndUnless} +FunctionEnd + +; Sets this installation as the default calendar client by setting the registry keys +; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS +; plugin. This is a function instead of a macro so it is +; easily called from an elevated instance of the binary. Since this can be +; called by an elevated instance logging is not performed in this function. +Function SetAsDefaultCalendarAppUserHKCU + ; Only set as the user's Calendar client if the StartMenuInternet + ; registry keys are for this install. + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\Calendar\${ClientsRegName}\DefaultIcon" "" + ${Unless} ${Errors} + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${If} "$0" == "$INSTDIR" + WriteRegStr HKCU "Software\Clients\Calendar" "" "${ClientsRegName}" + ${EndIf} + ${EndIf} + ${EndUnless} + + SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) + + ${If} ${AtLeastWin8} + ${SetHandlersCalendar} + ${EndIf} + + ClearErrors + ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegNameCalendar}" + ; Only register as the handler if the app registry name exists + ; under the RegisteredApplications registry key. + ${Unless} ${Errors} + AppAssocReg::SetAppAsDefaultAll "${AppRegNameCalendar}" + ${EndUnless} +FunctionEnd + +!endif diff --git a/comm/mail/installer/windows/nsis/uninstaller.nsi b/comm/mail/installer/windows/nsis/uninstaller.nsi new file mode 100755 index 0000000000..c2a6b4b1b3 --- /dev/null +++ b/comm/mail/installer/windows/nsis/uninstaller.nsi @@ -0,0 +1,683 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Required Plugins: +# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in +# BitsUtils http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/BitsUtils +# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash +# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in +# UAC http://nsis.sourceforge.net/UAC_plug-in + +; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs +!verbose 3 + +; 7-Zip provides better compression than the lzma from NSIS so we add the files +; uncompressed and use 7-Zip to create a SFX archive of it +SetDatablockOptimize on +SetCompress off +CRCCheck on + +RequestExecutionLevel user + +Unicode true +ManifestSupportedOS all +ManifestDPIAware true + +!addplugindir ./ + +; Attempt to elevate Standard Users in addition to users that +; are a member of the Administrators group. +!define NONADMIN_ELEVATE + +; prevents compiling of the reg write logging. +!define NO_LOG + +!define MaintUninstallKey \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService" + +Var TmpVal +Var MaintCertKey +; AddTaskbarSC is defined here in order to silence warnings from inside +; MigrateTaskBarShortcut and is not intended to be used here. +; See Bug 1329869 for more. +Var AddTaskbarSC + +; Other included files may depend upon these includes! +; The following includes are provided by NSIS. +!include FileFunc.nsh +!include LogicLib.nsh +!include MUI.nsh +!include WinMessages.nsh +!include WinVer.nsh +!include WordFunc.nsh + +!insertmacro GetSize +!insertmacro StrFilter +!insertmacro WordReplace + +!insertmacro un.GetParent + +; The following includes are custom. +!include branding.nsi +!include defines.nsi +!include common.nsh +!include locales.nsi + +; This is named BrandShortName helper because we use this for software update +; post update cleanup. +VIAddVersionKey "FileDescription" "${BrandShortName} Helper" +VIAddVersionKey "OriginalFilename" "helper.exe" + +!insertmacro AddHandlerValues +!insertmacro CleanVirtualStore +!insertmacro ElevateUAC +!insertmacro GetLongPath +!insertmacro GetPathFromString +!insertmacro InitHashAppModelId +!insertmacro IsHandlerForInstallDir +!insertmacro IsPinnedToTaskBar +!insertmacro IsUserAdmin +!insertmacro LogDesktopShortcut +!insertmacro LogQuickLaunchShortcut +!insertmacro LogStartMenuShortcut +!insertmacro PinnedToStartMenuLnkCount +!insertmacro RegCleanAppHandler +!insertmacro RegCleanMain +!insertmacro RegCleanUninstall +!insertmacro SetAppLSPCategories +!insertmacro SetBrandNameVars +!insertmacro UpdateShortcutAppModelIDs +!insertmacro UnloadUAC +!insertmacro WriteRegDWORD2 +!insertmacro WriteRegStr2 + +; This needs to be inserted after InitHashAppModelId because it uses +; $AppUserModelID and the compiler can't handle using variables lexically before +; they've been declared. +!insertmacro GetInstallerRegistryPref + +!insertmacro un.ChangeMUIHeaderImage +!insertmacro un.CheckForFilesInUse +!insertmacro un.CleanMaintenanceServiceLogs +!insertmacro un.CleanVirtualStore +!insertmacro un.DeleteShortcuts +!insertmacro un.GetLongPath +!insertmacro un.GetSecondInstallPath +!insertmacro un.InitHashAppModelId +!insertmacro un.ManualCloseAppPrompt +!insertmacro un.RegCleanAppHandler +!insertmacro un.RegCleanFileHandler +!insertmacro un.RegCleanMain +!insertmacro un.RegCleanUninstall +!insertmacro un.RegCleanProtocolHandler +!insertmacro un.RemoveQuotesFromPath +!insertmacro un.RemovePrecompleteEntries +!insertmacro un.SetAppLSPCategories +!insertmacro un.SetBrandNameVars + +!include shared.nsh + +; Helper macros for ui callbacks. Insert these after shared.nsh +!insertmacro OnEndCommon +!insertmacro UninstallOnInitCommon + +!insertmacro un.OnEndCommon +!insertmacro un.UninstallUnOnInitCommon + +Name "${BrandFullName}" +OutFile "helper.exe" +!ifdef HAVE_64BIT_BUILD + InstallDir "$PROGRAMFILES64\${BrandFullName}\" +!else + InstallDir "$PROGRAMFILES32\${BrandFullName}\" +!endif +ShowUnInstDetails nevershow + +################################################################################ +# Modern User Interface - MUI + +!define MUI_ABORTWARNING +!define MUI_ICON setup.ico +!define MUI_UNICON setup.ico +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp +; By default MUI_BGCOLOR is hardcoded to FFFFFF, which is only correct if the +; the Windows theme or high-contrast mode hasn't changed it, so we need to +; override that with GetSysColor(COLOR_WINDOW) (this string ends up getting +; passed to SetCtlColors, which uses this custom syntax to mean that). +!define MUI_BGCOLOR SYSCLR:WINDOW + +; Use a right to left header image when the language is right to left +!ifdef ${AB_CD}_rtl +!define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp +!else +!define MUI_HEADERIMAGE_BITMAP wizHeader.bmp +!endif + +/** + * Uninstall Pages + */ +; Welcome Page +!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preWelcome +!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.showWelcome +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.leaveWelcome +!insertmacro MUI_UNPAGE_WELCOME + +; Custom Uninstall Confirm Page +UninstPage custom un.preConfirm + +; Remove Files Page +!insertmacro MUI_UNPAGE_INSTFILES + +; Finish Page +!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.showFinish +!insertmacro MUI_UNPAGE_FINISH + +; Use the default dialog for IDD_VERIFY for a simple Banner +ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe" + +################################################################################ +# Helper Functions + +; This function is used to uninstall the maintenance service if the +; application currently being uninstalled is the last application to use the +; maintenance service. +Function un.UninstallServiceIfNotUsed + ; $0 will store if a subkey exists + ; $1 will store the first subkey if it exists or an empty string if it doesn't + ; Backup the old values + Push $0 + Push $1 + + ; The maintenance service always uses the 64-bit registry on x64 systems + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + + ; Figure out the number of subkeys + StrCpy $0 0 + ${Do} + EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0 + ${If} "$1" == "" + ${ExitDo} + ${EndIf} + IntOp $0 $0 + 1 + ${Loop} + + ; Restore back the registry view + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastUsed + ${EndIf} + + ${If} $0 == 0 + ; Get the path of the maintenance service uninstaller. + ; Look in both the 32-bit and 64-bit registry views. + SetRegView 32 + ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" + SetRegView lastused + + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + ${If} $1 == "" + SetRegView 64 + ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString" + SetRegView lastused + ${EndIf} + ${EndIf} + + ; If the uninstall string does not exist, skip executing it + ${If} $1 != "" + ; $1 is already a quoted string pointing to the install path + ; so we're already protected against paths with spaces + nsExec::Exec "$1 /S" + ${EndIf} + ${EndIf} + + ; Restore the old value of $1 and $0 + Pop $1 + Pop $0 +FunctionEnd + +################################################################################ +# Install Sections +; Empty section required for the installer to compile as an uninstaller +Section "" +SectionEnd + +################################################################################ +# Uninstall Sections + +Section "Uninstall" + SetDetailsPrint textonly + DetailPrint $(STATUS_UNINSTALL_MAIN) + SetDetailsPrint none + + ; Delete the app exe to prevent launching the app while we are uninstalling. + ClearErrors + ${DeleteFile} "$INSTDIR\${FileMainEXE}" + ${If} ${Errors} + ; If the user closed the application it can take several seconds for it to + ; shut down completely. If the application is being used by another user we + ; can still delete the files when the system is restarted. + Sleep 5000 + ${DeleteFile} "$INSTDIR\${FileMainEXE}" + ClearErrors + ${EndIf} + + ; setup the application model id registration value + ${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" + + SetShellVarContext current ; Set SHCTX to HKCU + ${un.RegCleanMain} "Software\Mozilla" + ${un.RegCleanUninstall} + ${un.DeleteShortcuts} + + ; Unregister resources associated with Win7 taskbar jump lists. + ${If} ${AtLeastWin7} + ${AndIf} "$AppUserModelID" != "" + ApplicationID::UninstallJumpLists "$AppUserModelID" + ${EndIf} + + ; Clean up old maintenance service logs + ${un.CleanMaintenanceServiceLogs} "Thunderbird" + + ; Remove any app model id's stored in the registry for this install path + DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR" + DeleteRegValue HKLM "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR" + + ClearErrors + WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" + ${If} ${Errors} + StrCpy $TmpVal "HKCU" ; used primarily for logging + ${Else} + SetShellVarContext all ; Set SHCTX to HKLM + DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" + StrCpy $TmpVal "HKLM" ; used primarily for logging + ${un.RegCleanMain} "Software\Mozilla" + ${un.RegCleanUninstall} + ${un.DeleteShortcuts} + ${EndIf} + + ${un.RegCleanAppHandler} "Thunderbird.Url.mailto" + ${un.RegCleanAppHandler} "Thunderbird.Url.mid" + ${un.RegCleanAppHandler} "Thunderbird.Url.news" + ${un.RegCleanAppHandler} "Thunderbird.Url.webcal" + ${un.RegCleanAppHandler} "ThunderbirdEML" + ${un.RegCleanAppHandler} "ThunderbirdICS" + ${un.RegCleanProtocolHandler} "mailto" + ${un.RegCleanProtocolHandler} "mid" + ${un.RegCleanProtocolHandler} "news" + ${un.RegCleanProtocolHandler} "nntp" + ${un.RegCleanProtocolHandler} "snews" + ${un.RegCleanProtocolHandler} "webcal" + ${un.RegCleanProtocolHandler} "webcals" + + ClearErrors + ReadRegStr $R9 HKCR "ThunderbirdEML" "" + ; Don't clean up the file handlers if the ThunderbirdEML key still exists + ; since there could be a second installation that may be the default file + ; handler. + ${If} ${Errors} + ${un.RegCleanFileHandler} ".eml" "ThunderbirdEML" + ${un.RegCleanFileHandler} ".wdseml" "ThunderbirdEML" + DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\KindMap" ".wdseml" + ; It doesn't matter if the value didn't exist + ClearErrors + ${EndIf} + + ClearErrors + ReadRegStr $R9 HKCR "ThunderbirdICS" "" + ; Don't clean up the file handlers if the ThunderbirdICS key still exists + ; since there could be a second installation that may be the default file + ; handler. + ${If} ${Errors} + ${un.RegCleanFileHandler} ".ics" "ThunderbirdICS" + ; It doesn't matter if the value didn't exist + ClearErrors + ${EndIf} + + SetShellVarContext all ; Set SHCTX to HKLM + ${un.GetSecondInstallPath} "Software\Mozilla" $R9 + ${If} $R9 == "false" + SetShellVarContext current ; Set SHCTX to HKCU + ${un.GetSecondInstallPath} "Software\Mozilla" $R9 + ${EndIf} + + StrCpy $0 "Software\Clients\Mail\${ClientsRegName}\shell\open\command" + ReadRegStr $R1 HKLM "$0" "" + ${un.RemoveQuotesFromPath} "$R1" $R1 + ${un.GetParent} "$R1" $R1 + + ; Only remove the Clients\Mail & Clients\News & Clients\Calendar key if it + ; refers to this install location. The Clients\* keys are independent + ; of the default app for the OS settings. The XPInstall base un-installer + ; always removes these keys if it is uninstalling the default app and it + ; will always replace the keys when installing even if there is another + ; install of Thunderbird that is set as the + ; default app. Now the keys are always updated on install but are only + ; removed if they refer to this install location. + ${If} "$INSTDIR" == "$R1" + DeleteRegKey HKLM "Software\Clients\Mail\${ClientsRegName}" + DeleteRegKey HKLM "Software\Clients\News\${ClientsRegName}" + DeleteRegKey HKLM "Software\Clients\Calendar\${ClientsRegName}" + DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegNameMail}" + DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegNameNews}" + DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegNameCalendar}" + ${EndIf} + + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" + ${If} $R9 == "false" + DeleteRegKey HKLM "$0" + DeleteRegKey HKCU "$0" + ${Else} + ReadRegStr $R1 HKLM "$0" "" + ${un.RemoveQuotesFromPath} "$R1" $R1 + ${un.GetParent} "$R1" $R1 + ${If} "$INSTDIR" == "$R1" + WriteRegStr HKLM "$0" "" "$R9" + ${un.GetParent} "$R9" $R1 + WriteRegStr HKLM "$0" "Path" "$R1" + ${EndIf} + ${EndIf} + + ; Remove directories and files we always control before parsing the uninstall + ; log so empty directories can be removed. + ${If} ${FileExists} "$INSTDIR\updates" + RmDir /r /REBOOTOK "$INSTDIR\updates" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\defaults\shortcuts" + RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\distribution" + RmDir /r /REBOOTOK "$INSTDIR\distribution" + ${EndIf} + + ; Application update won't add these files to the uninstall log so delete + ; them if they still exist. + ${If} ${FileExists} "$INSTDIR\MapiProxy_InUse.dll" + Delete /REBOOTOK "$INSTDIR\MapiProxy_InUse.dll" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\mozMapi32_InUse.dll" + Delete /REBOOTOK "$INSTDIR\mozMapi32_InUse.dll" + ${EndIf} + + ; Remove files that may be left behind by the application in the + ; VirtualStore directory. + ${un.CleanVirtualStore} + + ; Only unregister the dll if the registration points to this installation + ReadRegStr $R1 HKCR "CLSID\{0D68D6D0-D93D-4D08-A30D-F00DD1F45B24}\InProcServer32" "" + ${If} "$INSTDIR\AccessibleMarshal.dll" == "$R1" + ${UnregisterDLL} "$INSTDIR\AccessibleMarshal.dll" + ${EndIf} + + ${If} ${FileExists} "$INSTDIR\AccessibleHandler.dll" + ${UnregisterDLL} "$INSTDIR\AccessibleHandler.dll" + ${EndIf} + + ; Remove the Windows Reporter Module entry + DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\RuntimeExceptionHelperModules" "$INSTDIR\mozwer.dll" + + ${un.RemovePrecompleteEntries} "false" + + ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js" + Delete /REBOOTOK "$INSTDIR\defaults\pref\channel-prefs.js" + ${EndIf} + RmDir "$INSTDIR\defaults\pref" + RmDir "$INSTDIR\defaults" + ${If} ${FileExists} "$INSTDIR\uninstall" + ; Remove the uninstall directory that we control + RmDir /r /REBOOTOK "$INSTDIR\uninstall" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\install.log" + Delete /REBOOTOK "$INSTDIR\install.log" + ${EndIf} + ${If} ${FileExists} "$INSTDIR\update-settings.ini" + Delete /REBOOTOK "$INSTDIR\update-settings.ini" + ${EndIf} + + ; Remove the installation directory if it is empty + RmDir "$INSTDIR" + + ; If thunderbird.exe was successfully deleted yet we still need to restart to + ; remove other files create a dummy thunderbird.exe.moz-delete to prevent the + ; installer from allowing an install without restart when it is required + ; to complete an uninstall. + ${If} ${RebootFlag} + ; Admin is required to delete files on reboot so only add the moz-delete if + ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the + ; user is an admin. + UAC::IsAdmin + ${If} "$0" == "1" + ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete" + FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w + FileWrite $0 "Will be deleted on restart" + Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete" + FileClose $0 + ${EndUnless} + ${EndIf} + ${EndIf} + + ; Refresh desktop icons otherwise the start menu internet item won't be + ; removed and other ugly things will happen like recreation of the app's + ; clients registry key by the OS under some conditions. + ${RefreshShellIcons} + +!ifdef MOZ_MAINTENANCE_SERVICE + ; Get the path the allowed cert is at and remove it + ; Keep this block of code last since it modifies the reg view + ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" + Pop $MaintCertKey + ${If} $MaintCertKey != "" + ; Always use the 64bit registry for certs on 64bit systems. + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + DeleteRegKey HKLM "$MaintCertKey" + ${If} ${RunningX64} + ${OrIf} ${IsNativeARM64} + SetRegView lastused + ${EndIf} + ${EndIf} + Call un.UninstallServiceIfNotUsed +!endif + +!ifdef MOZ_BITS_DOWNLOAD + BitsUtils::CancelBitsJobsByName "MozillaUpdate $AppUserModelID" + Pop $0 +!endif + +SectionEnd + +################################################################################ +# Language + +!insertmacro MOZ_MUI_LANGUAGE 'baseLocale' +!verbose push +!verbose 3 +!include "overrideLocale.nsh" +!include "customLocale.nsh" +!verbose pop + +; Set this after the locale files to override it if it is in the locale. Using +; " " for BrandingText will hide the "Nullsoft Install System..." branding. +BrandingText " " + +################################################################################ +# Page pre, show, and leave functions + +Function un.preWelcome + ${If} ${FileExists} "$INSTDIR\distribution\modern-wizard.bmp" + Delete "$PLUGINSDIR\modern-wizard.bmp" + CopyFiles /SILENT "$INSTDIR\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp" + ${EndIf} +!ifdef MOZ_BITS_DOWNLOAD + BitsUtils::StartBitsServiceBackground +!endif +FunctionEnd + +Function un.ShowWelcome + ; The welcome and finish pages don't get the correct colors for their labels + ; like the other pages do, presumably because they're built by filling in an + ; InstallOptions .ini file instead of from a dialog resource like the others. + ; Field 2 is the header and Field 3 is the body text. + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 2" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 3" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW +FunctionEnd + +Function un.leaveWelcome + ${If} ${FileExists} "$INSTDIR\${FileMainEXE}" + Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)" + + ; If the message window has been found previously give the app an additional + ; five seconds to close. + ${If} "$TmpVal" == "FoundMessageWindow" + Sleep 5000 + ${EndIf} + + ${PushFilesToCheck} + + ${un.CheckForFilesInUse} $TmpVal + + Banner::destroy + + ; If there are files in use $TmpVal will be "true" + ${If} "$TmpVal" == "true" + ; If the message window is found the call to ManualCloseAppPrompt will + ; abort leaving the value of $TmpVal set to "FoundMessageWindow". + StrCpy $TmpVal "FoundMessageWindow" + ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)" + ; If the message window is not found set $TmpVal to "true" so the restart + ; required message is displayed. + StrCpy $TmpVal "true" + ${EndIf} + ${EndIf} +FunctionEnd + +Function un.preConfirm + ; The header and subheader on the wizard pages don't get the correct text + ; color by default for some reason, even though the other controls do. + GetDlgItem $0 $HWNDPARENT 1037 + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + GetDlgItem $0 $HWNDPARENT 1038 + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ${If} ${FileExists} "$INSTDIR\distribution\modern-header.bmp" + ${AndIf} $hHeaderBitmap == "" + Delete "$PLUGINSDIR\modern-header.bmp" + CopyFiles /SILENT "$INSTDIR\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp" + ${un.ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp" + ${EndIf} + + ; Setup the unconfirm.ini file for the Custom Uninstall Confirm Page + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "3" + + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Left "0" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Right "-1" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Top "5" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Bottom "15" + + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Type "text" + ; The contents of this control must be set as follows in the pre function + ; ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND" + ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" State "" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Left "0" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Right "-1" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Top "17" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY" + + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "label" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_CONFIRM_CLICK)" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "130" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "150" + + ${If} "$TmpVal" == "true" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "label" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "35" + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "45" + + WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "4" + ${EndIf} + + !insertmacro MUI_HEADER_TEXT "$(UN_CONFIRM_PAGE_TITLE)" "$(UN_CONFIRM_PAGE_SUBTITLE)" + ; The Summary custom page has a textbox that will automatically receive + ; focus. This sets the focus to the Install button instead. + !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "unconfirm.ini" + GetDlgItem $0 $HWNDPARENT 1 + System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i" + ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND" + SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR" + !insertmacro MUI_INSTALLOPTIONS_SHOW +FunctionEnd + +Function un.ShowFinish + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 2" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 3" "HWND" + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ; Either Fields 4 and 5 are the reboot option radio buttons, or Field 4 is + ; the survey checkbox and Field 5 doesn't exist. Either way, we need to + ; clear the theme from them before we can set their background colors. + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 4" "HWND" + System::Call 'uxtheme::SetWindowTheme(i $0, w " ", w " ")' + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + + ClearErrors + ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 5" "HWND" + ${IfNot} ${Errors} + System::Call 'uxtheme::SetWindowTheme(i $0, w " ", w " ")' + SetCtlColors $0 SYSCLR:WINDOWTEXT SYSCLR:WINDOW + ${EndIf} +FunctionEnd + +################################################################################ +# Initialization Functions + +Function .onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + ; We need this set up for most of the helper.exe operations. + ${UninstallOnInitCommon} +FunctionEnd + +Function un.onInit + ; Remove the current exe directory from the search order. + ; This only effects LoadLibrary calls and not implicitly loaded DLLs. + System::Call 'kernel32::SetDllDirectoryW(w "")' + + StrCpy $LANGUAGE 0 + + ${un.UninstallUnOnInitCommon} + + !insertmacro InitInstallOptionsFile "unconfirm.ini" +FunctionEnd + +Function .onGUIEnd + ${OnEndCommon} +FunctionEnd + +Function un.onGUIEnd + ${un.OnEndCommon} +FunctionEnd diff --git a/comm/mail/installer/windows/nsis/updater_append.ini b/comm/mail/installer/windows/nsis/updater_append.ini new file mode 100644 index 0000000000..af7742c12c --- /dev/null +++ b/comm/mail/installer/windows/nsis/updater_append.ini @@ -0,0 +1,12 @@ + +; IMPORTANT: This file should always start with a newline in case a locale +; provided updater.ini does not end with a newline. +; Application to launch after an update has been successfully applied. This +; must be in the same directory or a sub-directory of the directory of the +; application executable that initiated the software update. +[PostUpdateWin] +; ExeRelPath is the path to the PostUpdateWin executable relative to the +; application executable. +ExeRelPath=uninstall\helper.exe +; ExeArg is the argument to pass to the PostUpdateWin exe +ExeArg=/PostUpdate -- cgit v1.2.3