1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
14 # The Original Code is the Mozilla Installer code.
16 # The Initial Developer of the Original Code is Mozilla Foundation
17 # Portions created by the Initial Developer are Copyright (C) 2006
18 # the Initial Developer. All Rights Reserved.
21 # Robert Strong <robert.bugzilla@gmail.com>
23 # Alternatively, the contents of this file may be used under the terms of
24 # either the GNU General Public License Version 2 or later (the "GPL"), or
25 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 # in which case the provisions of the GPL or the LGPL are applicable instead
27 # of those above. If you wish to allow use of your version of this file only
28 # under the terms of either the GPL or the LGPL, and not to allow others to
29 # use your version of this file under the terms of the MPL, indicate your
30 # decision by deleting the provisions above and replace them with the notice
31 # and other provisions required by the GPL or the LGPL. If you do not delete
32 # the provisions above, a recipient may use your version of this file under
33 # the terms of any one of the MPL, the GPL or the LGPL.
35 # ***** END LICENSE BLOCK *****
37 ################################################################################
38 # Helper defines and macros for toolkit applications
41 * Avoid creating macros / functions that overwrite registers (see the
42 * GetLongPath macro for one way to avoid this)!
44 * Before using the registers exchange the passed in params and save existing
45 * register values to the stack.
47 * Exch $R9 ; exhange the original $R9 with the top of the stack
48 * Exch 1 ; exchange the top of the stack with 1 below the top of the stack
49 * Exch $R8 ; exchange the original $R8 with the top of the stack
50 * Exch 2 ; exchange the top of the stack with 2 below the top of the stack
51 * Exch $R7 ; exchange the original $R7 with the top of the stack
52 * Push $R6 ; push the original $R6 onto the top of the stack
53 * Push $R5 ; push the original $R5 onto the top of the stack
54 * Push $R4 ; push the original $R4 onto the top of the stack
58 * ; Restore the values.
59 * Pop $R4 ; restore the value for $R4 from the top of the stack
60 * Pop $R5 ; restore the value for $R5 from the top of the stack
61 * Pop $R6 ; restore the value for $R6 from the top of the stack
62 * Exch $R7 ; exchange the new $R7 value with the top of the stack
63 * Exch 2 ; exchange the top of the stack with 2 below the top of the stack
64 * Exch $R8 ; exchange the new $R8 value with the top of the stack
65 * Exch 1 ; exchange the top of the stack with 2 below the top of the stack
66 * Exch $R9 ; exchange the new $R9 value with the top of the stack
69 * When inserting macros in common.nsh from another macro in common.nsh that
70 * can be used from the uninstaller _MOZFUNC_UN will be undefined when it is
71 * inserted. Use the following to redefine _MOZFUNC_UN with its original value
72 * (see the RegCleanMain macro for an example).
74 * !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
75 * !insertmacro ${_MOZFUNC_UN_TMP}FileJoin
76 * !insertmacro ${_MOZFUNC_UN_TMP}LineFind
77 * !insertmacro ${_MOZFUNC_UN_TMP}TextCompareNoDetails
78 * !insertmacro ${_MOZFUNC_UN_TMP}TrimNewLines
80 * !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
81 * !undef _MOZFUNC_UN_TMP
84 ; When including a file provided by NSIS check if its verbose macro is defined
85 ; to prevent loading the file a second time.
86 !ifmacrondef TEXTFUNC_VERBOSE
90 !ifmacrondef FILEFUNC_VERBOSE
94 !ifmacrondef LOGICLIB_VERBOSITY
98 !ifndef WINMESSAGES_INCLUDED
99 !include WinMessages.nsh
106 ; When including WinVer.nsh check if ___WINVER__NSH___ is defined to prevent
107 ; loading the file a second time. NSIS versions prior to 2.21 didn't include
108 ; WinVer.nsh so include it with the /NOFATAL option.
109 !ifndef ___WINVER__NSH___
110 !include /NONFATAL WinVer.nsh
113 ; NSIS provided macros that we have overridden.
114 !include overrides.nsh
116 ################################################################################
117 # Macros for debugging
120 * The following two macros assist with verifying that a macro doesn't
121 * overwrite any registers.
124 * ${debugSetRegisters}
126 * ${debugDisplayRegisters}
130 * Sets all register values to their name to assist with verifying that a macro
131 * doesn't overwrite any registers.
133 !macro debugSetRegisters
155 !define debugSetRegisters "!insertmacro debugSetRegisters"
158 * Displays all register values to assist with verifying that a macro doesn't
159 * overwrite any registers.
161 !macro debugDisplayRegisters
163 "Register Values:$\n\
164 $$0 = $0$\n$$1 = $1$\n$$2 = $2$\n$$3 = $3$\n$$4 = $4$\n\
165 $$5 = $5$\n$$6 = $6$\n$$7 = $7$\n$$8 = $8$\n$$9 = $9$\n\
166 $$R0 = $R0$\n$$R1 = $R1$\n$$R2 = $R2$\n$$R3 = $R3$\n$$R4 = $R4$\n\
167 $$R5 = $R5$\n$$R6 = $R6$\n$$R7 = $R7$\n$$R8 = $R8$\n$$R9 = $R9"
169 !define debugDisplayRegisters "!insertmacro debugDisplayRegisters"
172 ################################################################################
173 # Modern User Interface (MUI) override macros
175 ; Modified version of the following MUI macros to support Mozilla localization.
177 ; MUI_LANGUAGEFILE_BEGIN
178 ; MOZ_MUI_LANGUAGEFILE_END
179 ; See <NSIS App Dir>/Contrib/Modern UI/System.nsh for more information
180 !define MUI_INSTALLOPTIONS_READ "!insertmacro MUI_INSTALLOPTIONS_READ"
182 !macro MOZ_MUI_LANGUAGE LANGUAGE
184 !verbose ${MUI_VERBOSE}
185 !include "${LANGUAGE}.nsh"
189 !macro MOZ_MUI_LANGUAGEFILE_BEGIN LANGUAGE
192 !insertmacro MUI_INSERT
194 !ifndef "MUI_LANGUAGEFILE_${LANGUAGE}_USED"
195 !define "MUI_LANGUAGEFILE_${LANGUAGE}_USED"
196 LoadLanguageFile "${LANGUAGE}.nlf"
198 !error "Modern UI language file ${LANGUAGE} included twice!"
202 ; Custom version of MUI_LANGUAGEFILE_END. The macro to add the default MUI
203 ; strings and the macros for several strings that are part of the NSIS MUI and
204 ; not in our locale files have been commented out.
205 !macro MOZ_MUI_LANGUAGEFILE_END
207 # !include "${NSISDIR}\Contrib\Modern UI\Language files\Default.nsh"
208 !ifdef MUI_LANGUAGEFILE_DEFAULT_USED
209 !undef MUI_LANGUAGEFILE_DEFAULT_USED
210 !warning "${LANGUAGE} Modern UI language file version doesn't match. Using default English texts for missing strings."
213 !insertmacro MUI_LANGUAGEFILE_DEFINE "MUI_${LANGUAGE}_LANGNAME" "MUI_LANGNAME"
215 !ifndef MUI_LANGDLL_PUSHLIST
216 !define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} "
218 !ifdef MUI_LANGDLL_PUSHLIST_TEMP
219 !undef MUI_LANGDLL_PUSHLIST_TEMP
221 !define MUI_LANGDLL_PUSHLIST_TEMP "${MUI_LANGDLL_PUSHLIST}"
222 !undef MUI_LANGDLL_PUSHLIST
223 !define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} ${MUI_LANGDLL_PUSHLIST_TEMP}"
226 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE WELCOME "MUI_TEXT_WELCOME_INFO_TITLE"
227 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE WELCOME "MUI_TEXT_WELCOME_INFO_TEXT"
229 !ifdef MUI_TEXT_LICENSE_TITLE
230 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_TEXT_LICENSE_TITLE"
232 !ifdef MUI_TEXT_LICENSE_SUBTITLE
233 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_TEXT_LICENSE_SUBTITLE"
235 !ifdef MUI_INNERTEXT_LICENSE_TOP
236 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_TOP"
239 # !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM"
241 !ifdef MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX
242 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX"
245 !ifdef MUI_INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS
246 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS"
249 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE COMPONENTS "MUI_TEXT_COMPONENTS_TITLE"
250 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE COMPONENTS "MUI_TEXT_COMPONENTS_SUBTITLE"
251 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE COMPONENTS "MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE"
252 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE COMPONENTS "MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO"
254 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE DIRECTORY "MUI_TEXT_DIRECTORY_TITLE"
255 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE DIRECTORY "MUI_TEXT_DIRECTORY_SUBTITLE"
257 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_TEXT_STARTMENU_TITLE"
258 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_TEXT_STARTMENU_SUBTITLE"
259 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_INNERTEXT_STARTMENU_TOP"
260 # !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_INNERTEXT_STARTMENU_CHECKBOX"
262 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_INSTALLING_TITLE"
263 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_INSTALLING_SUBTITLE"
265 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_FINISH_TITLE"
266 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_FINISH_SUBTITLE"
268 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_ABORT_TITLE"
269 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_ABORT_SUBTITLE"
271 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_BUTTONTEXT_FINISH"
272 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_TITLE"
273 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_TEXT"
274 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_REBOOT"
275 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_REBOOTNOW"
276 !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_REBOOTLATER"
277 # !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_RUN"
278 # !insertmacro MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_SHOWREADME"
280 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_DEFINE MUI_ABORTWARNING "MUI_TEXT_ABORTWARNING"
283 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE WELCOME "MUI_UNTEXT_WELCOME_INFO_TITLE"
284 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE WELCOME "MUI_UNTEXT_WELCOME_INFO_TEXT"
286 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE CONFIRM "MUI_UNTEXT_CONFIRM_TITLE"
287 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE CONFIRM "MUI_UNTEXT_CONFIRM_SUBTITLE"
289 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNTEXT_LICENSE_TITLE"
290 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNTEXT_LICENSE_SUBTITLE"
292 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM"
293 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM_CHECKBOX"
294 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS"
296 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE COMPONENTS "MUI_UNTEXT_COMPONENTS_TITLE"
297 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE COMPONENTS "MUI_UNTEXT_COMPONENTS_SUBTITLE"
299 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE DIRECTORY "MUI_UNTEXT_DIRECTORY_TITLE"
300 # !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE DIRECTORY "MUI_UNTEXT_DIRECTORY_SUBTITLE"
302 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_UNINSTALLING_TITLE"
303 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_UNINSTALLING_SUBTITLE"
305 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_FINISH_TITLE"
306 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_FINISH_SUBTITLE"
308 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_ABORT_TITLE"
309 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_ABORT_SUBTITLE"
311 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_TITLE"
312 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_TEXT"
313 !insertmacro MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_REBOOT"
315 !insertmacro MUI_LANGUAGEFILE_LANGSTRING_DEFINE MUI_UNABORTWARNING "MUI_UNTEXT_ABORTWARNING"
320 ################################################################################
321 # Macros for creating Install Options ini files
323 # DEPRECATED - all ini creation code should be added to the application's
324 # installer and uninstaller files.
326 !macro createComponentsINI
327 WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "5"
329 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label"
330 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_LABEL)"
331 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0"
332 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1"
333 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5"
334 WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "15"
336 ${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
337 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox"
338 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(DOMI_TITLE)"
339 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "15"
340 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1"
341 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "20"
342 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "30"
343 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1"
344 WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP"
347 ${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
348 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Type "label"
349 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Text "$(DOMI_TEXT)"
350 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Left "30"
351 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Right "-1"
352 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Top "32"
353 WriteINIStr "$PLUGINSDIR\components.ini" "Field 3" Bottom "52"
357 !macro createShortcutsINI
358 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Settings" NumFields "4"
360 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Type "label"
361 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Text "$(CREATE_ICONS_DESC)"
362 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Left "0"
363 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Right "-1"
364 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Top "5"
365 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 1" Bottom "15"
367 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Type "checkbox"
368 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Text "$(ICONS_DESKTOP)"
369 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Left "15"
370 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Right "-1"
371 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Top "20"
372 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Bottom "30"
373 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" State "1"
374 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 2" Flags "GROUP"
376 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Type "checkbox"
377 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Text "$(ICONS_STARTMENU)"
378 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Left "15"
379 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Right "-1"
380 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Top "40"
381 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" Bottom "50"
382 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 3" State "1"
384 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Type "checkbox"
385 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Text "$(ICONS_QUICKLAUNCH)"
386 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Left "15"
387 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Right "-1"
388 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Top "60"
389 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" Bottom "70"
390 WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1"
393 !macro createBasicCustomOptionsINI
394 WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
396 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
397 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
398 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0"
399 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1"
400 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0"
401 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10"
403 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton"
404 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)"
405 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "15"
406 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1"
407 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25"
408 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35"
409 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1"
410 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP"
412 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton"
413 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)"
414 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "15"
415 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1"
416 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55"
417 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
418 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
420 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
421 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
422 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "30"
423 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1"
424 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37"
425 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57"
427 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label"
428 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)"
429 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "30"
430 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1"
431 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
432 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
435 !macro createBasicCompleteCustomOptionsINI
436 WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "7"
438 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
439 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_DESC)"
440 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0"
441 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1"
442 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0"
443 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10"
445 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton"
446 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)"
447 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "15"
448 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1"
449 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25"
450 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35"
451 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1"
452 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP"
454 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton"
455 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_COMPLETE_RADIO)"
456 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "15"
457 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1"
458 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55"
459 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
460 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
462 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "RadioButton"
463 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_CUSTOM_RADIO)"
464 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15"
465 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1"
466 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "85"
467 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "95"
468 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" State "0"
470 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label"
471 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_STANDARD_DESC)"
472 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "30"
473 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1"
474 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "37"
475 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "57"
477 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Type "label"
478 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Text "$(OPTION_COMPLETE_DESC)"
479 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Left "30"
480 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Right "-1"
481 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Top "67"
482 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Bottom "87"
484 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Type "label"
485 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Text "$(OPTION_CUSTOM_DESC)"
486 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Left "30"
487 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Right "-1"
488 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Top "97"
489 WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Bottom "117"
492 !macro createBasicCustomSetAsDefaultOptionsINI
493 WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "6"
495 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
496 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
497 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left "0"
498 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right "-1"
499 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top "0"
500 WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10"
502 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Type "RadioButton"
503 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Text "$(OPTION_STANDARD_RADIO)"
504 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Left "15"
505 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Right "-1"
506 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Top "25"
507 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Bottom "35"
508 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" State "1"
509 WriteINIStr "$PLUGINSDIR\options.ini" "Field 2" Flags "GROUP"
511 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Type "RadioButton"
512 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Text "$(OPTION_CUSTOM_RADIO)"
513 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Left "15"
514 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Right "-1"
515 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Top "55"
516 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
517 WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
519 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
520 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
521 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "30"
522 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Right "-1"
523 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Top "37"
524 WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Bottom "57"
526 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Type "label"
527 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Text "$(OPTION_CUSTOM_DESC)"
528 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Left "30"
529 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Right "-1"
530 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
531 WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
533 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Type "checkbox"
534 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Text "$(OPTIONS_MAKE_DEFAULT)"
535 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Left "0"
536 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Right "-1"
537 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Top "124"
538 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Bottom "145"
539 WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" State "1"
542 !macro createSummaryINI
543 WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "3"
545 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Type "label"
546 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Text "$(SUMMARY_INSTALLED_TO)"
547 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Left "0"
548 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Right "-1"
549 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Top "5"
550 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 1" Bottom "15"
552 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Type "text"
553 ; The contents of this control must be set as follows in the pre function
554 ; ${MUI_INSTALLOPTIONS_READ} $1 "summary.ini" "Field 2" "HWND"
555 ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
556 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" state ""
557 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Left "0"
558 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Right "-1"
559 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Top "17"
560 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" Bottom "30"
561 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags "READONLY"
563 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type "label"
564 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_CLICK)"
565 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left "0"
566 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right "-1"
567 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top "130"
568 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150"
570 ${If} "$TmpVal" == "true"
571 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type "label"
572 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_INSTALL)"
573 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left "0"
574 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right "-1"
575 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "35"
576 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "45"
578 WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
581 ReadINIStr $0 "$PLUGINSDIR\options.ini" "Field 6" "State"
583 ${If} "$TmpVal" == "true"
584 ; To insert this control reset Top / Bottom for controls below this one
585 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top "50"
586 WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "60"
592 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type "label"
593 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text "$(SUMMARY_MAKE_DEFAULT)"
594 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
595 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
596 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top "35"
597 WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "45"
599 WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0"
603 !macro un.createUnConfirmINI
604 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "5"
606 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label"
607 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)"
608 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Left "0"
609 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Right "-1"
610 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Top "5"
611 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Bottom "15"
613 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Type "text"
614 ; The contents of this control must be set as follows in the pre function
615 ; ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND"
616 ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
617 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" State ""
618 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Left "0"
619 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Right "-1"
620 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Top "17"
621 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30"
622 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY"
624 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "checkbox"
625 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_REMOVE_PROFILES)"
626 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0"
627 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1"
628 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "40"
629 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "50"
630 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" State "0"
631 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" flags "NOTIFY"
633 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "text"
634 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" State "$(UN_REMOVE_PROFILES_DESC)"
635 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0"
636 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1"
637 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "52"
638 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "120"
639 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" flags "MULTILINE|READONLY"
641 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Type "label"
642 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Text "$(UN_CONFIRM_CLICK)"
643 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Left "0"
644 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Right "-1"
645 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Top "130"
646 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Bottom "150"
648 ${If} "$TmpVal" == "true"
649 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Type "label"
650 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)"
651 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Left "0"
652 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Right "-1"
653 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Top "35"
654 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Bottom "45"
656 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "6"
658 ; To insert this control reset Top / Bottom for controls below this one
659 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "55"
660 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "65"
661 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "67"
666 * DEPRECATED - use GetParent instead.
691 !define GetParentDir "!insertmacro GetParentDir"
694 * DEPRECATED - use GetPathFromString and RemoveQuotesFromPath
696 * Removes quotes and trailing path separator from registry string paths.
698 * Contains the registry string
699 * @return Modified string at the top of the stack.
701 !macro GetPathFromRegStr
706 StrCpy $R9 "$R0" "" -1
714 StrCpy $R0 "$R0" "" 1
716 StrCpy $R9 "$R0" "" -1
721 GetFullPathName $R8 $R0
730 !define GetPathFromRegStr "!insertmacro GetPathFromRegStr"
733 ################################################################################
734 # Macros for handling files in use
737 * Checks for files in use in the $INSTDIR directory. To check files in
738 * sub-directories this macro would need to be rewritten to create
739 * sub-directories in the temporary directory used to backup the files that are
744 * ; The first string to be pushed onto the stack MUST be "end" to indicate
745 * ; that there are no more files in the $INSTDIR directory to check.
748 * ; The last file pushed should be the app's main exe so if it is in use this
749 * ; macro will return after the first check.
750 * Push "${FileMainEXE}"
751 * ${CheckForFilesInUse} $R9
753 * !IMPORTANT - this macro uses the $R7, $R8, and $R9 registers and makes no
754 * attempt to restore their original values.
757 * false if all of the files popped from the stack are not in use.
758 * True if any of the files popped from the stack are in use.
759 * $R7 = Temporary backup directory where the files will be copied to.
760 * $R8 = value popped from the stack. This will either be a file name for a file
761 * in the $INSTDIR directory or "end" to indicate that there are no
762 * additional files to check.
765 !macro CheckForFilesInUse
767 !ifndef ${_MOZFUNC_UN}CheckForFilesInUse
769 !verbose ${_MOZFUNC_VERBOSE}
770 !define ${_MOZFUNC_UN}CheckForFilesInUse "!insertmacro ${_MOZFUNC_UN}CheckForFilesInUseCall"
772 Function ${_MOZFUNC_UN}CheckForFilesInUse
773 ; Create a temporary backup directory.
774 GetTempFileName $R7 "$INSTDIR"
781 StrCmp "$R8" "end" end +1
782 IfFileExists "$INSTDIR\$R8" +1 start
785 CopyFiles /SILENT "$INSTDIR\$R8" "$R7\$R8"
787 Delete "$INSTDIR\$R8"
794 SetOutPath "$INSTDIR"
795 CopyFiles /SILENT "$R7\*" "$INSTDIR\"
807 !macro CheckForFilesInUseCall _RESULT
809 !verbose ${_MOZFUNC_VERBOSE}
810 Call CheckForFilesInUse
815 !macro un.CheckForFilesInUseCall _RESULT
817 !verbose ${_MOZFUNC_VERBOSE}
818 Call un.CheckForFilesInUse
823 !macro un.CheckForFilesInUse
824 !ifndef un.CheckForFilesInUse
826 !verbose ${_MOZFUNC_VERBOSE}
828 !define _MOZFUNC_UN "un."
830 !insertmacro CheckForFilesInUse
839 * The macros below will automatically prepend un. to the function names when
840 * they are defined (e.g. !define un.RegCleanMain).
844 !ifndef _MOZFUNC_VERBOSE
845 !define _MOZFUNC_VERBOSE 3
847 !verbose ${_MOZFUNC_VERBOSE}
848 !define MOZFUNC_VERBOSE "!insertmacro MOZFUNC_VERBOSE"
853 !macro MOZFUNC_VERBOSE _VERBOSE
856 !undef _MOZFUNC_VERBOSE
857 !define _MOZFUNC_VERBOSE ${_VERBOSE}
862 * Displays a MessageBox and then calls abort to prevent continuing to the
863 * next page when the specified Window Class is found.
865 * @param _WINDOW_CLASS
866 * The Window Class to search for with FindWindow.
868 * The message text to display in the message box.
870 * $R7 = return value from FindWindow
871 * $R8 = _WINDOW_CLASS
874 !macro ManualCloseAppPrompt
876 !ifndef ${_MOZFUNC_UN}ManualCloseAppPrompt
878 !verbose ${_MOZFUNC_VERBOSE}
879 !define ${_MOZFUNC_UN}ManualCloseAppPrompt "!insertmacro ${_MOZFUNC_UN}ManualCloseAppPromptCall"
881 Function ${_MOZFUNC_UN}ManualCloseAppPrompt
888 IntCmp $R7 0 +3 +1 +1
889 MessageBox MB_OK|MB_ICONQUESTION "$R9"
902 !macro ManualCloseAppPromptCall _WINDOW_CLASS _MSG
904 !verbose ${_MOZFUNC_VERBOSE}
905 Push "${_WINDOW_CLASS}"
907 Call ManualCloseAppPrompt
911 !macro un.ManualCloseAppPromptCall _WINDOW_CLASS _MSG
913 !verbose ${_MOZFUNC_VERBOSE}
914 Push "${_WINDOW_CLASS}"
916 Call un.ManualCloseAppPrompt
920 !macro un.ManualCloseAppPrompt
921 !ifndef un.ManualCloseAppPrompt
923 !verbose ${_MOZFUNC_VERBOSE}
925 !define _MOZFUNC_UN "un."
927 !insertmacro ManualCloseAppPrompt
936 * Posts WM_QUIT to the application's message window which is found using the
937 * message window's class. This macro uses the nsProcess plugin available
938 * from http://nsis.sourceforge.net/NsProcess_plugin
941 * The message text to display in the message box.
943 * If false don't prompt the user and automatically exit the
944 * application if it is running.
946 * $R6 = return value for nsProcess::_FindProcess and nsProcess::_KillProcess
947 * $R7 = return value from FindWindow
953 !ifndef ${_MOZFUNC_UN}CloseApp
955 !verbose ${_MOZFUNC_VERBOSE}
956 !define ${_MOZFUNC_UN}CloseApp "!insertmacro ${_MOZFUNC_UN}CloseAppCall"
958 Function ${_MOZFUNC_UN}CloseApp
967 nsProcess::_FindProcess /NOUNLOAD "${FileMainEXE}"
971 StrCmp $R8 "false" +2 +1
972 MessageBox MB_OKCANCEL|MB_ICONQUESTION "$R9" IDCANCEL exit 0
974 FindWindow $R7 "${WindowClass}"
975 IntCmp $R7 0 +4 +1 +1
976 System::Call 'user32::PostMessage(i r17, i ${WM_QUIT}, i 0, i 0)'
977 # The amount of time to wait for the app to shutdown before prompting again
981 nsProcess::_FindProcess /NOUNLOAD "${FileMainEXE}"
985 nsProcess::_KillProcess /NOUNLOAD "${FileMainEXE}"
1009 !macro CloseAppCall _MSG _PROMPT
1011 !verbose ${_MOZFUNC_VERBOSE}
1021 !verbose ${_MOZFUNC_VERBOSE}
1023 !define _MOZFUNC_UN "un."
1025 !insertmacro CloseApp
1033 !macro un.CloseAppCall _MSG _PROMPT
1035 !verbose ${_MOZFUNC_VERBOSE}
1043 ################################################################################
1044 # Macros for working with the registry
1047 * Writes a registry string using SHCTX and the supplied params and logs the
1048 * action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
1050 * Define NO_LOG to prevent all logging when calling this from the uninstaller.
1053 * The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
1054 * This will only be used for logging.
1056 * The subkey in relation to the key root.
1058 * The key value name to write to.
1060 * The string to write to the key value name.
1061 * @param _LOG_UNINSTALL
1062 * 0 = don't add to uninstall log, 1 = add to uninstall log.
1068 * $R9 = _LOG_UNINSTALL
1072 !ifndef ${_MOZFUNC_UN}WriteRegStr2
1074 !verbose ${_MOZFUNC_VERBOSE}
1075 !define ${_MOZFUNC_UN}WriteRegStr2 "!insertmacro ${_MOZFUNC_UN}WriteRegStr2Call"
1077 Function ${_MOZFUNC_UN}WriteRegStr2
1089 WriteRegStr SHCTX "$R6" "$R7" "$R8"
1093 FileWrite $fhInstallLog " ** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **$\r$\n"
1095 StrCmp "$R9" "1" +1 +2
1096 FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
1097 FileWrite $fhInstallLog " Added Registry String: $R5 | $R6 | $R7 | $R8$\r$\n"
1115 !macro WriteRegStr2Call _ROOT _KEY _NAME _STR _LOG_UNINSTALL
1117 !verbose ${_MOZFUNC_VERBOSE}
1122 Push "${_LOG_UNINSTALL}"
1127 !macro un.WriteRegStr2Call _ROOT _KEY _NAME _STR _LOG_UNINSTALL
1129 !verbose ${_MOZFUNC_VERBOSE}
1134 Push "${_LOG_UNINSTALL}"
1135 Call un.WriteRegStr2
1139 !macro un.WriteRegStr2
1140 !ifndef un.WriteRegStr2
1142 !verbose ${_MOZFUNC_VERBOSE}
1144 !define _MOZFUNC_UN "un."
1146 !insertmacro WriteRegStr2
1155 * Writes a registry dword using SHCTX and the supplied params and logs the
1156 * action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
1158 * Define NO_LOG to prevent all logging when calling this from the uninstaller.
1161 * The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
1162 * This will only be used for logging.
1164 * The subkey in relation to the key root.
1166 * The key value name to write to.
1168 * The dword to write to the key value name.
1169 * @param _LOG_UNINSTALL
1170 * 0 = don't add to uninstall log, 1 = add to uninstall log.
1176 * $R9 = _LOG_UNINSTALL
1178 !macro WriteRegDWORD2
1180 !ifndef ${_MOZFUNC_UN}WriteRegDWORD2
1182 !verbose ${_MOZFUNC_VERBOSE}
1183 !define ${_MOZFUNC_UN}WriteRegDWORD2 "!insertmacro ${_MOZFUNC_UN}WriteRegDWORD2Call"
1185 Function ${_MOZFUNC_UN}WriteRegDWORD2
1197 WriteRegDWORD SHCTX "$R6" "$R7" "$R8"
1201 FileWrite $fhInstallLog " ** ERROR Adding Registry DWord: $R5 | $R6 | $R7 | $R8 **$\r$\n"
1203 StrCmp "$R9" "1" +1 +2
1204 FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
1205 FileWrite $fhInstallLog " Added Registry DWord: $R5 | $R6 | $R7 | $R8$\r$\n"
1223 !macro WriteRegDWORD2Call _ROOT _KEY _NAME _DWORD _LOG_UNINSTALL
1225 !verbose ${_MOZFUNC_VERBOSE}
1230 Push "${_LOG_UNINSTALL}"
1235 !macro un.WriteRegDWORD2Call _ROOT _KEY _NAME _DWORD _LOG_UNINSTALL
1237 !verbose ${_MOZFUNC_VERBOSE}
1242 Push "${_LOG_UNINSTALL}"
1243 Call un.WriteRegDWORD2
1247 !macro un.WriteRegDWORD2
1248 !ifndef un.WriteRegDWORD2
1250 !verbose ${_MOZFUNC_VERBOSE}
1252 !define _MOZFUNC_UN "un."
1254 !insertmacro WriteRegDWORD2
1263 * Writes a registry string to HKCR using the supplied params and logs the
1264 * action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
1266 * Define NO_LOG to prevent all logging when calling this from the uninstaller.
1269 * The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
1270 * This will only be used for logging.
1272 * The subkey in relation to the key root.
1274 * The key value name to write to.
1276 * The string to write to the key value name.
1277 * @param _LOG_UNINSTALL
1278 * 0 = don't add to uninstall log, 1 = add to uninstall log.
1284 * $R9 = _LOG_UNINSTALL
1286 !macro WriteRegStrHKCR
1288 !ifndef ${_MOZFUNC_UN}WriteRegStrHKCR
1290 !verbose ${_MOZFUNC_VERBOSE}
1291 !define ${_MOZFUNC_UN}WriteRegStrHKCR "!insertmacro ${_MOZFUNC_UN}WriteRegStrHKCRCall"
1293 Function ${_MOZFUNC_UN}WriteRegStrHKCR
1305 WriteRegStr HKCR "$R6" "$R7" "$R8"
1309 FileWrite $fhInstallLog " ** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **$\r$\n"
1311 StrCmp "$R9" "1" +1 +2
1312 FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
1313 FileWrite $fhInstallLog " Added Registry String: $R5 | $R6 | $R7 | $R8$\r$\n"
1331 !macro WriteRegStrHKCRCall _ROOT _KEY _NAME _STR _LOG_UNINSTALL
1333 !verbose ${_MOZFUNC_VERBOSE}
1338 Push "${_LOG_UNINSTALL}"
1339 Call WriteRegStrHKCR
1343 !macro un.WriteRegStrHKCRCall _ROOT _KEY _NAME _STR _LOG_UNINSTALL
1345 !verbose ${_MOZFUNC_VERBOSE}
1350 Push "${_LOG_UNINSTALL}"
1351 Call un.WriteRegStrHKCR
1355 !macro un.WriteRegStrHKCR
1356 !ifndef un.WriteRegStrHKCR
1358 !verbose ${_MOZFUNC_VERBOSE}
1360 !define _MOZFUNC_UN "un."
1362 !insertmacro WriteRegStrHKCR
1371 * Creates a registry key. NSIS doesn't supply a RegCreateKey method and instead
1372 * will auto create keys when a reg key name value pair is set.
1373 * i - int (includes char, byte, short, handles, pointers and so on)
1374 * t - text, string (LPCSTR, pointer to first character)
1375 * * - pointer specifier -> the proc needs the pointer to type, affects next
1376 * char (parameter) [ex: '*i' - pointer to int]
1377 * see the NSIS documentation for additional information.
1379 !define RegCreateKey "Advapi32::RegCreateKeyA(i, t, *i) i"
1382 * Creates a registry key. This will log the actions to the install and
1383 * uninstall logs. Alternatively you can set a registry value to create the key
1384 * and then delete the value.
1386 * Define NO_LOG to prevent all logging when calling this from the uninstaller.
1389 * The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
1391 * The subkey in relation to the key root.
1392 * @param _LOG_UNINSTALL
1393 * 0 = don't add to uninstall log, 1 = add to uninstall log.
1395 * $R4 = [out] handle to newly created registry key. If this is not a key
1396 * located in one of the predefined registry keys this must be closed
1397 * with RegCloseKey (this should not be needed unless someone decides to
1398 * do something extremely squirrelly with NSIS).
1399 * $R5 = return value from RegCreateKeyA (represented by r15 in the system call).
1400 * $R6 = [in] hKey passed to RegCreateKeyA.
1403 * $R9 = _LOG_UNINSTALL
1407 !ifndef ${_MOZFUNC_UN}CreateRegKey
1409 !verbose ${_MOZFUNC_VERBOSE}
1410 !define ${_MOZFUNC_UN}CreateRegKey "!insertmacro ${_MOZFUNC_UN}CreateRegKeyCall"
1412 Function ${_MOZFUNC_UN}CreateRegKey
1422 StrCmp $R7 "HKCR" +1 +2
1423 StrCpy $R6 "0x80000000"
1424 StrCmp $R7 "HKCU" +1 +2
1425 StrCpy $R6 "0x80000001"
1426 StrCmp $R7 "HKLM" +1 +2
1427 StrCpy $R6 "0x80000002"
1429 ; see definition of RegCreateKey
1430 System::Call "${RegCreateKey}($R6, '$R8', .r14) .r15"
1433 ; if $R5 is not 0 then there was an error creating the registry key.
1435 FileWrite $fhInstallLog " ** ERROR Adding Registry Key: $R7 | $R8 **$\r$\n"
1437 StrCmp "$R9" "1" +1 +2
1438 FileWrite $fhUninstallLog "RegKey: $R7 | $R8$\r$\n"
1439 FileWrite $fhInstallLog " Added Registry Key: $R7 | $R8$\r$\n"
1456 !macro CreateRegKeyCall _ROOT _KEY _LOG_UNINSTALL
1458 !verbose ${_MOZFUNC_VERBOSE}
1461 Push "${_LOG_UNINSTALL}"
1466 !macro un.CreateRegKeyCall _ROOT _KEY _LOG_UNINSTALL
1468 !verbose ${_MOZFUNC_VERBOSE}
1471 Push "${_LOG_UNINSTALL}"
1472 Call un.CreateRegKey
1476 !macro un.CreateRegKey
1477 !ifndef un.CreateRegKey
1479 !verbose ${_MOZFUNC_VERBOSE}
1481 !define _MOZFUNC_UN "un."
1483 !insertmacro CreateRegKey
1492 ################################################################################
1493 # Macros for adding file and protocol handlers
1496 * Writes common registry values for a handler using SHCTX.
1499 * The subkey in relation to the key root.
1501 * The path and args to launch the application.
1503 * The path to an exe that contains an icon and the icon resource id.
1505 * The display name for the handler. If emtpy no value will be set.
1506 * @param _ISPROTOCOL
1507 * Sets protocol handler specific registry values when "true".
1509 * Sets DDE specific registry values when "true".
1511 * $R3 = string value of the current registry key path.
1519 !macro AddHandlerValues
1521 !ifndef ${_MOZFUNC_UN}AddHandlerValues
1523 !verbose ${_MOZFUNC_VERBOSE}
1524 !define ${_MOZFUNC_UN}AddHandlerValues "!insertmacro ${_MOZFUNC_UN}AddHandlerValuesCall"
1526 Function ${_MOZFUNC_UN}AddHandlerValues
1540 StrCmp "$R7" "" +6 +1
1541 ReadRegStr $R3 SHCTX "$R4" "FriendlyTypeName"
1543 StrCmp "$R3" "" +1 +3
1544 WriteRegStr SHCTX "$R4" "" "$R7"
1545 WriteRegStr SHCTX "$R4" "FriendlyTypeName" "$R7"
1547 StrCmp "$R8" "true" +1 +8
1548 WriteRegStr SHCTX "$R4" "URL Protocol" ""
1551 ReadRegDWord $R3 SHCTX "$R4" "EditFlags"
1552 StrCmp $R3 "" +1 +3 ; Only add EditFlags if a value doesn't exist
1553 DeleteRegValue SHCTX "$R4" "EditFlags"
1554 WriteRegDWord SHCTX "$R4" "EditFlags" 0x00000002
1556 StrCmp "$R6" "" +2 +1
1557 WriteRegStr SHCTX "$R4\DefaultIcon" "" "$R6"
1559 StrCmp "$R5" "" +2 +1
1560 WriteRegStr SHCTX "$R4\shell\open\command" "" "$R5"
1562 !ifdef DDEApplication
1563 StrCmp "$R9" "true" +1 +11
1564 WriteRegStr SHCTX "$R4\shell\open\ddeexec" "" "$\"%1$\",,0,0,,,,"
1565 WriteRegStr SHCTX "$R4\shell\open\ddeexec" "NoActivateHandler" ""
1566 WriteRegStr SHCTX "$R4\shell\open\ddeexec\Application" "" "${DDEApplication}"
1567 WriteRegStr SHCTX "$R4\shell\open\ddeexec\Topic" "" "WWW_OpenURL"
1568 ; The ifexec key may have been added by another application so try to
1569 ; delete it to prevent it from breaking this app's shell integration.
1570 ; Also, IE 6 and below doesn't remove this key when it sets itself as the
1571 ; default handler and if this key exists IE's shell integration breaks.
1572 DeleteRegKey HKLM "$R4\shell\open\ddeexec\ifexec"
1573 DeleteRegKey HKCU "$R4\shell\open\ddeexec\ifexec"
1596 !macro AddHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _ISDDE
1598 !verbose ${_MOZFUNC_VERBOSE}
1603 Push "${_ISPROTOCOL}"
1605 Call AddHandlerValues
1609 !macro un.AddHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _ISDDE
1611 !verbose ${_MOZFUNC_VERBOSE}
1616 Push "${_ISPROTOCOL}"
1618 Call un.AddHandlerValues
1622 !macro un.AddHandlerValues
1623 !ifndef un.AddHandlerValues
1625 !verbose ${_MOZFUNC_VERBOSE}
1627 !define _MOZFUNC_UN "un."
1629 !insertmacro AddHandlerValues
1638 * Writes common registry values for a handler that uses DDE using SHCTX.
1641 * The key name in relation to the HKCR root. SOFTWARE\Classes is
1642 * prefixed to this value when using SHCTX.
1644 * The path and args to launch the application.
1646 * The path to an exe that contains an icon and the icon resource id.
1648 * The display name for the handler. If emtpy no value will be set.
1649 * @param _ISPROTOCOL
1650 * Sets protocol handler specific registry values when "true".
1651 * @param _DDE_APPNAME
1652 * Sets DDE specific registry values when not an empty string.
1654 * $R0 = storage for SOFTWARE\Classes
1655 * $R1 = string value of the current registry key path.
1661 * $R7 = _DDE_APPNAME
1662 * $R8 = _DDE_DEFAULT
1665 !macro AddDDEHandlerValues
1667 !ifndef ${_MOZFUNC_UN}AddDDEHandlerValues
1669 !verbose ${_MOZFUNC_VERBOSE}
1670 !define ${_MOZFUNC_UN}AddDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDDEHandlerValuesCall"
1672 Function ${_MOZFUNC_UN}AddDDEHandlerValues
1691 StrCpy $R0 "SOFTWARE\Classes"
1692 StrCmp "$R5" "" +6 +1
1693 ReadRegStr $R1 SHCTX "$R2" "FriendlyTypeName"
1695 StrCmp "$R1" "" +1 +3
1696 WriteRegStr SHCTX "$R0\$R2" "" "$R5"
1697 WriteRegStr SHCTX "$R0\$R2" "FriendlyTypeName" "$R5"
1699 StrCmp "$R6" "true" +1 +8
1700 WriteRegStr SHCTX "$R0\$R2" "URL Protocol" ""
1703 ReadRegDWord $R1 SHCTX "$R0\$R2" "EditFlags"
1704 StrCmp $R1 "" +1 +3 ; Only add EditFlags if a value doesn't exist
1705 DeleteRegValue SHCTX "$R0\$R2" "EditFlags"
1706 WriteRegDWord SHCTX "$R0\$R2" "EditFlags" 0x00000002
1708 StrCmp "$R4" "" +2 +1
1709 WriteRegStr SHCTX "$R0\$R2\DefaultIcon" "" "$R4"
1711 WriteRegStr SHCTX "$R0\$R2\shell\open\command" "" "$R3"
1713 WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "" "$R8"
1714 WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "NoActivateHandler" ""
1715 WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Application" "" "$R7"
1716 WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Topic" "" "$R9"
1718 ; The ifexec key may have been added by another application so try to
1719 ; delete it to prevent it from breaking this app's shell integration.
1720 ; Also, IE 6 and below doesn't remove this key when it sets itself as the
1721 ; default handler and if this key exists IE's shell integration breaks.
1722 DeleteRegKey HKLM "$R0\$R2\shell\open\ddeexec\ifexec"
1723 DeleteRegKey HKCU "$R0\$R2\shell\open\ddeexec\ifexec"
1749 !macro AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
1751 !verbose ${_MOZFUNC_VERBOSE}
1756 Push "${_ISPROTOCOL}"
1757 Push "${_DDE_APPNAME}"
1758 Push "${_DDE_DEFAULT}"
1759 Push "${_DDE_TOPIC}"
1760 Call AddDDEHandlerValues
1764 !macro un.AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
1766 !verbose ${_MOZFUNC_VERBOSE}
1771 Push "${_ISPROTOCOL}"
1772 Push "${_DDE_APPNAME}"
1773 Push "${_DDE_DEFAULT}"
1774 Push "${_DDE_TOPIC}"
1775 Call un.AddDDEHandlerValues
1779 !macro un.AddDDEHandlerValues
1780 !ifndef un.AddDDEHandlerValues
1782 !verbose ${_MOZFUNC_VERBOSE}
1784 !define _MOZFUNC_UN "un."
1786 !insertmacro AddDDEHandlerValues
1794 ################################################################################
1795 # Macros for retrieving existing install paths
1798 * Finds a second installation of the application so we can make informed
1799 * decisions about registry operations. This uses SHCTX to determine the
1800 * registry hive so you must call SetShellVarContext first.
1803 * The registry subkey (typically this will be Software\Mozilla).
1805 * false if a second install isn't found, path to the main exe if a
1806 * second install is found.
1808 * $R3 = stores the long path to $INSTDIR
1809 * $R4 = counter for the outer loop's EnumRegKey
1810 * $R5 = return value from ReadRegStr and RemoveQuotesFromPath
1811 * $R6 = return value from GetParent
1812 * $R7 = return value from the loop's EnumRegKey
1813 * $R8 = storage for _KEY
1814 * $R9 = _KEY and _RESULT
1816 !macro GetSecondInstallPath
1818 !ifndef ${_MOZFUNC_UN}GetSecondInstallPath
1819 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
1820 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
1821 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
1822 !insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
1824 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
1825 !undef _MOZFUNC_UN_TMP
1828 !verbose ${_MOZFUNC_VERBOSE}
1829 !define ${_MOZFUNC_UN}GetSecondInstallPath "!insertmacro ${_MOZFUNC_UN}GetSecondInstallPathCall"
1831 Function ${_MOZFUNC_UN}GetSecondInstallPath
1840 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R3
1842 StrCpy $R4 0 ; set the counter for the loop to 0
1843 StrCpy $R8 "$R9" ; Registry key path to search
1844 StrCpy $R9 "false" ; default return value
1847 EnumRegKey $R7 SHCTX $R8 $R4
1848 StrCmp $R7 "" end +1 ; if empty there are no more keys to enumerate
1849 IntOp $R4 $R4 + 1 ; increment the loop's counter
1851 ReadRegStr $R5 SHCTX "$R8\$R7\bin" "PathToExe"
1854 ${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R5
1856 IfFileExists "$R5" +1 loop
1857 ${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
1858 ${${_MOZFUNC_UN}GetParent} "$R5" $R6
1859 StrCmp "$R6" "$R3" loop +1
1860 StrCmp "$R6\${FileMainEXE}" "$R5" +1 loop
1879 !macro GetSecondInstallPathCall _KEY _RESULT
1881 !verbose ${_MOZFUNC_VERBOSE}
1883 Call GetSecondInstallPath
1888 !macro un.GetSecondInstallPathCall _KEY _RESULT
1890 !verbose ${_MOZFUNC_VERBOSE}
1892 Call un.GetSecondInstallPath
1897 !macro un.GetSecondInstallPath
1898 !ifndef un.GetSecondInstallPath
1900 !verbose ${_MOZFUNC_VERBOSE}
1902 !define _MOZFUNC_UN "un."
1904 !insertmacro GetSecondInstallPath
1913 * Finds an existing installation path for the application based on the
1914 * application's executable name so we can default to using this path for the
1915 * install. If there is zero or more than one installation of the application
1916 * then we default to the default installation path. This uses SHCTX to
1917 * determine the registry hive to read from so you must call SetShellVarContext
1921 * The registry subkey (typically this will be Software\Mozilla\App Name).
1923 * false if a single install location for this app name isn't found,
1924 * path to the install directory if a single install location is found.
1926 * $R5 = counter for the loop's EnumRegKey
1927 * $R6 = return value from EnumRegKey
1928 * $R7 = return value from ReadRegStr
1929 * $R8 = storage for _KEY
1930 * $R9 = _KEY and _RESULT
1932 !macro GetSingleInstallPath
1934 !ifndef ${_MOZFUNC_UN}GetSingleInstallPath
1935 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
1936 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
1937 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
1938 !insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
1940 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
1941 !undef _MOZFUNC_UN_TMP
1944 !verbose ${_MOZFUNC_VERBOSE}
1945 !define ${_MOZFUNC_UN}GetSingleInstallPath "!insertmacro ${_MOZFUNC_UN}GetSingleInstallPathCall"
1947 Function ${_MOZFUNC_UN}GetSingleInstallPath
1956 StrCpy $R5 0 ; set the counter for the loop to 0
1960 EnumRegKey $R6 SHCTX $R8 $R5
1962 StrCmp $R6 "" cleanup +1 ; if empty there are no more keys to enumerate
1963 IntOp $R5 $R5 + 1 ; increment the loop's counter
1965 ReadRegStr $R7 SHCTX "$R8\$R6\Main" "PathToExe"
1967 ${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R7" $R7
1968 GetFullPathName $R7 "$R7"
1971 StrCmp "$R9" "false" +1 +3
1978 StrCmp $R9 "false" end +1
1979 ${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
1980 ${${_MOZFUNC_UN}GetParent} "$R9" $R9
1996 !macro GetSingleInstallPathCall _KEY _RESULT
1998 !verbose ${_MOZFUNC_VERBOSE}
2000 Call GetSingleInstallPath
2005 !macro un.GetSingleInstallPathCall _KEY _RESULT
2007 !verbose ${_MOZFUNC_VERBOSE}
2009 Call un.GetSingleInstallPath
2014 !macro un.GetSingleInstallPath
2015 !ifndef un.GetSingleInstallPath
2017 !verbose ${_MOZFUNC_VERBOSE}
2019 !define _MOZFUNC_UN "un."
2021 !insertmacro GetSingleInstallPath
2030 ################################################################################
2031 # Macros for working with the file system
2034 * Attempts to delete a file if it exists. This will fail if the file is in use.
2037 * The path to the file that is to be deleted.
2039 !macro DeleteFile _FILE
2040 ${If} ${FileExists} "${_FILE}"
2044 !define DeleteFile "!insertmacro DeleteFile"
2047 * Removes a directory if it exists and is empty.
2050 * The path to the directory that is to be removed.
2052 !macro RemoveDir _DIR
2053 ${If} ${FileExists} "${_DIR}"
2057 !define RemoveDir "!insertmacro RemoveDir"
2060 * Checks whether we can write to the install directory. If the install
2061 * directory already exists this will attempt to create a temporary file in the
2062 * install directory and then delete it. If it does not exist this will attempt
2063 * to create the directory and then delete it. If we can write to the install
2064 * directory this will return true... if not, this will return false.
2067 * true if the install directory can be written to otherwise false.
2069 * $R7 = temp filename in installation directory returned from GetTempFileName
2070 * $R8 = filehandle to temp file used for writing
2073 !macro CanWriteToInstallDir
2075 !ifndef ${_MOZFUNC_UN}CanWriteToInstallDir
2077 !verbose ${_MOZFUNC_VERBOSE}
2078 !define ${_MOZFUNC_UN}CanWriteToInstallDir "!insertmacro ${_MOZFUNC_UN}CanWriteToInstallDirCall"
2080 Function ${_MOZFUNC_UN}CanWriteToInstallDir
2086 IfFileExists "$INSTDIR" +1 checkCreateDir
2087 GetTempFileName $R7 "$INSTDIR"
2089 FileWrite $R8 "Write Access Test"
2091 IfFileExists "$R7" +3 +1
2099 CreateDirectory "$INSTDIR"
2100 IfFileExists "$INSTDIR" +3 +1
2118 !macro CanWriteToInstallDirCall _RESULT
2120 !verbose ${_MOZFUNC_VERBOSE}
2121 Call CanWriteToInstallDir
2126 !macro un.CanWriteToInstallDirCall _RESULT
2128 !verbose ${_MOZFUNC_VERBOSE}
2129 Call un.CanWriteToInstallDir
2134 !macro un.CanWriteToInstallDir
2135 !ifndef un.CanWriteToInstallDir
2137 !verbose ${_MOZFUNC_VERBOSE}
2139 !define _MOZFUNC_UN "un."
2141 !insertmacro CanWriteToInstallDir
2150 * Checks whether there is sufficient free space available on the installation
2151 * directory's drive. If there is sufficient free space this will return true...
2152 * if not, this will return false. This will only calculate the size of the
2153 * first three sections.
2156 * true if there is sufficient free space otherwise false.
2158 * $R2 = return value from greater than comparison (0=false 1=true)
2159 * $R3 = free space for the install directory's drive
2160 * $R4 = install directory root
2161 * $R5 = return value from SectionGetSize
2162 * $R6 = return value from 'and' comparison of SectionGetFlags (1=selected)
2163 * $R7 = return value from SectionGetFlags
2164 * $R8 = size in KB required for this installation
2167 !macro CheckDiskSpace
2169 !ifndef ${_MOZFUNC_UN}CheckDiskSpace
2170 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2171 !insertmacro ${_MOZFUNC_UN_TMP}GetRoot
2172 !insertmacro ${_MOZFUNC_UN_TMP}DriveSpace
2174 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2175 !undef _MOZFUNC_UN_TMP
2178 !verbose ${_MOZFUNC_VERBOSE}
2179 !define ${_MOZFUNC_UN}CheckDiskSpace "!insertmacro ${_MOZFUNC_UN}CheckDiskSpaceCall"
2181 Function ${_MOZFUNC_UN}CheckDiskSpace
2192 SectionGetSize 0 $R8
2194 SectionGetFlags 1 $R7
2195 IntOp $R6 ${SF_SELECTED} & $R7
2196 IntCmp $R6 0 +3 +1 +1
2197 SectionGetSize 1 $R5
2200 SectionGetFlags 2 $R7
2201 IntOp $R6 ${SF_SELECTED} & $R7
2202 IntCmp $R6 0 +3 +1 +1
2203 SectionGetSize 2 $R5
2206 ${${_MOZFUNC_UN}GetRoot} "$INSTDIR" $R4
2207 ${${_MOZFUNC_UN}DriveSpace} "$R4" "/D=F /S=K" $R3
2209 System::Int64Op $R3 > $R8
2212 IntCmp $R2 1 end +1 +1
2232 !macro CheckDiskSpaceCall _RESULT
2234 !verbose ${_MOZFUNC_VERBOSE}
2240 !macro un.CheckDiskSpaceCall _RESULT
2242 !verbose ${_MOZFUNC_VERBOSE}
2243 Call un.CheckDiskSpace
2248 !macro un.CheckDiskSpace
2249 !ifndef un.CheckDiskSpace
2251 !verbose ${_MOZFUNC_VERBOSE}
2253 !define _MOZFUNC_UN "un."
2255 !insertmacro CheckDiskSpace
2264 * Returns the path found within a passed in string. The path is quoted or not
2265 * with the exception of an unquoted non 8dot3 path without arguments that is
2266 * also not a DefaultIcon path, is a 8dot3 path or not, has command line
2267 * arguments, or is a registry DefaultIcon path (e.g. <path to binary>,# where #
2268 * is the icon's resuorce id). The string does not need to be a valid path or
2269 * exist. It is up to the caller to pass in a string of one of the forms noted
2270 * above and to verify existence if necessary.
2273 * In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -flag "%1"
2274 * In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE,0
2275 * In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE
2276 * In: "C:\PROGRA~1\MOZILL~1\FIREFOX.EXE"
2277 * In: "C:\PROGRA~1\MOZILL~1\FIREFOX.EXE" -flag "%1"
2278 * Out: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE
2280 * In: "C:\Program Files\Mozilla Firefox\firefox.exe" -flag "%1"
2281 * In: C:\Program Files\Mozilla Firefox\firefox.exe,0
2282 * In: "C:\Program Files\Mozilla Firefox\firefox.exe"
2283 * Out: C:\Program Files\Mozilla Firefox\firefox.exe
2286 * The string containing the path.
2288 * The register to store the path to.
2290 * $R7 = counter for the outer loop's EnumRegKey
2291 * $R8 = return value from ReadRegStr
2292 * $R9 = _IN_PATH and _OUT_PATH
2294 !macro GetPathFromString
2296 !ifndef ${_MOZFUNC_UN}GetPathFromString
2298 !verbose ${_MOZFUNC_VERBOSE}
2299 !define ${_MOZFUNC_UN}GetPathFromString "!insertmacro ${_MOZFUNC_UN}GetPathFromStringCall"
2301 Function ${_MOZFUNC_UN}GetPathFromString
2306 StrCpy $R7 0 ; Set the counter to 0.
2308 ; Handle quoted paths with arguments.
2309 StrCpy $R8 $R9 1 ; Copy the first char.
2310 StrCmp $R8 '"' +2 +1 ; Is it a "?
2311 StrCmp $R8 "'" +1 +9 ; Is it a '?
2312 StrCpy $R9 $R9 "" 1 ; Remove the first char.
2313 IntOp $R7 $R7 + 1 ; Increment the counter.
2314 StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
2315 StrCmp $R8 "" end +1 ; Are there no more chars?
2316 StrCmp $R8 '"' +2 +1 ; Is it a " char?
2317 StrCmp $R8 "'" +1 -4 ; Is it a ' char?
2318 StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
2321 ; Handle DefaultIcon paths. DefaultIcon paths are not quoted and end with
2323 IntOp $R7 $R7 - 1 ; Decrement the counter.
2324 StrCpy $R8 $R9 1 $R7 ; Copy one char from the end minus the counter.
2325 StrCmp $R8 '' +4 +1 ; Are there no more chars?
2326 StrCmp $R8 ',' +1 -3 ; Is it a , char?
2327 StrCpy $R9 $R9 $R7 ; Copy chars up to the end minus the counter.
2330 ; Handle unquoted paths with arguments. An unquoted path with arguments
2331 ; must be an 8dot3 path.
2332 StrCpy $R7 -1 ; Set the counter to -1 so it will start at 0.
2333 IntOp $R7 $R7 + 1 ; Increment the counter.
2334 StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
2335 StrCmp $R8 "" end +1 ; Are there no more chars?
2336 StrCmp $R8 " " +1 -3 ; Is it a space char?
2337 StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
2351 !macro GetPathFromStringCall _IN_PATH _OUT_PATH
2353 !verbose ${_MOZFUNC_VERBOSE}
2355 Call GetPathFromString
2360 !macro un.GetPathFromStringCall _IN_PATH _OUT_PATH
2362 !verbose ${_MOZFUNC_VERBOSE}
2364 Call un.GetPathFromString
2369 !macro un.GetPathFromString
2370 !ifndef un.GetPathFromString
2372 !verbose ${_MOZFUNC_VERBOSE}
2374 !define _MOZFUNC_UN "un."
2376 !insertmacro GetPathFromString
2385 * Removes the quotes from each end of a string if present.
2388 * The string containing the path.
2390 * The register to store the long path.
2392 * $R7 = storage for single character comparison
2393 * $R8 = storage for _IN_PATH
2394 * $R9 = _IN_PATH and _OUT_PATH
2396 !macro RemoveQuotesFromPath
2398 !ifndef ${_MOZFUNC_UN}RemoveQuotesFromPath
2400 !verbose ${_MOZFUNC_VERBOSE}
2401 !define ${_MOZFUNC_UN}RemoveQuotesFromPath "!insertmacro ${_MOZFUNC_UN}RemoveQuotesFromPathCall"
2403 Function ${_MOZFUNC_UN}RemoveQuotesFromPath
2409 StrCmp $R7 "$\"" +1 +2
2410 StrCpy $R9 "$R9" "" 1
2412 StrCpy $R7 "$R9" "" -1
2413 StrCmp $R7 "$\"" +1 +2
2425 !macro RemoveQuotesFromPathCall _IN_PATH _OUT_PATH
2427 !verbose ${_MOZFUNC_VERBOSE}
2429 Call RemoveQuotesFromPath
2434 !macro un.RemoveQuotesFromPathCall _IN_PATH _OUT_PATH
2436 !verbose ${_MOZFUNC_VERBOSE}
2438 Call un.RemoveQuotesFromPath
2443 !macro un.RemoveQuotesFromPath
2444 !ifndef un.RemoveQuotesFromPath
2446 !verbose ${_MOZFUNC_VERBOSE}
2448 !define _MOZFUNC_UN "un."
2450 !insertmacro RemoveQuotesFromPath
2459 * Returns the long path for an existing file or directory. GetLongPathNameA
2460 * may not be available on Win95 if Microsoft Layer for Unicode is not
2461 * installed and GetFullPathName only returns a long path for the last file or
2462 * directory that doesn't end with a \ in the path that it is passed. If the
2463 * path does not exist on the file system this will return an empty string. To
2464 * provide a consistent result trailing back-slashes are always removed.
2466 * Note: 1024 used by GetLongPathNameA is the maximum NSIS string length.
2469 * The string containing the path.
2471 * The register to store the long path.
2473 * $R4 = counter value when the previous \ was found
2474 * $R5 = directory or file name found during loop
2475 * $R6 = return value from GetLongPathNameA and loop counter
2476 * $R7 = long path from GetLongPathNameA and single char from path for comparison
2477 * $R8 = storage for _IN_PATH
2478 * $R9 = _IN_PATH _OUT_PATH
2482 !ifndef ${_MOZFUNC_UN}GetLongPath
2484 !verbose ${_MOZFUNC_VERBOSE}
2485 !define ${_MOZFUNC_UN}GetLongPath "!insertmacro ${_MOZFUNC_UN}GetLongPathCall"
2487 Function ${_MOZFUNC_UN}GetLongPath
2499 GetFullPathName $R8 "$R8"
2500 IfErrors end_GetLongPath +1 ; If the path doesn't exist return an empty string.
2502 ; Remove trailing \'s from the path.
2503 StrCpy $R6 "$R8" "" -1
2504 StrCmp $R6 "\" +1 +2
2507 System::Call 'kernel32::GetLongPathNameA(t r18, t .r17, i 1024)i .r16'
2508 StrCmp "$R7" "" +4 +1 ; Empty string when GetLongPathNameA is not present.
2509 StrCmp $R6 0 +3 +1 ; Should never equal 0 since the path exists.
2511 GoTo end_GetLongPath
2513 ; Do it the hard way.
2514 StrCpy $R4 0 ; Stores the position in the string of the last \ found.
2515 StrCpy $R6 -1 ; Set the counter to -1 so it will start at 0.
2518 IntOp $R6 $R6 + 1 ; Increment the counter.
2519 StrCpy $R7 $R8 1 $R6 ; Starting from the counter copy the next char.
2520 StrCmp $R7 "" +2 +1 ; Are there no more chars?
2521 StrCmp $R7 "\" +1 -3 ; Is it a \?
2523 ; Copy chars starting from the previously found \ to the counter.
2524 StrCpy $R5 $R8 $R6 $R4
2526 ; If this is the first \ found we want to swap R9 with R5 so a \ will
2527 ; be appended to the drive letter and colon (e.g. C: will become C:\).
2532 GetFullPathName $R9 "$R9\$R5"
2534 StrCmp $R7 "" end_GetLongPath +1 ; Are there no more chars?
2536 ; Store the counter for the current \ and prefix it for StrCpy operations.
2538 IntOp $R6 $R6 + 1 ; Increment the counter so we skip over the \.
2539 StrCpy $R8 $R8 "" $R6 ; Copy chars starting from the counter to the end.
2540 StrCpy $R6 -1 ; Reset the counter to -1 so it will start over at 0.
2541 GoTo loop_GetLongPath
2558 !macro GetLongPathCall _IN_PATH _OUT_PATH
2560 !verbose ${_MOZFUNC_VERBOSE}
2567 !macro un.GetLongPathCall _IN_PATH _OUT_PATH
2569 !verbose ${_MOZFUNC_VERBOSE}
2576 !macro un.GetLongPath
2577 !ifndef un.GetLongPath
2579 !verbose ${_MOZFUNC_VERBOSE}
2581 !define _MOZFUNC_UN "un."
2583 !insertmacro GetLongPath
2592 ################################################################################
2593 # Macros for cleaning up the registry and file system
2596 * Removes registry keys that reference this install location and for paths that
2597 * no longer exist. This uses SHCTX to determine the registry hive so you must
2598 * call SetShellVarContext first.
2601 * The registry subkey (typically this will be Software\Mozilla).
2603 * XXXrstrong - there is the potential for Key: Software/Mozilla/AppName,
2604 * ValueName: CurrentVersion, ValueData: AppVersion to reference a key that is
2605 * no longer available due to this cleanup. This should be no worse than prior
2606 * to this reg cleanup since the referenced key would be for an app that is no
2607 * longer installed on the system.
2609 * $R1 = stores the long path to $INSTDIR
2610 * $R2 = return value from the stack from the GetParent and GetLongPath macros
2611 * $R3 = return value from the outer loop's EnumRegKey
2612 * $R4 = return value from the inner loop's EnumRegKey
2613 * $R5 = return value from ReadRegStr
2614 * $R6 = counter for the outer loop's EnumRegKey
2615 * $R7 = counter for the inner loop's EnumRegKey
2616 * $R8 = return value from the stack from the RemoveQuotesFromPath macro
2621 !ifndef ${_MOZFUNC_UN}RegCleanMain
2622 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2623 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
2624 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2625 !insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
2627 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2628 !undef _MOZFUNC_UN_TMP
2631 !verbose ${_MOZFUNC_VERBOSE}
2632 !define ${_MOZFUNC_UN}RegCleanMain "!insertmacro ${_MOZFUNC_UN}RegCleanMainCall"
2634 Function ${_MOZFUNC_UN}RegCleanMain
2645 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R1
2646 StrCpy $R6 0 ; set the counter for the outer loop to 0
2649 EnumRegKey $R3 SHCTX $R9 $R6
2650 StrCmp $R3 "" end +1 ; if empty there are no more keys to enumerate
2651 IntOp $R6 $R6 + 1 ; increment the outer loop's counter
2653 ReadRegStr $R5 SHCTX "$R9\$R3\bin" "PathToExe"
2654 IfErrors 0 outercontinue
2655 StrCpy $R7 0 ; set the counter for the inner loop to 0
2658 EnumRegKey $R4 SHCTX "$R9\$R3" $R7
2659 StrCmp $R4 "" outerloop +1 ; if empty there are no more keys to enumerate
2660 IntOp $R7 $R7 + 1 ; increment the inner loop's counter
2662 ReadRegStr $R5 SHCTX "$R9\$R3\$R4\Main" "PathToExe"
2665 ${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R8
2666 ${${_MOZFUNC_UN}GetParent} "$R8" $R2
2667 ${${_MOZFUNC_UN}GetLongPath} "$R2" $R2
2668 IfFileExists "$R2" +1 innerloop
2669 StrCmp "$R2" "$R1" +1 innerloop
2672 DeleteRegKey SHCTX "$R9\$R3\$R4"
2674 IntOp $R7 $R7 - 1 ; decrement the inner loop's counter when the key is deleted successfully.
2676 DeleteRegKey /ifempty SHCTX "$R9\$R3"
2677 IfErrors innerloop outerdecrement
2680 ${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R8
2681 ${${_MOZFUNC_UN}GetParent} "$R8" $R2
2682 ${${_MOZFUNC_UN}GetLongPath} "$R2" $R2
2683 IfFileExists "$R2" +1 outerloop
2684 StrCmp "$R2" "$R1" +1 outerloop
2687 DeleteRegKey SHCTX "$R9\$R3"
2691 IntOp $R6 $R6 - 1 ; decrement the outer loop's counter when the key is deleted successfully.
2712 !macro RegCleanMainCall _KEY
2714 !verbose ${_MOZFUNC_VERBOSE}
2720 !macro un.RegCleanMainCall _KEY
2722 !verbose ${_MOZFUNC_VERBOSE}
2724 Call un.RegCleanMain
2728 !macro un.RegCleanMain
2729 !ifndef un.RegCleanMain
2731 !verbose ${_MOZFUNC_VERBOSE}
2733 !define _MOZFUNC_UN "un."
2735 !insertmacro RegCleanMain
2744 * Removes all registry keys from \Software\Windows\CurrentVersion\Uninstall
2745 * that reference this install location. This uses SHCTX to determine the
2746 * registry hive so you must call SetShellVarContext first.
2748 * $R4 = stores the long path to $INSTDIR
2749 * $R5 = return value from ReadRegStr
2750 * $R6 = string for the base reg key (e.g. Software\Microsoft\Windows\CurrentVersion\Uninstall)
2751 * $R7 = return value from EnumRegKey
2752 * $R8 = counter for EnumRegKey
2753 * $R9 = return value from the stack from the RemoveQuotesFromPath and GetLongPath macros
2755 !macro RegCleanUninstall
2757 !ifndef ${_MOZFUNC_UN}RegCleanUninstall
2758 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2759 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2760 !insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
2762 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2763 !undef _MOZFUNC_UN_TMP
2766 !verbose ${_MOZFUNC_VERBOSE}
2767 !define ${_MOZFUNC_UN}RegCleanUninstall "!insertmacro ${_MOZFUNC_UN}RegCleanUninstallCall"
2769 Function ${_MOZFUNC_UN}RegCleanUninstall
2777 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R4
2778 StrCpy $R6 "Software\Microsoft\Windows\CurrentVersion\Uninstall"
2783 EnumRegKey $R7 SHCTX $R6 $R8
2784 StrCmp $R7 "" end +1
2785 IntOp $R8 $R8 + 1 ; Increment the counter
2787 ReadRegStr $R5 SHCTX "$R6\$R7" "InstallLocation"
2789 ${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R9
2790 ${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
2791 StrCmp "$R9" "$R4" +1 loop
2793 DeleteRegKey SHCTX "$R6\$R7"
2795 IntOp $R8 $R8 - 1 ; Decrement the counter on successful deletion
2813 !macro RegCleanUninstallCall
2815 !verbose ${_MOZFUNC_VERBOSE}
2816 Call RegCleanUninstall
2820 !macro un.RegCleanUninstallCall
2822 !verbose ${_MOZFUNC_VERBOSE}
2823 Call un.RegCleanUninstall
2827 !macro un.RegCleanUninstall
2828 !ifndef un.RegCleanUninstall
2830 !verbose ${_MOZFUNC_VERBOSE}
2832 !define _MOZFUNC_UN "un."
2834 !insertmacro RegCleanUninstall
2843 * Removes an application specific handler registry key under Software\Classes
2844 * for both HKCU and HKLM when its open command refers to this install
2845 * location or the install location doesn't exist.
2847 * @param _HANDLER_NAME
2848 * The registry name for the handler.
2850 * $R7 = stores the long path to the $INSTDIR
2851 * $R8 = stores the path to the open command's parent directory
2852 * $R9 = _HANDLER_NAME
2854 !macro RegCleanAppHandler
2856 !ifndef ${_MOZFUNC_UN}RegCleanAppHandler
2857 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2858 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2859 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
2860 !insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
2862 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2863 !undef _MOZFUNC_UN_TMP
2866 !verbose ${_MOZFUNC_VERBOSE}
2867 !define ${_MOZFUNC_UN}RegCleanAppHandler "!insertmacro ${_MOZFUNC_UN}RegCleanAppHandlerCall"
2869 Function ${_MOZFUNC_UN}RegCleanAppHandler
2875 ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
2877 ${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
2878 ${${_MOZFUNC_UN}GetParent} "$R8" $R8
2879 IfFileExists "$R8" +3 +1
2880 DeleteRegKey HKCU "Software\Classes\$R9"
2883 ${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
2884 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
2885 StrCmp "$R7" "$R8" +1 next
2886 DeleteRegKey HKCU "Software\Classes\$R9"
2889 ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
2891 ${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
2892 ${${_MOZFUNC_UN}GetParent} "$R8" $R8
2893 IfFileExists "$R8" +3 +1
2894 DeleteRegKey HKLM "Software\Classes\$R9"
2897 ${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
2898 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
2899 StrCmp "$R7" "$R8" +1 end
2900 DeleteRegKey HKLM "Software\Classes\$R9"
2913 !macro RegCleanAppHandlerCall _HANDLER_NAME
2915 !verbose ${_MOZFUNC_VERBOSE}
2916 Push "${_HANDLER_NAME}"
2917 Call RegCleanAppHandler
2921 !macro un.RegCleanAppHandlerCall _HANDLER_NAME
2923 !verbose ${_MOZFUNC_VERBOSE}
2924 Push "${_HANDLER_NAME}"
2925 Call un.RegCleanAppHandler
2929 !macro un.RegCleanAppHandler
2930 !ifndef un.RegCleanAppHandler
2932 !verbose ${_MOZFUNC_VERBOSE}
2934 !define _MOZFUNC_UN "un."
2936 !insertmacro RegCleanAppHandler
2945 * Cleans up the registry for a protocol handler when its open command
2946 * refers to this install location. For HKCU the registry key is deleted
2947 * and for HKLM the values set by the application are deleted.
2949 * @param _HANDLER_NAME
2950 * The registry name for the handler.
2952 * $R7 = stores the long path to $INSTDIR
2953 * $R8 = stores the the long path to the open command's parent directory
2954 * $R9 = _HANDLER_NAME
2956 !macro un.RegCleanProtocolHandler
2958 !ifndef un.RegCleanProtocolHandler
2959 !insertmacro un.GetLongPath
2960 !insertmacro un.GetParent
2961 !insertmacro un.GetPathFromString
2964 !verbose ${_MOZFUNC_VERBOSE}
2965 !define un.RegCleanProtocolHandler "!insertmacro un.RegCleanProtocolHandlerCall"
2967 Function un.RegCleanProtocolHandler
2972 ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
2973 ${un.GetLongPath} "$INSTDIR" $R7
2975 StrCmp "$R8" "" next +1
2976 ${un.GetPathFromString} "$R8" $R8
2977 ${un.GetParent} "$R8" $R8
2978 ${un.GetLongPath} "$R8" $R8
2979 StrCmp "$R7" "$R8" +1 next
2980 DeleteRegKey HKCU "Software\Classes\$R9"
2983 ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
2984 StrCmp "$R8" "" end +1
2985 ${un.GetLongPath} "$INSTDIR" $R7
2986 ${un.GetPathFromString} "$R8" $R8
2987 ${un.GetParent} "$R8" $R8
2988 ${un.GetLongPath} "$R8" $R8
2989 StrCmp "$R7" "$R8" +1 end
2990 DeleteRegValue HKLM "Software\Classes\$R9\DefaultIcon" ""
2991 DeleteRegValue HKLM "Software\Classes\$R9\shell\open" ""
2992 DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec" ""
2993 DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Application" ""
2994 DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Topic" ""
3007 !macro un.RegCleanProtocolHandlerCall _HANDLER_NAME
3009 !verbose ${_MOZFUNC_VERBOSE}
3010 Push "${_HANDLER_NAME}"
3011 Call un.RegCleanProtocolHandler
3016 * Cleans up the registry for a file handler when the passed in value equals
3017 * the default value for the file handler. For HKCU the registry key is deleted
3018 * and for HKLM the default value is deleted.
3020 * @param _HANDLER_NAME
3021 * The registry name for the handler.
3022 * @param _DEFAULT_VALUE
3023 * The value to check for against the handler's default value.
3025 * $R6 = stores the long path to $INSTDIR
3026 * $R7 = _DEFAULT_VALUE
3027 * $R9 = _HANDLER_NAME
3029 !macro RegCleanFileHandler
3031 !ifndef ${_MOZFUNC_UN}RegCleanFileHandler
3032 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3033 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3034 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
3035 !insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
3037 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3038 !undef _MOZFUNC_UN_TMP
3041 !verbose ${_MOZFUNC_VERBOSE}
3042 !define ${_MOZFUNC_UN}RegCleanFileHandler "!insertmacro ${_MOZFUNC_UN}RegCleanFileHandlerCall"
3044 Function ${_MOZFUNC_UN}RegCleanFileHandler
3050 ReadRegStr $R7 HKCU "Software\Classes\$R9" ""
3051 StrCmp "$R7" "$R8" +1 +2
3052 DeleteRegKey HKCU "Software\Classes\$R9"
3054 ReadRegStr $R7 HKLM "Software\Classes\$R9" ""
3055 StrCmp "$R7" "$R8" +1 +2
3056 DeleteRegValue HKLM "Software\Classes\$R9" ""
3070 !macro RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
3072 !verbose ${_MOZFUNC_VERBOSE}
3073 Push "${_DEFAULT_VALUE}"
3074 Push "${_HANDLER_NAME}"
3075 Call RegCleanFileHandler
3079 !macro un.RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
3081 !verbose ${_MOZFUNC_VERBOSE}
3082 Push "${_DEFAULT_VALUE}"
3083 Push "${_HANDLER_NAME}"
3084 Call un.RegCleanFileHandler
3088 !macro un.RegCleanFileHandler
3089 !ifndef un.RegCleanFileHandler
3091 !verbose ${_MOZFUNC_VERBOSE}
3093 !define _MOZFUNC_UN "un."
3095 !insertmacro RegCleanFileHandler
3104 * Checks if a handler's open command points to this installation directory.
3105 * Uses SHCTX to determine the registry hive (e.g. HKLM or HKCU) to check.
3107 * @param _HANDLER_NAME
3108 * The registry name for the handler.
3110 * true if it is the handler's open command points to this
3111 * installation directory and false if it does not.
3113 * $R7 = stores the value of the open command and the path macros return values
3114 * $R8 = stores the handler's registry key name
3115 * $R9 = _DEFAULT_VALUE and _RESULT
3117 !macro IsHandlerForInstallDir
3119 !ifndef ${_MOZFUNC_UN}IsHandlerForInstallDir
3120 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3121 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3122 !insertmacro ${_MOZFUNC_UN_TMP}GetParent
3123 !insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
3125 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3126 !undef _MOZFUNC_UN_TMP
3129 !verbose ${_MOZFUNC_VERBOSE}
3130 !define ${_MOZFUNC_UN}IsHandlerForInstallDir "!insertmacro ${_MOZFUNC_UN}IsHandlerForInstallDirCall"
3132 Function ${_MOZFUNC_UN}IsHandlerForInstallDir
3139 ReadRegStr $R7 SHCTX "Software\Classes\$R8\shell\open\command" ""
3142 ${GetPathFromString} "$R7" $R7
3143 ${GetParent} "$R7" $R7
3144 ${GetLongPath} "$R7" $R7
3145 StrCmp "$R7" "$INSTDIR" +1 end
3160 !macro IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
3162 !verbose ${_MOZFUNC_VERBOSE}
3163 Push "${_HANDLER_NAME}"
3164 Call IsHandlerForInstallDir
3169 !macro un.IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
3171 !verbose ${_MOZFUNC_VERBOSE}
3172 Push "${_HANDLER_NAME}"
3173 Call un.IsHandlerForInstallDir
3178 !macro un.IsHandlerForInstallDir
3179 !ifndef un.IsHandlerForInstallDir
3181 !verbose ${_MOZFUNC_VERBOSE}
3183 !define _MOZFUNC_UN "un."
3185 !insertmacro IsHandlerForInstallDir
3194 * If present removes the VirtualStore directory for this installation. Uses the
3195 * program files directory path and the current install location to determine
3196 * the sub-directory in the VirtualStore directory.
3198 * $R5 = various path values.
3199 * $R6 = length of the long path to $PROGRAMFILES
3200 * $R7 = length of the long path to $INSTDIR
3201 * $R8 = long path to $PROGRAMFILES
3202 * $R9 = long path to $INSTDIR
3204 !macro CleanVirtualStore
3206 !ifndef ${_MOZFUNC_UN}CleanVirtualStore
3207 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3208 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3210 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3211 !undef _MOZFUNC_UN_TMP
3214 !verbose ${_MOZFUNC_VERBOSE}
3215 !define ${_MOZFUNC_UN}CleanVirtualStore "!insertmacro ${_MOZFUNC_UN}CleanVirtualStoreCall"
3217 Function ${_MOZFUNC_UN}CleanVirtualStore
3224 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R9
3225 StrCmp $R9 "" end +1
3226 ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES" $R8
3227 StrCmp $R8 "" end +1
3231 ; Only continue If the length of $INSTDIR is greater than the length of
3233 IntCmp $R7 $R6 end end +1
3235 ; Copy from the start of $INSTDIR the length of $PROGRAMFILES
3236 StrCpy $R5 "$R9" $R6
3237 StrCmp "$R5" "$R8" +1 end ; Check if $INSTDIR is under $PROGRAMFILES
3239 ; Remove the drive letter and colon from the $INSTDIR long path
3240 StrCpy $R5 "$R9" "" 2
3241 StrCpy $R5 "$PROFILE\AppData\Local\VirtualStore$R5"
3242 ${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3243 StrCmp $R5 "" end +1
3245 IfFileExists "$R5" +1 end
3262 !macro CleanVirtualStoreCall
3264 !verbose ${_MOZFUNC_VERBOSE}
3265 Call CleanVirtualStore
3269 !macro un.CleanVirtualStoreCall
3271 !verbose ${_MOZFUNC_VERBOSE}
3272 Call un.CleanVirtualStore
3276 !macro un.CleanVirtualStore
3277 !ifndef un.CleanVirtualStore
3279 !verbose ${_MOZFUNC_VERBOSE}
3281 !define _MOZFUNC_UN "un."
3283 !insertmacro CleanVirtualStore
3292 * If present removes the updates directory located in the profile's local
3293 * directory for this installation.
3295 * @param _REL_PROFILE_PATH
3296 * The relative path to the profile directory from $LOCALAPPDATA.
3298 * $R4 = various path values.
3299 * $R5 = length of the long path to $PROGRAMFILES
3300 * $R6 = length of the long path to $INSTDIR
3301 * $R7 = long path to $PROGRAMFILES
3302 * $R8 = long path to $INSTDIR
3303 * $R9 = _REL_PROFILE_PATH
3305 !macro CleanUpdatesDir
3307 !ifndef ${_MOZFUNC_UN}CleanUpdatesDir
3308 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3309 !insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3311 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3312 !undef _MOZFUNC_UN_TMP
3315 !verbose ${_MOZFUNC_VERBOSE}
3316 !define ${_MOZFUNC_UN}CleanUpdatesDir "!insertmacro ${_MOZFUNC_UN}CleanUpdatesDirCall"
3318 Function ${_MOZFUNC_UN}CleanUpdatesDir
3326 StrCmp $R9 "" end +1 ; The relative path to the app's profiles is required
3327 ${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R8
3328 StrCmp $R8 "" end +1
3329 ${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES" $R7
3330 StrCmp $R7 "" end +1
3334 ; Only continue If the length of $INSTDIR is greater than the length of
3336 IntCmp $R6 $R5 end end +1
3338 ; Copy from the start of $INSTDIR the length of $PROGRAMFILES
3339 StrCpy $R4 "$R8" $R5
3340 StrCmp "$R4" "$R7" +1 end ; Check if $INSTDIR is under $PROGRAMFILES
3342 ; Copy the relative path to $INSTDIR from $PROGRAMFILES
3343 StrCpy $R4 "$R8" "" $R5
3345 ; Concatenate the path to $LOCALAPPDATA the relative profile path and the
3346 ; relative path to $INSTDIR from $PROGRAMFILES
3347 StrCpy $R4 "$LOCALAPPDATA\$R9$R4"
3348 ${${_MOZFUNC_UN}GetLongPath} "$R4" $R4
3349 StrCmp $R4 "" end +1
3351 IfFileExists "$R4\updates" +1 end
3369 !macro CleanUpdatesDirCall _REL_PROFILE_PATH
3371 !verbose ${_MOZFUNC_VERBOSE}
3372 Push "${_REL_PROFILE_PATH}"
3373 Call CleanUpdatesDir
3377 !macro un.CleanUpdatesDirCall _REL_PROFILE_PATH
3379 !verbose ${_MOZFUNC_VERBOSE}
3380 Push "${_REL_PROFILE_PATH}"
3381 Call un.CleanUpdatesDir
3385 !macro un.CleanUpdatesDir
3386 !ifndef un.CleanUpdatesDir
3388 !verbose ${_MOZFUNC_VERBOSE}
3390 !define _MOZFUNC_UN "un."
3392 !insertmacro CleanUpdatesDir
3401 * Deletes all relative profiles specified in an application's profiles.ini and
3402 * performs various other cleanup.
3404 * @param _REL_PROFILE_PATH
3405 * The relative path to the profile directory.
3407 * $R6 = value of IsRelative read from profiles.ini
3408 * $R7 = value of Path to profile read from profiles.ini
3409 * $R8 = counter for reading profiles (e.g. Profile0, Profile1, etc.)
3410 * $R9 = _REL_PROFILE_PATH
3412 !macro DeleteRelativeProfiles
3414 !ifndef ${_MOZFUNC_UN}DeleteRelativeProfiles
3415 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3416 !insertmacro ${_MOZFUNC_UN_TMP}WordReplace
3418 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3419 !undef _MOZFUNC_UN_TMP
3422 !verbose ${_MOZFUNC_VERBOSE}
3423 !define ${_MOZFUNC_UN}DeleteRelativeProfiles "!insertmacro ${_MOZFUNC_UN}DeleteRelativeProfilesCall"
3425 Function ${_MOZFUNC_UN}DeleteRelativeProfiles
3431 SetShellVarContext current
3435 IntOp $R8 $R8 + 1 ; Increment the counter.
3436 ReadINIStr $R7 "$APPDATA\$R9\profiles.ini" "Profile$R8" "Path"
3439 ; Only remove relative profiles
3440 ReadINIStr $R6 "$APPDATA\$R9\profiles.ini" "Profile$R8" "IsRelative"
3441 StrCmp "$R6" "1" +1 loop
3443 ; Relative paths in profiles.ini use / as a separator
3444 ${${_MOZFUNC_UN}WordReplace} "$R7" "/" "\" "+" $R7
3446 IfFileExists "$LOCALAPPDATA\$R9\$R7" +1 +2
3447 RmDir /r "$LOCALAPPDATA\$R9\$R7"
3448 IfFileExists "$APPDATA\$R9\$R7" +1 +2
3449 RmDir /r "$APPDATA\$R9\$R7"
3453 ; Remove profiles directory under LOCALAPPDATA (e.g. cache, etc.) since
3454 ; they are at times abandoned.
3455 RmDir /r "$LOCALAPPDATA\$R9\Profiles"
3456 RmDir /r "$APPDATA\$R9\Crash Reports"
3457 Delete "$APPDATA\$R9\profiles.ini"
3458 Delete "$APPDATA\$R9\console.log"
3459 Delete "$APPDATA\$R9\pluginreg.dat"
3460 RmDir "$APPDATA\$R9\Profiles"
3461 RmDir "$APPDATA\$R9"
3473 !macro DeleteRelativeProfilesCall _REL_PROFILE_PATH
3475 !verbose ${_MOZFUNC_VERBOSE}
3476 Push "${_REL_PROFILE_PATH}"
3477 Call DeleteRelativeProfiles
3481 !macro un.DeleteRelativeProfilesCall _REL_PROFILE_PATH
3483 !verbose ${_MOZFUNC_VERBOSE}
3484 Push "${_REL_PROFILE_PATH}"
3485 Call un.DeleteRelativeProfiles
3489 !macro un.DeleteRelativeProfiles
3490 !ifndef un.DeleteRelativeProfiles
3492 !verbose ${_MOZFUNC_VERBOSE}
3494 !define _MOZFUNC_UN "un."
3496 !insertmacro DeleteRelativeProfiles
3505 ################################################################################
3506 # Macros for parsing and updating the uninstall.log and removed-files.log
3509 * Updates the uninstall.log with new files added by software update.
3511 * When modifying this macro be aware that LineFind uses all registers except
3512 * $R0-$R3 so be cautious. Callers of this macro are not affected.
3514 !macro UpdateUninstallLog
3516 !ifndef UpdateUninstallLog
3517 !insertmacro FileJoin
3518 !insertmacro LineFind
3519 !insertmacro TextCompareNoDetails
3520 !insertmacro TrimNewLines
3523 !verbose ${_MOZFUNC_VERBOSE}
3524 !define UpdateUninstallLog "!insertmacro UpdateUninstallLogCall"
3526 Function UpdateUninstallLog
3534 GetFullPathName $R3 "$INSTDIR\uninstall"
3535 IfFileExists "$R3\uninstall.update" +2 0
3538 ${LineFind} "$R3\uninstall.update" "" "1:-1" "CleanupUpdateLog"
3540 GetTempFileName $R2 "$R3"
3542 ${TextCompareNoDetails} "$R3\uninstall.update" "$R3\uninstall.log" "SlowDiff" "CreateUpdateDiff"
3546 ${FileJoin} "$R3\uninstall.log" "$R2" "$R3\uninstall.log"
3558 ; This callback MUST use labels vs. relative line numbers.
3559 Function CleanupUpdateLog
3561 StrCmp "$R2" "EXECUTE ADD " +1 skip
3562 StrCpy $R9 "$R9" "" 12
3567 StrCpy $R4 "" ; Initialize to an empty string.
3568 StrCpy $R6 -1 ; Set the counter to -1 so it will start at 0.
3571 IntOp $R6 $R6 + 1 ; Increment the counter.
3572 StrCpy $R5 $R9 1 $R6 ; Starting from the counter copy the next char.
3573 StrCmp $R5 "" copy ; Are there no more chars?
3574 StrCmp $R5 "/" +1 +2 ; Is the char a /?
3575 StrCpy $R5 "\" ; Replace the char with a \.
3581 StrCpy $R9 "File: \$R4"
3588 StrCpy $0 "SkipWrite"
3594 Function CreateUpdateDiff
3595 ${TrimNewLines} "$9" $9
3597 FileWrite $R1 "$9$\r$\n"
3606 !macro UpdateUninstallLogCall
3608 !verbose ${_MOZFUNC_VERBOSE}
3609 Call UpdateUninstallLog
3614 * Updates the uninstall.log with entries from uninstall.bak. The uninstall.bak
3615 * is the uninstall.log renamed to uninstall.bak at the beginning of the
3618 * When modifying this macro be aware that LineFind uses all registers except
3619 * $R0-$R3 so be cautious. Callers of this macro are not affected.
3621 !macro UpdateFromPreviousLog
3623 !ifndef UpdateFromPreviousLog
3624 !insertmacro FileJoin
3625 !insertmacro GetTime
3626 !insertmacro TextCompareNoDetails
3627 !insertmacro TrimNewLines
3630 !verbose ${_MOZFUNC_VERBOSE}
3631 !define UpdateFromPreviousLog "!insertmacro UpdateFromPreviousLogCall"
3633 Function UpdateFromPreviousLog
3646 ; Diff and add missing entries from the previous file log if it exists
3647 IfFileExists "$INSTDIR\uninstall\uninstall.bak" +1 end
3648 StrCpy $R0 "$INSTDIR\uninstall\uninstall.log"
3649 StrCpy $R1 "$INSTDIR\uninstall\uninstall.bak"
3652 ${TextCompareNoDetails} "$R1" "$R0" "SlowDiff" "UpdateFromPreviousLog_AddToLog"
3655 ${FileJoin} "$INSTDIR\uninstall\uninstall.log" "$R2" "$INSTDIR\uninstall\uninstall.log"
3657 ${DeleteFile} "$INSTDIR\uninstall\uninstall.bak"
3675 Function UpdateFromPreviousLog_AddToLog
3676 ${TrimNewLines} "$9" $9
3678 FileWrite $R3 "$9$\r$\n"
3679 ${LogMsg} "Added To Uninstall Log: $9"
3689 !macro UpdateFromPreviousLogCall
3691 !verbose ${_MOZFUNC_VERBOSE}
3692 Call UpdateFromPreviousLog
3697 * Parses the removed-files.log to remove files, and directories prior to
3700 * When modifying this macro be aware that LineFind uses all registers except
3701 * $R0-$R3 so be cautious. Callers of this macro are not affected.
3703 !macro ParseRemovedFilesLog
3705 !ifndef ParseRemovedFilesLog
3706 !insertmacro LineFind
3707 !insertmacro TrimNewLines
3710 !verbose ${_MOZFUNC_VERBOSE}
3711 !define ParseRemovedFilesLog "!insertmacro ParseRemovedFilesLogCall"
3713 Function ParseRemovedFilesLog
3725 IfFileExists "$EXEDIR\removed-files.log" +1 end
3726 ${LogHeader} "Removing Obsolete Files and Directories"
3727 ${LineFind} "$EXEDIR\removed-files.log" "/NUL" "1:-1" "ParseRemovedFilesLog_RemoveFile"
3728 ${LineFind} "$EXEDIR\removed-files.log" "/NUL" "1:-1" "ParseRemovedFilesLog_RemoveDir"
3744 Function ParseRemovedFilesLog_RemoveFile
3745 ${TrimNewLines} "$R9" $R9
3748 StrCmp $R1 "File:" +1 end
3749 StrCpy $R9 "$R9" "" 6
3750 IfFileExists "$INSTDIR$R9" +1 end
3753 ${DeleteFile} "$INSTDIR$R9"
3755 ${LogMsg} "Deleted File: $INSTDIR$R9"
3759 Rename "$INSTDIR$R9" "$INSTDIR$R9.moz-delete"
3760 IfErrors +1 reboot_delete
3762 ; Original file will be deleted on reboot
3763 Delete /REBOOTOK "$INSTDIR$R9"
3764 ${LogMsg} "Delayed Delete File (Reboot Required): $INSTDIR$R9"
3767 ; Renamed file will be deleted on reboot
3769 Delete /REBOOTOK "$INSTDIR$R9.moz-delete"
3770 ${LogMsg} "Delayed Delete File (Reboot Required): $INSTDIR$R9.moz-delete"
3779 ; The xpinstall based installer removed directories even when they aren't
3780 ; empty so this does as well.
3781 Function ParseRemovedFilesLog_RemoveDir
3782 ${TrimNewLines} "$R9" $R9
3784 StrCmp "$R1" "Dir:" +1 end
3785 StrCpy $R9 "$R9" "" 5
3786 StrCpy $R1 "$R9" "" -1
3788 StrCmp "$R1" "\" +1 +2
3791 IfFileExists "$INSTDIR$R9" +1 end
3793 RmDir /r "$INSTDIR$R9"
3795 ${LogMsg} "** ERROR Removing Directory: $INSTDIR$R9 **"
3798 ${LogMsg} "Removed Directory: $INSTDIR$R9"
3810 !macro ParseRemovedFilesLogCall
3812 !verbose ${_MOZFUNC_VERBOSE}
3813 Call ParseRemovedFilesLog
3818 * Copies files from a source directory to a destination directory with logging
3819 * to the uninstall.log. If any destination files are in use a reboot will be
3820 * necessary to complete the installation and the reboot flag (see IfRebootFlag
3821 * in the NSIS documentation).
3823 * @param _PATH_TO_SOURCE
3824 * Source path to copy the files from. This must not end with a \.
3826 * @param _PATH_TO_DESTINATION
3827 * Destination path to copy the files to. This must not end with a \.
3829 * @param _PREFIX_ERROR_CREATEDIR
3830 * Prefix for the directory creation error message. The directory path
3831 * will be inserted below this string.
3833 * @param _SUFFIX_ERROR_CREATEDIR
3834 * Suffix for the directory creation error message. The directory path
3835 * will be inserted above this string.
3837 * $0 = destination file's parent directory used in the create_dir label
3838 * $R0 = copied value from $R6 (e.g. _PATH_TO_SOURCE)
3839 * $R1 = copied value from $R7 (e.g. _PATH_TO_DESTINATION)
3840 * $R2 = string length of the path to source
3841 * $R3 = relative path from the path to source
3842 * $R4 = copied value from $R8 (e.g. _PREFIX_ERROR_CREATEDIR)
3843 * $R5 = copied value from $R9 (e.g. _SUFFIX_ERROR_CREATEDIR)
3844 * note: the LocateNoDetails macro uses these registers so we copy the values
3845 * to other registers.
3846 * $R6 = initially _PATH_TO_SOURCE and then set to "size" ($R6="" if directory,
3847 * $R6="0" if file with /S=)"path\name" in callback
3848 * $R7 = initially _PATH_TO_DESTINATION and then set to "name" in callback
3849 * $R8 = initially _PREFIX_ERROR_CREATEDIR and then set to "path" in callback
3850 * $R9 = initially _SUFFIX_ERROR_CREATEDIR and then set to "path\name" in
3853 !macro CopyFilesFromDir
3855 !ifndef CopyFilesFromDir
3856 !insertmacro LocateNoDetails
3857 !insertmacro OnEndCommon
3858 !insertmacro WordReplace
3861 !verbose ${_MOZFUNC_VERBOSE}
3862 !define CopyFilesFromDir "!insertmacro CopyFilesFromDirCall"
3864 Function CopyFilesFromDir
3887 ${LocateNoDetails} "$R0" "/L=FD" "CopyFileCallback"
3905 Function CopyFileCallback
3906 StrCpy $R3 $R8 "" $R2 ; $R3 always begins with a \.
3910 StrCmp $R6 "" +1 copy_file
3911 IfFileExists "$R1$R3\$R7" end +1
3912 StrCpy $0 "$R1$R3\$R7"
3916 CreateDirectory "$0"
3917 IfFileExists "$0" +1 err_create_dir ; protect against looping.
3918 ${LogMsg} "Created Directory: $0"
3919 StrCmp $R6 "" end copy_file
3922 ${LogMsg} "** ERROR Creating Directory: $0 **"
3923 MessageBox MB_RETRYCANCEL|MB_ICONQUESTION "$R4$\r$\n$\r$\n$0$\r$\n$\r$\n$R5" IDRETRY retry
3929 IfFileExists "$0" +1 create_dir
3932 ${DeleteFile} "$R1$R3\$R7"
3933 IfErrors +1 dest_clear
3935 Rename "$R1$R3\$R7" "$R1$R3\$R7.moz-delete"
3936 IfErrors +1 reboot_delete
3938 ; file will replace destination file on reboot
3939 Rename "$R9" "$R9.moz-upgrade"
3940 CopyFiles /SILENT "$R9.moz-upgrade" "$R1$R3"
3941 Rename /REBOOTOK "$R1$R3\$R7.moz-upgrade" "$R1$R3\$R7"
3942 ${LogMsg} "Copied File: $R1$R3\$R7.moz-upgrade"
3943 ${LogMsg} "Delayed Install File (Reboot Required): $R1$R3\$R7"
3946 ; file will be deleted on reboot
3948 CopyFiles /SILENT $R9 "$R1$R3"
3949 Delete /REBOOTOK "$R1$R3\$R7.moz-delete"
3950 ${LogMsg} "Installed File: $R1$R3\$R7"
3951 ${LogMsg} "Delayed Delete File (Reboot Required): $R1$R3\$R7.moz-delete"
3954 ; destination file doesn't exist - coast is clear
3956 CopyFiles /SILENT $R9 "$R1$R3"
3957 ${LogMsg} "Installed File: $R1$R3\$R7"
3960 ; If the file is installed into the installation directory remove the
3961 ; installation directory's path from the file path when writing to the
3962 ; uninstall.log so it will be a relative path. This allows the same
3963 ; helper.exe to be used with zip builds if we supply an uninstall.log.
3964 ${WordReplace} "$R1$R3\$R7" "$INSTDIR" "" "+" $R3
3965 ${LogUninstall} "File: $R3"
3975 !macro CopyFilesFromDirCall _PATH_TO_SOURCE _PATH_TO_DESTINATION \
3976 _PREFIX_ERROR_CREATEDIR _SUFFIX_ERROR_CREATEDIR
3978 !verbose ${_MOZFUNC_VERBOSE}
3979 Push "${_PATH_TO_SOURCE}"
3980 Push "${_PATH_TO_DESTINATION}"
3981 Push "${_PREFIX_ERROR_CREATEDIR}"
3982 Push "${_SUFFIX_ERROR_CREATEDIR}"
3983 Call CopyFilesFromDir
3988 * Parses the uninstall.log to unregister dll's, remove files, and remove
3989 * empty directories for this installation.
3991 * When modifying this macro be aware that LineFind uses all registers except
3992 * $R0-$R3 so be cautious. Callers of this macro are not affected.
3994 !macro un.ParseUninstallLog
3996 !ifndef un.ParseUninstallLog
3997 !insertmacro un.LineFind
3998 !insertmacro un.TrimNewLines
4001 !verbose ${_MOZFUNC_VERBOSE}
4002 !define un.ParseUninstallLog "!insertmacro un.ParseUninstallLogCall"
4004 Function un.ParseUninstallLog
4017 IfFileExists "$INSTDIR\uninstall\uninstall.log" +1 end
4019 ; Copy the uninstall log file to a temporary file
4020 GetTempFileName $TmpVal
4021 CopyFiles /SILENT /FILESONLY "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
4024 ${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
4027 ${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
4029 ; Remove empty directories
4030 ${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
4032 ; Delete the temporary uninstall log file
4033 Delete /REBOOTOK "$TmpVal"
4050 Function un.RemoveFilesCallback
4051 ${un.TrimNewLines} "$R9" $R9
4054 StrCmp "$R1" "File:" +1 end
4055 StrCpy $R9 "$R9" "" 6
4058 StrCpy $R1 "$INSTDIR$R9"
4059 StrCmp "$R0" "\" +2 +1
4062 IfFileExists "$R1" +1 end
4066 Rename "$R1" "$R1.moz-delete"
4068 Delete /REBOOTOK "$R1"
4071 Delete /REBOOTOK "$R1.moz-delete"
4079 Function un.UnRegDLLsCallback
4080 ${un.TrimNewLines} "$R9" $R9
4083 StrCmp $R1 "DLLReg:" +1 end
4084 StrCpy $R9 "$R9" "" 8
4087 StrCpy $R1 "$INSTDIR$R9"
4088 StrCmp $R0 "\" +2 +1
4099 ; Using locate will leave file handles open to some of the directories
4100 ; which will prevent the deletion of these directories. This parses the
4101 ; uninstall.log and uses the file entries to find / remove empty
4103 Function un.RemoveDirsCallback
4104 ${un.TrimNewLines} "$R9" $R9
4105 StrCpy $R0 "$R9" 5 ; Copy the first five chars
4106 StrCmp "$R0" "File:" +1 end
4108 StrCpy $R9 "$R9" "" 6 ; Copy string starting after the 6th char
4109 StrCpy $R0 "$R9" 1 ; Copy the first char
4111 StrCpy $R1 "$INSTDIR$R9" ; Copy the install dir path and suffix it with the string
4112 StrCmp "$R0" "\" loop ; If this is a relative path goto the loop
4113 StrCpy $R1 "$R9" ; Already a full path so copy the string
4116 ${un.GetParent} "$R1" $R1 ; Get the parent directory for the path
4117 StrCmp "$R1" "$INSTDIR" end ; If the directory is the install dir goto end
4119 ; We only try to remove empty directories but the Desktop, StartMenu, and
4120 ; QuickLaunch directories can be empty so guard against removing them.
4121 SetShellVarContext all ; Set context to all users
4122 StrCmp "$R1" "$DESKTOP" end ; All users desktop
4123 StrCmp "$R1" "$STARTMENU" end ; All users start menu
4125 SetShellVarContext current ; Set context to all users
4126 StrCmp "$R1" "$DESKTOP" end ; Current user desktop
4127 StrCmp "$R1" "$STARTMENU" end ; Current user start menu
4128 StrCmp "$R1" "$QUICKLAUNCH" end ; Current user quick launch
4130 IfFileExists "$R1" +1 +3 ; Only try to remove the dir if it exists
4132 RmDir "$R1" ; Remove the dir
4133 IfErrors end ; If we fail there is no use trying to remove its parent dir
4135 StrCmp "$R0" "\" loop end ; Only loop when the path is relative to the install dir
4147 !macro un.ParseUninstallLogCall
4149 !verbose ${_MOZFUNC_VERBOSE}
4150 Call un.ParseUninstallLog
4155 ################################################################################
4156 # Macros for custom branding
4159 * Sets BrandFullName and / or BrandShortName to values provided in the specified
4160 * ini file and defaults to BrandShortName and BrandFullName as defined in
4161 * branding.nsi when the associated ini file entry is not specified.
4165 * BrandFullName=Custom Full Name
4166 * BrandShortName=Custom Short Name
4168 * @param _PATH_TO_INI
4169 * Path to the ini file.
4171 * $R6 = return value from ReadINIStr
4172 * $R7 = stores BrandShortName
4173 * $R8 = stores BrandFullName
4174 * $R9 = _PATH_TO_INI
4176 !macro SetBrandNameVars
4178 !ifndef ${_MOZFUNC_UN}SetBrandNameVars
4179 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
4180 !insertmacro ${_MOZFUNC_UN_TMP}WordReplace
4182 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
4183 !undef _MOZFUNC_UN_TMP
4185 ; Prevent declaring vars twice when the SetBrandNameVars macro is
4186 ; inserted into both the installer and uninstaller.
4187 !ifndef SetBrandNameVars
4194 !verbose ${_MOZFUNC_VERBOSE}
4195 !define ${_MOZFUNC_UN}SetBrandNameVars "!insertmacro ${_MOZFUNC_UN}SetBrandNameVarsCall"
4197 Function ${_MOZFUNC_UN}SetBrandNameVars
4203 StrCpy $R8 "${BrandFullName}"
4204 StrCpy $R7 "${BrandShortName}"
4206 IfFileExists "$R9" +1 finish
4209 ReadINIStr $R6 $R9 "Branding" "BrandFullName"
4214 ReadINIStr $R6 $R9 "Branding" "BrandShortName"
4219 StrCpy $BrandFullName "$R8"
4220 ${${_MOZFUNC_UN}WordReplace} "$R8" "&" "&&" "+" $R8
4221 StrCpy $BrandFullNameDA "$R8"
4222 StrCpy $BrandShortName "$R7"
4234 !macro SetBrandNameVarsCall _PATH_TO_INI
4236 !verbose ${_MOZFUNC_VERBOSE}
4237 Push "${_PATH_TO_INI}"
4238 Call SetBrandNameVars
4242 !macro un.SetBrandNameVarsCall _PATH_TO_INI
4244 !verbose ${_MOZFUNC_VERBOSE}
4245 Push "${_PATH_TO_INI}"
4246 Call un.SetBrandNameVars
4250 !macro un.SetBrandNameVars
4251 !ifndef un.SetBrandNameVars
4253 !verbose ${_MOZFUNC_VERBOSE}
4255 !define _MOZFUNC_UN "un."
4257 !insertmacro SetBrandNameVars
4266 * Replaces the wizard's header image with the one specified.
4268 * @param _PATH_TO_IMAGE
4269 * Fully qualified path to the bitmap to use for the header image.
4271 * $R8 = hwnd for the control returned from GetDlgItem.
4272 * $R9 = _PATH_TO_IMAGE
4274 !macro ChangeMUIHeaderImage
4276 !ifndef ${_MOZFUNC_UN}ChangeMUIHeaderImage
4280 !verbose ${_MOZFUNC_VERBOSE}
4281 !define ${_MOZFUNC_UN}ChangeMUIHeaderImage "!insertmacro ${_MOZFUNC_UN}ChangeMUIHeaderImageCall"
4283 Function ${_MOZFUNC_UN}ChangeMUIHeaderImage
4287 GetDlgItem $R8 $HWNDPARENT 1046
4288 System::Call 'user32::LoadImage(i 0, t "$R9", i 0, i 0, i 0, i 0x0010|0x2000) i.s'
4290 SendMessage $R8 ${STM_SETIMAGE} 0 $hHeaderBitmap
4291 ; There is no way to specify a show function for a custom page so hide
4292 ; and then show the control to force the bitmap to redraw.
4293 ShowWindow $R8 ${SW_HIDE}
4294 ShowWindow $R8 ${SW_SHOW}
4304 !macro ChangeMUIHeaderImageCall _PATH_TO_IMAGE
4306 !verbose ${_MOZFUNC_VERBOSE}
4307 Push "${_PATH_TO_IMAGE}"
4308 Call ChangeMUIHeaderImage
4312 !macro un.ChangeMUIHeaderImageCall _PATH_TO_IMAGE
4314 !verbose ${_MOZFUNC_VERBOSE}
4315 Push "${_PATH_TO_IMAGE}"
4316 Call un.ChangeMUIHeaderImage
4320 !macro un.ChangeMUIHeaderImage
4321 !ifndef un.ChangeMUIHeaderImage
4323 !verbose ${_MOZFUNC_VERBOSE}
4325 !define _MOZFUNC_UN "un."
4327 !insertmacro ChangeMUIHeaderImage
4336 ################################################################################
4337 # User interface callback helper defines and macros
4339 /* Install type defines */
4340 !ifndef INSTALLTYPE_BASIC
4341 !define INSTALLTYPE_BASIC 1
4344 !ifndef INSTALLTYPE_ADVANCED
4345 !define INSTALLTYPE_ADVANCED 2
4348 !ifndef INSTALLTYPE_CUSTOM
4349 !define INSTALLTYPE_CUSTOM 4
4353 * Checks whether to display the current page (e.g. if not performing a custom
4354 * install don't display the custom pages).
4356 !macro CheckCustomCommon
4358 !ifndef CheckCustomCommon
4360 !verbose ${_MOZFUNC_VERBOSE}
4361 !define CheckCustomCommon "!insertmacro CheckCustomCommonCall"
4363 Function CheckCustomCommon
4365 ; Abort if not a custom install
4366 IntCmp $InstallType ${INSTALLTYPE_CUSTOM} +2 +1 +1
4375 !macro CheckCustomCommonCall
4377 !verbose ${_MOZFUNC_VERBOSE}
4378 Call CheckCustomCommon
4383 * Unloads dll's and releases references when the installer and uninstaller
4388 !ifndef ${_MOZFUNC_UN}OnEndCommon
4389 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
4390 !insertmacro ${_MOZFUNC_UN_TMP}UnloadUAC
4392 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
4393 !undef _MOZFUNC_UN_TMP
4396 !verbose ${_MOZFUNC_VERBOSE}
4397 !define ${_MOZFUNC_UN}OnEndCommon "!insertmacro ${_MOZFUNC_UN}OnEndCommonCall"
4399 Function ${_MOZFUNC_UN}OnEndCommon
4401 ${${_MOZFUNC_UN}UnloadUAC}
4402 StrCmp $hHeaderBitmap "" +3 +1
4403 System::Call "gdi32::DeleteObject(i s)" $hHeaderBitmap
4404 StrCpy $hHeaderBitmap ""
4414 !macro OnEndCommonCall
4416 !verbose ${_MOZFUNC_VERBOSE}
4421 !macro un.OnEndCommonCall
4423 !verbose ${_MOZFUNC_VERBOSE}
4428 !macro un.OnEndCommon
4429 !ifndef un.OnEndCommon
4431 !verbose ${_MOZFUNC_VERBOSE}
4433 !define _MOZFUNC_UN "un."
4435 !insertmacro OnEndCommon
4444 * Called from the installer's .onInit function not to be confused with the
4445 * uninstaller's .onInit or the uninstaller's un.onInit functions.
4447 * @param _WARN_UNSUPPORTED_MSG
4448 * Message displayed when the Windows version is not supported.
4450 * $R5 = return value from the GetSize macro
4451 * $R6 = general string values, return value from GetTempFileName, return
4452 * value from the GetSize macro
4453 * $R7 = full path to the configuration ini file
4454 * $R8 = return value from the GetParameters macro
4455 * $R9 = _WARN_UNSUPPORTED_MSG
4457 !macro InstallOnInitCommon
4459 !ifndef InstallOnInitCommon
4460 !insertmacro CloseApp
4461 !insertmacro ElevateUAC
4462 !insertmacro GetOptions
4463 !insertmacro GetParameters
4464 !insertmacro GetSize
4467 !verbose ${_MOZFUNC_VERBOSE}
4468 !define InstallOnInitCommon "!insertmacro InstallOnInitCommonCall"
4470 Function InstallOnInitCommon
4477 !ifdef ___WINVER__NSH___
4478 ${Unless} ${AtLeastWin2000}
4479 ; XXX-rstrong - some systems fail the AtLeastWin2000 test for an
4480 ; unknown reason. To work around this also check if the Windows NT
4481 ; registry Key exists and if it does if the first char in
4482 ; CurrentVersion is equal to 3 (Windows NT 3.5 and 3.5.1) or 4
4486 ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
4489 ${OrIf} "$R8" == "3"
4490 ${OrIf} "$R8" == "4"
4491 MessageBox MB_OK|MB_ICONSTOP "$R9" IDOK
4492 ; Nothing initialized so no need to call OnEndCommon
4498 ${GetParameters} $R8
4500 ; Require elevation if the user can elevate
4505 ${GetOptions} "$R8" "-ms" $R7
4507 ; Default install type
4508 StrCpy $InstallType ${INSTALLTYPE_BASIC}
4509 ; Support for specifying an installation configuration file.
4511 ${GetOptions} "$R8" "/INI=" $R7
4513 ; The configuration file must also exist
4514 ${If} ${FileExists} "$R7"
4516 ReadINIStr $R8 $R7 "Install" "InstallDirectoryName"
4518 StrCpy $INSTDIR "$PROGRAMFILES\$R8"
4520 ReadINIStr $R8 $R7 "Install" "InstallDirectoryPath"
4522 StrCpy $INSTDIR "$R8"
4526 ${If} $INSTDIR == ""
4527 ; Check if there is an existing uninstall registry entry for this
4528 ; version of the application and if present install into that location
4529 StrCpy $R6 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})"
4530 ReadRegStr $R8 HKLM "$R6" "InstallLocation"
4532 StrCpy $INSTDIR "$PROGRAMFILES\${BrandFullName}"
4534 GetFullPathName $INSTDIR "$R8"
4535 ${Unless} ${FileExists} "$INSTDIR"
4536 StrCpy $INSTDIR "$PROGRAMFILES\${BrandFullName}"
4541 ; Quit if we are unable to create the installation directory or we are
4542 ; unable to write to a file in the installation directory.
4544 ${If} ${FileExists} "$INSTDIR"
4545 GetTempFileName $R6 "$INSTDIR"
4547 FileWrite $R5 "Write Access Test"
4551 ; Nothing initialized so no need to call OnEndCommon
4555 CreateDirectory "$INSTDIR"
4557 ; Nothing initialized so no need to call OnEndCommon
4562 ReadINIStr $R8 $R7 "Install" "CloseAppNoPrompt"
4564 ; Try to close the app if the exe is in use.
4566 ${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
4567 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
4571 ${CloseApp} "false" ""
4573 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
4574 ; If unsuccessful try one more time and if it still fails Quit
4577 ${CloseApp} "false" ""
4579 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
4581 ; Nothing initialized so no need to call OnEndCommon
4588 ReadINIStr $R8 $R7 "Install" "QuickLaunchShortcut"
4589 ${If} $R8 == "false"
4590 StrCpy $AddQuickLaunchSC "0"
4592 StrCpy $AddQuickLaunchSC "1"
4595 ReadINIStr $R8 $R7 "Install" "DesktopShortcut"
4596 ${If} $R8 == "false"
4597 StrCpy $AddDesktopSC "0"
4599 StrCpy $AddDesktopSC "1"
4602 ReadINIStr $R8 $R7 "Install" "StartMenuShortcuts"
4603 ${If} $R8 == "false"
4604 StrCpy $AddStartMenuSC "0"
4606 StrCpy $AddStartMenuSC "1"
4609 ReadINIStr $R8 $R7 "Install" "StartMenuDirectoryName"
4611 StrCpy $StartMenuDir "$R8"
4616 ; Support for the deprecated -ms command line argument. The new command
4617 ; line arguments are not supported when -ms is used.
4634 !macro InstallOnInitCommonCall _WARN_UNSUPPORTED_MSG
4636 !verbose ${_MOZFUNC_VERBOSE}
4637 Push "${_WARN_UNSUPPORTED_MSG}"
4638 Call InstallOnInitCommon
4643 * Called from the uninstaller's .onInit function not to be confused with the
4644 * installer's .onInit or the uninstaller's un.onInit functions.
4646 !macro UninstallOnInitCommon
4648 !ifndef UninstallOnInitCommon
4649 !insertmacro ElevateUAC
4650 !insertmacro GetLongPath
4651 !insertmacro GetOptions
4652 !insertmacro GetParameters
4653 !insertmacro UnloadUAC
4654 !insertmacro UpdateUninstallLog
4657 !verbose ${_MOZFUNC_VERBOSE}
4658 !define UninstallOnInitCommon "!insertmacro UninstallOnInitCommonCall"
4660 Function UninstallOnInitCommon
4661 ; Prevents breaking Thunderbird
4662 !ifdef SetBrandNameVars
4663 ${SetBrandNameVars} "$EXEDIR\distribution\setup.ini"
4666 ; Prevent launching the application when a reboot is required and this
4667 ; executable is the main application executable
4668 IfFileExists "$EXEDIR\${FileMainEXE}.moz-upgrade" +1 +4
4669 MessageBox MB_YESNO "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2
4671 Quit ; Nothing initialized so no need to call OnEndCommon
4673 GetFullPathName $INSTDIR "$EXEDIR\.."
4674 ${GetLongPath} "$INSTDIR" $INSTDIR
4675 IfFileExists "$INSTDIR\${FileMainEXE}" +2 +1
4676 Quit ; Nothing initialized so no need to call OnEndCommon
4678 ; Prevents breaking Thunderbird
4679 !ifdef SetBrandNameVars
4680 ${SetBrandNameVars} "$INSTDIR\distribution\setup.ini"
4683 ; Prevent all operations (e.g. set as default, postupdate, etc.) when a
4684 ; reboot is required and the executable launched is helper.exe
4685 IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4
4686 MessageBox MB_YESNO "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2
4688 Quit ; Nothing initialized so no need to call OnEndCommon
4690 ${GetParameters} $R0
4692 StrCmp "$R0" "" continue +1
4694 ; Require elevation if the user can elevate
4696 ${GetOptions} "$R0" "/HideShortcuts" $R2
4697 IfErrors showshortcuts +1
4702 ; Require elevation if the user can elevate
4705 ${GetOptions} "$R0" "/ShowShortcuts" $R2
4706 IfErrors defaultappuser +1
4711 ; Require elevation if the the StartMenuInternet registry keys require
4712 ; updating and the user can elevate
4715 ${GetOptions} "$R0" "/SetAsDefaultAppUser" $R2
4716 IfErrors defaultappglobal +1
4717 ${SetAsDefaultAppUser}
4720 ; Require elevation if the user can elevate
4723 ${GetOptions} "$R0" "/SetAsDefaultAppGlobal" $R2
4724 IfErrors postupdate +1
4726 ${SetAsDefaultAppGlobal}
4729 ; Do not attempt to elevate. The application launching this executable is
4730 ; responsible for elevation if it is required.
4732 ${WordReplace} "$R0" "$\"" "" "+" $R0
4734 ${GetOptions} "$R0" "/PostUpdate" $R2
4735 IfErrors continue +1
4736 ; If the uninstall.log does not exist don't perform post update
4737 ; operations. This prevents updating the registry for zip builds.
4738 IfFileExists "$EXEDIR\uninstall.log" +1 finish
4741 ${GetOptions} "$R0" "/UninstallLog=" $R2
4742 IfErrors updateuninstalllog +1
4743 StrCmp "$R2" "" finish +1
4744 GetFullPathName $R3 "$R2"
4745 IfFileExists "$R3" +1 finish
4746 Delete "$INSTDIR\uninstall\*wizard*"
4747 Delete "$INSTDIR\uninstall\uninstall.log"
4748 CopyFiles /SILENT /FILESONLY "$R3" "$INSTDIR\uninstall\"
4749 ${GetParent} "$R3" $R4
4754 ; Do not attempt to elevate. The application launching this executable is
4755 ; responsible for elevation if it is required.
4757 ${UpdateUninstallLog}
4761 System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
4762 Quit ; Nothing initialized so no need to call OnEndCommon
4766 ; If the uninstall.log does not exist don't perform uninstall
4767 ; operations. This prevents running the uninstaller for zip builds.
4768 IfFileExists "$INSTDIR\uninstall\uninstall.log" +2 +1
4769 Quit ; Nothing initialized so no need to call OnEndCommon
4771 ; Require elevation if the user can elevate
4774 ; If we made it this far then this installer is being used as an uninstaller.
4775 WriteUninstaller "$EXEDIR\uninstaller.exe"
4777 StrCpy $R1 "$\"$EXEDIR\uninstaller.exe$\""
4778 StrCmp $R0 "/S" +1 +2
4779 StrCpy $R1 "$\"$EXEDIR\uninstaller.exe$\" /S"
4781 ; When the uninstaller is launched it copies itself to the temp directory
4782 ; so it won't be in use so it can delete itself.
4784 ${DeleteFile} "$EXEDIR\uninstaller.exe"
4787 Quit ; Nothing initialized so no need to call OnEndCommon
4795 !macro UninstallOnInitCommonCall
4797 !verbose ${_MOZFUNC_VERBOSE}
4798 Call UninstallOnInitCommon
4803 * Called from the MUI preDirectory function
4805 * $R9 = returned value from GetSingleInstallPath, CheckDiskSpace, and
4806 * CanWriteToInstallDir macros
4808 !macro PreDirectoryCommon
4810 !ifndef PreDirectoryCommon
4811 !insertmacro CanWriteToInstallDir
4812 !insertmacro CheckDiskSpace
4813 !insertmacro GetLongPath
4815 !ifndef NO_INSTDIR_FROM_REG
4816 !insertmacro GetSingleInstallPath
4820 !verbose ${_MOZFUNC_VERBOSE}
4821 !define PreDirectoryCommon "!insertmacro PreDirectoryCommonCall"
4823 Function PreDirectoryCommon
4826 !ifndef NO_INSTDIR_FROM_REG
4827 SetShellVarContext all ; Set SHCTX to HKLM
4828 ${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
4830 StrCmp "$R9" "false" +1 fix_install_dir
4832 SetShellVarContext current ; Set SHCTX to HKCU
4833 ${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
4836 StrCmp "$R9" "false" +2 +1
4837 StrCpy $INSTDIR "$R9"
4840 IfFileExists "$INSTDIR" +1 check_install_dir
4842 ; Always display the long path if the path already exists.
4843 ${GetLongPath} "$INSTDIR" $INSTDIR
4845 ; The call to GetLongPath returns a long path without a trailing
4846 ; back-slash. Append a \ to the path to prevent the directory
4847 ; name from being appended when using the NSIS create new folder.
4848 ; http://www.nullsoft.com/free/nsis/makensis.htm#InstallDir
4849 StrCpy $INSTDIR "$INSTDIR\"
4852 IntCmp $InstallType ${INSTALLTYPE_CUSTOM} end +1 +1
4853 ${CheckDiskSpace} $R9
4854 StrCmp $R9 "false" end +1
4855 ${CanWriteToInstallDir} $R9
4856 StrCmp $R9 "false" end +1
4868 !macro PreDirectoryCommonCall
4870 !verbose ${_MOZFUNC_VERBOSE}
4871 Call PreDirectoryCommon
4876 * Called from the MUI leaveDirectory function
4878 * @param _WARN_DISK_SPACE
4879 * Message displayed when there isn't enough disk space to perform the
4881 * @param _WARN_WRITE_ACCESS
4882 * Message displayed when the installer does not have write access to
4885 * $R7 = returned value from CheckDiskSpace and CanWriteToInstallDir macros
4886 * $R8 = _WARN_DISK_SPACE
4887 * $R9 = _WARN_WRITE_ACCESS
4889 !macro LeaveDirectoryCommon
4891 !ifndef LeaveDirectoryCommon
4892 !insertmacro CheckDiskSpace
4893 !insertmacro CanWriteToInstallDir
4896 !verbose ${_MOZFUNC_VERBOSE}
4897 !define LeaveDirectoryCommon "!insertmacro LeaveDirectoryCommonCall"
4899 Function LeaveDirectoryCommon
4905 ${CheckDiskSpace} $R7
4906 StrCmp $R7 "false" +1 +3
4907 MessageBox MB_OK "$R8"
4910 ${CanWriteToInstallDir} $R7
4911 StrCmp $R7 "false" +1 +3
4912 MessageBox MB_OK "$R9"
4925 !macro LeaveDirectoryCommonCall _WARN_DISK_SPACE _WARN_WRITE_ACCESS
4927 Push "${_WARN_DISK_SPACE}"
4928 Push "${_WARN_WRITE_ACCESS}"
4929 !verbose ${_MOZFUNC_VERBOSE}
4930 Call LeaveDirectoryCommon
4935 ################################################################################
4936 # Install Section common macros.
4939 * Performs common cleanup operations prior to the actual installation.
4940 * This macro should be called first when installation starts.
4942 !macro InstallStartCleanupCommon
4944 !ifndef InstallStartCleanupCommon
4945 !insertmacro CleanVirtualStore
4946 !insertmacro EndUninstallLog
4947 !insertmacro ParseRemovedFilesLog
4948 !insertmacro UpdateFromPreviousLog
4951 !verbose ${_MOZFUNC_VERBOSE}
4952 !define InstallStartCleanupCommon "!insertmacro InstallStartCleanupCommonCall"
4954 Function InstallStartCleanupCommon
4956 ; Remove files not removed by parsing the removed-files.log
4957 Delete "$INSTDIR\install_wizard.log"
4958 Delete "$INSTDIR\install_status.log"
4960 RmDir /r "$INSTDIR\updates"
4961 Delete "$INSTDIR\updates.xml"
4962 Delete "$INSTDIR\active-update.xml"
4964 RmDir /r "$INSTDIR\distribution"
4966 ; Remove files from the uninstall directory.
4967 IfFileExists "$INSTDIR\uninstall" +1 +7
4968 Delete "$INSTDIR\uninstall\*wizard*"
4969 Delete "$INSTDIR\uninstall\uninstall.ini"
4970 Delete "$INSTDIR\uninstall\cleanup.log"
4971 Delete "$INSTDIR\uninstall\uninstall.update"
4972 IfFileExists "$INSTDIR\uninstall\uninstall.log" +1 +2
4973 Rename "$INSTDIR\uninstall\uninstall.log" "$INSTDIR\uninstall\uninstall.bak"
4975 ; Since we write to the uninstall.log in this directory during the
4976 ; installation create the directory if it doesn't already exist.
4977 IfFileExists "$INSTDIR\uninstall" +2 +1
4978 CreateDirectory "$INSTDIR\uninstall"
4980 ; Remove files that may be left behind by the application in the
4981 ; VirtualStore directory.
4982 ${CleanVirtualStore}
4984 ; Remove the files and directories in the removed-files.log
4985 ${ParseRemovedFilesLog}
4992 !macro InstallStartCleanupCommonCall
4994 !verbose ${_MOZFUNC_VERBOSE}
4995 Call InstallStartCleanupCommon
5000 * Performs common cleanup operations after the actual installation.
5001 * This macro should be called last during the installation.
5003 !macro InstallEndCleanupCommon
5005 !ifndef InstallEndCleanupCommon
5006 !insertmacro EndUninstallLog
5007 !insertmacro UpdateFromPreviousLog
5010 !verbose ${_MOZFUNC_VERBOSE}
5011 !define InstallEndCleanupCommon "!insertmacro InstallEndCleanupCommonCall"
5013 Function InstallEndCleanupCommon
5015 ; Close the file handle to the uninstall.log
5017 ${UpdateFromPreviousLog}
5025 !macro InstallEndCleanupCommonCall
5027 !verbose ${_MOZFUNC_VERBOSE}
5028 Call InstallEndCleanupCommon
5033 ################################################################################
5034 # UAC Related Macros
5037 * Provides UAC elevation support for Vista and above (requires the UAC plugin).
5039 * $0 = return values from calls to the UAC plugin (always uses $0)
5040 * $R9 = return values from GetParameters and GetOptions macros
5044 !ifndef ${_MOZFUNC_UN}ElevateUAC
5045 !ifdef USE_UAC_PLUGIN
5046 !ifdef ___WINVER__NSH___
5047 !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
5048 !insertmacro ${_MOZFUNC_UN_TMP}GetOptions
5049 !insertmacro ${_MOZFUNC_UN_TMP}GetParameters
5051 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
5052 !undef _MOZFUNC_UN_TMP
5057 !verbose ${_MOZFUNC_VERBOSE}
5058 !define ${_MOZFUNC_UN}ElevateUAC "!insertmacro ${_MOZFUNC_UN}ElevateUACCall"
5060 Function ${_MOZFUNC_UN}ElevateUAC
5061 ; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
5062 !ifdef USE_UAC_PLUGIN
5063 !ifdef ___WINVER__NSH___
5067 ${If} ${AtLeastWinVista}
5069 ; If the user is not an admin already
5072 ; If the system supports UAC
5074 UAC::GetElevationType
5075 ; If the user account has a split token
5079 ; Nothing besides UAC initialized so no need to call OnEndCommon
5084 ${GetParameters} $R9
5087 ${GetOptions} "$R9" "/UAC:" $0
5088 ; If the command line contains /UAC then we need to initialize
5089 ; the UAC plugin to use UAC::ExecCodeSegment to execute code in
5090 ; the non-elevated context.
5108 !macro ElevateUACCall
5110 !verbose ${_MOZFUNC_VERBOSE}
5115 !macro un.ElevateUACCall
5117 !verbose ${_MOZFUNC_VERBOSE}
5122 !macro un.ElevateUAC
5123 !ifndef un.ElevateUAC
5125 !verbose ${_MOZFUNC_VERBOSE}
5127 !define _MOZFUNC_UN "un."
5129 !insertmacro ElevateUAC
5138 * Unloads the UAC plugin so the NSIS plugins can be removed when the installer
5139 * and uninstaller exit.
5141 * $R9 = return values from GetParameters and GetOptions macros
5145 !ifndef ${_MOZFUNC_UN}UnloadUAC
5146 !ifdef USE_UAC_PLUGIN
5147 !ifdef ___WINVER__NSH___
5148 !define _MOZFUNC_UN_TMP_UnloadUAC ${_MOZFUNC_UN}
5149 !insertmacro ${_MOZFUNC_UN_TMP_UnloadUAC}GetOptions
5150 !insertmacro ${_MOZFUNC_UN_TMP_UnloadUAC}GetParameters
5152 !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP_UnloadUAC}
5153 !undef _MOZFUNC_UN_TMP_UnloadUAC
5158 !verbose ${_MOZFUNC_VERBOSE}
5159 !define ${_MOZFUNC_UN}UnloadUAC "!insertmacro ${_MOZFUNC_UN}UnloadUACCall"
5161 Function ${_MOZFUNC_UN}UnloadUAC
5162 !ifdef USE_UAC_PLUGIN
5163 !ifdef ___WINVER__NSH___
5166 ${Unless} ${AtLeastWinVista}
5171 ${${_MOZFUNC_UN}GetParameters} $R9
5172 ${${_MOZFUNC_UN}GetOptions} "$R9" "/UAC:" $R9
5173 ; If the command line contains /UAC then we need to unload the UAC plugin
5188 !macro UnloadUACCall
5190 !verbose ${_MOZFUNC_VERBOSE}
5195 !macro un.UnloadUACCall
5197 !verbose ${_MOZFUNC_VERBOSE}
5203 !ifndef un.UnloadUAC
5205 !verbose ${_MOZFUNC_VERBOSE}
5207 !define _MOZFUNC_UN "un."
5209 !insertmacro UnloadUAC
5218 ################################################################################
5219 # Macros for logging
5221 # Since these are used by other macros they should be inserted first. All of
5222 # these macros can be easily inserted using the _LoggingCommon macro.
5225 * Adds all logging macros in the correct order in one fell swoop as well as
5226 * the vars for the install.log and uninstall.log file handles.
5228 !macro _LoggingCommon
5229 Var /GLOBAL fhInstallLog
5230 Var /GLOBAL fhUninstallLog
5231 !insertmacro StartInstallLog
5232 !insertmacro EndInstallLog
5233 !insertmacro StartUninstallLog
5234 !insertmacro EndUninstallLog
5236 !define _LoggingCommon "!insertmacro _LoggingCommon"
5239 * Creates a file named install.log in the install directory (e.g. $INSTDIR)
5240 * and adds the installation started message to the install.log for this
5241 * installation. This also adds the fhInstallLog and fhUninstallLog vars used
5244 * $fhInstallLog = filehandle for $INSTDIR\install.log
5247 * Typically the BrandFullName
5249 * The locale identifier
5250 * @param _APP_VERSION
5251 * The application version
5252 * @param _GRE_VERSION
5253 * The Gecko Runtime Engine version
5257 * $R8 = _APP_VERSION
5258 * $R9 = _GRE_VERSION
5260 !macro StartInstallLog
5262 !ifndef StartInstallLog
5263 !insertmacro GetTime
5266 !verbose ${_MOZFUNC_VERBOSE}
5267 !define StartInstallLog "!insertmacro StartInstallLogCall"
5269 Function StartInstallLog
5285 FileOpen $fhInstallLog "$INSTDIR\install.log" w
5287 ${GetTime} "" "L" $9 $R0 $R1 $R2 $R3 $R4 $R5
5288 FileWrite $fhInstallLog "$R6 Installation Started: $R1-$R0-$9 $R3:$R4:$R5"
5289 ${WriteLogSeparator}
5291 ${LogHeader} "Installation Details"
5292 ${LogMsg} "Install Dir: $INSTDIR"
5293 ${LogMsg} "Locale : $R7"
5294 ${LogMsg} "App Version: $R8"
5295 ${LogMsg} "GRE Version: $R9"
5317 !macro StartInstallLogCall _APP_NAME _AB_CD _APP_VERSION _GRE_VERSION
5319 !verbose ${_MOZFUNC_VERBOSE}
5322 Push "${_APP_VERSION}"
5323 Push "${_GRE_VERSION}"
5324 Call StartInstallLog
5329 * Writes the installation finished message to the install.log and closes the
5330 * file handles to the install.log and uninstall.log
5336 !macro EndInstallLog
5338 !ifndef EndInstallLog
5339 !insertmacro GetTime
5342 !verbose ${_MOZFUNC_VERBOSE}
5343 !define EndInstallLog "!insertmacro EndInstallLogCall"
5345 Function EndInstallLog
5355 ${WriteLogSeparator}
5356 ${GetTime} "" "L" $R2 $R3 $R4 $R5 $R6 $R7 $R8
5357 FileWrite $fhInstallLog "$R9 Installation Finished: $R4-$R3-$R2 $R6:$R7:$R8$\r$\n"
5358 FileClose $fhInstallLog
5374 !macro EndInstallLogCall _APP_NAME
5376 !verbose ${_MOZFUNC_VERBOSE}
5383 * Opens the file handle to the uninstall.log.
5385 * $fhUninstallLog = filehandle for $INSTDIR\uninstall\uninstall.log
5387 !macro StartUninstallLog
5389 !ifndef StartUninstallLog
5391 !verbose ${_MOZFUNC_VERBOSE}
5392 !define StartUninstallLog "!insertmacro StartUninstallLogCall"
5394 Function StartUninstallLog
5395 FileOpen $fhUninstallLog "$INSTDIR\uninstall\uninstall.log" w
5402 !macro StartUninstallLogCall
5404 !verbose ${_MOZFUNC_VERBOSE}
5405 Call StartUninstallLog
5410 * Closes the file handle to the uninstall.log.
5412 !macro EndUninstallLog
5414 !ifndef EndUninstallLog
5417 !verbose ${_MOZFUNC_VERBOSE}
5418 !define EndUninstallLog "!insertmacro EndUninstallLogCall"
5420 Function EndUninstallLog
5421 FileClose $fhUninstallLog
5428 !macro EndUninstallLogCall
5430 !verbose ${_MOZFUNC_VERBOSE}
5431 Call EndUninstallLog
5436 * Adds a section header to the human readable log.
5439 * The header text to write to the log.
5441 !macro LogHeader _HEADER
5442 ${WriteLogSeparator}
5443 FileWrite $fhInstallLog "${_HEADER}"
5444 ${WriteLogSeparator}
5446 !define LogHeader "!insertmacro LogHeader"
5449 * Adds a section message to the human readable log.
5452 * The message text to write to the log.
5455 FileWrite $fhInstallLog " ${_MSG}$\r$\n"
5457 !define LogMsg "!insertmacro LogMsg"
5460 * Adds an uninstall entry to the uninstall log.
5463 * The message text to write to the log.
5465 !macro LogUninstall _MSG
5466 FileWrite $fhUninstallLog "${_MSG}$\r$\n"
5468 !define LogUninstall "!insertmacro LogUninstall"
5471 * Adds a section divider to the human readable log.
5473 !macro WriteLogSeparator
5474 FileWrite $fhInstallLog "$\r$\n----------------------------------------\
5475 ---------------------------------------$\r$\n"
5477 !define WriteLogSeparator "!insertmacro WriteLogSeparator"