1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
################################################################################
7
# Helper defines and macros for toolkit applications
10
* Avoid creating macros / functions that overwrite registers (see the
11
* GetLongPath macro for one way to avoid this)!
13
* Before using the registers exchange the passed in params and save existing
14
* register values to the stack.
16
* Exch $R9 ; exhange the original $R9 with the top of the stack
17
* Exch 1 ; exchange the top of the stack with 1 below the top of the stack
18
* Exch $R8 ; exchange the original $R8 with the top of the stack
19
* Exch 2 ; exchange the top of the stack with 2 below the top of the stack
20
* Exch $R7 ; exchange the original $R7 with the top of the stack
21
* Push $R6 ; push the original $R6 onto the top of the stack
22
* Push $R5 ; push the original $R5 onto the top of the stack
23
* Push $R4 ; push the original $R4 onto the top of the stack
27
* ; Restore the values.
28
* Pop $R4 ; restore the value for $R4 from the top of the stack
29
* Pop $R5 ; restore the value for $R5 from the top of the stack
30
* Pop $R6 ; restore the value for $R6 from the top of the stack
31
* Exch $R7 ; exchange the new $R7 value with the top of the stack
32
* Exch 2 ; exchange the top of the stack with 2 below the top of the stack
33
* Exch $R8 ; exchange the new $R8 value with the top of the stack
34
* Exch 1 ; exchange the top of the stack with 2 below the top of the stack
35
* Exch $R9 ; exchange the new $R9 value with the top of the stack
38
* When inserting macros in common.nsh from another macro in common.nsh that
39
* can be used from the uninstaller _MOZFUNC_UN will be undefined when it is
40
* inserted. Use the following to redefine _MOZFUNC_UN with its original value
41
* (see the RegCleanMain macro for an example).
43
* !define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
44
* !insertmacro ${_MOZFUNC_UN_TMP}FileJoin
45
* !insertmacro ${_MOZFUNC_UN_TMP}LineFind
46
* !insertmacro ${_MOZFUNC_UN_TMP}TextCompareNoDetails
47
* !insertmacro ${_MOZFUNC_UN_TMP}TrimNewLines
49
* !define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
50
* !undef _MOZFUNC_UN_TMP
53
; When including a file provided by NSIS check if its verbose macro is defined
54
; to prevent loading the file a second time.
55
!ifmacrondef TEXTFUNC_VERBOSE
59
!ifmacrondef FILEFUNC_VERBOSE
63
!ifmacrondef LOGICLIB_VERBOSITY
67
!ifndef WINMESSAGES_INCLUDED
68
!include WinMessages.nsh
75
; When including WinVer.nsh check if ___WINVER__NSH___ is defined to prevent
76
; loading the file a second time. NSIS versions prior to 2.21 didn't include
77
; WinVer.nsh so include it with the /NOFATAL option.
78
!ifndef ___WINVER__NSH___
79
!include /NONFATAL WinVer.nsh
84
; NSIS provided macros that we have overridden.
85
!include overrides.nsh
87
!define SHORTCUTS_LOG "shortcuts_log.ini"
90
################################################################################
91
# Macros for debugging
94
* The following two macros assist with verifying that a macro doesn't
95
* overwrite any registers.
98
* ${debugSetRegisters}
100
* ${debugDisplayRegisters}
104
* Sets all register values to their name to assist with verifying that a macro
105
* doesn't overwrite any registers.
107
!macro debugSetRegisters
129
!define debugSetRegisters "!insertmacro debugSetRegisters"
132
* Displays all register values to assist with verifying that a macro doesn't
133
* overwrite any registers.
135
!macro debugDisplayRegisters
137
"Register Values:$\n\
138
$$0 = $0$\n$$1 = $1$\n$$2 = $2$\n$$3 = $3$\n$$4 = $4$\n\
139
$$5 = $5$\n$$6 = $6$\n$$7 = $7$\n$$8 = $8$\n$$9 = $9$\n\
140
$$R0 = $R0$\n$$R1 = $R1$\n$$R2 = $R2$\n$$R3 = $R3$\n$$R4 = $R4$\n\
141
$$R5 = $R5$\n$$R6 = $R6$\n$$R7 = $R7$\n$$R8 = $R8$\n$$R9 = $R9"
143
!define debugDisplayRegisters "!insertmacro debugDisplayRegisters"
146
################################################################################
147
# Modern User Interface (MUI) override macros
149
; Removed macros in nsis 2.33u (ported from nsis 2.22)
150
; MUI_LANGUAGEFILE_DEFINE
151
; MUI_LANGUAGEFILE_LANGSTRING_PAGE
152
; MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE
153
; MUI_LANGUAGEFILE_LANGSTRING_DEFINE
154
; MUI_LANGUAGEFILE_UNLANGSTRING_PAGE
156
!macro MOZ_MUI_LANGUAGEFILE_DEFINE DEFINE NAME
159
!define "${DEFINE}" "${${NAME}}"
165
!macro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE PAGE NAME
167
!ifdef MUI_${PAGE}PAGE
168
LangString "${NAME}" 0 "${${NAME}}"
176
!macro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE PAGE NAME
178
!ifdef MUI_${PAGE}PAGE | MUI_UN${PAGE}PAGE
179
LangString "${NAME}" 0 "${${NAME}}"
187
!macro MOZ_MUI_LANGUAGEFILE_LANGSTRING_DEFINE DEFINE NAME
190
LangString "${NAME}" 0 "${${NAME}}"
196
!macro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE PAGE NAME
198
!ifdef MUI_UNINSTALLER
199
!ifdef MUI_UN${PAGE}PAGE
200
LangString "${NAME}" 0 "${${NAME}}"
211
; Modified version of the following MUI macros to support Mozilla localization.
213
; MUI_LANGUAGEFILE_BEGIN
214
; MOZ_MUI_LANGUAGEFILE_END
215
; See <NSIS App Dir>/Contrib/Modern UI/System.nsh for more information
216
!define MUI_INSTALLOPTIONS_READ "!insertmacro MUI_INSTALLOPTIONS_READ"
218
!macro MOZ_MUI_LANGUAGE LANGUAGE
220
!verbose ${MUI_VERBOSE}
221
!include "${LANGUAGE}.nsh"
225
!macro MOZ_MUI_LANGUAGEFILE_BEGIN LANGUAGE
226
!insertmacro MUI_INSERT
227
!ifndef "MUI_LANGUAGEFILE_${LANGUAGE}_USED"
228
!define "MUI_LANGUAGEFILE_${LANGUAGE}_USED"
229
LoadLanguageFile "${LANGUAGE}.nlf"
231
!error "Modern UI language file ${LANGUAGE} included twice!"
235
; Custom version of MUI_LANGUAGEFILE_END. The macro to add the default MUI
236
; strings and the macros for several strings that are part of the NSIS MUI and
237
; not in our locale files have been commented out.
238
!macro MOZ_MUI_LANGUAGEFILE_END
240
# !include "${NSISDIR}\Contrib\Modern UI\Language files\Default.nsh"
241
!ifdef MUI_LANGUAGEFILE_DEFAULT_USED
242
!undef MUI_LANGUAGEFILE_DEFAULT_USED
243
!warning "${LANGUAGE} Modern UI language file version doesn't match. Using default English texts for missing strings."
246
!insertmacro MOZ_MUI_LANGUAGEFILE_DEFINE "MUI_${LANGUAGE}_LANGNAME" "MUI_LANGNAME"
248
!ifndef MUI_LANGDLL_PUSHLIST
249
!define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} "
251
!ifdef MUI_LANGDLL_PUSHLIST_TEMP
252
!undef MUI_LANGDLL_PUSHLIST_TEMP
254
!define MUI_LANGDLL_PUSHLIST_TEMP "${MUI_LANGDLL_PUSHLIST}"
255
!undef MUI_LANGDLL_PUSHLIST
256
!define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} ${MUI_LANGDLL_PUSHLIST_TEMP}"
259
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE WELCOME "MUI_TEXT_WELCOME_INFO_TITLE"
260
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE WELCOME "MUI_TEXT_WELCOME_INFO_TEXT"
262
!ifdef MUI_TEXT_LICENSE_TITLE
263
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_TEXT_LICENSE_TITLE"
265
!ifdef MUI_TEXT_LICENSE_SUBTITLE
266
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_TEXT_LICENSE_SUBTITLE"
268
!ifdef MUI_INNERTEXT_LICENSE_TOP
269
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_TOP"
272
# !insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM"
274
!ifdef MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX
275
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX"
278
!ifdef MUI_INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS
279
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE LICENSE "MUI_INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS"
282
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE COMPONENTS "MUI_TEXT_COMPONENTS_TITLE"
283
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE COMPONENTS "MUI_TEXT_COMPONENTS_SUBTITLE"
284
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE COMPONENTS "MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE"
285
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE COMPONENTS "MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO"
287
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE DIRECTORY "MUI_TEXT_DIRECTORY_TITLE"
288
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE DIRECTORY "MUI_TEXT_DIRECTORY_SUBTITLE"
290
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_TEXT_STARTMENU_TITLE"
291
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_TEXT_STARTMENU_SUBTITLE"
292
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_INNERTEXT_STARTMENU_TOP"
293
# !insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE STARTMENU "MUI_INNERTEXT_STARTMENU_CHECKBOX"
295
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_INSTALLING_TITLE"
296
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_INSTALLING_SUBTITLE"
298
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_FINISH_TITLE"
299
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_FINISH_SUBTITLE"
301
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_ABORT_TITLE"
302
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE INSTFILES "MUI_TEXT_ABORT_SUBTITLE"
304
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_BUTTONTEXT_FINISH"
305
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_TITLE"
306
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_TEXT"
307
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_INFO_REBOOT"
308
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_REBOOTNOW"
309
!insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_REBOOTLATER"
310
# !insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_RUN"
311
# !insertmacro MOZ_MUI_LANGUAGEFILE_MULTILANGSTRING_PAGE FINISH "MUI_TEXT_FINISH_SHOWREADME"
313
; Support for using the existing MUI_TEXT_ABORTWARNING string
314
!ifdef MOZ_MUI_CUSTOM_ABORT
315
LangString MOZ_MUI_TEXT_ABORTWARNING 0 "${MUI_TEXT_ABORTWARNING}"
318
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_DEFINE MUI_ABORTWARNING "MUI_TEXT_ABORTWARNING"
321
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE WELCOME "MUI_UNTEXT_WELCOME_INFO_TITLE"
322
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE WELCOME "MUI_UNTEXT_WELCOME_INFO_TEXT"
324
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE CONFIRM "MUI_UNTEXT_CONFIRM_TITLE"
325
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE CONFIRM "MUI_UNTEXT_CONFIRM_SUBTITLE"
327
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNTEXT_LICENSE_TITLE"
328
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNTEXT_LICENSE_SUBTITLE"
330
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM"
331
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM_CHECKBOX"
332
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE LICENSE "MUI_UNINNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS"
334
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE COMPONENTS "MUI_UNTEXT_COMPONENTS_TITLE"
335
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE COMPONENTS "MUI_UNTEXT_COMPONENTS_SUBTITLE"
337
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE DIRECTORY "MUI_UNTEXT_DIRECTORY_TITLE"
338
# !insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE DIRECTORY "MUI_UNTEXT_DIRECTORY_SUBTITLE"
340
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_UNINSTALLING_TITLE"
341
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_UNINSTALLING_SUBTITLE"
343
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_FINISH_TITLE"
344
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_FINISH_SUBTITLE"
346
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_ABORT_TITLE"
347
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE INSTFILES "MUI_UNTEXT_ABORT_SUBTITLE"
349
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_TITLE"
350
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_TEXT"
351
!insertmacro MOZ_MUI_LANGUAGEFILE_UNLANGSTRING_PAGE FINISH "MUI_UNTEXT_FINISH_INFO_REBOOT"
353
!insertmacro MOZ_MUI_LANGUAGEFILE_LANGSTRING_DEFINE MUI_UNABORTWARNING "MUI_UNTEXT_ABORTWARNING"
355
!ifndef MUI_LANGDLL_LANGUAGES
356
!define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' "
357
!define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' "
359
!ifdef MUI_LANGDLL_LANGUAGES_TEMP
360
!undef MUI_LANGDLL_LANGUAGES_TEMP
362
!define MUI_LANGDLL_LANGUAGES_TEMP "${MUI_LANGDLL_LANGUAGES}"
363
!undef MUI_LANGDLL_LANGUAGES
365
!ifdef MUI_LANGDLL_LANGUAGES_CP_TEMP
366
!undef MUI_LANGDLL_LANGUAGES_CP_TEMP
368
!define MUI_LANGDLL_LANGUAGES_CP_TEMP "${MUI_LANGDLL_LANGUAGES_CP}"
369
!undef MUI_LANGDLL_LANGUAGES_CP
371
!define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' ${MUI_LANGDLL_LANGUAGES_TEMP}"
372
!define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' ${MUI_LANGDLL_LANGUAGES_CP_TEMP}"
378
* Creates an InstallOptions file with a UTF-16LE BOM and adds the RTL value
379
* to the Settings section.
382
* The name of the file to be created in $PLUGINSDIR.
384
!macro InitInstallOptionsFile _FILE
387
FileOpen $R9 "$PLUGINSDIR\${_FILE}" w
388
FileWriteWord $R9 "65279"
390
WriteIniStr "$PLUGINSDIR\${_FILE}" "Settings" "RTL" "$(^RTL)"
396
################################################################################
397
# Macros for handling files in use
400
* Checks for files in use in the $INSTDIR directory. To check files in
401
* sub-directories this macro would need to be rewritten to create
402
* sub-directories in the temporary directory used to backup the files that are
407
* ; The first string to be pushed onto the stack MUST be "end" to indicate
408
* ; that there are no more files in the $INSTDIR directory to check.
411
* ; The last file pushed should be the app's main exe so if it is in use this
412
* ; macro will return after the first check.
413
* Push "${FileMainEXE}"
414
* ${CheckForFilesInUse} $R9
416
* !IMPORTANT - this macro uses the $R7, $R8, and $R9 registers and makes no
417
* attempt to restore their original values.
420
* false if all of the files popped from the stack are not in use.
421
* True if any of the files popped from the stack are in use.
422
* $R7 = Temporary backup directory where the files will be copied to.
423
* $R8 = value popped from the stack. This will either be a file name for a file
424
* in the $INSTDIR directory or "end" to indicate that there are no
425
* additional files to check.
428
!macro CheckForFilesInUse
430
!ifndef ${_MOZFUNC_UN}CheckForFilesInUse
432
!verbose ${_MOZFUNC_VERBOSE}
433
!define ${_MOZFUNC_UN}CheckForFilesInUse "!insertmacro ${_MOZFUNC_UN}CheckForFilesInUseCall"
435
Function ${_MOZFUNC_UN}CheckForFilesInUse
436
; Create a temporary backup directory.
437
GetTempFileName $R7 "$INSTDIR"
443
${While} $R8 != "end"
444
${Unless} ${FileExists} "$INSTDIR\$R8"
445
Pop $R8 ; get next file to check before continuing
450
CopyFiles /SILENT "$INSTDIR\$R8" "$R7\$R8" ; try to copy
457
Delete "$INSTDIR\$R8" ; delete original
461
Delete "$R7\$R8" ; delete temp copy
465
Pop $R8 ; get next file to check
469
${While} $R8 != "end"
474
SetOutPath "$INSTDIR"
475
CopyFiles /SILENT "$R7\*" "$INSTDIR\"
487
!macro CheckForFilesInUseCall _RESULT
489
!verbose ${_MOZFUNC_VERBOSE}
490
Call CheckForFilesInUse
495
!macro un.CheckForFilesInUseCall _RESULT
497
!verbose ${_MOZFUNC_VERBOSE}
498
Call un.CheckForFilesInUse
503
!macro un.CheckForFilesInUse
504
!ifndef un.CheckForFilesInUse
506
!verbose ${_MOZFUNC_VERBOSE}
508
!define _MOZFUNC_UN "un."
510
!insertmacro CheckForFilesInUse
519
* The macros below will automatically prepend un. to the function names when
520
* they are defined (e.g. !define un.RegCleanMain).
524
!ifndef _MOZFUNC_VERBOSE
525
!define _MOZFUNC_VERBOSE 3
527
!verbose ${_MOZFUNC_VERBOSE}
528
!define MOZFUNC_VERBOSE "!insertmacro MOZFUNC_VERBOSE"
533
!macro MOZFUNC_VERBOSE _VERBOSE
536
!undef _MOZFUNC_VERBOSE
537
!define _MOZFUNC_VERBOSE ${_VERBOSE}
542
* Displays a MessageBox and then calls abort to prevent continuing to the
543
* next page when the specified Window Class is found.
545
* @param _WINDOW_CLASS
546
* The Window Class to search for with FindWindow.
548
* The message text to display in the message box.
550
* $R7 = return value from FindWindow
551
* $R8 = _WINDOW_CLASS
554
!macro ManualCloseAppPrompt
556
!ifndef ${_MOZFUNC_UN}ManualCloseAppPrompt
558
!verbose ${_MOZFUNC_VERBOSE}
559
!define ${_MOZFUNC_UN}ManualCloseAppPrompt "!insertmacro ${_MOZFUNC_UN}ManualCloseAppPromptCall"
561
Function ${_MOZFUNC_UN}ManualCloseAppPrompt
568
${If} $R7 <> 0 ; integer comparison
569
MessageBox MB_OK|MB_ICONQUESTION "$R9"
583
!macro ManualCloseAppPromptCall _WINDOW_CLASS _MSG
585
!verbose ${_MOZFUNC_VERBOSE}
586
Push "${_WINDOW_CLASS}"
588
Call ManualCloseAppPrompt
592
!macro un.ManualCloseAppPromptCall _WINDOW_CLASS _MSG
594
!verbose ${_MOZFUNC_VERBOSE}
595
Push "${_WINDOW_CLASS}"
597
Call un.ManualCloseAppPrompt
601
!macro un.ManualCloseAppPrompt
602
!ifndef un.ManualCloseAppPrompt
604
!verbose ${_MOZFUNC_VERBOSE}
606
!define _MOZFUNC_UN "un."
608
!insertmacro ManualCloseAppPrompt
617
################################################################################
618
# Macros for working with the registry
621
* Writes a registry string using SHCTX and the supplied params and logs the
622
* action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
624
* Define NO_LOG to prevent all logging when calling this from the uninstaller.
627
* The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
628
* This will only be used for logging.
630
* The subkey in relation to the key root.
632
* The key value name to write to.
634
* The string to write to the key value name.
635
* @param _LOG_UNINSTALL
636
* 0 = don't add to uninstall log, 1 = add to uninstall log.
642
* $R9 = _LOG_UNINSTALL
646
!ifndef ${_MOZFUNC_UN}WriteRegStr2
648
!verbose ${_MOZFUNC_VERBOSE}
649
!define ${_MOZFUNC_UN}WriteRegStr2 "!insertmacro ${_MOZFUNC_UN}WriteRegStr2Call"
651
Function ${_MOZFUNC_UN}WriteRegStr2
663
WriteRegStr SHCTX "$R6" "$R7" "$R8"
667
${LogMsg} "** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **"
669
${If} $R9 == 1 ; add to the uninstall log?
670
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
672
${LogMsg} "Added Registry String: $R5 | $R6 | $R7 | $R8"
691
!macro WriteRegStr2Call _ROOT _KEY _NAME _STR _LOG_UNINSTALL
693
!verbose ${_MOZFUNC_VERBOSE}
698
Push "${_LOG_UNINSTALL}"
703
!macro un.WriteRegStr2Call _ROOT _KEY _NAME _STR _LOG_UNINSTALL
705
!verbose ${_MOZFUNC_VERBOSE}
710
Push "${_LOG_UNINSTALL}"
715
!macro un.WriteRegStr2
716
!ifndef un.WriteRegStr2
718
!verbose ${_MOZFUNC_VERBOSE}
720
!define _MOZFUNC_UN "un."
722
!insertmacro WriteRegStr2
731
* Writes a registry dword using SHCTX and the supplied params and logs the
732
* action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
734
* Define NO_LOG to prevent all logging when calling this from the uninstaller.
737
* The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
738
* This will only be used for logging.
740
* The subkey in relation to the key root.
742
* The key value name to write to.
744
* The dword to write to the key value name.
745
* @param _LOG_UNINSTALL
746
* 0 = don't add to uninstall log, 1 = add to uninstall log.
752
* $R9 = _LOG_UNINSTALL
754
!macro WriteRegDWORD2
756
!ifndef ${_MOZFUNC_UN}WriteRegDWORD2
758
!verbose ${_MOZFUNC_VERBOSE}
759
!define ${_MOZFUNC_UN}WriteRegDWORD2 "!insertmacro ${_MOZFUNC_UN}WriteRegDWORD2Call"
761
Function ${_MOZFUNC_UN}WriteRegDWORD2
773
WriteRegDWORD SHCTX "$R6" "$R7" "$R8"
777
${LogMsg} "** ERROR Adding Registry DWord: $R5 | $R6 | $R7 | $R8 **"
779
${If} $R9 == 1 ; add to the uninstall log?
780
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
782
${LogMsg} "Added Registry DWord: $R5 | $R6 | $R7 | $R8"
801
!macro WriteRegDWORD2Call _ROOT _KEY _NAME _DWORD _LOG_UNINSTALL
803
!verbose ${_MOZFUNC_VERBOSE}
808
Push "${_LOG_UNINSTALL}"
813
!macro un.WriteRegDWORD2Call _ROOT _KEY _NAME _DWORD _LOG_UNINSTALL
815
!verbose ${_MOZFUNC_VERBOSE}
820
Push "${_LOG_UNINSTALL}"
821
Call un.WriteRegDWORD2
825
!macro un.WriteRegDWORD2
826
!ifndef un.WriteRegDWORD2
828
!verbose ${_MOZFUNC_VERBOSE}
830
!define _MOZFUNC_UN "un."
832
!insertmacro WriteRegDWORD2
841
* Writes a registry string to HKCR using the supplied params and logs the
842
* action to the install log and the uninstall log if _LOG_UNINSTALL equals 1.
844
* Define NO_LOG to prevent all logging when calling this from the uninstaller.
847
* The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
848
* This will only be used for logging.
850
* The subkey in relation to the key root.
852
* The key value name to write to.
854
* The string to write to the key value name.
855
* @param _LOG_UNINSTALL
856
* 0 = don't add to uninstall log, 1 = add to uninstall log.
862
* $R9 = _LOG_UNINSTALL
864
!macro WriteRegStrHKCR
866
!ifndef ${_MOZFUNC_UN}WriteRegStrHKCR
868
!verbose ${_MOZFUNC_VERBOSE}
869
!define ${_MOZFUNC_UN}WriteRegStrHKCR "!insertmacro ${_MOZFUNC_UN}WriteRegStrHKCRCall"
871
Function ${_MOZFUNC_UN}WriteRegStrHKCR
883
WriteRegStr HKCR "$R6" "$R7" "$R8"
887
${LogMsg} "** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **"
889
${If} $R9 == 1 ; add to the uninstall log?
890
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
892
${LogMsg} "Added Registry String: $R5 | $R6 | $R7 | $R8"
911
!macro WriteRegStrHKCRCall _ROOT _KEY _NAME _STR _LOG_UNINSTALL
913
!verbose ${_MOZFUNC_VERBOSE}
918
Push "${_LOG_UNINSTALL}"
923
!macro un.WriteRegStrHKCRCall _ROOT _KEY _NAME _STR _LOG_UNINSTALL
925
!verbose ${_MOZFUNC_VERBOSE}
930
Push "${_LOG_UNINSTALL}"
931
Call un.WriteRegStrHKCR
935
!macro un.WriteRegStrHKCR
936
!ifndef un.WriteRegStrHKCR
938
!verbose ${_MOZFUNC_VERBOSE}
940
!define _MOZFUNC_UN "un."
942
!insertmacro WriteRegStrHKCR
950
!define KEY_SET_VALUE 0x0002
951
!define KEY_WOW64_64KEY 0x0100
952
!ifndef HAVE_64BIT_OS
953
!define CREATE_KEY_SAM ${KEY_SET_VALUE}
955
!define CREATE_KEY_SAM ${KEY_SET_VALUE}|${KEY_WOW64_64KEY}
959
* Creates a registry key. This will log the actions to the install and
960
* uninstall logs. Alternatively you can set a registry value to create the key
961
* and then delete the value.
963
* Define NO_LOG to prevent all logging when calling this from the uninstaller.
966
* The registry key root as defined by NSIS (e.g. HKLM, HKCU, etc.).
968
* The subkey in relation to the key root.
969
* @param _LOG_UNINSTALL
970
* 0 = don't add to uninstall log, 1 = add to uninstall log.
972
* $R4 = [out] handle to newly created registry key. If this is not a key
973
* located in one of the predefined registry keys this must be closed
974
* with RegCloseKey (this should not be needed unless someone decides to
975
* do something extremely squirrelly with NSIS).
976
* $R5 = return value from RegCreateKeyExW (represented by R5 in the system call).
977
* $R6 = [in] hKey passed to RegCreateKeyExW.
980
* $R9 = _LOG_UNINSTALL
984
!ifndef ${_MOZFUNC_UN}CreateRegKey
986
!verbose ${_MOZFUNC_VERBOSE}
987
!define ${_MOZFUNC_UN}CreateRegKey "!insertmacro ${_MOZFUNC_UN}CreateRegKeyCall"
989
Function ${_MOZFUNC_UN}CreateRegKey
999
StrCmp $R7 "HKCR" +1 +2
1000
StrCpy $R6 "0x80000000"
1001
StrCmp $R7 "HKCU" +1 +2
1002
StrCpy $R6 "0x80000001"
1003
StrCmp $R7 "HKLM" +1 +2
1004
StrCpy $R6 "0x80000002"
1006
; see definition of RegCreateKey
1007
System::Call "Advapi32::RegCreateKeyExW(i R6, w R8, i 0, i 0, i 0,\
1008
i ${CREATE_KEY_SAM}, i 0, *i .R4,\
1012
; if $R5 is not 0 then there was an error creating the registry key.
1014
${LogMsg} "** ERROR Adding Registry Key: $R7 | $R8 **"
1016
${If} $R9 == 1 ; add to the uninstall log?
1017
${LogUninstall} "RegKey: $R7 | $R8"
1019
${LogMsg} "Added Registry Key: $R7 | $R8"
1024
System::Call "Advapi32::RegCloseKey(iR4)"
1040
!macro CreateRegKeyCall _ROOT _KEY _LOG_UNINSTALL
1042
!verbose ${_MOZFUNC_VERBOSE}
1045
Push "${_LOG_UNINSTALL}"
1050
!macro un.CreateRegKeyCall _ROOT _KEY _LOG_UNINSTALL
1052
!verbose ${_MOZFUNC_VERBOSE}
1055
Push "${_LOG_UNINSTALL}"
1056
Call un.CreateRegKey
1060
!macro un.CreateRegKey
1061
!ifndef un.CreateRegKey
1063
!verbose ${_MOZFUNC_VERBOSE}
1065
!define _MOZFUNC_UN "un."
1067
!insertmacro CreateRegKey
1076
* Helper for checking for the existence of a registry key.
1077
* SHCTX is the root key to search.
1080
* Sub key to iterate for the key in question
1082
* Key name to search for
1084
* 'true' / 'false' result
1086
!macro CheckIfRegistryKeyExists
1087
!ifndef CheckIfRegistryKeyExists
1089
!verbose ${_MOZFUNC_VERBOSE}
1090
!define CheckIfRegistryKeyExists "!insertmacro CheckIfRegistryKeyExistsCall"
1092
Function CheckIfRegistryKeyExists
1093
; stack: main key, key
1094
Exch $R9 ; main key, stack: old R9, key
1095
Exch 1 ; stack: key, old R9
1096
Exch $R8 ; key, stack: old R8, old R9
1102
StrCpy $R7 "0" # loop index
1104
EnumRegKey $R6 SHCTX "$R9" "$R7"
1105
${If} "$R6" == "$R8"
1110
${LoopWhile} $R6 != ""
1117
Pop $R7 ; stack: old R8, old R9
1118
Pop $R8 ; stack: old R9
1119
Exch $R9 ; stack: result
1126
!macro CheckIfRegistryKeyExistsCall _MAIN_KEY _KEY _RESULT
1128
!verbose ${_MOZFUNC_VERBOSE}
1131
Call CheckIfRegistryKeyExists
1136
################################################################################
1137
# Macros for adding file and protocol handlers
1140
* Writes common registry values for a handler using SHCTX.
1143
* The subkey in relation to the key root.
1145
* The path and args to launch the application.
1147
* The path to the binary that contains the icon group for the default icon
1148
* followed by a comma and either the icon group's resource index or the icon
1149
* group's resource id prefixed with a minus sign
1151
* The display name for the handler. If emtpy no value will be set.
1152
* @param _ISPROTOCOL
1153
* Sets protocol handler specific registry values when "true".
1155
* Sets DDE specific registry values when "true".
1157
* $R3 = string value of the current registry key path.
1165
!macro AddHandlerValues
1167
!ifndef ${_MOZFUNC_UN}AddHandlerValues
1169
!verbose ${_MOZFUNC_VERBOSE}
1170
!define ${_MOZFUNC_UN}AddHandlerValues "!insertmacro ${_MOZFUNC_UN}AddHandlerValuesCall"
1172
Function ${_MOZFUNC_UN}AddHandlerValues
1186
StrCmp "$R7" "" +6 +1
1187
ReadRegStr $R3 SHCTX "$R4" "FriendlyTypeName"
1189
StrCmp "$R3" "" +1 +3
1190
WriteRegStr SHCTX "$R4" "" "$R7"
1191
WriteRegStr SHCTX "$R4" "FriendlyTypeName" "$R7"
1193
StrCmp "$R8" "true" +1 +2
1194
WriteRegStr SHCTX "$R4" "URL Protocol" ""
1196
ReadRegDWord $R3 SHCTX "$R4" "EditFlags"
1197
StrCmp $R3 "" +1 +3 ; Only add EditFlags if a value doesn't exist
1198
DeleteRegValue SHCTX "$R4" "EditFlags"
1199
WriteRegDWord SHCTX "$R4" "EditFlags" 0x00000002
1201
StrCmp "$R6" "" +2 +1
1202
WriteRegStr SHCTX "$R4\DefaultIcon" "" "$R6"
1204
StrCmp "$R5" "" +2 +1
1205
WriteRegStr SHCTX "$R4\shell\open\command" "" "$R5"
1207
!ifdef DDEApplication
1208
StrCmp "$R9" "true" +1 +11
1209
WriteRegStr SHCTX "$R4\shell\open\ddeexec" "" "$\"%1$\",,0,0,,,,"
1210
WriteRegStr SHCTX "$R4\shell\open\ddeexec" "NoActivateHandler" ""
1211
WriteRegStr SHCTX "$R4\shell\open\ddeexec\Application" "" "${DDEApplication}"
1212
WriteRegStr SHCTX "$R4\shell\open\ddeexec\Topic" "" "WWW_OpenURL"
1213
; The ifexec key may have been added by another application so try to
1214
; delete it to prevent it from breaking this app's shell integration.
1215
; Also, IE 6 and below doesn't remove this key when it sets itself as the
1216
; default handler and if this key exists IE's shell integration breaks.
1217
DeleteRegKey HKLM "$R4\shell\open\ddeexec\ifexec"
1218
DeleteRegKey HKCU "$R4\shell\open\ddeexec\ifexec"
1241
!macro AddHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _ISDDE
1243
!verbose ${_MOZFUNC_VERBOSE}
1248
Push "${_ISPROTOCOL}"
1250
Call AddHandlerValues
1254
!macro un.AddHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _ISDDE
1256
!verbose ${_MOZFUNC_VERBOSE}
1261
Push "${_ISPROTOCOL}"
1263
Call un.AddHandlerValues
1267
!macro un.AddHandlerValues
1268
!ifndef un.AddHandlerValues
1270
!verbose ${_MOZFUNC_VERBOSE}
1272
!define _MOZFUNC_UN "un."
1274
!insertmacro AddHandlerValues
1283
* Writes common registry values for a handler that uses DDE using SHCTX.
1286
* The key name in relation to the HKCR root. SOFTWARE\Classes is
1287
* prefixed to this value when using SHCTX.
1289
* The path and args to launch the application.
1291
* The path to the binary that contains the icon group for the default icon
1292
* followed by a comma and either the icon group's resource index or the icon
1293
* group's resource id prefixed with a minus sign
1295
* The display name for the handler. If emtpy no value will be set.
1296
* @param _ISPROTOCOL
1297
* Sets protocol handler specific registry values when "true".
1298
* @param _DDE_APPNAME
1299
* Sets DDE specific registry values when not an empty string.
1301
* $R0 = storage for SOFTWARE\Classes
1302
* $R1 = string value of the current registry key path.
1308
* $R7 = _DDE_APPNAME
1309
* $R8 = _DDE_DEFAULT
1312
!macro AddDDEHandlerValues
1314
!ifndef ${_MOZFUNC_UN}AddDDEHandlerValues
1316
!verbose ${_MOZFUNC_VERBOSE}
1317
!define ${_MOZFUNC_UN}AddDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDDEHandlerValuesCall"
1319
Function ${_MOZFUNC_UN}AddDDEHandlerValues
1338
StrCpy $R0 "SOFTWARE\Classes"
1339
StrCmp "$R5" "" +6 +1
1340
ReadRegStr $R1 SHCTX "$R2" "FriendlyTypeName"
1342
StrCmp "$R1" "" +1 +3
1343
WriteRegStr SHCTX "$R0\$R2" "" "$R5"
1344
WriteRegStr SHCTX "$R0\$R2" "FriendlyTypeName" "$R5"
1346
StrCmp "$R6" "true" +1 +2
1347
WriteRegStr SHCTX "$R0\$R2" "URL Protocol" ""
1349
ReadRegDWord $R1 SHCTX "$R0\$R2" "EditFlags"
1350
StrCmp $R1 "" +1 +3 ; Only add EditFlags if a value doesn't exist
1351
DeleteRegValue SHCTX "$R0\$R2" "EditFlags"
1352
WriteRegDWord SHCTX "$R0\$R2" "EditFlags" 0x00000002
1354
StrCmp "$R4" "" +2 +1
1355
WriteRegStr SHCTX "$R0\$R2\DefaultIcon" "" "$R4"
1357
WriteRegStr SHCTX "$R0\$R2\shell" "" "open"
1358
WriteRegStr SHCTX "$R0\$R2\shell\open\command" "" "$R3"
1360
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "" "$R8"
1361
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "NoActivateHandler" ""
1362
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Application" "" "$R7"
1363
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Topic" "" "$R9"
1365
; The ifexec key may have been added by another application so try to
1366
; delete it to prevent it from breaking this app's shell integration.
1367
; Also, IE 6 and below doesn't remove this key when it sets itself as the
1368
; default handler and if this key exists IE's shell integration breaks.
1369
DeleteRegKey HKLM "$R0\$R2\shell\open\ddeexec\ifexec"
1370
DeleteRegKey HKCU "$R0\$R2\shell\open\ddeexec\ifexec"
1396
!macro AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
1398
!verbose ${_MOZFUNC_VERBOSE}
1403
Push "${_ISPROTOCOL}"
1404
Push "${_DDE_APPNAME}"
1405
Push "${_DDE_DEFAULT}"
1406
Push "${_DDE_TOPIC}"
1407
Call AddDDEHandlerValues
1411
!macro un.AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
1413
!verbose ${_MOZFUNC_VERBOSE}
1418
Push "${_ISPROTOCOL}"
1419
Push "${_DDE_APPNAME}"
1420
Push "${_DDE_DEFAULT}"
1421
Push "${_DDE_TOPIC}"
1422
Call un.AddDDEHandlerValues
1426
!macro un.AddDDEHandlerValues
1427
!ifndef un.AddDDEHandlerValues
1429
!verbose ${_MOZFUNC_VERBOSE}
1431
!define _MOZFUNC_UN "un."
1433
!insertmacro AddDDEHandlerValues
1442
* Writes common registry values for a handler that DOES NOT use DDE using SHCTX.
1445
* The key name in relation to the HKCR root. SOFTWARE\Classes is
1446
* prefixed to this value when using SHCTX.
1448
* The path and args to launch the application.
1450
* The path to the binary that contains the icon group for the default icon
1451
* followed by a comma and either the icon group's resource index or the icon
1452
* group's resource id prefixed with a minus sign
1454
* The display name for the handler. If emtpy no value will be set.
1455
* @param _ISPROTOCOL
1456
* Sets protocol handler specific registry values when "true".
1458
* $R3 = storage for SOFTWARE\Classes
1459
* $R4 = string value of the current registry key path.
1466
!macro AddDisabledDDEHandlerValues
1468
!ifndef ${_MOZFUNC_UN}AddDisabledDDEHandlerValues
1470
!verbose ${_MOZFUNC_VERBOSE}
1471
!define ${_MOZFUNC_UN}AddDisabledDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDisabledDDEHandlerValuesCall"
1473
Function ${_MOZFUNC_UN}AddDisabledDDEHandlerValues
1474
Exch $R9 ; true if a protocol handler
1476
Exch $R8 ; FriendlyTypeName
1478
Exch $R7 ; icon index
1480
Exch $R6 ; shell\open\command
1484
Push $R3 ; base reg class
1486
StrCpy $R3 "SOFTWARE\Classes"
1487
StrCmp "$R8" "" +6 +1
1488
ReadRegStr $R4 SHCTX "$R5" "FriendlyTypeName"
1490
StrCmp "$R4" "" +1 +3
1491
WriteRegStr SHCTX "$R3\$R5" "" "$R8"
1492
WriteRegStr SHCTX "$R3\$R5" "FriendlyTypeName" "$R8"
1494
StrCmp "$R9" "true" +1 +2
1495
WriteRegStr SHCTX "$R3\$R5" "URL Protocol" ""
1497
ReadRegDWord $R4 SHCTX "$R3\$R5" "EditFlags"
1498
StrCmp $R4 "" +1 +3 ; Only add EditFlags if a value doesn't exist
1499
DeleteRegValue SHCTX "$R3\$R5" "EditFlags"
1500
WriteRegDWord SHCTX "$R3\$R5" "EditFlags" 0x00000002
1502
StrCmp "$R7" "" +2 +1
1503
WriteRegStr SHCTX "$R3\$R5\DefaultIcon" "" "$R7"
1505
; Main command handler for the app
1506
WriteRegStr SHCTX "$R3\$R5\shell\open\command" "" "$R6"
1508
; Drop support for DDE (bug 491947), and remove old dde entries if
1511
; Note, changes in SHCTX should propegate to hkey classes root when
1512
; current user or local machine entries are written. Windows will also
1513
; attempt to propegate entries when a handler is used. CR entries are a
1514
; combination of LM and CU, with CU taking priority.
1516
; To disable dde, an empty shell/ddeexec key must be created in current
1517
; user or local machine. Unfortunately, settings have various different
1518
; behaviors depending on the windows version. The following code attempts
1519
; to address these differences.
1521
; On XP (no SP, SP1, SP2), Vista: An empty default string
1522
; must be set under ddeexec. Empty strings propagate to CR.
1524
; Win7: IE does not configure ddeexec, so issues with left over ddeexec keys
1525
; in LM are reduced. We configure an empty ddeexec key with an empty default
1526
; string in CU to be sure.
1528
DeleteRegKey SHCTX "SOFTWARE\Classes\$R5\shell\open\ddeexec"
1529
WriteRegStr SHCTX "SOFTWARE\Classes\$R5\shell\open\ddeexec" "" ""
1550
!macro AddDisabledDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL
1552
!verbose ${_MOZFUNC_VERBOSE}
1557
Push "${_ISPROTOCOL}"
1558
Call AddDisabledDDEHandlerValues
1562
!macro un.AddDisabledDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL
1564
!verbose ${_MOZFUNC_VERBOSE}
1569
Push "${_ISPROTOCOL}"
1570
Call un.AddDisabledDDEHandlerValues
1574
!macro un.AddDisabledDDEHandlerValues
1575
!ifndef un.AddDisabledDDEHandlerValues
1577
!verbose ${_MOZFUNC_VERBOSE}
1579
!define _MOZFUNC_UN "un."
1581
!insertmacro AddDisabledDDEHandlerValues
1590
################################################################################
1591
# Macros for handling DLL registration
1593
!macro RegisterDLL DLL
1595
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
1596
; (not on Windows XP http://support.microsoft.com/kb/282747) so just use it
1597
; when installing on an x64 systems even when installing an x86 application.
1599
${DisableX64FSRedirection}
1600
ExecWait '"$SYSDIR\regsvr32.exe" /s "${DLL}"'
1601
${EnableX64FSRedirection}
1608
!macro UnregisterDLL DLL
1610
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
1611
; (not on Windows XP http://support.microsoft.com/kb/282747) so just use it
1612
; when installing on an x64 systems even when installing an x86 application.
1614
${DisableX64FSRedirection}
1615
ExecWait '"$SYSDIR\regsvr32.exe" /s /u "${DLL}"'
1616
${EnableX64FSRedirection}
1623
!define RegisterDLL `!insertmacro RegisterDLL`
1624
!define UnregisterDLL `!insertmacro UnregisterDLL`
1627
################################################################################
1628
# Macros for retrieving existing install paths
1631
* Finds a second installation of the application so we can make informed
1632
* decisions about registry operations. This uses SHCTX to determine the
1633
* registry hive so you must call SetShellVarContext first.
1636
* The registry subkey (typically this will be Software\Mozilla).
1638
* false if a second install isn't found, path to the main exe if a
1639
* second install is found.
1641
* $R3 = stores the long path to $INSTDIR
1642
* $R4 = counter for the outer loop's EnumRegKey
1643
* $R5 = return value from ReadRegStr and RemoveQuotesFromPath
1644
* $R6 = return value from GetParent
1645
* $R7 = return value from the loop's EnumRegKey
1646
* $R8 = storage for _KEY
1647
* $R9 = _KEY and _RESULT
1649
!macro GetSecondInstallPath
1651
!ifndef ${_MOZFUNC_UN}GetSecondInstallPath
1652
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
1653
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
1654
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
1655
!insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
1657
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
1658
!undef _MOZFUNC_UN_TMP
1661
!verbose ${_MOZFUNC_VERBOSE}
1662
!define ${_MOZFUNC_UN}GetSecondInstallPath "!insertmacro ${_MOZFUNC_UN}GetSecondInstallPathCall"
1664
Function ${_MOZFUNC_UN}GetSecondInstallPath
1673
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R3
1675
StrCpy $R4 0 ; set the counter for the loop to 0
1676
StrCpy $R8 "$R9" ; Registry key path to search
1677
StrCpy $R9 "false" ; default return value
1680
EnumRegKey $R7 SHCTX $R8 $R4
1681
StrCmp $R7 "" end +1 ; if empty there are no more keys to enumerate
1682
IntOp $R4 $R4 + 1 ; increment the loop's counter
1684
ReadRegStr $R5 SHCTX "$R8\$R7\bin" "PathToExe"
1687
${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R5
1689
IfFileExists "$R5" +1 loop
1690
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
1691
${${_MOZFUNC_UN}GetParent} "$R5" $R6
1692
StrCmp "$R6" "$R3" loop +1
1693
StrCmp "$R6\${FileMainEXE}" "$R5" +1 loop
1712
!macro GetSecondInstallPathCall _KEY _RESULT
1714
!verbose ${_MOZFUNC_VERBOSE}
1716
Call GetSecondInstallPath
1721
!macro un.GetSecondInstallPathCall _KEY _RESULT
1723
!verbose ${_MOZFUNC_VERBOSE}
1725
Call un.GetSecondInstallPath
1730
!macro un.GetSecondInstallPath
1731
!ifndef un.GetSecondInstallPath
1733
!verbose ${_MOZFUNC_VERBOSE}
1735
!define _MOZFUNC_UN "un."
1737
!insertmacro GetSecondInstallPath
1746
* Finds an existing installation path for the application based on the
1747
* application's executable name so we can default to using this path for the
1748
* install. If there is zero or more than one installation of the application
1749
* then we default to the default installation path. This uses SHCTX to
1750
* determine the registry hive to read from so you must call SetShellVarContext
1754
* The registry subkey (typically this will be Software\Mozilla\App Name).
1756
* false if a single install location for this app name isn't found,
1757
* path to the install directory if a single install location is found.
1759
* $R5 = counter for the loop's EnumRegKey
1760
* $R6 = return value from EnumRegKey
1761
* $R7 = return value from ReadRegStr
1762
* $R8 = storage for _KEY
1763
* $R9 = _KEY and _RESULT
1765
!macro GetSingleInstallPath
1767
!ifndef ${_MOZFUNC_UN}GetSingleInstallPath
1768
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
1769
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
1770
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
1771
!insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
1773
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
1774
!undef _MOZFUNC_UN_TMP
1777
!verbose ${_MOZFUNC_VERBOSE}
1778
!define ${_MOZFUNC_UN}GetSingleInstallPath "!insertmacro ${_MOZFUNC_UN}GetSingleInstallPathCall"
1780
Function ${_MOZFUNC_UN}GetSingleInstallPath
1789
StrCpy $R5 0 ; set the counter for the loop to 0
1793
EnumRegKey $R6 SHCTX $R8 $R5
1795
StrCmp $R6 "" cleanup +1 ; if empty there are no more keys to enumerate
1796
IntOp $R5 $R5 + 1 ; increment the loop's counter
1798
ReadRegStr $R7 SHCTX "$R8\$R6\Main" "PathToExe"
1800
${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R7" $R7
1801
GetFullPathName $R7 "$R7"
1804
StrCmp "$R9" "false" +1 +3
1811
StrCmp $R9 "false" end +1
1812
${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
1813
${${_MOZFUNC_UN}GetParent} "$R9" $R9
1829
!macro GetSingleInstallPathCall _KEY _RESULT
1831
!verbose ${_MOZFUNC_VERBOSE}
1833
Call GetSingleInstallPath
1838
!macro un.GetSingleInstallPathCall _KEY _RESULT
1840
!verbose ${_MOZFUNC_VERBOSE}
1842
Call un.GetSingleInstallPath
1847
!macro un.GetSingleInstallPath
1848
!ifndef un.GetSingleInstallPath
1850
!verbose ${_MOZFUNC_VERBOSE}
1852
!define _MOZFUNC_UN "un."
1854
!insertmacro GetSingleInstallPath
1863
################################################################################
1864
# Macros for working with the file system
1867
* Attempts to delete a file if it exists. This will fail if the file is in use.
1870
* The path to the file that is to be deleted.
1872
!macro DeleteFile _FILE
1873
${If} ${FileExists} "${_FILE}"
1877
!define DeleteFile "!insertmacro DeleteFile"
1880
* Removes a directory if it exists and is empty.
1883
* The path to the directory that is to be removed.
1885
!macro RemoveDir _DIR
1886
${If} ${FileExists} "${_DIR}"
1890
!define RemoveDir "!insertmacro RemoveDir"
1893
* Checks whether it is possible to create and delete a directory and a file in
1894
* the install directory. Creation and deletion of files and directories are
1895
* checked since a user may have rights for one and not the other. If creation
1896
* and deletion of a file and a directory are successful this macro will return
1897
* true... if not, this it return false.
1900
* true if files and directories can be created and deleted in the
1901
* install directory otherwise false.
1903
* $R8 = temporary filename in the installation directory returned from
1907
!macro CanWriteToInstallDir
1909
!ifndef ${_MOZFUNC_UN}CanWriteToInstallDir
1911
!verbose ${_MOZFUNC_VERBOSE}
1912
!define ${_MOZFUNC_UN}CanWriteToInstallDir "!insertmacro ${_MOZFUNC_UN}CanWriteToInstallDirCall"
1914
Function ${_MOZFUNC_UN}CanWriteToInstallDir
1920
; IfFileExists returns false for $INSTDIR when $INSTDIR is the root of a
1921
; UNC path so always try to create $INSTDIR
1922
CreateDirectory "$INSTDIR\"
1923
GetTempFileName $R8 "$INSTDIR\"
1925
${Unless} ${FileExists} $R8 ; Can files be created?
1931
${If} ${FileExists} $R8 ; Can files be deleted?
1937
${Unless} ${FileExists} $R8 ; Can directories be created?
1943
${If} ${FileExists} $R8 ; Can directories be deleted?
1950
RmDir "$INSTDIR\" ; Only remove $INSTDIR if it is empty
1961
!macro CanWriteToInstallDirCall _RESULT
1963
!verbose ${_MOZFUNC_VERBOSE}
1964
Call CanWriteToInstallDir
1969
!macro un.CanWriteToInstallDirCall _RESULT
1971
!verbose ${_MOZFUNC_VERBOSE}
1972
Call un.CanWriteToInstallDir
1977
!macro un.CanWriteToInstallDir
1978
!ifndef un.CanWriteToInstallDir
1980
!verbose ${_MOZFUNC_VERBOSE}
1982
!define _MOZFUNC_UN "un."
1984
!insertmacro CanWriteToInstallDir
1993
* Checks whether there is sufficient free space available for the installation
1994
* directory using GetDiskFreeSpaceExW which respects disk quotas. This macro
1995
* will calculate the size of all sections that are selected, compare that with
1996
* the free space available, and if there is sufficient free space it will
1997
* return true... if not, it will return false.
2000
* "true" if there is sufficient free space otherwise "false".
2002
* $R5 = return value from SectionGetSize
2003
* $R6 = return value from SectionGetFlags
2004
* return value from an 'and' comparison of SectionGetFlags (1=selected)
2005
* return value for lpFreeBytesAvailable from GetDiskFreeSpaceExW
2006
* return value for System::Int64Op $R6 / 1024
2007
* return value for System::Int64Op $R6 > $R8
2008
* $R7 = the counter for enumerating the sections
2009
* the temporary file name for the directory created under $INSTDIR passed
2010
* to GetDiskFreeSpaceExW.
2011
* $R8 = sum in KB of all selected sections
2014
!macro CheckDiskSpace
2016
!ifndef ${_MOZFUNC_UN}CheckDiskSpace
2018
!verbose ${_MOZFUNC_VERBOSE}
2019
!define ${_MOZFUNC_UN}CheckDiskSpace "!insertmacro ${_MOZFUNC_UN}CheckDiskSpaceCall"
2021
Function ${_MOZFUNC_UN}CheckDiskSpace
2030
StrCpy $R9 "true" ; default return value
2031
StrCpy $R8 "0" ; sum in KB of all selected sections
2032
StrCpy $R7 "0" ; counter for enumerating sections
2034
; Enumerate the sections and sum up the sizes of the sections that are
2036
SectionGetFlags $R7 $R6
2038
IntOp $R6 ${SF_SELECTED} & $R6
2039
IntCmp $R6 0 +3 +1 +1
2040
SectionGetSize $R7 $R5
2045
; The directory passed to GetDiskFreeSpaceExW must exist for the call to
2046
; succeed. Since the CanWriteToInstallDir macro is called prior to this
2047
; macro the call to CreateDirectory will always succeed.
2049
; IfFileExists returns false for $INSTDIR when $INSTDIR is the root of a
2050
; UNC path so always try to create $INSTDIR
2051
CreateDirectory "$INSTDIR\"
2052
GetTempFileName $R7 "$INSTDIR\"
2054
CreateDirectory "$R7"
2056
System::Call 'kernel32::GetDiskFreeSpaceExW(w, *l, *l, *l) i(R7, .R6, ., .) .'
2058
; Convert to KB for comparison with $R8 which is in KB
2059
System::Int64Op $R6 / 1024
2062
System::Int64Op $R6 > $R8
2065
IntCmp $R6 1 end +1 +1
2070
RmDir "$INSTDIR\" ; Only remove $INSTDIR if it is empty
2085
!macro CheckDiskSpaceCall _RESULT
2087
!verbose ${_MOZFUNC_VERBOSE}
2093
!macro un.CheckDiskSpaceCall _RESULT
2095
!verbose ${_MOZFUNC_VERBOSE}
2096
Call un.CheckDiskSpace
2101
!macro un.CheckDiskSpace
2102
!ifndef un.CheckDiskSpace
2104
!verbose ${_MOZFUNC_VERBOSE}
2106
!define _MOZFUNC_UN "un."
2108
!insertmacro CheckDiskSpace
2117
* Returns the path found within a passed in string. The path is quoted or not
2118
* with the exception of an unquoted non 8dot3 path without arguments that is
2119
* also not a DefaultIcon path, is a 8dot3 path or not, has command line
2120
* arguments, or is a registry DefaultIcon path (e.g. <path to binary>,# where #
2121
* is the icon's resuorce id). The string does not need to be a valid path or
2122
* exist. It is up to the caller to pass in a string of one of the forms noted
2123
* above and to verify existence if necessary.
2126
* In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -flag "%1"
2127
* In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE,0
2128
* In: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE
2129
* In: "C:\PROGRA~1\MOZILL~1\FIREFOX.EXE"
2130
* In: "C:\PROGRA~1\MOZILL~1\FIREFOX.EXE" -flag "%1"
2131
* Out: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE
2133
* In: "C:\Program Files\Mozilla Firefox\firefox.exe" -flag "%1"
2134
* In: C:\Program Files\Mozilla Firefox\firefox.exe,0
2135
* In: "C:\Program Files\Mozilla Firefox\firefox.exe"
2136
* Out: C:\Program Files\Mozilla Firefox\firefox.exe
2139
* The string containing the path.
2141
* The register to store the path to.
2143
* $R7 = counter for the outer loop's EnumRegKey
2144
* $R8 = return value from ReadRegStr
2145
* $R9 = _IN_PATH and _OUT_PATH
2147
!macro GetPathFromString
2149
!ifndef ${_MOZFUNC_UN}GetPathFromString
2151
!verbose ${_MOZFUNC_VERBOSE}
2152
!define ${_MOZFUNC_UN}GetPathFromString "!insertmacro ${_MOZFUNC_UN}GetPathFromStringCall"
2154
Function ${_MOZFUNC_UN}GetPathFromString
2159
StrCpy $R7 0 ; Set the counter to 0.
2161
; Handle quoted paths with arguments.
2162
StrCpy $R8 $R9 1 ; Copy the first char.
2163
StrCmp $R8 '"' +2 +1 ; Is it a "?
2164
StrCmp $R8 "'" +1 +9 ; Is it a '?
2165
StrCpy $R9 $R9 "" 1 ; Remove the first char.
2166
IntOp $R7 $R7 + 1 ; Increment the counter.
2167
StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
2168
StrCmp $R8 "" end +1 ; Are there no more chars?
2169
StrCmp $R8 '"' +2 +1 ; Is it a " char?
2170
StrCmp $R8 "'" +1 -4 ; Is it a ' char?
2171
StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
2174
; Handle DefaultIcon paths. DefaultIcon paths are not quoted and end with
2176
IntOp $R7 $R7 - 1 ; Decrement the counter.
2177
StrCpy $R8 $R9 1 $R7 ; Copy one char from the end minus the counter.
2178
StrCmp $R8 '' +4 +1 ; Are there no more chars?
2179
StrCmp $R8 ',' +1 -3 ; Is it a , char?
2180
StrCpy $R9 $R9 $R7 ; Copy chars up to the end minus the counter.
2183
; Handle unquoted paths with arguments. An unquoted path with arguments
2184
; must be an 8dot3 path.
2185
StrCpy $R7 -1 ; Set the counter to -1 so it will start at 0.
2186
IntOp $R7 $R7 + 1 ; Increment the counter.
2187
StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
2188
StrCmp $R8 "" end +1 ; Are there no more chars?
2189
StrCmp $R8 " " +1 -3 ; Is it a space char?
2190
StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
2204
!macro GetPathFromStringCall _IN_PATH _OUT_PATH
2206
!verbose ${_MOZFUNC_VERBOSE}
2208
Call GetPathFromString
2213
!macro un.GetPathFromStringCall _IN_PATH _OUT_PATH
2215
!verbose ${_MOZFUNC_VERBOSE}
2217
Call un.GetPathFromString
2222
!macro un.GetPathFromString
2223
!ifndef un.GetPathFromString
2225
!verbose ${_MOZFUNC_VERBOSE}
2227
!define _MOZFUNC_UN "un."
2229
!insertmacro GetPathFromString
2238
* Removes the quotes from each end of a string if present.
2241
* The string containing the path.
2243
* The register to store the long path.
2245
* $R7 = storage for single character comparison
2246
* $R8 = storage for _IN_PATH
2247
* $R9 = _IN_PATH and _OUT_PATH
2249
!macro RemoveQuotesFromPath
2251
!ifndef ${_MOZFUNC_UN}RemoveQuotesFromPath
2253
!verbose ${_MOZFUNC_VERBOSE}
2254
!define ${_MOZFUNC_UN}RemoveQuotesFromPath "!insertmacro ${_MOZFUNC_UN}RemoveQuotesFromPathCall"
2256
Function ${_MOZFUNC_UN}RemoveQuotesFromPath
2262
StrCmp $R7 "$\"" +1 +2
2263
StrCpy $R9 "$R9" "" 1
2265
StrCpy $R7 "$R9" "" -1
2266
StrCmp $R7 "$\"" +1 +2
2278
!macro RemoveQuotesFromPathCall _IN_PATH _OUT_PATH
2280
!verbose ${_MOZFUNC_VERBOSE}
2282
Call RemoveQuotesFromPath
2287
!macro un.RemoveQuotesFromPathCall _IN_PATH _OUT_PATH
2289
!verbose ${_MOZFUNC_VERBOSE}
2291
Call un.RemoveQuotesFromPath
2296
!macro un.RemoveQuotesFromPath
2297
!ifndef un.RemoveQuotesFromPath
2299
!verbose ${_MOZFUNC_VERBOSE}
2301
!define _MOZFUNC_UN "un."
2303
!insertmacro RemoveQuotesFromPath
2312
* Returns the long path for an existing file or directory. GetLongPathNameW
2313
* may not be available on Win95 if Microsoft Layer for Unicode is not
2314
* installed and GetFullPathName only returns a long path for the last file or
2315
* directory that doesn't end with a \ in the path that it is passed. If the
2316
* path does not exist on the file system this will return an empty string. To
2317
* provide a consistent result trailing back-slashes are always removed.
2319
* Note: 1024 used by GetLongPathNameW is the maximum NSIS string length.
2322
* The string containing the path.
2324
* The register to store the long path.
2326
* $R4 = counter value when the previous \ was found
2327
* $R5 = directory or file name found during loop
2328
* $R6 = return value from GetLongPathNameW and loop counter
2329
* $R7 = long path from GetLongPathNameW and single char from path for comparison
2330
* $R8 = storage for _IN_PATH
2331
* $R9 = _IN_PATH _OUT_PATH
2335
!ifndef ${_MOZFUNC_UN}GetLongPath
2337
!verbose ${_MOZFUNC_VERBOSE}
2338
!define ${_MOZFUNC_UN}GetLongPath "!insertmacro ${_MOZFUNC_UN}GetLongPathCall"
2340
Function ${_MOZFUNC_UN}GetLongPath
2350
GetFullPathName $R8 "$R9"
2351
IfErrors end_GetLongPath +1 ; If the path doesn't exist return an empty string.
2353
System::Call 'kernel32::GetLongPathNameW(w R8, w .R7, i 1024)i .R6'
2354
StrCmp "$R7" "" +4 +1 ; Empty string when GetLongPathNameW is not present.
2355
StrCmp $R6 0 +3 +1 ; Should never equal 0 since the path exists.
2357
GoTo end_GetLongPath
2359
; Do it the hard way.
2360
StrCpy $R4 0 ; Stores the position in the string of the last \ found.
2361
StrCpy $R6 -1 ; Set the counter to -1 so it will start at 0.
2364
IntOp $R6 $R6 + 1 ; Increment the counter.
2365
StrCpy $R7 $R8 1 $R6 ; Starting from the counter copy the next char.
2366
StrCmp $R7 "" +2 +1 ; Are there no more chars?
2367
StrCmp $R7 "\" +1 -3 ; Is it a \?
2369
; Copy chars starting from the previously found \ to the counter.
2370
StrCpy $R5 $R8 $R6 $R4
2372
; If this is the first \ found we want to swap R9 with R5 so a \ will
2373
; be appended to the drive letter and colon (e.g. C: will become C:\).
2378
GetFullPathName $R9 "$R9\$R5"
2380
StrCmp $R7 "" end_GetLongPath +1 ; Are there no more chars?
2382
; Store the counter for the current \ and prefix it for StrCpy operations.
2384
IntOp $R6 $R6 + 1 ; Increment the counter so we skip over the \.
2385
StrCpy $R8 $R8 "" $R6 ; Copy chars starting from the counter to the end.
2386
StrCpy $R6 -1 ; Reset the counter to -1 so it will start over at 0.
2387
GoTo loop_GetLongPath
2390
; If there is a trailing slash remove it
2392
StrCpy $R8 "$R9" "" -1
2393
StrCmp $R8 "\" +1 +2
2410
!macro GetLongPathCall _IN_PATH _OUT_PATH
2412
!verbose ${_MOZFUNC_VERBOSE}
2419
!macro un.GetLongPathCall _IN_PATH _OUT_PATH
2421
!verbose ${_MOZFUNC_VERBOSE}
2428
!macro un.GetLongPath
2429
!ifndef un.GetLongPath
2431
!verbose ${_MOZFUNC_VERBOSE}
2433
!define _MOZFUNC_UN "un."
2435
!insertmacro GetLongPath
2444
################################################################################
2445
# Macros for cleaning up the registry and file system
2448
* Removes registry keys that reference this install location and for paths that
2449
* no longer exist. This uses SHCTX to determine the registry hive so you must
2450
* call SetShellVarContext first.
2453
* The registry subkey (typically this will be Software\Mozilla).
2455
* XXXrstrong - there is the potential for Key: Software/Mozilla/AppName,
2456
* ValueName: CurrentVersion, ValueData: AppVersion to reference a key that is
2457
* no longer available due to this cleanup. This should be no worse than prior
2458
* to this reg cleanup since the referenced key would be for an app that is no
2459
* longer installed on the system.
2461
* $R0 = on x64 systems set to 'false' at the beginning of the macro when
2462
* enumerating the x86 registry view and set to 'true' when enumerating
2463
* the x64 registry view.
2464
* $R1 = stores the long path to $INSTDIR
2465
* $R2 = return value from the stack from the GetParent and GetLongPath macros
2466
* $R3 = return value from the outer loop's EnumRegKey
2467
* $R4 = return value from the inner loop's EnumRegKey
2468
* $R5 = return value from ReadRegStr
2469
* $R6 = counter for the outer loop's EnumRegKey
2470
* $R7 = counter for the inner loop's EnumRegKey
2471
* $R8 = return value from the stack from the RemoveQuotesFromPath macro
2476
!ifndef ${_MOZFUNC_UN}RegCleanMain
2477
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2478
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
2479
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2480
!insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
2482
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2483
!undef _MOZFUNC_UN_TMP
2486
!verbose ${_MOZFUNC_VERBOSE}
2487
!define ${_MOZFUNC_UN}RegCleanMain "!insertmacro ${_MOZFUNC_UN}RegCleanMainCall"
2489
Function ${_MOZFUNC_UN}RegCleanMain
2501
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R1
2502
StrCpy $R6 0 ; set the counter for the outer loop to 0
2506
; Set the registry to the 32 bit registry for 64 bit installations or to
2507
; the 64 bit registry for 32 bit installations at the beginning so it can
2508
; easily be set back to the correct registry view when finished.
2509
!ifdef HAVE_64BIT_OS
2517
EnumRegKey $R3 SHCTX $R9 $R6
2518
StrCmp $R3 "" end +1 ; if empty there are no more keys to enumerate
2519
IntOp $R6 $R6 + 1 ; increment the outer loop's counter
2521
ReadRegStr $R5 SHCTX "$R9\$R3\bin" "PathToExe"
2522
IfErrors 0 outercontinue
2523
StrCpy $R7 0 ; set the counter for the inner loop to 0
2526
EnumRegKey $R4 SHCTX "$R9\$R3" $R7
2527
StrCmp $R4 "" outerloop +1 ; if empty there are no more keys to enumerate
2528
IntOp $R7 $R7 + 1 ; increment the inner loop's counter
2530
ReadRegStr $R5 SHCTX "$R9\$R3\$R4\Main" "PathToExe"
2533
${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R8
2534
${${_MOZFUNC_UN}GetParent} "$R8" $R2
2535
${${_MOZFUNC_UN}GetLongPath} "$R2" $R2
2536
IfFileExists "$R2" +1 innerloop
2537
StrCmp "$R2" "$R1" +1 innerloop
2540
DeleteRegKey SHCTX "$R9\$R3\$R4"
2542
IntOp $R7 $R7 - 1 ; decrement the inner loop's counter when the key is deleted successfully.
2544
DeleteRegKey /ifempty SHCTX "$R9\$R3"
2545
IfErrors innerloop outerdecrement
2548
${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R8
2549
${${_MOZFUNC_UN}GetParent} "$R8" $R2
2550
${${_MOZFUNC_UN}GetLongPath} "$R2" $R2
2551
IfFileExists "$R2" +1 outerloop
2552
StrCmp "$R2" "$R1" +1 outerloop
2555
DeleteRegKey SHCTX "$R9\$R3"
2559
IntOp $R6 $R6 - 1 ; decrement the outer loop's counter when the key is deleted successfully.
2564
${AndIf} "$R0" == "false"
2565
; Set the registry to the correct view.
2566
!ifdef HAVE_64BIT_OS
2572
StrCpy $R6 0 ; set the counter for the outer loop to 0
2595
!macro RegCleanMainCall _KEY
2597
!verbose ${_MOZFUNC_VERBOSE}
2603
!macro un.RegCleanMainCall _KEY
2605
!verbose ${_MOZFUNC_VERBOSE}
2607
Call un.RegCleanMain
2611
!macro un.RegCleanMain
2612
!ifndef un.RegCleanMain
2614
!verbose ${_MOZFUNC_VERBOSE}
2616
!define _MOZFUNC_UN "un."
2618
!insertmacro RegCleanMain
2627
* Removes all registry keys from \Software\Windows\CurrentVersion\Uninstall
2628
* that reference this install location in both the 32 bit and 64 bit registry
2629
* view. This macro uses SHCTX to determine the registry hive so you must call
2630
* SetShellVarContext first.
2632
* $R3 = on x64 systems set to 'false' at the beginning of the macro when
2633
* enumerating the x86 registry view and set to 'true' when enumerating
2634
* the x64 registry view.
2635
* $R4 = stores the long path to $INSTDIR
2636
* $R5 = return value from ReadRegStr
2637
* $R6 = string for the base reg key (e.g. Software\Microsoft\Windows\CurrentVersion\Uninstall)
2638
* $R7 = return value from EnumRegKey
2639
* $R8 = counter for EnumRegKey
2640
* $R9 = return value from the stack from the RemoveQuotesFromPath and GetLongPath macros
2642
!macro RegCleanUninstall
2644
!ifndef ${_MOZFUNC_UN}RegCleanUninstall
2645
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2646
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2647
!insertmacro ${_MOZFUNC_UN_TMP}RemoveQuotesFromPath
2649
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2650
!undef _MOZFUNC_UN_TMP
2653
!verbose ${_MOZFUNC_VERBOSE}
2654
!define ${_MOZFUNC_UN}RegCleanUninstall "!insertmacro ${_MOZFUNC_UN}RegCleanUninstallCall"
2656
Function ${_MOZFUNC_UN}RegCleanUninstall
2665
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R4
2666
StrCpy $R6 "Software\Microsoft\Windows\CurrentVersion\Uninstall"
2672
; Set the registry to the 32 bit registry for 64 bit installations or to
2673
; the 64 bit registry for 32 bit installations at the beginning so it can
2674
; easily be set back to the correct registry view when finished.
2675
!ifdef HAVE_64BIT_OS
2683
EnumRegKey $R7 SHCTX $R6 $R8
2684
StrCmp $R7 "" end +1
2685
IntOp $R8 $R8 + 1 ; Increment the counter
2687
ReadRegStr $R5 SHCTX "$R6\$R7" "InstallLocation"
2689
${${_MOZFUNC_UN}RemoveQuotesFromPath} "$R5" $R9
2690
${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
2691
StrCmp "$R9" "$R4" +1 loop
2693
DeleteRegKey SHCTX "$R6\$R7"
2695
IntOp $R8 $R8 - 1 ; Decrement the counter on successful deletion
2700
${AndIf} "$R3" == "false"
2701
; Set the registry to the correct view.
2702
!ifdef HAVE_64BIT_OS
2729
!macro RegCleanUninstallCall
2731
!verbose ${_MOZFUNC_VERBOSE}
2732
Call RegCleanUninstall
2736
!macro un.RegCleanUninstallCall
2738
!verbose ${_MOZFUNC_VERBOSE}
2739
Call un.RegCleanUninstall
2743
!macro un.RegCleanUninstall
2744
!ifndef un.RegCleanUninstall
2746
!verbose ${_MOZFUNC_VERBOSE}
2748
!define _MOZFUNC_UN "un."
2750
!insertmacro RegCleanUninstall
2759
* Removes an application specific handler registry key under Software\Classes
2760
* for both HKCU and HKLM when its open command refers to this install
2761
* location or the install location doesn't exist.
2763
* @param _HANDLER_NAME
2764
* The registry name for the handler.
2766
* $R7 = stores the long path to the $INSTDIR
2767
* $R8 = stores the path to the open command's parent directory
2768
* $R9 = _HANDLER_NAME
2770
!macro RegCleanAppHandler
2772
!ifndef ${_MOZFUNC_UN}RegCleanAppHandler
2773
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2774
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2775
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
2776
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
2778
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2779
!undef _MOZFUNC_UN_TMP
2782
!verbose ${_MOZFUNC_VERBOSE}
2783
!define ${_MOZFUNC_UN}RegCleanAppHandler "!insertmacro ${_MOZFUNC_UN}RegCleanAppHandlerCall"
2785
Function ${_MOZFUNC_UN}RegCleanAppHandler
2791
ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
2793
${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
2794
${${_MOZFUNC_UN}GetParent} "$R8" $R8
2795
IfFileExists "$R8" +3 +1
2796
DeleteRegKey HKCU "Software\Classes\$R9"
2799
${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
2800
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
2801
StrCmp "$R7" "$R8" +1 next
2802
DeleteRegKey HKCU "Software\Classes\$R9"
2805
ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
2807
${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
2808
${${_MOZFUNC_UN}GetParent} "$R8" $R8
2809
IfFileExists "$R8" +3 +1
2810
DeleteRegKey HKLM "Software\Classes\$R9"
2813
${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
2814
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
2815
StrCmp "$R7" "$R8" +1 end
2816
DeleteRegKey HKLM "Software\Classes\$R9"
2829
!macro RegCleanAppHandlerCall _HANDLER_NAME
2831
!verbose ${_MOZFUNC_VERBOSE}
2832
Push "${_HANDLER_NAME}"
2833
Call RegCleanAppHandler
2837
!macro un.RegCleanAppHandlerCall _HANDLER_NAME
2839
!verbose ${_MOZFUNC_VERBOSE}
2840
Push "${_HANDLER_NAME}"
2841
Call un.RegCleanAppHandler
2845
!macro un.RegCleanAppHandler
2846
!ifndef un.RegCleanAppHandler
2848
!verbose ${_MOZFUNC_VERBOSE}
2850
!define _MOZFUNC_UN "un."
2852
!insertmacro RegCleanAppHandler
2861
* Cleans up the registry for a protocol handler when its open command
2862
* refers to this install location. For HKCU the registry key is deleted
2863
* and for HKLM the values set by the application are deleted.
2865
* @param _HANDLER_NAME
2866
* The registry name for the handler.
2868
* $R7 = stores the long path to $INSTDIR
2869
* $R8 = stores the the long path to the open command's parent directory
2870
* $R9 = _HANDLER_NAME
2872
!macro un.RegCleanProtocolHandler
2874
!ifndef un.RegCleanProtocolHandler
2875
!insertmacro un.GetLongPath
2876
!insertmacro un.GetParent
2877
!insertmacro un.GetPathFromString
2880
!verbose ${_MOZFUNC_VERBOSE}
2881
!define un.RegCleanProtocolHandler "!insertmacro un.RegCleanProtocolHandlerCall"
2883
Function un.RegCleanProtocolHandler
2888
ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
2889
${un.GetLongPath} "$INSTDIR" $R7
2891
StrCmp "$R8" "" next +1
2892
${un.GetPathFromString} "$R8" $R8
2893
${un.GetParent} "$R8" $R8
2894
${un.GetLongPath} "$R8" $R8
2895
StrCmp "$R7" "$R8" +1 next
2896
DeleteRegKey HKCU "Software\Classes\$R9"
2899
ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
2900
StrCmp "$R8" "" end +1
2901
${un.GetLongPath} "$INSTDIR" $R7
2902
${un.GetPathFromString} "$R8" $R8
2903
${un.GetParent} "$R8" $R8
2904
${un.GetLongPath} "$R8" $R8
2905
StrCmp "$R7" "$R8" +1 end
2906
DeleteRegValue HKLM "Software\Classes\$R9\DefaultIcon" ""
2907
DeleteRegValue HKLM "Software\Classes\$R9\shell\open" ""
2908
DeleteRegValue HKLM "Software\Classes\$R9\shell\open\command" ""
2909
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec" ""
2910
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Application" ""
2911
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Topic" ""
2924
!macro un.RegCleanProtocolHandlerCall _HANDLER_NAME
2926
!verbose ${_MOZFUNC_VERBOSE}
2927
Push "${_HANDLER_NAME}"
2928
Call un.RegCleanProtocolHandler
2933
* Cleans up the registry for a file handler when the passed in value equals
2934
* the default value for the file handler. For HKCU the registry key is deleted
2935
* and for HKLM the default value is deleted.
2937
* @param _HANDLER_NAME
2938
* The registry name for the handler.
2939
* @param _DEFAULT_VALUE
2940
* The value to check for against the handler's default value.
2942
* $R6 = stores the long path to $INSTDIR
2943
* $R7 = _DEFAULT_VALUE
2944
* $R9 = _HANDLER_NAME
2946
!macro RegCleanFileHandler
2948
!ifndef ${_MOZFUNC_UN}RegCleanFileHandler
2949
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
2950
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
2951
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
2952
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
2954
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
2955
!undef _MOZFUNC_UN_TMP
2958
!verbose ${_MOZFUNC_VERBOSE}
2959
!define ${_MOZFUNC_UN}RegCleanFileHandler "!insertmacro ${_MOZFUNC_UN}RegCleanFileHandlerCall"
2961
Function ${_MOZFUNC_UN}RegCleanFileHandler
2967
ReadRegStr $R7 HKCU "Software\Classes\$R9" ""
2968
StrCmp "$R7" "$R8" +1 +2
2969
DeleteRegKey HKCU "Software\Classes\$R9"
2971
ReadRegStr $R7 HKLM "Software\Classes\$R9" ""
2972
StrCmp "$R7" "$R8" +1 +2
2973
DeleteRegValue HKLM "Software\Classes\$R9" ""
2987
!macro RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
2989
!verbose ${_MOZFUNC_VERBOSE}
2990
Push "${_DEFAULT_VALUE}"
2991
Push "${_HANDLER_NAME}"
2992
Call RegCleanFileHandler
2996
!macro un.RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
2998
!verbose ${_MOZFUNC_VERBOSE}
2999
Push "${_DEFAULT_VALUE}"
3000
Push "${_HANDLER_NAME}"
3001
Call un.RegCleanFileHandler
3005
!macro un.RegCleanFileHandler
3006
!ifndef un.RegCleanFileHandler
3008
!verbose ${_MOZFUNC_VERBOSE}
3010
!define _MOZFUNC_UN "un."
3012
!insertmacro RegCleanFileHandler
3021
* Checks if a handler's open command points to this installation directory.
3022
* Uses SHCTX to determine the registry hive (e.g. HKLM or HKCU) to check.
3024
* @param _HANDLER_NAME
3025
* The registry name for the handler.
3027
* true if it is the handler's open command points to this
3028
* installation directory and false if it does not.
3030
* $R7 = stores the value of the open command and the path macros return values
3031
* $R8 = stores the handler's registry key name
3032
* $R9 = _DEFAULT_VALUE and _RESULT
3034
!macro IsHandlerForInstallDir
3036
!ifndef ${_MOZFUNC_UN}IsHandlerForInstallDir
3037
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3038
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3039
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
3040
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
3042
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3043
!undef _MOZFUNC_UN_TMP
3046
!verbose ${_MOZFUNC_VERBOSE}
3047
!define ${_MOZFUNC_UN}IsHandlerForInstallDir "!insertmacro ${_MOZFUNC_UN}IsHandlerForInstallDirCall"
3049
Function ${_MOZFUNC_UN}IsHandlerForInstallDir
3056
ReadRegStr $R7 SHCTX "Software\Classes\$R8\shell\open\command" ""
3059
${GetPathFromString} "$R7" $R7
3060
${GetParent} "$R7" $R7
3061
${GetLongPath} "$R7" $R7
3062
${If} $R7 == $INSTDIR
3078
!macro IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
3080
!verbose ${_MOZFUNC_VERBOSE}
3081
Push "${_HANDLER_NAME}"
3082
Call IsHandlerForInstallDir
3087
!macro un.IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
3089
!verbose ${_MOZFUNC_VERBOSE}
3090
Push "${_HANDLER_NAME}"
3091
Call un.IsHandlerForInstallDir
3096
!macro un.IsHandlerForInstallDir
3097
!ifndef un.IsHandlerForInstallDir
3099
!verbose ${_MOZFUNC_VERBOSE}
3101
!define _MOZFUNC_UN "un."
3103
!insertmacro IsHandlerForInstallDir
3112
* Removes the application's VirtualStore directory if present when the
3113
* installation directory is a sub-directory of the program files directory.
3115
* $R4 = $PROGRAMFILES/$PROGRAMFILES64 for CleanVirtualStore_Internal
3116
* $R5 = various path values.
3117
* $R6 = length of the long path to $PROGRAMFILES32 or $PROGRAMFILES64
3118
* $R7 = long path to $PROGRAMFILES32 or $PROGRAMFILES64
3119
* $R8 = length of the long path to $INSTDIR
3120
* $R9 = long path to $INSTDIR
3122
!macro CleanVirtualStore
3124
!ifndef ${_MOZFUNC_UN}CleanVirtualStore
3125
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3126
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3128
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3129
!undef _MOZFUNC_UN_TMP
3132
!verbose ${_MOZFUNC_VERBOSE}
3133
!define ${_MOZFUNC_UN}CleanVirtualStore "!insertmacro ${_MOZFUNC_UN}CleanVirtualStoreCall"
3135
Function ${_MOZFUNC_UN}CleanVirtualStore
3143
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R9
3147
StrCpy $R4 $PROGRAMFILES32
3148
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
3151
StrCpy $R4 $PROGRAMFILES64
3152
Call ${_MOZFUNC_UN}CleanVirtualStore_Internal
3167
Function ${_MOZFUNC_UN}CleanVirtualStore_Internal
3168
${${_MOZFUNC_UN}GetLongPath} "" $R7
3172
; Copy from the start of $INSTDIR the length of $PROGRAMFILES64
3173
StrCpy $R5 "$R9" $R6
3174
${If} "$R5" == "$R7"
3175
; Remove the drive letter and colon from the $INSTDIR long path
3176
StrCpy $R5 "$R9" "" 2
3177
StrCpy $R5 "$LOCALAPPDATA\VirtualStore$R5"
3178
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3180
${AndIf} ${FileExists} "$R5"
3192
!macro CleanVirtualStoreCall
3194
!verbose ${_MOZFUNC_VERBOSE}
3195
Call CleanVirtualStore
3199
!macro un.CleanVirtualStoreCall
3201
!verbose ${_MOZFUNC_VERBOSE}
3202
Call un.CleanVirtualStore
3206
!macro un.CleanVirtualStore
3207
!ifndef un.CleanVirtualStore
3209
!verbose ${_MOZFUNC_VERBOSE}
3211
!define _MOZFUNC_UN "un."
3213
!insertmacro CleanVirtualStore
3222
* If present removes the updates directory located in the profile's local
3223
* directory for this installation.
3225
* @param _REL_PROFILE_PATH
3226
* The relative path to the profile directory from $LOCALAPPDATA.
3228
* $R4 = various path values.
3229
* $R5 = length of the long path to $PROGRAMFILES
3230
* $R6 = length of the long path to $INSTDIR
3231
* $R7 = long path to $PROGRAMFILES
3232
* $R8 = long path to $INSTDIR
3233
* $R9 = _REL_PROFILE_PATH
3235
!macro CleanUpdatesDir
3237
!ifndef ${_MOZFUNC_UN}CleanUpdatesDir
3238
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3239
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3241
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3242
!undef _MOZFUNC_UN_TMP
3245
!verbose ${_MOZFUNC_VERBOSE}
3246
!define ${_MOZFUNC_UN}CleanUpdatesDir "!insertmacro ${_MOZFUNC_UN}CleanUpdatesDirCall"
3248
Function ${_MOZFUNC_UN}CleanUpdatesDir
3256
StrCmp $R9 "" end +1 ; The relative path to the app's profiles is required
3257
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R8
3258
StrCmp $R8 "" end +1
3259
${${_MOZFUNC_UN}GetLongPath} "$PROGRAMFILES" $R7
3260
StrCmp $R7 "" end +1
3264
; Only continue If the length of $INSTDIR is greater than the length of
3266
IntCmp $R6 $R5 end end +1
3268
; Copy from the start of $INSTDIR the length of $PROGRAMFILES
3269
StrCpy $R4 "$R8" $R5
3270
StrCmp "$R4" "$R7" +1 end ; Check if $INSTDIR is under $PROGRAMFILES
3272
; Copy the relative path to $INSTDIR from $PROGRAMFILES
3273
StrCpy $R4 "$R8" "" $R5
3275
; Concatenate the path to $LOCALAPPDATA the relative profile path and the
3276
; relative path to $INSTDIR from $PROGRAMFILES
3277
StrCpy $R4 "$LOCALAPPDATA\$R9$R4"
3278
${${_MOZFUNC_UN}GetLongPath} "$R4" $R4
3279
StrCmp $R4 "" end +1
3281
IfFileExists "$R4\updates" +1 end
3299
!macro CleanUpdatesDirCall _REL_PROFILE_PATH
3301
!verbose ${_MOZFUNC_VERBOSE}
3302
Push "${_REL_PROFILE_PATH}"
3303
Call CleanUpdatesDir
3307
!macro un.CleanUpdatesDirCall _REL_PROFILE_PATH
3309
!verbose ${_MOZFUNC_VERBOSE}
3310
Push "${_REL_PROFILE_PATH}"
3311
Call un.CleanUpdatesDir
3315
!macro un.CleanUpdatesDir
3316
!ifndef un.CleanUpdatesDir
3318
!verbose ${_MOZFUNC_VERBOSE}
3320
!define _MOZFUNC_UN "un."
3322
!insertmacro CleanUpdatesDir
3331
* Deletes all relative profiles specified in an application's profiles.ini and
3332
* performs various other cleanup.
3334
* @param _REL_PROFILE_PATH
3335
* The relative path to the profile directory.
3337
* $R6 = value of IsRelative read from profiles.ini
3338
* $R7 = value of Path to profile read from profiles.ini
3339
* $R8 = counter for reading profiles (e.g. Profile0, Profile1, etc.)
3340
* $R9 = _REL_PROFILE_PATH
3342
!macro DeleteRelativeProfiles
3344
!ifndef ${_MOZFUNC_UN}DeleteRelativeProfiles
3345
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3346
!insertmacro ${_MOZFUNC_UN_TMP}WordReplace
3348
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3349
!undef _MOZFUNC_UN_TMP
3352
!verbose ${_MOZFUNC_VERBOSE}
3353
!define ${_MOZFUNC_UN}DeleteRelativeProfiles "!insertmacro ${_MOZFUNC_UN}DeleteRelativeProfilesCall"
3355
Function ${_MOZFUNC_UN}DeleteRelativeProfiles
3361
SetShellVarContext current
3365
IntOp $R8 $R8 + 1 ; Increment the counter.
3366
ReadINIStr $R7 "$APPDATA\$R9\profiles.ini" "Profile$R8" "Path"
3369
; Only remove relative profiles
3370
ReadINIStr $R6 "$APPDATA\$R9\profiles.ini" "Profile$R8" "IsRelative"
3371
StrCmp "$R6" "1" +1 loop
3373
; Relative paths in profiles.ini use / as a separator
3374
${${_MOZFUNC_UN}WordReplace} "$R7" "/" "\" "+" $R7
3376
IfFileExists "$LOCALAPPDATA\$R9\$R7" +1 +2
3377
RmDir /r "$LOCALAPPDATA\$R9\$R7"
3378
IfFileExists "$APPDATA\$R9\$R7" +1 +2
3379
RmDir /r "$APPDATA\$R9\$R7"
3383
; Remove profiles directory under LOCALAPPDATA (e.g. cache, etc.) since
3384
; they are at times abandoned.
3385
RmDir /r "$LOCALAPPDATA\$R9\Profiles"
3386
RmDir /r "$APPDATA\$R9\Crash Reports"
3387
Delete "$APPDATA\$R9\profiles.ini"
3388
Delete "$APPDATA\$R9\console.log"
3389
Delete "$APPDATA\$R9\pluginreg.dat"
3390
RmDir "$APPDATA\$R9\Profiles"
3391
RmDir "$APPDATA\$R9"
3403
!macro DeleteRelativeProfilesCall _REL_PROFILE_PATH
3405
!verbose ${_MOZFUNC_VERBOSE}
3406
Push "${_REL_PROFILE_PATH}"
3407
Call DeleteRelativeProfiles
3411
!macro un.DeleteRelativeProfilesCall _REL_PROFILE_PATH
3413
!verbose ${_MOZFUNC_VERBOSE}
3414
Push "${_REL_PROFILE_PATH}"
3415
Call un.DeleteRelativeProfiles
3419
!macro un.DeleteRelativeProfiles
3420
!ifndef un.DeleteRelativeProfiles
3422
!verbose ${_MOZFUNC_VERBOSE}
3424
!define _MOZFUNC_UN "un."
3426
!insertmacro DeleteRelativeProfiles
3435
* Deletes shortcuts and Start Menu directories under Programs as specified by
3436
* the shortcuts log ini file and on Windows 7 unpins TaskBar and Start Menu
3437
* shortcuts. The shortcuts will not be deleted if the shortcut target isn't for
3438
* this install location which is determined by the shortcut having a target of
3439
* $INSTDIR\${FileMainEXE}. The context (All Users or Current User) of the
3440
* $DESKTOP and $SMPROGRAMS constants depends on the
3441
* SetShellVarContext setting and must be set by the caller of this macro. There
3442
* is no All Users context for $QUICKLAUNCH but this will not cause a problem
3443
* since the macro will just continue past the $QUICKLAUNCH shortcut deletion
3444
* section on subsequent calls.
3446
* The ini file sections must have the following format (the order of the
3447
* sections in the ini file is not important):
3449
* ; RelativePath is the directory relative from the Start Menu
3450
* ; Programs directory.
3451
* RelativePath=Mozilla App
3452
* ; Shortcut1 is the first shortcut, Shortcut2 is the second shortcut, and so
3453
* ; on. There must not be a break in the sequence of the numbers.
3454
* Shortcut1=Mozilla App.lnk
3455
* Shortcut2=Mozilla App (Safe Mode).lnk
3457
* ; Shortcut1 is the first shortcut, Shortcut2 is the second shortcut, and so
3458
* ; on. There must not be a break in the sequence of the numbers.
3459
* Shortcut1=Mozilla App.lnk
3460
* Shortcut2=Mozilla App (Safe Mode).lnk
3462
* ; Shortcut1 is the first shortcut, Shortcut2 is the second shortcut, and so
3463
* ; on. There must not be a break in the sequence of the numbers for the
3465
* Shortcut1=Mozilla App.lnk
3466
* Shortcut2=Mozilla App (Safe Mode).lnk
3468
* ; Shortcut1 is the first shortcut, Shortcut2 is the second shortcut, and so
3469
* ; on. There must not be a break in the sequence of the numbers for the
3471
* Shortcut1=Mozilla App.lnk
3472
* Shortcut2=Mozilla App (Safe Mode).lnk
3474
* $R4 = counter for appending to Shortcut for enumerating the ini file entries
3475
* $R5 = return value from ShellLink::GetShortCutTarget and
3476
* ApplicationID::UninstallPinnedItem
3477
* $R6 = find handle and the long path to the Start Menu Programs directory
3478
* (e.g. $SMPROGRAMS)
3479
* $R7 = path to the $QUICKLAUNCH\User Pinned directory and the return value
3480
* from ReadINIStr for the relative path to the applications directory
3481
* under the Start Menu Programs directory and the long path to this
3483
* $R8 = return filename from FindFirst / FindNext and the return value from
3484
* ReadINIStr for enumerating shortcuts
3485
* $R9 = long path to the shortcuts log ini file
3487
!macro DeleteShortcuts
3489
!ifndef ${_MOZFUNC_UN}DeleteShortcuts
3490
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
3491
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
3492
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
3494
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
3495
!undef _MOZFUNC_UN_TMP
3498
!verbose ${_MOZFUNC_VERBOSE}
3499
!define ${_MOZFUNC_UN}DeleteShortcuts "!insertmacro ${_MOZFUNC_UN}DeleteShortcutsCall"
3501
Function ${_MOZFUNC_UN}DeleteShortcuts
3509
${If} ${AtLeastWin7}
3510
; Since shortcuts that are pinned can later be removed without removing
3511
; the pinned shortcut unpin the pinned shortcuts for the application's
3512
; main exe using the pinned shortcuts themselves.
3513
StrCpy $R7 "$QUICKLAUNCH\User Pinned"
3515
${If} ${FileExists} "$R7\TaskBar"
3516
; Delete TaskBar pinned shortcuts for the application's main exe
3517
FindFirst $R6 $R8 "$R7\TaskBar\*.lnk"
3519
${If} ${FileExists} "$R7\TaskBar\$R8"
3520
ShellLink::GetShortCutTarget "$R7\TaskBar\$R8"
3522
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3523
${If} "$R5" == "$INSTDIR\${FileMainEXE}"
3524
ApplicationID::UninstallPinnedItem "$R7\TaskBar\$R8"
3537
${If} ${FileExists} "$R7\StartMenu"
3538
; Delete Start Menu pinned shortcuts for the application's main exe
3539
FindFirst $R6 $R8 "$R7\StartMenu\*.lnk"
3541
${If} ${FileExists} "$R7\StartMenu\$R8"
3542
ShellLink::GetShortCutTarget "$R7\StartMenu\$R8"
3544
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3545
${If} "$R5" == "$INSTDIR\${FileMainEXE}"
3546
ApplicationID::UninstallPinnedItem "$R7\StartMenu\$R8"
3560
; Don't call ApplicationID::UninstallPinnedItem since pinned items for
3561
; this application were removed above and removing them below will remove
3562
; the association of side by side installations.
3563
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR\uninstall\${SHORTCUTS_LOG}" $R9
3564
${If} ${FileExists} "$R9"
3565
; Delete Start Menu shortcuts for this application
3568
IntOp $R4 $R4 + 1 ; Increment the counter
3570
ReadINIStr $R8 "$R9" "STARTMENU" "Shortcut$R4"
3575
${If} ${FileExists} "$SMPROGRAMS\$R8"
3576
ShellLink::GetShortCutTarget "$SMPROGRAMS\$R8"
3578
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3579
${If} "$INSTDIR\${FileMainEXE}" == "$R5"
3580
Delete "$SMPROGRAMS\$R8"
3585
; Delete Quick Launch shortcuts for this application
3588
IntOp $R4 $R4 + 1 ; Increment the counter
3590
ReadINIStr $R8 "$R9" "QUICKLAUNCH" "Shortcut$R4"
3595
${If} ${FileExists} "$QUICKLAUNCH\$R8"
3596
ShellLink::GetShortCutTarget "$QUICKLAUNCH\$R8"
3598
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3599
${If} "$INSTDIR\${FileMainEXE}" == "$R5"
3600
Delete "$QUICKLAUNCH\$R8"
3605
; Delete Desktop shortcuts for this application
3608
IntOp $R4 $R4 + 1 ; Increment the counter
3610
ReadINIStr $R8 "$R9" "DESKTOP" "Shortcut$R4"
3615
${If} ${FileExists} "$DESKTOP\$R8"
3616
ShellLink::GetShortCutTarget "$DESKTOP\$R8"
3618
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3619
${If} "$INSTDIR\${FileMainEXE}" == "$R5"
3620
Delete "$DESKTOP\$R8"
3625
${${_MOZFUNC_UN}GetLongPath} "$SMPROGRAMS" $R6
3627
; Delete Start Menu Programs shortcuts for this application
3629
ReadINIStr $R7 "$R9" "SMPROGRAMS" "RelativePathToDir"
3630
${${_MOZFUNC_UN}GetLongPath} "$R6\$R7" $R7
3631
${Unless} "$R7" == ""
3634
IntOp $R4 $R4 + 1 ; Increment the counter
3636
ReadINIStr $R8 "$R9" "SMPROGRAMS" "Shortcut$R4"
3641
${If} ${FileExists} "$R7\$R8"
3642
ShellLink::GetShortCutTarget "$R7\$R8"
3644
${${_MOZFUNC_UN}GetLongPath} "$R5" $R5
3645
${If} "$INSTDIR\${FileMainEXE}" == "$R5"
3651
; Delete Start Menu Programs directories for this application
3654
${If} "$R6" == "$R7"
3661
${${_MOZFUNC_UN}GetParent} "$R7" $R7
3680
!macro DeleteShortcutsCall
3682
!verbose ${_MOZFUNC_VERBOSE}
3683
Call DeleteShortcuts
3687
!macro un.DeleteShortcutsCall
3689
!verbose ${_MOZFUNC_VERBOSE}
3690
Call un.DeleteShortcuts
3694
!macro un.DeleteShortcuts
3695
!ifndef un.DeleteShortcuts
3697
!verbose ${_MOZFUNC_VERBOSE}
3699
!define _MOZFUNC_UN "un."
3701
!insertmacro DeleteShortcuts
3710
################################################################################
3711
# Macros for parsing and updating the uninstall.log
3714
* Updates the uninstall.log with new files added by software update.
3716
* When modifying this macro be aware that LineFind uses all registers except
3717
* $R0-$R3 and TextCompareNoDetails uses all registers except $R0-$R9 so be
3718
* cautious. Callers of this macro are not affected.
3720
!macro UpdateUninstallLog
3722
!ifndef UpdateUninstallLog
3723
!insertmacro FileJoin
3724
!insertmacro LineFind
3725
!insertmacro TextCompareNoDetails
3726
!insertmacro TrimNewLines
3729
!verbose ${_MOZFUNC_VERBOSE}
3730
!define UpdateUninstallLog "!insertmacro UpdateUninstallLogCall"
3732
Function UpdateUninstallLog
3740
GetFullPathName $R3 "$INSTDIR\uninstall"
3741
${If} ${FileExists} "$R3\uninstall.update"
3742
${LineFind} "$R3\uninstall.update" "" "1:-1" "CleanupUpdateLog"
3744
GetTempFileName $R2 "$R3"
3745
FileOpen $R1 "$R2" w
3746
${TextCompareNoDetails} "$R3\uninstall.update" "$R3\uninstall.log" "SlowDiff" "CreateUpdateDiff"
3750
${FileJoin} "$R3\uninstall.log" "$R2" "$R3\uninstall.log"
3763
; This callback MUST use labels vs. relative line numbers.
3764
Function CleanupUpdateLog
3766
StrCmp "$R2" "EXECUTE ADD " +1 skip
3767
StrCpy $R9 "$R9" "" 12
3772
StrCpy $R4 "" ; Initialize to an empty string.
3773
StrCpy $R6 -1 ; Set the counter to -1 so it will start at 0.
3776
IntOp $R6 $R6 + 1 ; Increment the counter.
3777
StrCpy $R5 $R9 1 $R6 ; Starting from the counter copy the next char.
3778
StrCmp $R5 "" copy ; Are there no more chars?
3779
StrCmp $R5 "/" +1 +2 ; Is the char a /?
3780
StrCpy $R5 "\" ; Replace the char with a \.
3786
StrCpy $R9 "File: \$R4"
3793
StrCpy $0 "SkipWrite"
3799
Function CreateUpdateDiff
3800
${TrimNewLines} "$9" $9
3802
FileWrite $R1 "$9$\r$\n"
3812
!macro UpdateUninstallLogCall
3814
!verbose ${_MOZFUNC_VERBOSE}
3815
Call UpdateUninstallLog
3820
* Copies files from a source directory to a destination directory with logging
3821
* to the uninstall.log. If any destination files are in use a reboot will be
3822
* necessary to complete the installation and the reboot flag (see IfRebootFlag
3823
* in the NSIS documentation).
3825
* @param _PATH_TO_SOURCE
3826
* Source path to copy the files from. This must not end with a \.
3828
* @param _PATH_TO_DESTINATION
3829
* Destination path to copy the files to. This must not end with a \.
3831
* @param _PREFIX_ERROR_CREATEDIR
3832
* Prefix for the directory creation error message. The directory path
3833
* will be inserted below this string.
3835
* @param _SUFFIX_ERROR_CREATEDIR
3836
* Suffix for the directory creation error message. The directory path
3837
* will be inserted above this string.
3839
* $0 = destination file's parent directory used in the create_dir label
3840
* $R0 = copied value from $R6 (e.g. _PATH_TO_SOURCE)
3841
* $R1 = copied value from $R7 (e.g. _PATH_TO_DESTINATION)
3842
* $R2 = string length of the path to source
3843
* $R3 = relative path from the path to source
3844
* $R4 = copied value from $R8 (e.g. _PREFIX_ERROR_CREATEDIR)
3845
* $R5 = copied value from $R9 (e.g. _SUFFIX_ERROR_CREATEDIR)
3846
* note: the LocateNoDetails macro uses these registers so we copy the values
3847
* to other registers.
3848
* $R6 = initially _PATH_TO_SOURCE and then set to "size" ($R6="" if directory,
3849
* $R6="0" if file with /S=)"path\name" in callback
3850
* $R7 = initially _PATH_TO_DESTINATION and then set to "name" in callback
3851
* $R8 = initially _PREFIX_ERROR_CREATEDIR and then set to "path" in callback
3852
* $R9 = initially _SUFFIX_ERROR_CREATEDIR and then set to "path\name" in
3855
!macro CopyFilesFromDir
3857
!ifndef CopyFilesFromDir
3858
!insertmacro LocateNoDetails
3859
!insertmacro OnEndCommon
3860
!insertmacro WordReplace
3863
!verbose ${_MOZFUNC_VERBOSE}
3864
!define CopyFilesFromDir "!insertmacro CopyFilesFromDirCall"
3866
Function CopyFilesFromDir
3889
${LocateNoDetails} "$R0" "/L=FD" "CopyFileCallback"
3907
Function CopyFileCallback
3908
StrCpy $R3 $R8 "" $R2 ; $R3 always begins with a \.
3912
StrCmp $R6 "" +1 copy_file
3913
IfFileExists "$R1$R3\$R7" end +1
3914
StrCpy $0 "$R1$R3\$R7"
3918
CreateDirectory "$0"
3919
IfFileExists "$0" +1 err_create_dir ; protect against looping.
3920
${LogMsg} "Created Directory: $0"
3921
StrCmp $R6 "" end copy_file
3924
${LogMsg} "** ERROR Creating Directory: $0 **"
3925
MessageBox MB_RETRYCANCEL|MB_ICONQUESTION "$R4$\r$\n$\r$\n$0$\r$\n$\r$\n$R5" IDRETRY retry
3931
StrCmp "$0" "$INSTDIR" +2 +1
3932
IfFileExists "$0" +1 create_dir
3935
${DeleteFile} "$R1$R3\$R7"
3936
IfErrors +1 dest_clear
3938
Rename "$R1$R3\$R7" "$R1$R3\$R7.moz-delete"
3939
IfErrors +1 reboot_delete
3941
; file will replace destination file on reboot
3942
Rename "$R9" "$R9.moz-upgrade"
3943
CopyFiles /SILENT "$R9.moz-upgrade" "$R1$R3"
3944
Rename /REBOOTOK "$R1$R3\$R7.moz-upgrade" "$R1$R3\$R7"
3945
${LogMsg} "Copied File: $R1$R3\$R7.moz-upgrade"
3946
${LogMsg} "Delayed Install File (Reboot Required): $R1$R3\$R7"
3949
; file will be deleted on reboot
3951
CopyFiles /SILENT $R9 "$R1$R3"
3952
Delete /REBOOTOK "$R1$R3\$R7.moz-delete"
3953
${LogMsg} "Installed File: $R1$R3\$R7"
3954
${LogMsg} "Delayed Delete File (Reboot Required): $R1$R3\$R7.moz-delete"
3957
; destination file doesn't exist - coast is clear
3959
CopyFiles /SILENT $R9 "$R1$R3"
3960
${LogMsg} "Installed File: $R1$R3\$R7"
3963
; If the file is installed into the installation directory remove the
3964
; installation directory's path from the file path when writing to the
3965
; uninstall.log so it will be a relative path. This allows the same
3966
; helper.exe to be used with zip builds if we supply an uninstall.log.
3967
${WordReplace} "$R1$R3\$R7" "$INSTDIR" "" "+" $R3
3968
${LogUninstall} "File: $R3"
3978
!macro CopyFilesFromDirCall _PATH_TO_SOURCE _PATH_TO_DESTINATION \
3979
_PREFIX_ERROR_CREATEDIR _SUFFIX_ERROR_CREATEDIR
3981
!verbose ${_MOZFUNC_VERBOSE}
3982
Push "${_PATH_TO_SOURCE}"
3983
Push "${_PATH_TO_DESTINATION}"
3984
Push "${_PREFIX_ERROR_CREATEDIR}"
3985
Push "${_SUFFIX_ERROR_CREATEDIR}"
3986
Call CopyFilesFromDir
3991
* Parses the uninstall.log on install to first remove a previous installation's
3992
* files and then their directories if empty prior to installing.
3994
* When modifying this macro be aware that LineFind uses all registers except
3995
* $R0-$R3 so be cautious. Callers of this macro are not affected.
3997
!macro OnInstallUninstall
3999
!ifndef OnInstallUninstall
4000
!insertmacro GetParent
4001
!insertmacro LineFind
4002
!insertmacro TrimNewLines
4005
!verbose ${_MOZFUNC_VERBOSE}
4006
!define OnInstallUninstall "!insertmacro OnInstallUninstallCall"
4008
Function OnInstallUninstall
4021
IfFileExists "$INSTDIR\uninstall\uninstall.log" +1 end
4023
${LogHeader} "Removing Previous Installation"
4025
; Copy the uninstall log file to a temporary file
4026
GetTempFileName $TmpVal
4027
CopyFiles /SILENT /FILESONLY "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
4030
${LineFind} "$TmpVal" "/NUL" "1:-1" "RemoveFilesCallback"
4032
; Remove empty directories
4033
${LineFind} "$TmpVal" "/NUL" "1:-1" "RemoveDirsCallback"
4035
; Delete the temporary uninstall log file
4036
Delete /REBOOTOK "$TmpVal"
4038
; Delete the uninstall log file
4039
Delete "$INSTDIR\uninstall\uninstall.log"
4057
Function RemoveFilesCallback
4058
${TrimNewLines} "$R9" $R9
4059
StrCpy $R1 "$R9" 5 ; Copy the first five chars
4061
StrCmp "$R1" "File:" +1 end
4062
StrCpy $R9 "$R9" "" 6 ; Copy string starting after the 6th char
4063
StrCpy $R0 "$R9" 1 ; Copy the first char
4065
StrCmp "$R0" "\" +1 end ; If this isn't a relative path goto end
4066
StrCmp "$R9" "\install.log" end +1 ; Skip the install.log
4067
StrCmp "$R9" "\MapiProxy_InUse.dll" end +1 ; Skip the MapiProxy_InUse.dll
4068
StrCmp "$R9" "\mozMapi32_InUse.dll" end +1 ; Skip the mozMapi32_InUse.dll
4070
StrCpy $R1 "$INSTDIR$R9" ; Copy the install dir path and suffix it with the string
4071
IfFileExists "$R1" +1 end
4076
${LogMsg} "Deleted File: $R1"
4081
Rename "$R1" "$R1.moz-delete"
4083
Delete /REBOOTOK "$R1.moz-delete"
4084
${LogMsg} "Delayed Delete File (Reboot Required): $R1.moz-delete"
4088
; Check if the file exists in the source. If it does the new file will
4089
; replace the existing file when the system is rebooted. If it doesn't
4090
; the file will be deleted when the system is rebooted.
4091
${Unless} ${FileExists} "$EXEDIR\core$R9"
4092
${AndUnless} ${FileExists} "$EXEDIR\optional$R9"
4093
Delete /REBOOTOK "$R1"
4094
${LogMsg} "Delayed Delete File (Reboot Required): $R1"
4103
; Using locate will leave file handles open to some of the directories
4104
; which will prevent the deletion of these directories. This parses the
4105
; uninstall.log and uses the file entries to find / remove empty
4107
Function RemoveDirsCallback
4108
${TrimNewLines} "$R9" $R9
4109
StrCpy $R0 "$R9" 5 ; Copy the first five chars
4110
StrCmp "$R0" "File:" +1 end
4112
StrCpy $R9 "$R9" "" 6 ; Copy string starting after the 6th char
4113
StrCpy $R0 "$R9" 1 ; Copy the first char
4115
StrCpy $R1 "$INSTDIR$R9" ; Copy the install dir path and suffix it with the string
4116
StrCmp "$R0" "\" loop end ; If this isn't a relative path goto end
4119
${GetParent} "$R1" $R1 ; Get the parent directory for the path
4120
StrCmp "$R1" "$INSTDIR" end +1 ; If the directory is the install dir goto end
4122
IfFileExists "$R1" +1 loop ; Only try to remove the dir if it exists
4124
RmDir "$R1" ; Remove the dir
4125
IfErrors end +1 ; If we fail there is no use trying to remove its parent dir
4126
${LogMsg} "Deleted Directory: $R1"
4139
!macro OnInstallUninstallCall
4141
!verbose ${_MOZFUNC_VERBOSE}
4142
Call OnInstallUninstall
4147
* Parses the uninstall.log to unregister dll's, remove files, and remove
4148
* empty directories for this installation.
4150
* When modifying this macro be aware that LineFind uses all registers except
4151
* $R0-$R3 so be cautious. Callers of this macro are not affected.
4153
!macro un.ParseUninstallLog
4155
!ifndef un.ParseUninstallLog
4156
!insertmacro un.GetParent
4157
!insertmacro un.LineFind
4158
!insertmacro un.TrimNewLines
4161
!verbose ${_MOZFUNC_VERBOSE}
4162
!define un.ParseUninstallLog "!insertmacro un.ParseUninstallLogCall"
4164
Function un.ParseUninstallLog
4177
IfFileExists "$INSTDIR\uninstall\uninstall.log" +1 end
4179
; Copy the uninstall log file to a temporary file
4180
GetTempFileName $TmpVal
4181
CopyFiles /SILENT /FILESONLY "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
4184
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
4187
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
4189
; Remove empty directories
4190
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
4192
; Delete the temporary uninstall log file
4193
Delete /REBOOTOK "$TmpVal"
4210
Function un.RemoveFilesCallback
4211
${un.TrimNewLines} "$R9" $R9
4214
StrCmp "$R1" "File:" +1 end
4215
StrCpy $R9 "$R9" "" 6
4218
StrCpy $R1 "$INSTDIR$R9"
4219
StrCmp "$R0" "\" +2 +1
4222
IfFileExists "$R1" +1 end
4226
Rename "$R1" "$R1.moz-delete"
4228
Delete /REBOOTOK "$R1"
4231
Delete /REBOOTOK "$R1.moz-delete"
4239
Function un.UnRegDLLsCallback
4240
${un.TrimNewLines} "$R9" $R9
4243
StrCmp $R1 "DLLReg:" +1 end
4244
StrCpy $R9 "$R9" "" 8
4247
StrCpy $R1 "$INSTDIR$R9"
4248
StrCmp $R0 "\" +2 +1
4251
${UnregisterDLL} $R1
4259
; Using locate will leave file handles open to some of the directories
4260
; which will prevent the deletion of these directories. This parses the
4261
; uninstall.log and uses the file entries to find / remove empty
4263
Function un.RemoveDirsCallback
4264
${un.TrimNewLines} "$R9" $R9
4265
StrCpy $R0 "$R9" 5 ; Copy the first five chars
4266
StrCmp "$R0" "File:" +1 end
4268
StrCpy $R9 "$R9" "" 6 ; Copy string starting after the 6th char
4269
StrCpy $R0 "$R9" 1 ; Copy the first char
4271
StrCpy $R1 "$INSTDIR$R9" ; Copy the install dir path and suffix it with the string
4272
StrCmp "$R0" "\" loop ; If this is a relative path goto the loop
4273
StrCpy $R1 "$R9" ; Already a full path so copy the string
4276
${un.GetParent} "$R1" $R1 ; Get the parent directory for the path
4277
StrCmp "$R1" "$INSTDIR" end ; If the directory is the install dir goto end
4279
; We only try to remove empty directories but the Desktop, StartMenu, and
4280
; QuickLaunch directories can be empty so guard against removing them.
4281
SetShellVarContext all ; Set context to all users
4282
StrCmp "$R1" "$DESKTOP" end ; All users desktop
4283
StrCmp "$R1" "$STARTMENU" end ; All users start menu
4285
SetShellVarContext current ; Set context to all users
4286
StrCmp "$R1" "$DESKTOP" end ; Current user desktop
4287
StrCmp "$R1" "$STARTMENU" end ; Current user start menu
4288
StrCmp "$R1" "$QUICKLAUNCH" end ; Current user quick launch
4290
IfFileExists "$R1" +1 +3 ; Only try to remove the dir if it exists
4292
RmDir "$R1" ; Remove the dir
4293
IfErrors end ; If we fail there is no use trying to remove its parent dir
4295
StrCmp "$R0" "\" loop end ; Only loop when the path is relative to the install dir
4307
!macro un.ParseUninstallLogCall
4309
!verbose ${_MOZFUNC_VERBOSE}
4310
Call un.ParseUninstallLog
4315
* Finds a valid Start Menu shortcut in the uninstall log and returns the
4316
* relative path from the Start Menu's Programs directory to the shortcut's
4319
* When modifying this macro be aware that LineFind uses all registers except
4320
* $R0-$R3 so be cautious. Callers of this macro are not affected.
4322
* @return _REL_PATH_TO_DIR
4323
* The relative path to the application's Start Menu directory from the
4324
* Start Menu's Programs directory.
4326
!macro FindSMProgramsDir
4328
!ifndef FindSMProgramsDir
4329
!insertmacro GetParent
4330
!insertmacro LineFind
4331
!insertmacro TrimNewLines
4334
!verbose ${_MOZFUNC_VERBOSE}
4335
!define FindSMProgramsDir "!insertmacro FindSMProgramsDirCall"
4337
Function FindSMProgramsDir
4344
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
4345
${LineFind} "$INSTDIR\uninstall\uninstall.log" "/NUL" "1:-1" "FindSMProgramsDirRelPath"
4355
; This callback MUST use labels vs. relative line numbers.
4356
Function FindSMProgramsDirRelPath
4358
${TrimNewLines} "$R9" $R9
4361
StrCmp "$R4" "File:" +1 end_FindSMProgramsDirRelPath
4362
StrCpy $R9 "$R9" "" 6
4365
StrCmp "$R4" "\" end_FindSMProgramsDirRelPath +1
4367
SetShellVarContext all
4368
${GetLongPath} "$SMPROGRAMS" $R4
4370
StrCpy $R1 "$R9" $R2
4371
StrCmp "$R1" "$R4" +1 end_FindSMProgramsDirRelPath
4372
IfFileExists "$R9" +1 end_FindSMProgramsDirRelPath
4373
ShellLink::GetShortCutTarget "$R9"
4375
StrCmp "$INSTDIR\${FileMainEXE}" "$R0" +1 end_FindSMProgramsDirRelPath
4376
${GetParent} "$R9" $R3
4378
StrCpy $R3 "$R3" "" $R2
4380
Pop $R4 ; Remove the previously pushed 0 from the stack and
4381
push "StopLineFind" ; push StopLineFind to stop finding more lines.
4383
end_FindSMProgramsDirRelPath:
4392
!macro FindSMProgramsDirCall _REL_PATH_TO_DIR
4394
!verbose ${_MOZFUNC_VERBOSE}
4395
Call FindSMProgramsDir
4396
Pop ${_REL_PATH_TO_DIR}
4401
################################################################################
4402
# Macros for custom branding
4405
* Sets BrandFullName and / or BrandShortName to values provided in the specified
4406
* ini file and defaults to BrandShortName and BrandFullName as defined in
4407
* branding.nsi when the associated ini file entry is not specified.
4411
* BrandFullName=Custom Full Name
4412
* BrandShortName=Custom Short Name
4414
* @param _PATH_TO_INI
4415
* Path to the ini file.
4417
* $R6 = return value from ReadINIStr
4418
* $R7 = stores BrandShortName
4419
* $R8 = stores BrandFullName
4420
* $R9 = _PATH_TO_INI
4422
!macro SetBrandNameVars
4424
!ifndef ${_MOZFUNC_UN}SetBrandNameVars
4425
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
4426
!insertmacro ${_MOZFUNC_UN_TMP}WordReplace
4428
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
4429
!undef _MOZFUNC_UN_TMP
4431
; Prevent declaring vars twice when the SetBrandNameVars macro is
4432
; inserted into both the installer and uninstaller.
4433
!ifndef SetBrandNameVars
4440
!verbose ${_MOZFUNC_VERBOSE}
4441
!define ${_MOZFUNC_UN}SetBrandNameVars "!insertmacro ${_MOZFUNC_UN}SetBrandNameVarsCall"
4443
Function ${_MOZFUNC_UN}SetBrandNameVars
4449
StrCpy $R8 "${BrandFullName}"
4450
StrCpy $R7 "${BrandShortName}"
4452
IfFileExists "$R9" +1 finish
4455
ReadINIStr $R6 $R9 "Branding" "BrandFullName"
4460
ReadINIStr $R6 $R9 "Branding" "BrandShortName"
4465
StrCpy $BrandFullName "$R8"
4466
${${_MOZFUNC_UN}WordReplace} "$R8" "&" "&&" "+" $R8
4467
StrCpy $BrandFullNameDA "$R8"
4468
StrCpy $BrandShortName "$R7"
4480
!macro SetBrandNameVarsCall _PATH_TO_INI
4482
!verbose ${_MOZFUNC_VERBOSE}
4483
Push "${_PATH_TO_INI}"
4484
Call SetBrandNameVars
4488
!macro un.SetBrandNameVarsCall _PATH_TO_INI
4490
!verbose ${_MOZFUNC_VERBOSE}
4491
Push "${_PATH_TO_INI}"
4492
Call un.SetBrandNameVars
4496
!macro un.SetBrandNameVars
4497
!ifndef un.SetBrandNameVars
4499
!verbose ${_MOZFUNC_VERBOSE}
4501
!define _MOZFUNC_UN "un."
4503
!insertmacro SetBrandNameVars
4512
* Replaces the wizard's header image with the one specified.
4514
* @param _PATH_TO_IMAGE
4515
* Fully qualified path to the bitmap to use for the header image.
4517
* $R8 = hwnd for the control returned from GetDlgItem.
4518
* $R9 = _PATH_TO_IMAGE
4520
!macro ChangeMUIHeaderImage
4522
!ifndef ${_MOZFUNC_UN}ChangeMUIHeaderImage
4526
!verbose ${_MOZFUNC_VERBOSE}
4527
!define ${_MOZFUNC_UN}ChangeMUIHeaderImage "!insertmacro ${_MOZFUNC_UN}ChangeMUIHeaderImageCall"
4529
Function ${_MOZFUNC_UN}ChangeMUIHeaderImage
4533
GetDlgItem $R8 $HWNDPARENT 1046
4534
System::Call 'user32::LoadImageW(i 0, w "$R9", i 0, i 0, i 0, i 0x0010|0x2000) i.s'
4536
SendMessage $R8 ${STM_SETIMAGE} 0 $hHeaderBitmap
4537
; There is no way to specify a show function for a custom page so hide
4538
; and then show the control to force the bitmap to redraw.
4539
ShowWindow $R8 ${SW_HIDE}
4540
ShowWindow $R8 ${SW_SHOW}
4550
!macro ChangeMUIHeaderImageCall _PATH_TO_IMAGE
4552
!verbose ${_MOZFUNC_VERBOSE}
4553
Push "${_PATH_TO_IMAGE}"
4554
Call ChangeMUIHeaderImage
4558
!macro un.ChangeMUIHeaderImageCall _PATH_TO_IMAGE
4560
!verbose ${_MOZFUNC_VERBOSE}
4561
Push "${_PATH_TO_IMAGE}"
4562
Call un.ChangeMUIHeaderImage
4566
!macro un.ChangeMUIHeaderImage
4567
!ifndef un.ChangeMUIHeaderImage
4569
!verbose ${_MOZFUNC_VERBOSE}
4571
!define _MOZFUNC_UN "un."
4573
!insertmacro ChangeMUIHeaderImage
4582
################################################################################
4583
# User interface callback helper defines and macros
4585
/* Install type defines */
4586
!ifndef INSTALLTYPE_BASIC
4587
!define INSTALLTYPE_BASIC 1
4590
!ifndef INSTALLTYPE_CUSTOM
4591
!define INSTALLTYPE_CUSTOM 2
4595
* Checks whether to display the current page (e.g. if not performing a custom
4596
* install don't display the custom pages).
4598
!macro CheckCustomCommon
4600
!ifndef CheckCustomCommon
4602
!verbose ${_MOZFUNC_VERBOSE}
4603
!define CheckCustomCommon "!insertmacro CheckCustomCommonCall"
4605
Function CheckCustomCommon
4607
; Abort if not a custom install
4608
IntCmp $InstallType ${INSTALLTYPE_CUSTOM} +2 +1 +1
4617
!macro CheckCustomCommonCall
4619
!verbose ${_MOZFUNC_VERBOSE}
4620
Call CheckCustomCommon
4625
* Unloads dll's and releases references when the installer and uninstaller
4630
!ifndef ${_MOZFUNC_UN}OnEndCommon
4631
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
4632
!insertmacro ${_MOZFUNC_UN_TMP}UnloadUAC
4634
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
4635
!undef _MOZFUNC_UN_TMP
4638
!verbose ${_MOZFUNC_VERBOSE}
4639
!define ${_MOZFUNC_UN}OnEndCommon "!insertmacro ${_MOZFUNC_UN}OnEndCommonCall"
4641
Function ${_MOZFUNC_UN}OnEndCommon
4643
${${_MOZFUNC_UN}UnloadUAC}
4644
StrCmp $hHeaderBitmap "" +3 +1
4645
System::Call "gdi32::DeleteObject(i s)" $hHeaderBitmap
4646
StrCpy $hHeaderBitmap ""
4656
!macro OnEndCommonCall
4658
!verbose ${_MOZFUNC_VERBOSE}
4663
!macro un.OnEndCommonCall
4665
!verbose ${_MOZFUNC_VERBOSE}
4670
!macro un.OnEndCommon
4671
!ifndef un.OnEndCommon
4673
!verbose ${_MOZFUNC_VERBOSE}
4675
!define _MOZFUNC_UN "un."
4677
!insertmacro OnEndCommon
4686
* Called from the installer's .onInit function not to be confused with the
4687
* uninstaller's .onInit or the uninstaller's un.onInit functions.
4689
* @param _WARN_UNSUPPORTED_MSG
4690
* Message displayed when the Windows version is not supported.
4692
* $R5 = return value from the GetSize macro
4693
* $R6 = general string values, return value from GetTempFileName, return
4694
* value from the GetSize macro
4695
* $R7 = full path to the configuration ini file
4696
* $R8 = used for OS Version and Service Pack detection and the return value
4697
* from the GetParameters macro
4698
* $R9 = _WARN_UNSUPPORTED_MSG
4700
!macro InstallOnInitCommon
4702
!ifndef InstallOnInitCommon
4703
!insertmacro ElevateUAC
4704
!insertmacro GetOptions
4705
!insertmacro GetParameters
4706
!insertmacro GetSize
4709
!verbose ${_MOZFUNC_VERBOSE}
4710
!define InstallOnInitCommon "!insertmacro InstallOnInitCommonCall"
4712
Function InstallOnInitCommon
4719
!ifdef HAVE_64BIT_OS
4720
${Unless} ${RunningX64}
4721
${OrUnless} ${AtLeastWinVista}
4722
MessageBox MB_OK|MB_ICONSTOP "$R9" IDOK
4723
; Nothing initialized so no need to call OnEndCommon
4730
${If} ${AtMostWin2000}
4735
${AndIf} ${AtMostServicePack} 1
4740
; XXX-rstrong - some systems failed the AtLeastWin2000 test that we
4741
; used to use for an unknown reason and likely fail the AtMostWin2000
4742
; and possibly the IsWinXP test as well. To work around this also
4743
; check if the Windows NT registry Key exists and if it does if the
4744
; first char in CurrentVersion is equal to 3 (Windows NT 3.5 and
4745
; 3.5.1), to 4 (Windows NT 4) or 5 (Windows 2000 and Windows XP).
4748
ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
4751
${OrIf} "$R8" == "3"
4752
${OrIf} "$R8" == "4"
4753
${OrIf} "$R8" == "5"
4754
MessageBox MB_OK|MB_ICONSTOP "$R9" IDOK
4755
; Nothing initialized so no need to call OnEndCommon
4761
${GetParameters} $R8
4763
; Require elevation if the user can elevate
4767
; Default install type
4768
StrCpy $InstallType ${INSTALLTYPE_BASIC}
4771
; Manually check for /S in the command line due to Bug 506867
4773
${GetOptions} "$R8" "/S" $R7
4777
; Support for the deprecated -ms command line argument. The new command
4778
; line arguments are not supported when -ms is used.
4780
${GetOptions} "$R8" "-ms" $R7
4787
; Support for specifying an installation configuration file.
4789
${GetOptions} "$R8" "/INI=" $R7
4791
; The configuration file must also exist
4792
${If} ${FileExists} "$R7"
4794
ReadINIStr $R8 $R7 "Install" "InstallDirectoryName"
4796
!ifdef HAVE_64BIT_OS
4797
StrCpy $INSTDIR "$PROGRAMFILES64\$R8"
4799
StrCpy $INSTDIR "$PROGRAMFILES32\$R8"
4802
ReadINIStr $R8 $R7 "Install" "InstallDirectoryPath"
4804
StrCpy $INSTDIR "$R8"
4808
; Quit if we are unable to create the installation directory or we are
4809
; unable to write to a file in the installation directory.
4811
${If} ${FileExists} "$INSTDIR"
4812
GetTempFileName $R6 "$INSTDIR"
4813
FileOpen $R5 "$R6" w
4814
FileWrite $R5 "Write Access Test"
4818
; Nothing initialized so no need to call OnEndCommon
4822
CreateDirectory "$INSTDIR"
4824
; Nothing initialized so no need to call OnEndCommon
4829
ReadINIStr $R8 $R7 "Install" "QuickLaunchShortcut"
4830
${If} $R8 == "false"
4831
StrCpy $AddQuickLaunchSC "0"
4833
StrCpy $AddQuickLaunchSC "1"
4836
ReadINIStr $R8 $R7 "Install" "DesktopShortcut"
4837
${If} $R8 == "false"
4838
StrCpy $AddDesktopSC "0"
4840
StrCpy $AddDesktopSC "1"
4843
ReadINIStr $R8 $R7 "Install" "StartMenuShortcuts"
4844
${If} $R8 == "false"
4845
StrCpy $AddStartMenuSC "0"
4847
StrCpy $AddStartMenuSC "1"
4850
ReadINIStr $R8 $R7 "Install" "MaintenanceService"
4851
${If} $R8 == "false"
4852
StrCpy $InstallMaintenanceService "0"
4855
!ifndef NO_STARTMENU_DIR
4856
ReadINIStr $R8 $R7 "Install" "StartMenuDirectoryName"
4858
StrCpy $StartMenuDir "$R8"
4877
!macro InstallOnInitCommonCall _WARN_UNSUPPORTED_MSG
4879
!verbose ${_MOZFUNC_VERBOSE}
4880
Push "${_WARN_UNSUPPORTED_MSG}"
4881
Call InstallOnInitCommon
4886
* Called from the uninstaller's .onInit function not to be confused with the
4887
* installer's .onInit or the uninstaller's un.onInit functions.
4889
!macro UninstallOnInitCommon
4891
!ifndef UninstallOnInitCommon
4892
!insertmacro ElevateUAC
4893
!insertmacro GetLongPath
4894
!insertmacro GetOptions
4895
!insertmacro GetParameters
4896
!insertmacro GetParent
4897
!insertmacro UnloadUAC
4898
!insertmacro UpdateShortcutAppModelIDs
4899
!insertmacro UpdateUninstallLog
4902
!verbose ${_MOZFUNC_VERBOSE}
4903
!define UninstallOnInitCommon "!insertmacro UninstallOnInitCommonCall"
4905
Function UninstallOnInitCommon
4906
; Prevents breaking apps that don't use SetBrandNameVars
4907
!ifdef SetBrandNameVars
4908
${SetBrandNameVars} "$EXEDIR\distribution\setup.ini"
4911
; Prevent launching the application when a reboot is required and this
4912
; executable is the main application executable
4913
IfFileExists "$EXEDIR\${FileMainEXE}.moz-upgrade" +1 +4
4914
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2
4916
Quit ; Nothing initialized so no need to call OnEndCommon
4918
${GetParent} "$EXEDIR" $INSTDIR
4919
${GetLongPath} "$INSTDIR" $INSTDIR
4920
IfFileExists "$INSTDIR\${FileMainEXE}" +2 +1
4921
Quit ; Nothing initialized so no need to call OnEndCommon
4923
; Prevents breaking apps that don't use SetBrandNameVars
4924
!ifdef SetBrandNameVars
4925
${SetBrandNameVars} "$INSTDIR\distribution\setup.ini"
4928
; Application update uses a directory named tobedeleted in the $INSTDIR to
4929
; delete files on OS reboot when they are in use. Try to delete this
4930
; directory if it exists.
4931
${If} ${FileExists} "$INSTDIR\tobedeleted"
4932
RmDir /r "$INSTDIR\tobedeleted"
4935
; Prevent all operations (e.g. set as default, postupdate, etc.) when a
4936
; reboot is required and the executable launched is helper.exe
4937
IfFileExists "$INSTDIR\${FileMainEXE}.moz-upgrade" +1 +4
4938
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2
4940
Quit ; Nothing initialized so no need to call OnEndCommon
4942
!ifdef HAVE_64BIT_OS
4946
${GetParameters} $R0
4948
StrCmp "$R0" "" continue +1
4950
; Update this user's shortcuts with the latest app user model id.
4952
${GetOptions} "$R0" "/UpdateShortcutAppUserModelIds" $R2
4953
IfErrors hideshortcuts +1
4955
!ifmacrodef InitHashAppModelId
4956
${If} "$AppUserModelID" != ""
4957
${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $R2
4960
StrCmp "$R2" "false" +1 finish ; true indicates that shortcuts have been updated
4961
Quit ; Nothing initialized so no need to call OnEndCommon
4963
; Require elevation if the user can elevate
4966
${GetOptions} "$R0" "/HideShortcuts" $R2
4967
IfErrors showshortcuts +1
4968
!ifndef NONADMIN_ELEVATE
4974
; Require elevation if the user can elevate
4977
${GetOptions} "$R0" "/ShowShortcuts" $R2
4978
IfErrors defaultappuser +1
4979
!ifndef NONADMIN_ELEVATE
4985
; Require elevation if the the StartMenuInternet registry keys require
4986
; updating and the user can elevate
4989
${GetOptions} "$R0" "/SetAsDefaultAppUser" $R2
4990
IfErrors defaultappglobal +1
4991
${SetAsDefaultAppUser}
4994
; Require elevation if the user can elevate
4997
${GetOptions} "$R0" "/SetAsDefaultAppGlobal" $R2
4998
IfErrors postupdate +1
5000
${SetAsDefaultAppGlobal}
5003
; Do not attempt to elevate. The application launching this executable is
5004
; responsible for elevation if it is required.
5006
${WordReplace} "$R0" "$\"" "" "+" $R0
5008
${GetOptions} "$R0" "/PostUpdate" $R2
5009
IfErrors continue +1
5010
; If the uninstall.log does not exist don't perform post update
5011
; operations. This prevents updating the registry for zip builds.
5012
IfFileExists "$EXEDIR\uninstall.log" +2 +1
5013
Quit ; Nothing initialized so no need to call OnEndCommon
5016
${GetOptions} "$R0" "/UninstallLog=" $R2
5017
IfErrors updateuninstalllog +1
5018
StrCmp "$R2" "" finish +1
5019
GetFullPathName $R3 "$R2"
5020
IfFileExists "$R3" +1 finish
5021
Delete "$INSTDIR\uninstall\*wizard*"
5022
Delete "$INSTDIR\uninstall\uninstall.log"
5023
CopyFiles /SILENT /FILESONLY "$R3" "$INSTDIR\uninstall\"
5024
${GetParent} "$R3" $R4
5029
; Do not attempt to elevate. The application launching this executable is
5030
; responsible for elevation if it is required.
5032
${UpdateUninstallLog}
5036
System::Call "shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)"
5037
Quit ; Nothing initialized so no need to call OnEndCommon
5041
; If the uninstall.log does not exist don't perform uninstall
5042
; operations. This prevents running the uninstaller for zip builds.
5043
IfFileExists "$INSTDIR\uninstall\uninstall.log" +2 +1
5044
Quit ; Nothing initialized so no need to call OnEndCommon
5046
; Require elevation if the user can elevate
5049
; If we made it this far then this installer is being used as an uninstaller.
5050
WriteUninstaller "$EXEDIR\uninstaller.exe"
5053
; Manually check for /S in the command line due to Bug 506867
5055
${GetOptions} "$R0" "/S" $R2
5059
; Support for the deprecated -ms command line argument.
5061
${GetOptions} "$R0" "-ms" $R2
5069
StrCpy $R1 "$\"$EXEDIR\uninstaller.exe$\" /S"
5071
StrCpy $R1 "$\"$EXEDIR\uninstaller.exe$\""
5074
; When the uninstaller is launched it copies itself to the temp directory
5075
; so it won't be in use so it can delete itself.
5077
${DeleteFile} "$EXEDIR\uninstaller.exe"
5080
Quit ; Nothing initialized so no need to call OnEndCommon
5088
!macro UninstallOnInitCommonCall
5090
!verbose ${_MOZFUNC_VERBOSE}
5091
Call UninstallOnInitCommon
5096
* Called from the uninstaller's un.onInit function not to be confused with the
5097
* installer's .onInit or the uninstaller's .onInit functions.
5099
!macro un.UninstallUnOnInitCommon
5101
!ifndef un.UninstallUnOnInitCommon
5102
!insertmacro un.GetLongPath
5103
!insertmacro un.GetParent
5104
!insertmacro un.SetBrandNameVars
5107
!verbose ${_MOZFUNC_VERBOSE}
5108
!define un.UninstallUnOnInitCommon "!insertmacro un.UninstallUnOnInitCommonCall"
5110
Function un.UninstallUnOnInitCommon
5111
${un.GetParent} "$INSTDIR" $INSTDIR
5112
${un.GetLongPath} "$INSTDIR" $INSTDIR
5113
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
5117
!ifdef HAVE_64BIT_OS
5121
; Prevents breaking apps that don't use SetBrandNameVars
5122
!ifdef un.SetBrandNameVars
5123
${un.SetBrandNameVars} "$INSTDIR\distribution\setup.ini"
5126
; Initialize $hHeaderBitmap to prevent redundant changing of the bitmap if
5127
; the user clicks the back button
5128
StrCpy $hHeaderBitmap ""
5135
!macro un.UninstallUnOnInitCommonCall
5137
!verbose ${_MOZFUNC_VERBOSE}
5138
Call un.UninstallUnOnInitCommon
5143
* Called from the MUI leaveOptions function to set the value of $INSTDIR.
5145
!macro LeaveOptionsCommon
5147
!ifndef LeaveOptionsCommon
5148
!insertmacro CanWriteToInstallDir
5149
!insertmacro GetLongPath
5151
!ifndef NO_INSTDIR_FROM_REG
5152
!insertmacro GetSingleInstallPath
5156
!verbose ${_MOZFUNC_VERBOSE}
5157
!define LeaveOptionsCommon "!insertmacro LeaveOptionsCommonCall"
5159
Function LeaveOptionsCommon
5162
!ifndef NO_INSTDIR_FROM_REG
5163
SetShellVarContext all ; Set SHCTX to HKLM
5164
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
5166
StrCmp "$R9" "false" +1 finish_get_install_dir
5168
SetShellVarContext current ; Set SHCTX to HKCU
5169
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
5171
finish_get_install_dir:
5172
StrCmp "$R9" "false" +2 +1
5173
StrCpy $INSTDIR "$R9"
5176
; If the user doesn't have write access to the installation directory set
5177
; the installation directory to a subdirectory of the All Users application
5178
; directory and if the user can't write to that location set the installation
5179
; directory to a subdirectory of the users local application directory
5180
; (e.g. non-roaming).
5181
${CanWriteToInstallDir} $R9
5182
StrCmp "$R9" "false" +1 finish_check_install_dir
5184
SetShellVarContext all ; Set SHCTX to All Users
5185
StrCpy $INSTDIR "$APPDATA\${BrandFullName}\"
5186
${CanWriteToInstallDir} $R9
5187
StrCmp "$R9" "false" +2 +1
5188
StrCpy $INSTDIR "$LOCALAPPDATA\${BrandFullName}\"
5190
finish_check_install_dir:
5191
IfFileExists "$INSTDIR" +3 +1
5195
; Always display the long path if the path already exists.
5196
${GetLongPath} "$INSTDIR" $INSTDIR
5198
; The call to GetLongPath returns a long path without a trailing
5199
; back-slash. Append a \ to the path to prevent the directory
5200
; name from being appended when using the NSIS create new folder.
5201
; http://www.nullsoft.com/free/nsis/makensis.htm#InstallDir
5202
StrCpy $INSTDIR "$INSTDIR\"
5211
!macro LeaveOptionsCommonCall
5213
!verbose ${_MOZFUNC_VERBOSE}
5214
Call LeaveOptionsCommon
5219
* Called from the MUI preDirectory function to verify there is enough disk
5220
* space for the installation and the installation directory is writable.
5222
* $R9 = returned value from CheckDiskSpace and CanWriteToInstallDir macros
5224
!macro PreDirectoryCommon
5226
!ifndef PreDirectoryCommon
5227
!insertmacro CanWriteToInstallDir
5228
!insertmacro CheckDiskSpace
5231
!verbose ${_MOZFUNC_VERBOSE}
5232
!define PreDirectoryCommon "!insertmacro PreDirectoryCommonCall"
5234
Function PreDirectoryCommon
5237
IntCmp $InstallType ${INSTALLTYPE_CUSTOM} end +1 +1
5238
${CanWriteToInstallDir} $R9
5239
StrCmp "$R9" "false" end +1
5240
${CheckDiskSpace} $R9
5241
StrCmp "$R9" "false" end +1
5253
!macro PreDirectoryCommonCall
5255
!verbose ${_MOZFUNC_VERBOSE}
5256
Call PreDirectoryCommon
5261
* Called from the MUI leaveDirectory function
5263
* @param _WARN_DISK_SPACE
5264
* Message displayed when there isn't enough disk space to perform the
5266
* @param _WARN_WRITE_ACCESS
5267
* Message displayed when the installer does not have write access to
5270
* $R7 = returned value from CheckDiskSpace and CanWriteToInstallDir macros
5271
* $R8 = _WARN_DISK_SPACE
5272
* $R9 = _WARN_WRITE_ACCESS
5274
!macro LeaveDirectoryCommon
5276
!ifndef LeaveDirectoryCommon
5277
!insertmacro CheckDiskSpace
5278
!insertmacro CanWriteToInstallDir
5281
!verbose ${_MOZFUNC_VERBOSE}
5282
!define LeaveDirectoryCommon "!insertmacro LeaveDirectoryCommonCall"
5284
Function LeaveDirectoryCommon
5290
${CanWriteToInstallDir} $R7
5291
${If} $R7 == "false"
5292
MessageBox MB_OK|MB_ICONEXCLAMATION "$R9"
5296
${CheckDiskSpace} $R7
5297
${If} $R7 == "false"
5298
MessageBox MB_OK|MB_ICONEXCLAMATION "$R8"
5312
!macro LeaveDirectoryCommonCall _WARN_DISK_SPACE _WARN_WRITE_ACCESS
5314
Push "${_WARN_DISK_SPACE}"
5315
Push "${_WARN_WRITE_ACCESS}"
5316
!verbose ${_MOZFUNC_VERBOSE}
5317
Call LeaveDirectoryCommon
5322
################################################################################
5323
# Install Section common macros.
5326
* Performs common cleanup operations prior to the actual installation.
5327
* This macro should be called first when installation starts.
5329
!macro InstallStartCleanupCommon
5331
!ifndef InstallStartCleanupCommon
5332
!insertmacro CleanVirtualStore
5333
!insertmacro EndUninstallLog
5334
!insertmacro OnInstallUninstall
5337
!verbose ${_MOZFUNC_VERBOSE}
5338
!define InstallStartCleanupCommon "!insertmacro InstallStartCleanupCommonCall"
5340
Function InstallStartCleanupCommon
5342
; Remove files not removed by parsing the uninstall.log
5343
Delete "$INSTDIR\install_wizard.log"
5344
Delete "$INSTDIR\install_status.log"
5346
RmDir /r "$INSTDIR\updates"
5347
Delete "$INSTDIR\updates.xml"
5348
Delete "$INSTDIR\active-update.xml"
5350
RmDir /r "$INSTDIR\distribution"
5352
; Remove files from the uninstall directory.
5353
${If} ${FileExists} "$INSTDIR\uninstall"
5354
Delete "$INSTDIR\uninstall\*wizard*"
5355
Delete "$INSTDIR\uninstall\uninstall.ini"
5356
Delete "$INSTDIR\uninstall\cleanup.log"
5357
Delete "$INSTDIR\uninstall\uninstall.update"
5358
${OnInstallUninstall}
5361
; Since we write to the uninstall.log in this directory during the
5362
; installation create the directory if it doesn't already exist.
5363
IfFileExists "$INSTDIR\uninstall" +2 +1
5364
CreateDirectory "$INSTDIR\uninstall"
5366
; Application update uses a directory named tobedeleted in the $INSTDIR to
5367
; delete files on OS reboot when they are in use. Try to delete this
5368
; directory if it exists.
5369
${If} ${FileExists} "$INSTDIR\tobedeleted"
5370
RmDir /r "$INSTDIR\tobedeleted"
5373
; Remove files that may be left behind by the application in the
5374
; VirtualStore directory.
5375
${CleanVirtualStore}
5382
!macro InstallStartCleanupCommonCall
5384
!verbose ${_MOZFUNC_VERBOSE}
5385
Call InstallStartCleanupCommon
5390
* Performs common cleanup operations after the actual installation.
5391
* This macro should be called last during the installation.
5393
!macro InstallEndCleanupCommon
5395
!ifndef InstallEndCleanupCommon
5396
!insertmacro EndUninstallLog
5399
!verbose ${_MOZFUNC_VERBOSE}
5400
!define InstallEndCleanupCommon "!insertmacro InstallEndCleanupCommonCall"
5402
Function InstallEndCleanupCommon
5404
; Close the file handle to the uninstall.log
5413
!macro InstallEndCleanupCommonCall
5415
!verbose ${_MOZFUNC_VERBOSE}
5416
Call InstallEndCleanupCommon
5421
################################################################################
5422
# UAC Related Macros
5425
* Provides UAC elevation support for Vista and above (requires the UAC plugin).
5427
* $0 = return values from calls to the UAC plugin (always uses $0)
5428
* $R9 = return values from GetParameters and GetOptions macros
5432
!ifndef ${_MOZFUNC_UN}ElevateUAC
5433
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
5434
!insertmacro ${_MOZFUNC_UN_TMP}GetOptions
5435
!insertmacro ${_MOZFUNC_UN_TMP}GetParameters
5437
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
5438
!undef _MOZFUNC_UN_TMP
5441
!verbose ${_MOZFUNC_VERBOSE}
5442
!define ${_MOZFUNC_UN}ElevateUAC "!insertmacro ${_MOZFUNC_UN}ElevateUACCall"
5444
Function ${_MOZFUNC_UN}ElevateUAC
5448
!ifndef NONADMIN_ELEVATE
5449
${If} ${AtLeastWinVista}
5451
; If the user is not an admin already
5454
; If the system supports UAC
5456
UAC::GetElevationType
5457
; If the user account has a split token
5461
; Nothing besides UAC initialized so no need to call OnEndCommon
5466
${GetParameters} $R9
5469
${GetOptions} "$R9" "/UAC:" $0
5470
; If the command line contains /UAC then we need to initialize
5471
; the UAC plugin to use UAC::ExecCodeSegment to execute code in
5472
; the non-elevated context.
5480
${If} ${AtLeastWinVista}
5482
; If the user is not an admin already
5485
; If the system supports UAC require that the user elevate
5487
UAC::GetElevationType
5488
; If the user account has a split token
5492
; Nothing besides UAC initialized so no need to call OnEndCommon
5496
; Check if UAC is enabled. If the user has turned UAC on or off
5497
; without rebooting this value will be incorrect. This is an
5498
; edgecase that we have to live with when trying to allow
5499
; installing when the user doesn't have privileges such as a public
5500
; computer while trying to also achieve UAC elevation. When this
5501
; happens the user will be presented with the runas dialog if the
5502
; value is 1 and won't be presented with the UAC dialog when the
5504
ReadRegDWord $R9 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" "EnableLUA"
5506
; This will display the UAC version of the runas dialog which
5507
; requires a password for an existing user account.
5509
${If} "$0" == "0" ; Was elevation successful
5511
; Nothing besides UAC initialized so no need to call OnEndCommon
5514
; Unload UAC since the elevation request was not successful and
5521
${${_MOZFUNC_UN}GetParameters} $R9
5522
${${_MOZFUNC_UN}GetOptions} "$R9" "/UAC:" $R9
5523
; If the command line contains /UAC then we need to initialize the UAC
5524
; plugin to use UAC::ExecCodeSegment to execute code in the
5525
; non-elevated context.
5543
!macro ElevateUACCall
5545
!verbose ${_MOZFUNC_VERBOSE}
5550
!macro un.ElevateUACCall
5552
!verbose ${_MOZFUNC_VERBOSE}
5557
!macro un.ElevateUAC
5558
!ifndef un.ElevateUAC
5560
!verbose ${_MOZFUNC_VERBOSE}
5562
!define _MOZFUNC_UN "un."
5564
!insertmacro ElevateUAC
5573
* Unloads the UAC plugin so the NSIS plugins can be removed when the installer
5574
* and uninstaller exit.
5576
* $R9 = return values from GetParameters and GetOptions macros
5580
!ifndef ${_MOZFUNC_UN}UnloadUAC
5581
!define _MOZFUNC_UN_TMP_UnloadUAC ${_MOZFUNC_UN}
5582
!insertmacro ${_MOZFUNC_UN_TMP_UnloadUAC}GetOptions
5583
!insertmacro ${_MOZFUNC_UN_TMP_UnloadUAC}GetParameters
5585
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP_UnloadUAC}
5586
!undef _MOZFUNC_UN_TMP_UnloadUAC
5589
!verbose ${_MOZFUNC_VERBOSE}
5590
!define ${_MOZFUNC_UN}UnloadUAC "!insertmacro ${_MOZFUNC_UN}UnloadUACCall"
5592
Function ${_MOZFUNC_UN}UnloadUAC
5593
${Unless} ${AtLeastWinVista}
5600
${${_MOZFUNC_UN}GetParameters} $R9
5601
${${_MOZFUNC_UN}GetOptions} "$R9" "/UAC:" $R9
5602
; If the command line contains /UAC then we need to unload the UAC plugin
5615
!macro UnloadUACCall
5617
!verbose ${_MOZFUNC_VERBOSE}
5622
!macro un.UnloadUACCall
5624
!verbose ${_MOZFUNC_VERBOSE}
5630
!ifndef un.UnloadUAC
5632
!verbose ${_MOZFUNC_VERBOSE}
5634
!define _MOZFUNC_UN "un."
5636
!insertmacro UnloadUAC
5645
################################################################################
5646
# Macros for uninstall.log and install.log logging
5648
# Since these are used by other macros they should be inserted first. All of
5649
# these macros can be easily inserted using the _LoggingCommon macro.
5652
* Adds all logging macros in the correct order in one fell swoop as well as
5653
* the vars for the install.log and uninstall.log file handles.
5655
!macro _LoggingCommon
5656
Var /GLOBAL fhInstallLog
5657
Var /GLOBAL fhUninstallLog
5658
!insertmacro StartInstallLog
5659
!insertmacro EndInstallLog
5660
!insertmacro StartUninstallLog
5661
!insertmacro EndUninstallLog
5663
!define _LoggingCommon "!insertmacro _LoggingCommon"
5666
* Creates a file named install.log in the install directory (e.g. $INSTDIR)
5667
* and adds the installation started message to the install.log for this
5668
* installation. This also adds the fhInstallLog and fhUninstallLog vars used
5671
* $fhInstallLog = filehandle for $INSTDIR\install.log
5674
* Typically the BrandFullName
5676
* The locale identifier
5677
* @param _APP_VERSION
5678
* The application version
5679
* @param _GRE_VERSION
5680
* The Gecko Runtime Engine version
5684
* $R8 = _APP_VERSION
5685
* $R9 = _GRE_VERSION
5687
!macro StartInstallLog
5689
!ifndef StartInstallLog
5690
!insertmacro GetTime
5693
!verbose ${_MOZFUNC_VERBOSE}
5694
!define StartInstallLog "!insertmacro StartInstallLogCall"
5696
Function StartInstallLog
5712
${DeleteFile} "$INSTDIR\install.log"
5713
FileOpen $fhInstallLog "$INSTDIR\install.log" w
5714
FileWriteWord $fhInstallLog "65279"
5716
${GetTime} "" "L" $9 $R0 $R1 $R2 $R3 $R4 $R5
5717
FileWriteUTF16LE $fhInstallLog "$R6 Installation Started: $R1-$R0-$9 $R3:$R4:$R5"
5718
${WriteLogSeparator}
5720
${LogHeader} "Installation Details"
5721
${LogMsg} "Install Dir: $INSTDIR"
5722
${LogMsg} "Locale : $R7"
5723
${LogMsg} "App Version: $R8"
5724
${LogMsg} "GRE Version: $R9"
5727
${LogMsg} "OS Name : Windows XP"
5728
${ElseIf} ${IsWin2003}
5729
${LogMsg} "OS Name : Windows 2003"
5730
${ElseIf} ${IsWinVista}
5731
${LogMsg} "OS Name : Windows Vista"
5733
${LogMsg} "OS Name : Windows 7"
5735
${LogMsg} "OS Name : Windows 8"
5736
${ElseIf} ${AtLeastWin8}
5737
${LogMsg} "OS Name : Above Windows 8"
5739
${LogMsg} "OS Name : Unable to detect"
5742
!ifdef HAVE_64BIT_OS
5743
${LogMsg} "Target CPU : x64"
5745
${LogMsg} "Target CPU : x86"
5768
!macro StartInstallLogCall _APP_NAME _AB_CD _APP_VERSION _GRE_VERSION
5770
!verbose ${_MOZFUNC_VERBOSE}
5773
Push "${_APP_VERSION}"
5774
Push "${_GRE_VERSION}"
5775
Call StartInstallLog
5780
* Writes the installation finished message to the install.log and closes the
5781
* file handles to the install.log and uninstall.log
5787
!macro EndInstallLog
5789
!ifndef EndInstallLog
5790
!insertmacro GetTime
5793
!verbose ${_MOZFUNC_VERBOSE}
5794
!define EndInstallLog "!insertmacro EndInstallLogCall"
5796
Function EndInstallLog
5806
${WriteLogSeparator}
5807
${GetTime} "" "L" $R2 $R3 $R4 $R5 $R6 $R7 $R8
5808
FileWriteUTF16LE $fhInstallLog "$R9 Installation Finished: $R4-$R3-$R2 $R6:$R7:$R8$\r$\n"
5809
FileClose $fhInstallLog
5825
!macro EndInstallLogCall _APP_NAME
5827
!verbose ${_MOZFUNC_VERBOSE}
5834
* Opens the file handle to the uninstall.log.
5836
* $fhUninstallLog = filehandle for $INSTDIR\uninstall\uninstall.log
5838
!macro StartUninstallLog
5840
!ifndef StartUninstallLog
5842
!verbose ${_MOZFUNC_VERBOSE}
5843
!define StartUninstallLog "!insertmacro StartUninstallLogCall"
5845
Function StartUninstallLog
5846
FileOpen $fhUninstallLog "$INSTDIR\uninstall\uninstall.log" w
5853
!macro StartUninstallLogCall
5855
!verbose ${_MOZFUNC_VERBOSE}
5856
Call StartUninstallLog
5861
* Closes the file handle to the uninstall.log.
5863
!macro EndUninstallLog
5865
!ifndef EndUninstallLog
5868
!verbose ${_MOZFUNC_VERBOSE}
5869
!define EndUninstallLog "!insertmacro EndUninstallLogCall"
5871
Function EndUninstallLog
5872
FileClose $fhUninstallLog
5879
!macro EndUninstallLogCall
5881
!verbose ${_MOZFUNC_VERBOSE}
5882
Call EndUninstallLog
5887
* Adds a section header to the human readable log.
5890
* The header text to write to the log.
5892
!macro LogHeader _HEADER
5893
${WriteLogSeparator}
5894
FileWriteUTF16LE $fhInstallLog "${_HEADER}"
5895
${WriteLogSeparator}
5897
!define LogHeader "!insertmacro LogHeader"
5900
* Adds a section message to the human readable log.
5903
* The message text to write to the log.
5906
FileWriteUTF16LE $fhInstallLog " ${_MSG}$\r$\n"
5908
!define LogMsg "!insertmacro LogMsg"
5911
* Adds an uninstall entry to the uninstall log.
5914
* The message text to write to the log.
5916
!macro LogUninstall _MSG
5917
FileWrite $fhUninstallLog "${_MSG}$\r$\n"
5919
!define LogUninstall "!insertmacro LogUninstall"
5922
* Adds a section divider to the human readable log.
5924
!macro WriteLogSeparator
5925
FileWriteUTF16LE $fhInstallLog "$\r$\n----------------------------------------\
5926
---------------------------------------$\r$\n"
5928
!define WriteLogSeparator "!insertmacro WriteLogSeparator"
5931
################################################################################
5932
# Macros for managing the shortcuts log ini file
5935
* Adds the most commonly used shortcut logging macros for the installer in one
5938
!macro _LoggingShortcutsCommon
5939
!insertmacro LogDesktopShortcut
5940
!insertmacro LogQuickLaunchShortcut
5941
!insertmacro LogSMProgramsShortcut
5943
!define _LoggingShortcutsCommon "!insertmacro _LoggingShortcutsCommon"
5946
* Creates the shortcuts log ini file with a UTF-16LE BOM if it doesn't exist.
5948
!macro initShortcutsLog
5951
IfFileExists "$INSTDIR\uninstall\${SHORTCUTS_LOG}" +4 +1
5952
FileOpen $R9 "$INSTDIR\uninstall\${SHORTCUTS_LOG}" w
5953
FileWriteWord $R9 "65279"
5958
!define initShortcutsLog "!insertmacro initShortcutsLog"
5961
* Adds shortcut entries to the shortcuts log ini file. This macro is primarily
5962
* a helper used by the LogDesktopShortcut, LogQuickLaunchShortcut, and
5963
* LogSMProgramsShortcut macros but it can be used by other code if desired. If
5964
* the value already exists the the value is not written to the file.
5966
* @param _SECTION_NAME
5967
* The section name to write to in the shortcut log ini file
5969
* The shortcut's file name
5971
* $R6 = return value from ReadIniStr for the shortcut file name
5972
* $R7 = counter for supporting multiple shortcuts in the same location
5973
* $R8 = _SECTION_NAME
5980
!verbose ${_MOZFUNC_VERBOSE}
5981
!define LogShortcut "!insertmacro LogShortcutCall"
5983
Function LogShortcut
5992
!insertmacro initShortcutsLog
5997
StrCmp "$R6" "$R9" +5 +1 ; if the shortcut already exists don't add it
5998
IntOp $R7 $R7 + 1 ; increment the counter
5999
ReadIniStr $R6 "$INSTDIR\uninstall\${SHORTCUTS_LOG}" "$R8" "Shortcut$R7"
6001
WriteINIStr "$INSTDIR\uninstall\${SHORTCUTS_LOG}" "$R8" "Shortcut$R7" "$R9"
6016
!macro LogShortcutCall _SECTION_NAME _FILE_NAME
6018
!verbose ${_MOZFUNC_VERBOSE}
6019
Push "${_SECTION_NAME}"
6020
Push "${_FILE_NAME}"
6026
* Adds a Desktop shortcut entry to the shortcuts log ini file.
6029
* The shortcut file name (e.g. shortcut.lnk)
6031
!macro LogDesktopShortcut
6033
!ifndef LogDesktopShortcut
6034
!insertmacro LogShortcut
6037
!verbose ${_MOZFUNC_VERBOSE}
6038
!define LogDesktopShortcut "!insertmacro LogDesktopShortcutCall"
6040
Function LogDesktopShortcut
6048
!macro LogDesktopShortcutCall _FILE_NAME
6050
!verbose ${_MOZFUNC_VERBOSE}
6052
Push "${_FILE_NAME}"
6053
Call LogDesktopShortcut
6058
* Adds a QuickLaunch shortcut entry to the shortcuts log ini file.
6061
* The shortcut file name (e.g. shortcut.lnk)
6063
!macro LogQuickLaunchShortcut
6065
!ifndef LogQuickLaunchShortcut
6066
!insertmacro LogShortcut
6069
!verbose ${_MOZFUNC_VERBOSE}
6070
!define LogQuickLaunchShortcut "!insertmacro LogQuickLaunchShortcutCall"
6072
Function LogQuickLaunchShortcut
6080
!macro LogQuickLaunchShortcutCall _FILE_NAME
6082
!verbose ${_MOZFUNC_VERBOSE}
6084
Push "${_FILE_NAME}"
6085
Call LogQuickLaunchShortcut
6090
* Adds a Start Menu shortcut entry to the shortcuts log ini file.
6093
* The shortcut file name (e.g. shortcut.lnk)
6095
!macro LogStartMenuShortcut
6097
!ifndef LogStartMenuShortcut
6098
!insertmacro LogShortcut
6101
!verbose ${_MOZFUNC_VERBOSE}
6102
!define LogStartMenuShortcut "!insertmacro LogStartMenuShortcutCall"
6104
Function LogStartMenuShortcut
6112
!macro LogStartMenuShortcutCall _FILE_NAME
6114
!verbose ${_MOZFUNC_VERBOSE}
6116
Push "${_FILE_NAME}"
6117
Call LogStartMenuShortcut
6122
* Adds a Start Menu Programs shortcut entry to the shortcuts log ini file.
6125
* The shortcut file name (e.g. shortcut.lnk)
6127
!macro LogSMProgramsShortcut
6129
!ifndef LogSMProgramsShortcut
6130
!insertmacro LogShortcut
6133
!verbose ${_MOZFUNC_VERBOSE}
6134
!define LogSMProgramsShortcut "!insertmacro LogSMProgramsShortcutCall"
6136
Function LogSMProgramsShortcut
6144
!macro LogSMProgramsShortcutCall _FILE_NAME
6146
!verbose ${_MOZFUNC_VERBOSE}
6148
Push "${_FILE_NAME}"
6149
Call LogSMProgramsShortcut
6154
* Adds the relative path from the Start Menu Programs directory for the
6155
* application's Start Menu directory if it is different from the existing value
6156
* to the shortcuts log ini file.
6158
* @param _REL_PATH_TO_DIR
6159
* The relative path from the Start Menu Programs directory to the
6160
* program's directory.
6162
* $R9 = _REL_PATH_TO_DIR
6164
!macro LogSMProgramsDirRelPath _REL_PATH_TO_DIR
6167
!insertmacro initShortcutsLog
6169
ReadINIStr $R9 "$INSTDIR\uninstall\${SHORTCUTS_LOG}" "SMPROGRAMS" "RelativePathToDir"
6170
StrCmp "$R9" "${_REL_PATH_TO_DIR}" +2 +1
6171
WriteINIStr "$INSTDIR\uninstall\${SHORTCUTS_LOG}" "SMPROGRAMS" "RelativePathToDir" "${_REL_PATH_TO_DIR}"
6175
!define LogSMProgramsDirRelPath "!insertmacro LogSMProgramsDirRelPath"
6178
* Copies the value for the relative path from the Start Menu programs directory
6179
* (e.g. $SMPROGRAMS) to the Start Menu directory as it is stored in the
6180
* shortcuts log ini file to the variable specified in the first parameter.
6182
!macro GetSMProgramsDirRelPath _VAR
6183
ReadINIStr ${_VAR} "$INSTDIR\uninstall\${SHORTCUTS_LOG}" "SMPROGRAMS" \
6186
!define GetSMProgramsDirRelPath "!insertmacro GetSMProgramsDirRelPath"
6189
* Copies the shortcuts log ini file path to the variable specified in the
6192
!macro GetShortcutsLogPath _VAR
6193
StrCpy ${_VAR} "$INSTDIR\uninstall\${SHORTCUTS_LOG}"
6195
!define GetShortcutsLogPath "!insertmacro GetShortcutsLogPath"
6198
* Deletes the shortcuts log ini file.
6200
!macro DeleteShortcutsLogFile
6201
${DeleteFile} "$INSTDIR\uninstall\${SHORTCUTS_LOG}"
6203
!define DeleteShortcutsLogFile "!insertmacro DeleteShortcutsLogFile"
6206
################################################################################
6207
# Macros for managing specific Windows version features
6210
* Sets the permitted layered service provider (LSP) categories on Windows
6211
* Vista and above for the application. Consumers should call this after an
6212
* installation log section has completed since this macro will log the results
6213
* to the installation log along with a header.
6215
* !IMPORTANT - When calling this macro from an uninstaller do not specify a
6216
* parameter. The paramter is hardcoded with 0x00000000 to remove
6217
* the LSP category for the application when performing an
6220
* @param _LSP_CATEGORIES
6221
* The permitted LSP categories for the application. When called by an
6222
* uninstaller this will always be 0x00000000.
6224
* $R5 = error code popped from the stack for the WSCSetApplicationCategory call
6225
* $R6 = return value from the WSCSetApplicationCategory call
6226
* $R7 = string length for the long path to the main application executable
6227
* $R8 = long path to the main application executable
6228
* $R9 = _LSP_CATEGORIES
6230
!macro SetAppLSPCategories
6232
!ifndef ${_MOZFUNC_UN}SetAppLSPCategories
6233
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
6234
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
6236
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
6237
!undef _MOZFUNC_UN_TMP
6240
!verbose ${_MOZFUNC_VERBOSE}
6241
!define ${_MOZFUNC_UN}SetAppLSPCategories "!insertmacro ${_MOZFUNC_UN}SetAppLSPCategoriesCall"
6243
Function ${_MOZFUNC_UN}SetAppLSPCategories
6244
${Unless} ${AtLeastWinVista}
6254
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR\${FileMainEXE}" $R8
6257
; Remove existing categories by setting the permitted categories to
6258
; 0x00000000 since new categories are ANDed with existing categories. If
6259
; the param value stored in $R9 is 0x00000000 then skip the removal since
6260
; the categories will be removed by the second call to
6261
; WSCSetApplicationCategory.
6262
StrCmp "$R9" "0x00000000" +2 +1
6263
System::Call "Ws2_32::WSCSetApplicationCategory(w R8, i R7, w n, i 0,\
6264
i 0x00000000, i n, *i) i"
6266
; Set the permitted LSP categories
6267
System::Call "Ws2_32::WSCSetApplicationCategory(w R8, i R7, w n, i 0,\
6268
i R9, i n, *i .s) i.R6"
6272
${LogHeader} "Setting Permitted LSP Categories"
6273
StrCmp "$R6" 0 +3 +1
6274
${LogMsg} "** ERROR Setting LSP Categories: $R5 **"
6276
${LogMsg} "Permitted LSP Categories: $R9"
6292
!macro SetAppLSPCategoriesCall _LSP_CATEGORIES
6294
!verbose ${_MOZFUNC_VERBOSE}
6295
Push "${_LSP_CATEGORIES}"
6296
Call SetAppLSPCategories
6300
!macro un.SetAppLSPCategoriesCall
6302
!verbose ${_MOZFUNC_VERBOSE}
6304
Call un.SetAppLSPCategories
6308
!macro un.SetAppLSPCategories
6309
!ifndef un.SetAppLSPCategories
6311
!verbose ${_MOZFUNC_VERBOSE}
6313
!define _MOZFUNC_UN "un."
6315
!insertmacro SetAppLSPCategories
6324
* Checks if any pinned TaskBar lnk files point to the executable's path passed
6328
* The executable path
6330
* false if no pinned shotcuts were found for this install location.
6331
* true if pinned shotcuts were found for this install location.
6333
* $R5 = stores whether a TaskBar lnk file has been found for the executable
6334
* $R6 = long path returned from GetShortCutTarget and GetLongPath
6335
* $R7 = file name returned from FindFirst and FindNext
6336
* $R8 = find handle for FindFirst and FindNext
6337
* $R9 = _EXE_PATH and _RESULT
6339
!macro IsPinnedToTaskBar
6341
!ifndef IsPinnedToTaskBar
6342
!insertmacro GetLongPath
6345
!verbose ${_MOZFUNC_VERBOSE}
6346
!define IsPinnedToTaskBar "!insertmacro IsPinnedToTaskBarCall"
6348
Function IsPinnedToTaskBar
6357
${If} ${AtLeastWin7}
6358
${AndIf} ${FileExists} "$QUICKLAUNCH\User Pinned\TaskBar"
6359
FindFirst $R8 $R7 "$QUICKLAUNCH\User Pinned\TaskBar\*.lnk"
6361
${If} ${FileExists} "$QUICKLAUNCH\User Pinned\TaskBar\$R7"
6362
ShellLink::GetShortCutTarget "$QUICKLAUNCH\User Pinned\TaskBar\$R7"
6364
${GetLongPath} "$R6" $R6
6365
${If} "$R6" == "$R9"
6394
!macro IsPinnedToTaskBarCall _EXE_PATH _RESULT
6396
!verbose ${_MOZFUNC_VERBOSE}
6398
Call IsPinnedToTaskBar
6404
* Checks if any pinned Start Menu lnk files point to the executable's path
6405
* passed to the macro.
6408
* The executable path
6410
* false if no pinned shotcuts were found for this install location.
6411
* true if pinned shotcuts were found for this install location.
6413
* $R5 = stores whether a Start Menu lnk file has been found for the executable
6414
* $R6 = long path returned from GetShortCutTarget and GetLongPath
6415
* $R7 = file name returned from FindFirst and FindNext
6416
* $R8 = find handle for FindFirst and FindNext
6417
* $R9 = _EXE_PATH and _RESULT
6419
!macro IsPinnedToStartMenu
6421
!ifndef IsPinnedToStartMenu
6422
!insertmacro GetLongPath
6425
!verbose ${_MOZFUNC_VERBOSE}
6426
!define IsPinnedToStartMenu "!insertmacro IsPinnedToStartMenuCall"
6428
Function IsPinnedToStartMenu
6437
${If} ${AtLeastWin7}
6438
${AndIf} ${FileExists} "$QUICKLAUNCH\User Pinned\StartMenu"
6439
FindFirst $R8 $R7 "$QUICKLAUNCH\User Pinned\StartMenu\*.lnk"
6441
${If} ${FileExists} "$QUICKLAUNCH\User Pinned\StartMenu\$R7"
6442
ShellLink::GetShortCutTarget "$QUICKLAUNCH\User Pinned\StartMenu\$R7"
6444
${GetLongPath} "$R6" $R6
6445
${If} "$R6" == "$R9"
6474
!macro IsPinnedToStartMenuCall _EXE_PATH _RESULT
6476
!verbose ${_MOZFUNC_VERBOSE}
6478
Call IsPinnedToStartMenu
6484
* Gets the number of pinned shortcut lnk files pinned to the Task Bar.
6487
* number of pinned shortcut lnk files.
6489
* $R7 = file name returned from FindFirst and FindNext
6490
* $R8 = find handle for FindFirst and FindNext
6493
!macro PinnedToTaskBarLnkCount
6495
!ifndef PinnedToTaskBarLnkCount
6496
!insertmacro GetLongPath
6499
!verbose ${_MOZFUNC_VERBOSE}
6500
!define PinnedToTaskBarLnkCount "!insertmacro PinnedToTaskBarLnkCountCall"
6502
Function PinnedToTaskBarLnkCount
6509
${If} ${AtLeastWin7}
6510
${AndIf} ${FileExists} "$QUICKLAUNCH\User Pinned\TaskBar"
6511
FindFirst $R8 $R7 "$QUICKLAUNCH\User Pinned\TaskBar\*.lnk"
6513
${If} ${FileExists} "$QUICKLAUNCH\User Pinned\TaskBar\$R7"
6536
!macro PinnedToTaskBarLnkCountCall _RESULT
6538
!verbose ${_MOZFUNC_VERBOSE}
6539
Call PinnedToTaskBarLnkCount
6545
* Gets the number of pinned shortcut lnk files pinned to the Start Menu.
6548
* number of pinned shortcut lnk files.
6550
* $R7 = file name returned from FindFirst and FindNext
6551
* $R8 = find handle for FindFirst and FindNext
6554
!macro PinnedToStartMenuLnkCount
6556
!ifndef PinnedToStartMenuLnkCount
6557
!insertmacro GetLongPath
6560
!verbose ${_MOZFUNC_VERBOSE}
6561
!define PinnedToStartMenuLnkCount "!insertmacro PinnedToStartMenuLnkCountCall"
6563
Function PinnedToStartMenuLnkCount
6570
${If} ${AtLeastWin7}
6571
${AndIf} ${FileExists} "$QUICKLAUNCH\User Pinned\StartMenu"
6572
FindFirst $R8 $R7 "$QUICKLAUNCH\User Pinned\StartMenu\*.lnk"
6574
${If} ${FileExists} "$QUICKLAUNCH\User Pinned\StartMenu\$R7"
6597
!macro PinnedToStartMenuLnkCountCall _RESULT
6599
!verbose ${_MOZFUNC_VERBOSE}
6600
Call PinnedToStartMenuLnkCount
6606
* Update Start Menu / TaskBar lnk files that point to the executable's path
6607
* passed to the macro and all other shortcuts installed by the application with
6608
* the current application user model ID. Requires ApplicationID.
6610
* NOTE: this does not update Desktop shortcut application user model ID due to
6614
* The main application executable path
6616
* The application user model ID for the current install
6618
* false if no pinned shotcuts were found for this install location.
6619
* true if pinned shotcuts were found for this install location.
6621
!macro UpdateShortcutAppModelIDs
6623
!ifndef UpdateShortcutAppModelIDs
6624
!insertmacro GetLongPath
6627
!verbose ${_MOZFUNC_VERBOSE}
6628
!define UpdateShortcutAppModelIDs "!insertmacro UpdateShortcutAppModelIDsCall"
6630
Function UpdateShortcutAppModelIDs
6631
; stack: path, appid
6632
Exch $R9 ; stack: $R9, appid | $R9 = path
6633
Exch 1 ; stack: appid, $R9
6634
Exch $R8 ; stack: $R8, $R9 | $R8 = appid
6635
Push $R7 ; stack: $R7, $R8, $R9
6639
Push $R3 ; stack: $R3, $R5, $R6, $R7, $R8, $R9
6642
; $R9 = main application executable path
6644
; $R7 = path to the application's start menu programs directory
6645
; $R6 = path to the shortcut log ini file
6646
; $R5 = shortcut filename
6647
; $R4 = GetShortCutTarget result
6651
${If} ${AtLeastWin7}
6652
; installed shortcuts
6653
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR\uninstall\${SHORTCUTS_LOG}" $R6
6654
${If} ${FileExists} "$R6"
6655
; Update the Start Menu shortcuts' App ID for this application
6658
IntOp $R2 $R2 + 1 ; Increment the counter
6660
ReadINIStr $R5 "$R6" "STARTMENU" "Shortcut$R2"
6665
${If} ${FileExists} "$SMPROGRAMS\$R5"
6666
ShellLink::GetShortCutTarget "$SMPROGRAMS\$$R5"
6668
${GetLongPath} "$R4" $R4
6669
${If} "$R4" == "$R9" ; link path == install path
6670
ApplicationID::Set "$SMPROGRAMS\$R5" "$R8"
6676
; Update the Quick Launch shortcuts' App ID for this application
6679
IntOp $R2 $R2 + 1 ; Increment the counter
6681
ReadINIStr $R5 "$R6" "QUICKLAUNCH" "Shortcut$R2"
6686
${If} ${FileExists} "$QUICKLAUNCH\$R5"
6687
ShellLink::GetShortCutTarget "$QUICKLAUNCH\$R5"
6689
${GetLongPath} "$R4" $R4
6690
${If} "$R4" == "$R9" ; link path == install path
6691
ApplicationID::Set "$QUICKLAUNCH\$R5" "$R8"
6697
; Update the Start Menu Programs shortcuts' App ID for this application
6699
ReadINIStr $R7 "$R6" "SMPROGRAMS" "RelativePathToDir"
6701
${${_MOZFUNC_UN}GetLongPath} "$SMPROGRAMS\$R7" $R7
6702
${Unless} "$R7" == ""
6705
IntOp $R2 $R2 + 1 ; Increment the counter
6707
ReadINIStr $R5 "$R6" "SMPROGRAMS" "Shortcut$R2"
6712
${If} ${FileExists} "$R7\$R5"
6713
ShellLink::GetShortCutTarget "$R7\$R5"
6715
${GetLongPath} "$R4" $R4
6716
${If} "$R4" == "$R9" ; link path == install path
6717
ApplicationID::Set "$R7\$R5" "$R8"
6726
StrCpy $R7 "$QUICKLAUNCH\User Pinned"
6729
; $R9 = main application executable path
6731
; $R7 = user pinned path
6733
; $R5 = found filename
6734
; $R4 = GetShortCutTarget result
6737
FindFirst $R6 $R5 "$R7\TaskBar\*.lnk"
6739
${If} ${FileExists} "$R7\TaskBar\$R5"
6740
ShellLink::GetShortCutTarget "$R7\TaskBar\$R5"
6742
${If} "$R4" == "$R9" ; link path == install path
6743
ApplicationID::Set "$R7\TaskBar\$R5" "$R8"
6744
Pop $R4 ; pop Set result off the stack
6757
FindFirst $R6 $R5 "$R7\StartMenu\*.lnk"
6759
${If} ${FileExists} "$R7\StartMenu\$R5"
6760
ShellLink::GetShortCutTarget "$R7\StartMenu\$R5"
6762
${If} "$R4" == "$R9" ; link path == install path
6763
ApplicationID::Set "$R7\StartMenu\$R5" "$R8"
6764
Pop $R4 ; pop Set result off the stack
6782
Pop $R3 ; stack: $R4, $R5, $R6, $R7, $R8, $R9
6783
Pop $R4 ; stack: $R5, $R6, $R7, $R8, $R9
6784
Pop $R5 ; stack: $R6, $R7, $R8, $R9
6785
Pop $R6 ; stack: $R7, $R8, $R9
6786
Pop $R7 ; stack: $R8, $R9
6787
Exch $R8 ; stack: appid, $R9 | $R8 = old $R8
6788
Exch 1 ; stack: $R9, appid
6789
Exch $R9 ; stack: path, appid | $R9 = old $R9
6796
!macro UpdateShortcutAppModelIDsCall _EXE_PATH _APP_ID _RESULT
6798
!verbose ${_MOZFUNC_VERBOSE}
6801
Call UpdateShortcutAppModelIDs
6807
; Copied from: http://nsis.sourceforge.net/IsUserAdmin
6808
Function IsUserAdmin
6817
UserInfo::GetAccountType
6820
StrCmp $R2 "Admin" 0 Continue
6841
* Retrieve if present or generate and store a 64 bit hash of an install path
6842
* using the City Hash algorithm. On return the resulting id is saved in the
6843
* $AppUserModelID variable declared by inserting this macro. InitHashAppModelId
6844
* will attempt to load from HKLM/_REG_PATH first, then HKCU/_REG_PATH. If found
6845
* in either it will return the hash it finds. If not found it will generate a
6846
* new hash and attempt to store the hash in HKLM/_REG_PATH, then HKCU/_REG_PATH.
6847
* Subsequent calls will then retreive the stored hash value. On any failure,
6848
* $AppUserModelID will be set to an empty string.
6850
* Registry format: root/_REG_PATH/"_EXE_PATH" = "hash"
6853
* The main application executable path
6855
* The HKLM/HKCU agnostic registry path where the key hash should
6856
* be stored. ex: "Software\Mozilla\Firefox\TaskBarIDs"
6857
* @result (Var) $AppUserModelID contains the app model id.
6859
!macro InitHashAppModelId
6860
!ifndef ${_MOZFUNC_UN}InitHashAppModelId
6861
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
6862
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
6864
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
6865
!undef _MOZFUNC_UN_TMP
6867
!ifndef InitHashAppModelId
6872
!verbose ${_MOZFUNC_VERBOSE}
6873
!define ${_MOZFUNC_UN}InitHashAppModelId "!insertmacro ${_MOZFUNC_UN}InitHashAppModelIdCall"
6875
Function ${_MOZFUNC_UN}InitHashAppModelId
6876
; stack: apppath, regpath
6877
Exch $R9 ; stack: $R9, regpath | $R9 = apppath
6878
Exch 1 ; stack: regpath, $R9
6879
Exch $R8 ; stack: $R8, $R9 | $R8 = regpath
6882
${If} ${AtLeastWin7}
6883
${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
6885
ReadRegStr $R7 HKLM "$R8" "$R9"
6888
ReadRegStr $R7 HKCU "$R8" "$R9"
6890
; If it doesn't exist, create a new one and store it
6891
CityHash::GetCityHash64 "$R9"
6893
${If} $AppUserModelID == "error"
6897
WriteRegStr HKLM "$R8" "$R9" "$AppUserModelID"
6900
WriteRegStr HKCU "$R8" "$R9" "$AppUserModelID"
6902
StrCpy $AppUserModelID "error"
6906
StrCpy $AppUserModelID $R7
6909
StrCpy $AppUserModelID $R7
6914
${If} "$AppUserModelID" == "error"
6915
StrCpy $AppUserModelID ""
6929
!macro InitHashAppModelIdCall _EXE_PATH _REG_PATH
6931
!verbose ${_MOZFUNC_VERBOSE}
6934
Call InitHashAppModelId
6938
!macro un.InitHashAppModelIdCall _EXE_PATH _REG_PATH
6940
!verbose ${_MOZFUNC_VERBOSE}
6943
Call un.InitHashAppModelId
6947
!macro un.InitHashAppModelId
6948
!ifndef un.InitHashAppModelId
6950
!verbose ${_MOZFUNC_VERBOSE}
6952
!define _MOZFUNC_UN "un."
6954
!insertmacro InitHashAppModelId
6963
; Removes the CEH registration if it's set to our installation directory.
6964
; If it's set to some other installation directory, then it should be removed
6965
; by that installation.
6966
!macro RemoveDEHRegistrationIfMatchingCall un
6967
Function ${un}RemoveDEHRegistrationIfMatchingCall
6968
; Move the old $R0 on the stack and set it to DEH ID
6970
; Backup the old values of R8 and R7 on the stack
6974
ReadRegStr $R8 HKCU "Software\Classes\CLSID\$R0\LocalServer32" ""
6975
${${un}GetLongPath} "$INSTDIR" $R7
6976
StrCmp "$R8" "" next +1
6977
IfFileExists "$R8" +1 clearHKCU
6978
${${un}GetParent} "$R8" $R8
6979
${${un}GetLongPath} "$R8" $R8
6980
StrCmp "$R7" "$R8" clearHKCU next
6982
DeleteRegKey HKCU "Software\Classes\CLSID\$R0"
6983
DeleteRegValue HKCU \
6984
"Software\Classes\$AppUserModelID\.exe\shell\open\command" \
6988
ReadRegStr $R8 HKLM "Software\Classes\CLSID\$R0\LocalServer32" ""
6989
${${un}GetLongPath} "$INSTDIR" $R7
6990
StrCmp "$R8" "" done +1
6991
IfFileExists "$R8" +1 clearHKLM
6992
${${un}GetParent} "$R8" $R8
6993
${${un}GetLongPath} "$R8" $R8
6994
StrCmp "$R7" "$R8" clearHKLM done
6996
DeleteRegKey HKLM "Software\Classes\CLSID\$R0"
6997
DeleteRegValue HKLM \
6998
"Software\Classes\$AppUserModelID\.exe\shell\open\command" \
7002
; Restore the stack back to its original state
7009
!macro RemoveDEHRegistrationIfMatching
7010
!insertmacro RemoveDEHRegistrationIfMatchingCall ""
7013
!macro un.RemoveDEHRegistrationIfMatching
7014
!insertmacro RemoveDEHRegistrationIfMatchingCall "un."
7017
!macro CleanupMetroBrowserHandlerValues un DELEGATE_EXECUTE_HANDLER_ID
7018
Push ${DELEGATE_EXECUTE_HANDLER_ID}
7019
Call ${un}RemoveDEHRegistrationIfMatchingCall
7021
!define CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues ""'
7022
!define un.CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues "un."'
7024
!macro AddMetroBrowserHandlerValues DELEGATE_EXECUTE_HANDLER_ID \
7025
DELEGATE_EXECUTE_HANDLER_PATH \
7027
PROTOCOL_ACTIVATION_ID \
7029
; Win8 doesn't use conventional progid command data to launch anymore.
7030
; Instead it uses a delegate execute handler which is a light weight COM
7031
; server for choosing the metro or desktop browser to launch depending
7032
; on the current environment (metro/desktop) it was activated in.
7033
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}" "" ""
7034
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe" "" ""
7035
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" "" "open"
7036
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" "CommandId" "open"
7037
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "" "$2"
7038
WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
7040
; Augment the url handler registrations with additional data needed for Metro
7041
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}"
7042
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "AppUserModelID" "${APP_USER_MODEL_ID}"
7043
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationName" "$BrandShortName"
7044
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationIcon" "$INSTDIR\${FileMainEXE},0"
7045
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationCompany" "${CompanyName}"
7046
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationDescription" "$(REG_APP_DESC)"
7047
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell" "" "open"
7048
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" "open"
7049
WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
7051
; Augment the file handler registrations with additional data needed for Metro
7052
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}"
7053
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell" "" "open"
7054
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" "open"
7055
WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}"
7057
; Win8 Metro delegate execute handler registration
7058
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "" "$BrandShortName CommandExecuteHandler"
7059
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "AppId" "${DELEGATE_EXECUTE_HANDLER_ID}"
7060
WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}\LocalServer32" "" "${DELEGATE_EXECUTE_HANDLER_PATH}"
7062
!define AddMetroBrowserHandlerValues "!insertmacro AddMetroBrowserHandlerValues"
7063
!endif ;end MOZ_METRO