Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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/.
5 # Required Plugins:
6 # AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
7 # CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
8 # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
9 # UAC http://nsis.sourceforge.net/UAC_plug-in
11 ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
12 !verbose 3
14 ; 7-Zip provides better compression than the lzma from NSIS so we add the files
15 ; uncompressed and use 7-Zip to create a SFX archive of it
16 SetDatablockOptimize on
17 SetCompress off
18 CRCCheck on
20 RequestExecutionLevel user
22 ; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
23 ; be removed after we require NSIS 3.0a2 or greater.
24 !ifdef NSIS_PACKEDVERSION
25 Unicode true
26 ManifestSupportedOS all
27 ManifestDPIAware true
28 !endif
30 !addplugindir ./
32 ; On Vista and above attempt to elevate Standard Users in addition to users that
33 ; are a member of the Administrators group.
34 !define NONADMIN_ELEVATE
36 ; prevents compiling of the reg write logging.
37 !define NO_LOG
39 !define MaintUninstallKey \
40 "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
42 Var TmpVal
43 Var MaintCertKey
45 ; Other included files may depend upon these includes!
46 ; The following includes are provided by NSIS.
47 !include FileFunc.nsh
48 !include LogicLib.nsh
49 !include MUI.nsh
50 !include WinMessages.nsh
51 !include WinVer.nsh
52 !include WordFunc.nsh
54 !insertmacro GetSize
55 !insertmacro StrFilter
56 !insertmacro WordReplace
58 !insertmacro un.GetParent
60 ; The following includes are custom.
61 !include branding.nsi
62 !include defines.nsi
63 !include common.nsh
64 !include locales.nsi
66 ; This is named BrandShortName helper because we use this for software update
67 ; post update cleanup.
68 VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
69 VIAddVersionKey "OriginalFilename" "helper.exe"
71 !insertmacro AddDisabledDDEHandlerValues
72 !insertmacro CleanVirtualStore
73 !insertmacro ElevateUAC
74 !insertmacro GetLongPath
75 !insertmacro GetPathFromString
76 !insertmacro InitHashAppModelId
77 !insertmacro IsHandlerForInstallDir
78 !insertmacro IsPinnedToTaskBar
79 !insertmacro IsUserAdmin
80 !insertmacro LogDesktopShortcut
81 !insertmacro LogQuickLaunchShortcut
82 !insertmacro LogStartMenuShortcut
83 !insertmacro PinnedToStartMenuLnkCount
84 !insertmacro RegCleanAppHandler
85 !insertmacro RegCleanMain
86 !insertmacro RegCleanUninstall
87 !ifdef MOZ_METRO
88 !insertmacro RemoveDEHRegistrationIfMatching
89 !endif
90 !insertmacro SetAppLSPCategories
91 !insertmacro SetBrandNameVars
92 !insertmacro UpdateShortcutAppModelIDs
93 !insertmacro UnloadUAC
94 !insertmacro WriteRegDWORD2
95 !insertmacro WriteRegStr2
96 !insertmacro CheckIfRegistryKeyExists
98 !insertmacro un.ChangeMUIHeaderImage
99 !insertmacro un.CheckForFilesInUse
100 !insertmacro un.CleanUpdateDirectories
101 !insertmacro un.CleanVirtualStore
102 !insertmacro un.DeleteShortcuts
103 !insertmacro un.GetLongPath
104 !insertmacro un.GetSecondInstallPath
105 !insertmacro un.InitHashAppModelId
106 !insertmacro un.ManualCloseAppPrompt
107 !insertmacro un.ParseUninstallLog
108 !insertmacro un.RegCleanAppHandler
109 !insertmacro un.RegCleanFileHandler
110 !insertmacro un.RegCleanMain
111 !insertmacro un.RegCleanUninstall
112 !insertmacro un.RegCleanProtocolHandler
113 !ifdef MOZ_METRO
114 !insertmacro un.RemoveDEHRegistrationIfMatching
115 !endif
116 !insertmacro un.RemoveQuotesFromPath
117 !insertmacro un.SetAppLSPCategories
118 !insertmacro un.SetBrandNameVars
120 !include shared.nsh
122 ; Helper macros for ui callbacks. Insert these after shared.nsh
123 !insertmacro OnEndCommon
124 !insertmacro UninstallOnInitCommon
126 !insertmacro un.OnEndCommon
127 !insertmacro un.UninstallUnOnInitCommon
129 Name "${BrandFullName}"
130 OutFile "helper.exe"
131 !ifdef HAVE_64BIT_OS
132 InstallDir "$PROGRAMFILES64\${BrandFullName}\"
133 !else
134 InstallDir "$PROGRAMFILES32\${BrandFullName}\"
135 !endif
136 ShowUnInstDetails nevershow
138 ################################################################################
139 # Modern User Interface - MUI
141 !define MUI_ABORTWARNING
142 !define MUI_ICON setup.ico
143 !define MUI_UNICON setup.ico
144 !define MUI_WELCOMEPAGE_TITLE_3LINES
145 !define MUI_HEADERIMAGE
146 !define MUI_HEADERIMAGE_RIGHT
147 !define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
149 ; Use a right to left header image when the language is right to left
150 !ifdef ${AB_CD}_rtl
151 !define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp
152 !else
153 !define MUI_HEADERIMAGE_BITMAP wizHeader.bmp
154 !endif
156 /**
157 * Uninstall Pages
158 */
159 ; Welcome Page
160 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.preWelcome
161 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.leaveWelcome
162 !insertmacro MUI_UNPAGE_WELCOME
164 ; Custom Uninstall Confirm Page
165 UninstPage custom un.preConfirm un.leaveConfirm
167 ; Remove Files Page
168 !insertmacro MUI_UNPAGE_INSTFILES
170 ; Finish Page
172 ; Don't setup the survey controls, functions, etc. when the application has
173 ; defined NO_UNINSTALL_SURVEY
174 !ifndef NO_UNINSTALL_SURVEY
175 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish
176 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
177 !define MUI_FINISHPAGE_SHOWREADME ""
178 !define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
179 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey
180 !endif
182 !insertmacro MUI_UNPAGE_FINISH
184 ; Use the default dialog for IDD_VERIFY for a simple Banner
185 ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe"
187 ; This function is used to uninstall the maintenance service if the
188 ; application currently being uninstalled is the last application to use the
189 ; maintenance service.
190 Function un.UninstallServiceIfNotUsed
191 ; $0 will store if a subkey exists
192 ; $1 will store the first subkey if it exists or an empty string if it doesn't
193 ; Backup the old values
194 Push $0
195 Push $1
197 ; The maintenance service always uses the 64-bit registry on x64 systems
198 ${If} ${RunningX64}
199 SetRegView 64
200 ${EndIf}
202 ; Figure out the number of subkeys
203 StrCpy $0 0
204 loop:
205 EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0
206 StrCmp $1 "" doneCount
207 IntOp $0 $0 + 1
208 goto loop
209 doneCount:
210 ; Restore back the registry view
211 ${If} ${RunningX64}
212 SetRegView lastUsed
213 ${EndIf}
214 ${If} $0 == 0
215 ; Get the path of the maintenance service uninstaller
216 ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
218 ; If the uninstall string does not exist, skip executing it
219 StrCmp $1 "" doneUninstall
221 ; $1 is already a quoted string pointing to the install path
222 ; so we're already protected against paths with spaces
223 nsExec::Exec "$1 /S"
224 doneUninstall:
225 ${EndIf}
227 ; Restore the old value of $1 and $0
228 Pop $1
229 Pop $0
230 FunctionEnd
232 ################################################################################
233 # Install Sections
234 ; Empty section required for the installer to compile as an uninstaller
235 Section ""
236 SectionEnd
238 ################################################################################
239 # Uninstall Sections
241 Section "Uninstall"
242 SetDetailsPrint textonly
243 DetailPrint $(STATUS_UNINSTALL_MAIN)
244 SetDetailsPrint none
246 ; Delete the app exe to prevent launching the app while we are uninstalling.
247 ClearErrors
248 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
249 ${If} ${Errors}
250 ; If the user closed the application it can take several seconds for it to
251 ; shut down completely. If the application is being used by another user we
252 ; can still delete the files when the system is restarted.
253 Sleep 5000
254 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
255 ClearErrors
256 ${EndIf}
258 ; setup the application model id registration value
259 ${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
261 SetShellVarContext current ; Set SHCTX to HKCU
262 ${un.RegCleanMain} "Software\Mozilla"
263 ${un.RegCleanUninstall}
264 ${un.DeleteShortcuts}
266 ; Unregister resources associated with Win7 taskbar jump lists.
267 ${If} ${AtLeastWin7}
268 ${AndIf} "$AppUserModelID" != ""
269 ApplicationID::UninstallJumpLists "$AppUserModelID"
270 ${EndIf}
272 ; Remove the updates directory for Vista and above
273 ${un.CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates"
275 ; Remove any app model id's stored in the registry for this install path
276 DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR"
277 DeleteRegValue HKLM "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR"
279 ClearErrors
280 WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
281 ${If} ${Errors}
282 StrCpy $TmpVal "HKCU" ; used primarily for logging
283 ${Else}
284 SetShellVarContext all ; Set SHCTX to HKLM
285 DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
286 StrCpy $TmpVal "HKLM" ; used primarily for logging
287 ${un.RegCleanMain} "Software\Mozilla"
288 ${un.RegCleanUninstall}
289 ${un.DeleteShortcuts}
290 ${un.SetAppLSPCategories}
291 ${EndIf}
293 !ifdef MOZ_METRO
294 ${If} ${AtLeastWin8}
295 ${un.CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \
296 "FirefoxURL" \
297 "FirefoxHTML"
298 ${EndIf}
299 ${ResetWin8PromptKeys} "HKCU" ""
300 ${ResetWin8MetroSplash}
301 !else
302 ; The metro browser is not enabled by the mozconfig.
303 ${If} ${AtLeastWin8}
304 ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \
305 $AppUserModelID \
306 "FirefoxURL" \
307 "FirefoxHTML"
308 ${EndIf}
309 !endif
311 ${un.RegCleanAppHandler} "FirefoxURL"
312 ${un.RegCleanAppHandler} "FirefoxHTML"
313 ${un.RegCleanProtocolHandler} "ftp"
314 ${un.RegCleanProtocolHandler} "http"
315 ${un.RegCleanProtocolHandler} "https"
317 ClearErrors
318 ReadRegStr $R9 HKCR "FirefoxHTML" ""
319 ; Don't clean up the file handlers if the FirefoxHTML key still exists since
320 ; there should be a second installation that may be the default file handler
321 ${If} ${Errors}
322 ${un.RegCleanFileHandler} ".htm" "FirefoxHTML"
323 ${un.RegCleanFileHandler} ".html" "FirefoxHTML"
324 ${un.RegCleanFileHandler} ".shtml" "FirefoxHTML"
325 ${un.RegCleanFileHandler} ".xht" "FirefoxHTML"
326 ${un.RegCleanFileHandler} ".xhtml" "FirefoxHTML"
327 ${un.RegCleanFileHandler} ".oga" "FirefoxHTML"
328 ${un.RegCleanFileHandler} ".ogg" "FirefoxHTML"
329 ${un.RegCleanFileHandler} ".ogv" "FirefoxHTML"
330 ${un.RegCleanFileHandler} ".pdf" "FirefoxHTML"
331 ${un.RegCleanFileHandler} ".webm" "FirefoxHTML"
332 ${EndIf}
334 SetShellVarContext all ; Set SHCTX to HKLM
335 ${un.GetSecondInstallPath} "Software\Mozilla" $R9
336 ${If} $R9 == "false"
337 SetShellVarContext current ; Set SHCTX to HKCU
338 ${un.GetSecondInstallPath} "Software\Mozilla" $R9
339 ${EndIf}
341 StrCpy $0 "Software\Clients\StartMenuInternet\${FileMainEXE}\shell\open\command"
342 ReadRegStr $R1 HKLM "$0" ""
343 ${un.RemoveQuotesFromPath} "$R1" $R1
344 ${un.GetParent} "$R1" $R1
346 ; Only remove the StartMenuInternet key if it refers to this install location.
347 ; The StartMenuInternet registry key is independent of the default browser
348 ; settings. The XPInstall base un-installer always removes this key if it is
349 ; uninstalling the default browser and it will always replace the keys when
350 ; installing even if there is another install of Firefox that is set as the
351 ; default browser. Now the key is always updated on install but it is only
352 ; removed if it refers to this install location.
353 ${If} "$INSTDIR" == "$R1"
354 DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}"
355 DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}"
356 ${EndIf}
358 ReadRegStr $R1 HKCU "$0" ""
359 ${un.RemoveQuotesFromPath} "$R1" $R1
360 ${un.GetParent} "$R1" $R1
362 ; Only remove the StartMenuInternet key if it refers to this install location.
363 ; The StartMenuInternet registry key is independent of the default browser
364 ; settings. The XPInstall base un-installer always removes this key if it is
365 ; uninstalling the default browser and it will always replace the keys when
366 ; installing even if there is another install of Firefox that is set as the
367 ; default browser. Now the key is always updated on install but it is only
368 ; removed if it refers to this install location.
369 ${If} "$INSTDIR" == "$R1"
370 DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${FileMainEXE}"
371 DeleteRegValue HKCU "Software\RegisteredApplications" "${AppRegName}"
372 ${EndIf}
374 StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
375 ${If} $R9 == "false"
376 DeleteRegKey HKLM "$0"
377 DeleteRegKey HKCU "$0"
378 StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\${FileMainEXE}"
379 DeleteRegKey HKLM "$0"
380 DeleteRegKey HKCU "$0"
381 StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe"
382 DeleteRegKey HKLM "$0"
383 DeleteRegKey HKCU "$0"
384 StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=firefox"
385 DeleteRegKey HKLM "$0"
386 DeleteRegKey HKCU "$0"
387 ${Else}
388 ReadRegStr $R1 HKLM "$0" ""
389 ${un.RemoveQuotesFromPath} "$R1" $R1
390 ${un.GetParent} "$R1" $R1
391 ${If} "$INSTDIR" == "$R1"
392 WriteRegStr HKLM "$0" "" "$R9"
393 ${un.GetParent} "$R9" $R1
394 WriteRegStr HKLM "$0" "Path" "$R1"
395 ${EndIf}
396 ${EndIf}
398 ; Remove directories and files we always control before parsing the uninstall
399 ; log so empty directories can be removed.
400 ${If} ${FileExists} "$INSTDIR\updates"
401 RmDir /r /REBOOTOK "$INSTDIR\updates"
402 ${EndIf}
403 ${If} ${FileExists} "$INSTDIR\updated"
404 RmDir /r /REBOOTOK "$INSTDIR\updated"
405 ${EndIf}
406 ${If} ${FileExists} "$INSTDIR\defaults\shortcuts"
407 RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts"
408 ${EndIf}
409 ${If} ${FileExists} "$INSTDIR\distribution"
410 RmDir /r /REBOOTOK "$INSTDIR\distribution"
411 ${EndIf}
412 ${If} ${FileExists} "$INSTDIR\removed-files"
413 Delete /REBOOTOK "$INSTDIR\removed-files"
414 ${EndIf}
416 ; Remove files that may be left behind by the application in the
417 ; VirtualStore directory.
418 ${un.CleanVirtualStore}
420 ; Parse the uninstall log to unregister dll's and remove all installed
421 ; files / directories this install is responsible for.
422 ${un.ParseUninstallLog}
424 ; Remove the uninstall directory that we control
425 RmDir /r /REBOOTOK "$INSTDIR\uninstall"
427 ; Explictly remove empty webapprt dir in case it exists
428 ; See bug 757978
429 RmDir "$INSTDIR\webapprt\components"
430 RmDir "$INSTDIR\webapprt"
432 RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
434 ; Remove the installation directory if it is empty
435 ${RemoveDir} "$INSTDIR"
437 ; If firefox.exe was successfully deleted yet we still need to restart to
438 ; remove other files create a dummy firefox.exe.moz-delete to prevent the
439 ; installer from allowing an install without restart when it is required
440 ; to complete an uninstall.
441 ${If} ${RebootFlag}
442 ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete"
443 FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w
444 FileWrite $0 "Will be deleted on restart"
445 Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete"
446 FileClose $0
447 ${EndUnless}
448 ${EndIf}
450 ; Refresh desktop icons otherwise the start menu internet item won't be
451 ; removed and other ugly things will happen like recreation of the app's
452 ; clients registry key by the OS under some conditions.
453 System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i 0, i 0, i 0)"
455 !ifdef MOZ_MAINTENANCE_SERVICE
456 ; Get the path the allowed cert is at and remove it
457 ; Keep this block of code last since it modfies the reg view
458 ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
459 Pop $MaintCertKey
460 ${If} $MaintCertKey != ""
461 ; We always use the 64bit registry for certs
462 ${If} ${RunningX64}
463 SetRegView 64
464 ${EndIf}
465 DeleteRegKey HKLM "$MaintCertKey"
466 ${If} ${RunningX64}
467 SetRegView lastused
468 ${EndIf}
469 ${EndIf}
470 Call un.UninstallServiceIfNotUsed
471 !endif
473 SectionEnd
475 ################################################################################
476 # Helper Functions
478 ; Don't setup the survey controls, functions, etc. when the application has
479 ; defined NO_UNINSTALL_SURVEY
480 !ifndef NO_UNINSTALL_SURVEY
481 Function un.Survey
482 Exec "$\"$TmpVal$\" $\"${SurveyURL}$\""
483 FunctionEnd
484 !endif
486 ################################################################################
487 # Language
489 !insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
490 !verbose push
491 !verbose 3
492 !include "overrideLocale.nsh"
493 !include "customLocale.nsh"
494 !verbose pop
496 ; Set this after the locale files to override it if it is in the locale. Using
497 ; " " for BrandingText will hide the "Nullsoft Install System..." branding.
498 BrandingText " "
500 ################################################################################
501 # Page pre, show, and leave functions
503 Function un.preWelcome
504 ${If} ${FileExists} "$INSTDIR\distribution\modern-wizard.bmp"
505 Delete "$PLUGINSDIR\modern-wizard.bmp"
506 CopyFiles /SILENT "$INSTDIR\distribution\modern-wizard.bmp" "$PLUGINSDIR\modern-wizard.bmp"
507 ${EndIf}
508 FunctionEnd
510 Function un.leaveWelcome
511 ${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
512 Banner::show /NOUNLOAD "$(BANNER_CHECK_EXISTING)"
514 ; If the message window has been found previously give the app an additional
515 ; five seconds to close.
516 ${If} "$TmpVal" == "FoundMessageWindow"
517 Sleep 5000
518 ${EndIf}
520 ${PushFilesToCheck}
522 ${un.CheckForFilesInUse} $TmpVal
524 Banner::destroy
526 ; If there are files in use $TmpVal will be "true"
527 ${If} "$TmpVal" == "true"
528 ; If the message window is found the call to ManualCloseAppPrompt will
529 ; abort leaving the value of $TmpVal set to "FoundMessageWindow".
530 StrCpy $TmpVal "FoundMessageWindow"
531 ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)"
532 ; If the message window is not found set $TmpVal to "true" so the restart
533 ; required message is displayed.
534 StrCpy $TmpVal "true"
535 ${EndIf}
536 ${EndIf}
537 FunctionEnd
539 Function un.preConfirm
540 ${If} ${FileExists} "$INSTDIR\distribution\modern-header.bmp"
541 ${AndIf} $hHeaderBitmap == ""
542 Delete "$PLUGINSDIR\modern-header.bmp"
543 CopyFiles /SILENT "$INSTDIR\distribution\modern-header.bmp" "$PLUGINSDIR\modern-header.bmp"
544 ${un.ChangeMUIHeaderImage} "$PLUGINSDIR\modern-header.bmp"
545 ${EndIf}
547 ; Setup the unconfirm.ini file for the Custom Uninstall Confirm Page
548 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "3"
550 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label"
551 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)"
552 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Left "0"
553 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Right "-1"
554 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Top "5"
555 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Bottom "15"
557 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Type "text"
558 ; The contents of this control must be set as follows in the pre function
559 ; ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND"
560 ; SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
561 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" State ""
562 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Left "0"
563 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Right "-1"
564 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Top "17"
565 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30"
566 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY"
568 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "label"
569 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_CONFIRM_CLICK)"
570 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0"
571 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1"
572 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "130"
573 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "150"
575 ${If} "$TmpVal" == "true"
576 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "label"
577 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)"
578 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0"
579 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1"
580 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "35"
581 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "45"
583 WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "4"
584 ${EndIf}
586 !insertmacro MUI_HEADER_TEXT "$(UN_CONFIRM_PAGE_TITLE)" "$(UN_CONFIRM_PAGE_SUBTITLE)"
587 ; The Summary custom page has a textbox that will automatically receive
588 ; focus. This sets the focus to the Install button instead.
589 !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "unconfirm.ini"
590 GetDlgItem $0 $HWNDPARENT 1
591 System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i"
592 ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND"
593 SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
594 !insertmacro MUI_INSTALLOPTIONS_SHOW
595 FunctionEnd
597 Function un.leaveConfirm
598 ; Try to delete the app executable and if we can't delete it try to find the
599 ; app's message window and prompt the user to close the app. This allows
600 ; running an instance that is located in another directory. If for whatever
601 ; reason there is no message window we will just rename the app's files and
602 ; then remove them on restart if they are in use.
603 ClearErrors
604 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
605 ${If} ${Errors}
606 ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)"
607 ${EndIf}
608 FunctionEnd
610 !ifndef NO_UNINSTALL_SURVEY
611 Function un.preFinish
612 ; Do not modify the finish page if there is a reboot pending
613 ${Unless} ${RebootFlag}
614 ; Setup the survey controls, functions, etc.
615 StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup"
616 ClearErrors
617 ReadRegStr $0 HKLM $TmpVal "Path"
618 ${If} ${Errors}
619 !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
620 ${Else}
621 ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles%
622 ${If} $0 != "\"
623 StrCpy $0 "$0\"
624 ${EndIf}
625 StrCpy $0 "$0\iexplore.exe"
626 ClearErrors
627 GetFullPathName $TmpVal $0
628 ${If} ${Errors}
629 !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
630 ${Else}
631 ; When we add an optional action to the finish page the cancel button
632 ; is enabled. This disables it and leaves the finish button as the
633 ; only choice.
634 !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
635 ${EndIf}
636 ${EndIf}
637 ${EndUnless}
638 FunctionEnd
639 !endif
641 ################################################################################
642 # Initialization Functions
644 Function .onInit
645 ; Remove the current exe directory from the search order.
646 ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
647 System::Call 'kernel32::SetDllDirectoryW(w "")'
649 ; We need this set up for most of the helper.exe operations.
650 ${UninstallOnInitCommon}
651 FunctionEnd
653 Function un.onInit
654 ; Remove the current exe directory from the search order.
655 ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
656 System::Call 'kernel32::SetDllDirectoryW(w "")'
658 StrCpy $LANGUAGE 0
660 ${un.UninstallUnOnInitCommon}
662 ; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
663 ; removed after we require NSIS 3.0a2 or greater.
664 !ifndef NSIS_PACKEDVERSION
665 ${If} ${AtLeastWinVista}
666 System::Call 'user32::SetProcessDPIAware()'
667 ${EndIf}
668 !endif
670 !insertmacro InitInstallOptionsFile "unconfirm.ini"
671 FunctionEnd
673 Function .onGUIEnd
674 ${OnEndCommon}
675 FunctionEnd
677 Function un.onGUIEnd
678 ${un.OnEndCommon}
679 FunctionEnd