source: filezilla/trunk/fuentes/data/install.nsi.in @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 37.8 KB
Line 
1; FileZilla 3 installation script
2; Written by Tim Kosse <mailto:tim.kosse@filezilla-project.org>
3;
4; Requires NSIS >= 2.35
5
6;--------------------------------
7; Build environment
8;--------------------------------
9
10  !define top_srcdir    @top_srcdir@
11  !define srcdir        @srcdir@
12  !define VERSION       @PACKAGE_VERSION@
13  !define VERSION_MAJOR @PACKAGE_VERSION_MAJOR@
14  !define VERSION_MINOR @PACKAGE_VERSION_MINOR@
15  !define VERSION_FULL  @PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_MICRO@.@PACKAGE_VERSION_NANO@
16  !define PUBLISHER     "Tim Kosse"
17  !define WEBSITE_URL   "https://filezilla-project.org/"
18  !addplugindir         @srcdir@
19
20;--------------------------------
21; General
22;--------------------------------
23
24  ; Name and file
25  Name "FileZilla Client ${VERSION}"
26  OutFile "FileZilla_3_setup.exe"
27
28  SetCompressor /SOLID LZMA
29
30  ; Default installation folder
31  !if "@NSIS_64BIT@" == "1"
32    InstallDir "$PROGRAMFILES64\FileZilla FTP Client"
33  !else
34    InstallDir "$PROGRAMFILES\FileZilla FTP Client"
35  !endif
36
37  ; Get installation folder from registry if available
38  InstallDirRegKey HKLM "Software\FileZilla Client" ""
39
40  RequestExecutionLevel user
41
42  !define DUMP_KEY "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"
43
44;--------------------------------
45; Libtool executable target path
46;--------------------------------
47
48  !include libtoolexecutablesubdir.nsh
49  !ifndef LT_EXEDIR
50    !define LT_EXEDIR ""
51  !endif
52
53;--------------------------------
54; Include Modern UI and functions
55;--------------------------------
56
57  !include "MUI2.nsh"
58  !include "WordFunc.nsh"
59  !include "Library.nsh"
60  !include "WinVer.nsh"
61  !include "FileFunc.nsh"
62  !include "Memento.nsh"
63  !include "@srcdir@\process_running.nsh"
64  !include "@srcdir@\UAC.nsh"
65
66;--------------------------------
67; Installer's VersionInfo
68;--------------------------------
69
70  VIProductVersion                   "${VERSION_FULL}"
71  VIAddVersionKey "CompanyName"      "${PUBLISHER}"
72  VIAddVersionKey "ProductName"      "FileZilla"
73  VIAddVersionKey "ProductVersion"   "${VERSION}"
74  VIAddVersionKey "FileDescription"  "FileZilla FTP Client"
75  VIAddVersionKey "FileVersion"      "${VERSION}"
76  VIAddVersionKey "LegalCopyright"   "${PUBLISHER}"
77  VIAddVersionKey "OriginalFilename" "FileZilla_${VERSION}_win32-setup.exe"
78
79
80;--------------------------------
81; Required functions
82;--------------------------------
83
84  !insertmacro GetParameters
85  !insertmacro GetOptions
86  !insertmacro un.GetParameters
87  !insertmacro un.GetOptions
88
89;--------------------------------
90; Variables
91;--------------------------------
92
93  Var MUI_TEMP
94  Var STARTMENU_FOLDER
95  Var PREVIOUS_INSTALLDIR
96  Var PREVIOUS_VERSION
97  Var PREVIOUS_VERSION_STATE
98  Var REINSTALL_UNINSTALL
99  Var REINSTALL_UNINSTALLBUTTON
100  Var ALL_USERS_DEFAULT
101  Var ALL_USERS
102  Var ALL_USERS_BUTTON
103  Var IS_ADMIN
104  Var USERNAME
105  Var PERFORM_UPDATE
106  Var SKIPLICENSE
107  Var GetInstalledSize.total
108
109;--------------------------------
110; Interface Settings
111;--------------------------------
112
113  !define MUI_ICON "${top_srcdir}/src/interface/resources/FileZilla.ico"
114  !define MUI_UNICON "${srcdir}/uninstall.ico"
115
116  !define MUI_ABORTWARNING
117
118;--------------------------------
119; Memento settings
120;--------------------------------
121
122!define MEMENTO_REGISTRY_ROOT SHELL_CONTEXT
123!define MEMENTO_REGISTRY_KEY "Software\FileZilla Client"
124
125;--------------------------------
126; Pages
127;--------------------------------
128
129  !define MUI_PAGE_CUSTOMFUNCTION_PRE PageLicensePre
130  !insertmacro MUI_PAGE_LICENSE "${top_srcdir}\COPYING"
131
132  Page custom PageReinstall PageLeaveReinstall
133  Page custom PageAllUsers PageLeaveAllUsers
134
135  !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
136  !insertmacro MUI_PAGE_COMPONENTS
137
138  !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
139  !insertmacro MUI_PAGE_DIRECTORY
140
141  ; Start Menu Folder Page Configuration
142  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
143  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\FileZilla Client"
144  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Startmenu"
145  !define MUI_STARTMENUPAGE_DEFAULTFOLDER "FileZilla FTP Client"
146
147  !define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartmenuPre
148  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
149
150  !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageInstfilesShow
151  !define MUI_PAGE_CUSTOMFUNCTION_LEAVE PostInstPage
152  !insertmacro MUI_PAGE_INSTFILES
153
154  !define MUI_FINISHPAGE_RUN
155  !define MUI_FINISHPAGE_RUN_FUNCTION CustomFinishRun
156  !define MUI_FINISHPAGE_RUN_TEXT "&Start FileZilla now"
157  !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageFinishPre
158  !insertmacro MUI_PAGE_FINISH
159
160  !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
161  !insertmacro MUI_UNPAGE_CONFIRM
162  !insertmacro MUI_UNPAGE_INSTFILES
163  !define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
164  !insertmacro MUI_UNPAGE_FINISH
165
166Function GetUserInfo
167  ClearErrors
168  UserInfo::GetName
169  ${If} ${Errors}
170    StrCpy $IS_ADMIN 1
171    Return
172  ${EndIf}
173  Pop $USERNAME
174
175  ${If} ${UAC_IsAdmin}
176    StrCpy $IS_ADMIN 1
177  ${Else}
178    StrCpy $IS_ADMIN 0
179  ${EndIf}
180
181FunctionEnd
182
183Function UpdateShellVarContext
184
185  ${If} $ALL_USERS == 1
186    SetShellVarContext all
187    DetailPrint "Installing for all users"
188  ${Else}
189    SetShellVarContext current
190    DetailPrint "Installing for current user"
191  ${EndIf}
192
193FunctionEnd
194
195Function ReadAllUsersCommandline
196
197  ${GetParameters} $R0
198
199  ${GetOptions} $R0 "/user" $R1
200
201  ${Unless} ${Errors}
202    ${If} $R1 == "current"
203    ${OrIf} $R1 == "=current"
204      StrCpy $ALL_USERS 0
205    ${ElseIf} $R1 == "all"
206    ${OrIf} $R1 == "=all"
207      StrCpy $ALL_USERS 1
208    ${Else}
209      MessageBox MB_ICONSTOP "Invalid option for /user. Has to be either /user=all or /user=current" /SD IDOK
210      Abort
211    ${EndIf}
212  ${EndUnless}
213  Call UpdateShellVarContext
214
215FunctionEnd
216
217Function CheckPrevInstallDirExists
218
219  ${If} $PREVIOUS_INSTALLDIR != ""
220
221    ; Make sure directory is valid
222    Push $R0
223    Push $R1
224    StrCpy $R0 "$PREVIOUS_INSTALLDIR" "" -1
225    ${If} $R0 == '\'
226    ${OrIf} $R0 == '/'
227      StrCpy $R0 $PREVIOUS_INSTALLDIR*.*
228    ${Else}
229      StrCpy $R0 $PREVIOUS_INSTALLDIR\*.*
230    ${EndIf}
231    ${IfNot} ${FileExists} $R0
232      StrCpy $PREVIOUS_INSTALLDIR ""
233    ${EndIf}
234    Pop $R1
235    Pop $R0
236
237  ${EndIf}
238
239FunctionEnd
240
241Function ReadPreviousVersion
242
243  ReadRegStr $PREVIOUS_INSTALLDIR HKLM "Software\FileZilla Client" ""
244
245  Call CheckPrevInstallDirExists
246
247  ${If} $PREVIOUS_INSTALLDIR != ""
248    ; Detect version
249    ReadRegStr $PREVIOUS_VERSION HKLM "Software\FileZilla Client" "Version"
250    ${If} $PREVIOUS_VERSION != ""
251      StrCpy $ALL_USERS 1
252      SetShellVarContext all
253      return
254    ${EndIf}
255  ${EndIf}
256
257  ReadRegStr $PREVIOUS_INSTALLDIR HKCU "Software\FileZilla Client" ""
258
259  Call CheckPrevInstallDirExists
260
261  ${If} $PREVIOUS_INSTALLDIR != ""
262    ; Detect version
263    ReadRegStr $PREVIOUS_VERSION HKCU "Software\FileZilla Client" "Version"
264    ${If} $PREVIOUS_VERSION != ""
265      StrCpy $ALL_USERS 0
266      SetShellVarContext current
267      return
268    ${EndIf}
269  ${EndIf}
270
271FunctionEnd
272
273Function LoadPreviousSettings
274
275  ; Component selection
276  ${MementoSectionRestore}
277
278  ; Startmenu
279  !define ID "Application"
280
281  !ifdef MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT & MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY & MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME
282
283    ReadRegStr $mui.StartMenuPage.RegistryLocation "${MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME}"
284
285    ${if} $mui.StartMenuPage.RegistryLocation != ""
286      StrCpy "$STARTMENU_FOLDER" $mui.StartMenuPage.RegistryLocation
287    ${else}
288      StrCpy "$STARTMENU_FOLDER" ""
289    ${endif}
290
291    !undef ID
292
293  !endif
294
295  ${If} $PREVIOUS_INSTALLDIR != ""
296    StrCpy $INSTDIR $PREVIOUS_INSTALLDIR
297  ${EndIf}
298
299FunctionEnd
300
301Function ReadUpdateCommandline
302
303  ${GetParameters} $R0
304
305  ${GetOptions} $R0 "/update" $R1
306
307  ${If} ${Errors}
308    StrCpy $PERFORM_UPDATE 0
309  ${Else}
310    StrCpy $PERFORM_UPDATE 1
311  ${EndIf}
312
313FunctionEnd
314
315Function ReadSkipLicense
316
317  ${GetParameters} $R0
318
319  ${GetOptions} $R0 "/skiplicense" $R1
320
321  ${If} ${Errors}
322    StrCpy $SKIPLICENSE 0
323  ${Else}
324    StrCpy $SKIPLICENSE 1
325  ${EndIf}
326
327FunctionEnd
328
329Function .onInit
330
331  ${Unless} ${AtLeastWinVista}
332    MessageBox MB_YESNO|MB_ICONSTOP "Unsupported operating system.$\nFileZilla ${VERSION} requires at least Windows Vista and may not work correctly on your system.$\nDo you really want to continue with the installation?" /SD IDNO IDYES installonoldwindows
333    Abort
334installonoldwindows:
335  ${EndUnless}
336
337  !if "@NSIS_64BIT@" == "1"
338    ${Unless} ${RunningX64}
339      MessageBox MB_YESNO|MB_ICONSTOP "Unsupported operating system.$\nThis is the installer for the 64bit version of FileZilla ${VERSION} and does not run on your operating system which is only 32bit.$\nPlease download the 32bit FileZilla installer instead.$\nDo you really want to continue with the installation?" /SD IDNO IDYES install64on32
340      Abort
341install64on32:
342    ${EndUnless}
343  !endif
344
345  !insertmacro UAC_RunElevated
346
347  ${Switch} $0
348  ${Case} 0
349    ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done.
350
351    ; Ignore success or failure here. Correct privileges are checked later on.
352    ${Break}
353  ${Case} 1223
354    ; User aborted elevation, continue regardless
355    ${Break}
356  ${Default}
357    MessageBox mb_iconstop "Could not elevate process (errorcode $0), continuing with normal user privileges." /SD IDOK
358    ${Break}
359  ${EndSwitch}
360
361  ; The UAC plugin changes the error level even in the inner process, reset it.
362  SetErrorLevel -1
363
364  ; /update argument
365  Call ReadUpdateCommandline
366
367  Call ReadSkipLicense
368
369  Call GetUserInfo
370
371  ; Initialize $ALL_USERS with default value
372  ${If} $IS_ADMIN == 1
373    StrCpy $ALL_USERS 1
374  ${Else}
375    StrCpy $ALL_USERS 0
376  ${EndIf}
377  Call UpdateShellVarContext
378
379  ; See if previous version exists
380  ; This can change ALL_USERS
381  Call ReadPreviousVersion
382
383  ; Load _all_ previous settings.
384  ; Need to do it now as up to now, $ALL_USERS was possibly reflecting a
385  ; previous installation. After this call, $ALL_USERS reflects the requested
386  ; installation mode for this installation.
387  Call LoadPreviousSettings
388
389  Call ReadAllUsersCommandline
390
391  ${If} $ALL_USERS == 1
392    ${If} $IS_ADMIN == 0
393
394      ${If} $PREVIOUS_VERSION != ""
395        MessageBox MB_ICONSTOP "FileZilla has been previously installed for all users.$\nPlease restart the installer with Administrator privileges." /SD IDOK
396        Abort
397      ${Else}
398        MessageBox MB_ICONSTOP "Cannot install for all users.$\nPlease restart the installer with Administrator privileges." /SD IDOK
399        Abort
400      ${EndIf}
401    ${EndIf}
402  ${EndIf}
403
404  ${If} $PREVIOUS_VERSION == ""
405
406    StrCpy $PERFORM_UPDATE 0
407    DetailPrint "No previous version of FileZilla was found"
408
409  ${Else}
410
411    Push "${VERSION}"
412    Push $PREVIOUS_VERSION
413    Call FZVersionCompare
414
415    DetailPrint "Found previous version: $PREVIOUS_VERSION"
416    DetailPrint "Installing $PREVIOUS_VERSION_STATE version ${VERSION}"
417
418  ${EndIf}
419
420  StrCpy $ALL_USERS_DEFAULT $ALL_USERS
421
422FunctionEnd
423
424Function FZVersionCompare
425
426  Exch $1
427  Exch
428  Exch $0
429
430  Push $2
431  Push $3
432  Push $4
433
434versioncomparebegin:
435  ${If} $0 == ""
436  ${AndIf} $1 == ""
437    StrCpy $PREVIOUS_VERSION_STATE "same"
438    goto versioncomparedone
439  ${EndIf}
440
441  StrCpy $2 0
442  StrCpy $3 0
443
444  ; Parse rc / beta suffixes for segments
445  StrCpy $4 $0 2
446  ${If} $4 == "rc"
447    StrCpy $2 100
448    StrCpy $0 $0 "" 2
449  ${Else}
450    StrCpy $4 $0 4
451    ${If} $4 == "beta"
452      StrCpy $0 $0 "" 4
453    ${Else}
454      StrCpy $2 10000
455    ${EndIf}
456  ${EndIf}
457
458  StrCpy $4 $1 2
459  ${If} $4 == "rc"
460    StrCpy $3 100
461    StrCpy $1 $1 "" 2
462  ${Else}
463    StrCpy $4 $1 4
464    ${If} $4 == "beta"
465      StrCpy $1 $1 "" 4
466    ${Else}
467      StrCpy $3 10000
468    ${EndIf}
469  ${EndIf}
470
471split1loop:
472
473  StrCmp $0 "" split1loopdone
474  StrCpy $4 $0 1
475  StrCpy $0 $0 "" 1
476  StrCmp $4 "." split1loopdone
477  StrCmp $4 "-" split1loopdone
478  StrCpy $2 $2$4
479  goto split1loop
480split1loopdone:
481
482split2loop:
483
484  StrCmp $1 "" split2loopdone
485  StrCpy $4 $1 1
486  StrCpy $1 $1 "" 1
487  StrCmp $4 "." split2loopdone
488  StrCmp $4 "-" split2loopdone
489  StrCpy $3 $3$4
490  goto split2loop
491split2loopdone:
492
493  ${If} $2 > $3
494    StrCpy $PREVIOUS_VERSION_STATE "newer"
495  ${ElseIf} $3 > $2
496    StrCpy $PREVIOUS_VERSION_STATE "older"
497  ${Else}
498    goto versioncomparebegin
499  ${EndIf}
500
501
502versioncomparedone:
503
504  Pop $4
505  Pop $3
506  Pop $2
507  Pop $1
508  Pop $0
509
510FunctionEnd
511
512Function PageLicensePre
513
514  ${If} $PERFORM_UPDATE == 1
515    Abort
516  ${Elseif} $SKIPLICENSE == 1
517    Abort
518  ${EndIf}
519FunctionEnd
520
521Function PageReinstall
522
523  ${If} $PREVIOUS_VERSION == ""
524    Abort
525  ${EndIf}
526
527  ${If} $PERFORM_UPDATE == 1
528    StrCpy $REINSTALL_UNINSTALL 1
529    Abort
530  ${EndIf}
531
532  nsDialogs::Create /NOUNLOAD 1018
533  Pop $0
534
535  ${If} $PREVIOUS_VERSION_STATE == "newer"
536
537    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install FileZilla."
538    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "An older version of FileZilla is installed on your system. Select the operation you want to perform and click Next to continue."
539    Pop $R0
540    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Upgrade FileZilla using previous settings (recommended)"
541    Pop $REINSTALL_UNINSTALLBUTTON
542    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
543    Pop $R0
544
545    ${If} $REINSTALL_UNINSTALL == ""
546      StrCpy $REINSTALL_UNINSTALL 1
547    ${EndIf}
548
549  ${ElseIf} $PREVIOUS_VERSION_STATE == "older"
550
551    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install FileZilla."
552    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "A newer version of FileZilla is already installed! It is not recommended that you downgrade to an older version. Select the operation you want to perform and click Next to continue."
553    Pop $R0
554    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Downgrade FileZilla using previous settings (recommended)"
555    Pop $REINSTALL_UNINSTALLBUTTON
556    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
557    Pop $R0
558
559    ${If} $REINSTALL_UNINSTALL == ""
560      StrCpy $REINSTALL_UNINSTALL 1
561    ${EndIf}
562
563  ${ElseIf} $PREVIOUS_VERSION_STATE == "same"
564
565    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
566    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "FileZilla ${VERSION} is already installed. Select the operation you want to perform and click Next to continue."
567    Pop $R0
568    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Add/Remove/Reinstall components"
569    Pop $R0
570    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Uninstall FileZilla"
571    Pop $REINSTALL_UNINSTALLBUTTON
572
573    ${If} $REINSTALL_UNINSTALL == ""
574      StrCpy $REINSTALL_UNINSTALL 2
575    ${EndIf}
576
577  ${Else}
578
579    MessageBox MB_ICONSTOP "Unknown value of PREVIOUS_VERSION_STATE, aborting" /SD IDOK
580    Abort
581
582  ${EndIf}
583
584  ${If} $REINSTALL_UNINSTALL == "1"
585    SendMessage $REINSTALL_UNINSTALLBUTTON ${BM_SETCHECK} 1 0
586  ${Else}
587    SendMessage $R0 ${BM_SETCHECK} 1 0
588  ${EndIf}
589
590  ${If} $SKIPLICENSE == 1
591    EnableWindow $mui.Button.Back 0
592  ${Else}
593    EnableWindow $mui.Button.Back 1
594  ${Endif}
595
596  nsDialogs::Show
597
598FunctionEnd
599
600Function RunUninstaller
601
602  ${If} $ALL_USERS_DEFAULT == 1
603    ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client" "UninstallString"
604  ${Else}
605    ReadRegStr $R1 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client" "UninstallString"
606  ${EndIf}
607
608  ${If} $R1 == ""
609    Return
610  ${EndIf}
611
612  ; Run uninstaller
613  HideWindow
614
615  ClearErrors
616
617  ${If} $PREVIOUS_VERSION_STATE == "same"
618  ${AndIf} $REINSTALL_UNINSTALL == "1"
619  ${AndIf} $PERFORM_UPDATE != "1"
620    ExecWait '$R1 _?=$INSTDIR'
621  ${Else}
622    ExecWait '$R1 /frominstall /keepstartmenudir _?=$INSTDIR'
623  ${EndIf}
624
625  IfErrors no_remove_uninstaller
626
627  IfFileExists "$INSTDIR\uninstall.exe" 0 no_remove_uninstaller
628
629    Delete "$R1"
630
631  ; Remove directory only if uninstalling for good
632  ${If} $PREVIOUS_VERSION_STATE == "same"
633  ${AndIf} $REINSTALL_UNINSTALL == "1"
634  ${AndIf} $PERFORM_UPDATE != "1"
635    RMDir $INSTDIR
636  ${EndIf}
637
638 no_remove_uninstaller:
639
640  BringToFront
641  Sleep 500
642
643FunctionEnd
644
645Function PageLeaveReinstall
646
647  SendMessage $REINSTALL_UNINSTALLBUTTON ${BM_GETCHECK} 0 0 $R0
648  ${If} $R0 == 1
649    ; Option to uninstall old version selected
650    StrCpy $REINSTALL_UNINSTALL 1
651  ${Else}
652    ; Custom up/downgrade or add/remove/reinstall
653    StrCpy $REINSTALL_UNINSTALL 2
654  ${EndIf}
655
656  ${If} $REINSTALL_UNINSTALL == 1
657
658    ${If} $PREVIOUS_VERSION_STATE == "same"
659
660      Call RunUninstaller
661      Quit
662
663    ${Else}
664
665      ; Need to reload defaults. User could have
666      ; chosen custom, change something, went back and selected
667      ; the express option.
668      StrCpy $ALL_USERS $ALL_USERS_DEFAULT
669      Call UpdateShellVarContext
670      Call LoadPreviousSettings
671
672    ${EndIf}
673
674  ${EndIf}
675
676FunctionEnd
677
678Function PageAllUsers
679
680  ${If} $REINSTALL_UNINSTALL == 1
681    ; Keep same settings
682    Abort
683  ${EndIf}
684
685  !insertmacro MUI_HEADER_TEXT "Choose Installation Options" "Who should this application be installed for?"
686
687  nsDialogs::Create /NOUNLOAD 1018
688  Pop $0
689
690  nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 30 "Please select whether you wish to make this software available to all users or just yourself."
691  Pop $R0
692
693  ${If} $IS_ADMIN == 1
694    StrCpy $R2 ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP}
695  ${Else}
696    StrCpy $R2 ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP}|${WS_DISABLED}
697  ${EndIf}
698  nsDialogs::CreateItem /NOUNLOAD BUTTON $R2 0 10 55 100% 30 "&Anyone who uses this computer (all users)"
699  Pop $ALL_USERS_BUTTON
700
701  StrCpy $R2 ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}
702
703  ${If} $USERNAME != ""
704    nsDialogs::CreateItem /NOUNLOAD BUTTON $R2 0 10 85 100% 50 "&Only for me ($USERNAME)"
705  ${Else}
706    nsDialogs::CreateItem /NOUNLOAD BUTTON $R2 0 10 85 100% 50 "&Only for me"
707  ${EndIf}
708  Pop $R0
709
710  ${If} $PREVIOUS_VERSION != ""
711    ${If} $ALL_USERS_DEFAULT == 1
712      nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -30 100% 30 "FileZilla has been previously installed for all users."
713    ${Else}
714      nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -30 100% 30 "FileZilla has been previously installed for this user only."
715    ${EndIf}
716  ${Else}
717    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -30 100% 30 "Installation for all users requires Administrator privileges."
718  ${EndIf}
719  Pop $R1
720
721  ${If} $ALL_USERS == "1"
722    SendMessage $ALL_USERS_BUTTON ${BM_SETCHECK} 1 0
723  ${Else}
724    SendMessage $R0 ${BM_SETCHECK} 1 0
725  ${EndIf}
726
727  ${If} $PREVIOUS_VERSION == ""
728  ${OrIf} $PERFORM_UPDATE == 1}
729    ${IF} $SKIPLICENSE == 1
730      EnableWindow $mui.Button.Back 0
731    ${ENDIF}
732  ${EndIf}
733
734  ${If} $PERFORM_UPDATE == 1
735    StrCpy $REINSTALL_UNINSTALL 1
736    Abort
737  ${EndIf}
738
739
740  nsDialogs::Show
741
742FunctionEnd
743
744Function PageLeaveAllUsers
745
746  SendMessage $ALL_USERS_BUTTON ${BM_GETCHECK} 0 0 $R0
747  ${If} $R0 == 0
748    StrCpy $ALL_USERS "0"
749  ${Else}
750    StrCpy $ALL_USERS "1"
751  ${EndIf}
752  Call UpdateShellVarContext
753
754FunctionEnd
755
756Function PageComponentsPre
757
758  ${If} $REINSTALL_UNINSTALL == 1
759
760    Abort
761
762  ${EndIf}
763
764FunctionEnd
765
766Function PageDirectoryPre
767
768  ${If} $REINSTALL_UNINSTALL == "1"
769
770    Abort
771
772  ${EndIf}
773
774FunctionEnd
775
776Function PageStartmenuPre
777
778  ${If} $REINSTALL_UNINSTALL == "1"
779
780    ${If} "$STARTMENU_FOLDER" == ""
781
782      StrCpy "$STARTMENU_FOLDER" ">"
783
784    ${EndIf}
785
786    Abort
787
788  ${EndIf}
789
790FunctionEnd
791
792Function CheckFileZillaRunning
793
794  Push "filezilla.exe"
795  Call IsProcessRunning
796  Pop $R1
797
798  ${If} $PERFORM_UPDATE == 1
799    StrCpy $R0 10
800  ${Else}
801    StrCpy $R0 2
802  ${EndIf}
803
804  ${While} $R1 == 1
805
806    ${If} $R0 == 0
807
808      ${ExitWhile}
809
810    ${EndIf}
811
812    Sleep 500
813
814    Push "filezilla.exe"
815    Call IsProcessRunning
816    Pop $R1
817
818    IntOp $R0 $R0 - 1
819
820  ${EndWhile}
821
822  Push "filezilla.exe"
823  Call IsProcessRunning
824  Pop $R1
825
826  ${While} $R1 == 1
827
828    MessageBox MB_ABORTRETRYIGNORE|MB_DEFBUTTON2 "FileZilla appears to be running.$\nPlease close all running instances of FileZilla before continuing the installation." /SD IDIGNORE IDABORT CheckFileZillaRunning_abort IDIGNORE CheckFileZillaRunning_ignore
829
830    Push "filezilla.exe"
831    Call IsProcessRunning
832    Pop $R1
833
834  ${EndWhile}
835
836 CheckFileZillaRunning_ignore:
837  Return
838
839 CheckFileZillaRunning_abort:
840  Quit
841
842FunctionEnd
843
844Function PageInstfilesShow
845
846  Call CheckFileZillaRunning
847
848  ${If} $REINSTALL_UNINSTALL != ""
849
850    Call RunUninstaller
851
852  ${EndIf}
853
854FunctionEnd
855
856Function .OnInstFailed
857FunctionEnd
858
859Function .onInstSuccess
860
861  ${MementoSectionSave}
862
863FunctionEnd
864
865;--------------------------------
866; Languages
867;--------------------------------
868
869  !insertmacro MUI_LANGUAGE "English"
870
871;--------------------------------
872; Installer Sections
873;--------------------------------
874
875Section "FileZilla Client" SecMain
876
877  SectionIn 1 RO
878
879  SetOutPath "$INSTDIR"
880
881  File "..\src\interface\${LT_EXEDIR}FileZilla.exe"
882  File "..\src\putty\${LT_EXEDIR}fzsftp.exe"
883  File "..\src\putty\${LT_EXEDIR}fzputtygen.exe"
884
885  File "${top_srcdir}\GPL.html"
886  File "${top_srcdir}\NEWS"
887  File "${top_srcdir}\AUTHORS"
888
889  DetailPrint "Installing resource files"
890  SetDetailsPrint none
891
892  SetOutPath "$INSTDIR\resources"
893  File "${top_srcdir}/src\interface\resources\*.png"
894  File "${top_srcdir}/src\interface\resources\defaultfilters.xml"
895  File "${top_srcdir}/src\interface\resources\finished.wav"
896  File "${top_srcdir}/src\interface\resources\theme.xml"
897
898  SetOutPath "$INSTDIR\resources\xrc"
899  File "${top_srcdir}/src\interface\resources\xrc\*.xrc"
900
901  SetOutPath "$INSTDIR\resources\16x16"
902  File "${top_srcdir}/src\interface\resources\16x16\*.png"
903  File "${top_srcdir}/src\interface\resources\16x16\*.gif"
904
905  SetOutPath "$INSTDIR\resources\32x32"
906  File "${top_srcdir}/src\interface\resources\32x32\*.png"
907
908  SetOutPath "$INSTDIR\resources\48x48"
909  File "${top_srcdir}/src\interface\resources\48x48\*.png"
910
911  SetDetailsPrint lastused
912
913  ; Create uninstaller
914  WriteUninstaller "$INSTDIR\uninstall.exe"
915
916  WriteRegStr SHCTX "Software\FileZilla Client" "" $INSTDIR
917  WriteRegStr SHCTX "Software\FileZilla Client" "Version" "${VERSION}"
918
919  WriteRegExpandStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client" "UninstallString" "$INSTDIR\uninstall.exe"
920  WriteRegExpandStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client" "InstallLocation" "$INSTDIR"
921  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "DisplayName"    "FileZilla Client ${VERSION}"
922  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "DisplayIcon"    "$INSTDIR\FileZilla.exe"
923  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "DisplayVersion" "${VERSION}"
924  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "URLInfoAbout"   "${WEBSITE_URL}"
925  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "URLUpdateInfo"  "${WEBSITE_URL}"
926  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "HelpLink"       "${WEBSITE_URL}"
927  WriteRegStr   SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "Publisher"      "${PUBLISHER}"
928  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "VersionMajor"   "${VERSION_MAJOR}"
929  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "VersionMinor"   "${VERSION_MINOR}"
930  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "NoModify"       "1"
931  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"   "NoRepair"       "1"
932
933  Call GetInstalledSize
934  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client" "EstimatedSize" "$GetInstalledSize.total" ; Create/Write the reg key with the dword value
935
936  SetOutPath "$INSTDIR\docs"
937  File "${top_srcdir}\docs\fzdefaults.xml.example"
938
939  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
940
941  ; Create shortcuts
942  SetOutPath "$INSTDIR"
943  CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
944  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
945  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla.lnk" "$INSTDIR\filezilla.exe"
946
947  ${If} ${AtLeastWin7}
948    ; Setting AppID
949    push "FileZilla.Client.AppID"
950    push "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla.lnk"
951    nsis_appid::set_appid
952  ${EndIf}
953
954  !insertmacro MUI_STARTMENU_WRITE_END
955
956  Push $R0
957  StrCpy $R0 "$STARTMENU_FOLDER" 1
958  ${if} $R0 == ">"
959    ; Write folder to registry
960    WriteRegStr "${MUI_STARTMENUPAGE_Application_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_Application_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_Application_REGISTRY_VALUENAME}" ">"
961  ${endif}
962  Pop $R0
963
964  ${If} $ALL_USERS == 1
965    ; Enable mini dumps
966    ${If} ${RunningX64}
967      SetRegView 64
968    ${EndIf}
969    WriteRegDWORD HKLM "${DUMP_KEY}\filezilla.exe"  "DumpType" "1"
970    WriteRegDWORD HKLM "${DUMP_KEY}\fzsftp.exe"     "DumpType" "1"
971    WriteRegDWORD HKLM "${DUMP_KEY}\fzputtygen.exe" "DumpType" "1"
972    ${If} ${RunningX64}
973      SetRegView lastused
974    ${EndIf}
975  ${EndIf}
976
977  ; Register App Path so that typing filezilla in Win+R dialog starts FileZilla
978  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe" "" "$INSTDIR\filezilla.exe"
979  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe" "Path" "$INSTDIR"
980
981SectionEnd
982
983!macro INSTALLICONSET SET
984  DetailPrint "Installing ${SET} icon set"
985  SetDetailsPrint none
986  SetOutPath "$INSTDIR\resources\${SET}"
987  File "${top_srcdir}/src\interface\resources\${SET}\theme.xml"
988  File /r "${top_srcdir}/src\interface\resources\${SET}\*.png"
989  File /nonfatal /r "${top_srcdir}/src\interface\resources\${SET}\*.gif"
990  SetDetailsPrint lastused
991!macroend
992
993${MementoSection} "Icon sets" SecIconSets
994
995  !insertmacro INSTALLICONSET blukis
996  !insertmacro INSTALLICONSET cyril
997  !insertmacro INSTALLICONSET flatzilla
998  !insertmacro INSTALLICONSET lone
999  !insertmacro INSTALLICONSET minimal
1000  !insertmacro INSTALLICONSET opencrystal
1001  !insertmacro INSTALLICONSET sun
1002  !insertmacro INSTALLICONSET tango
1003
1004${MementoSectionEnd}
1005
1006!if "@FILEZILLA_LINGUAS@" != ""
1007
1008  !macro INSTALLLANGFILE LANG
1009
1010     SetOutPath "$INSTDIR\locales\${LANG}"
1011     File /oname=filezilla.mo "..\locales\${LANG}.mo"
1012
1013  !macroend
1014
1015  ${MementoSection} "Language files" SecLang
1016
1017    DetailPrint "Installing language files"
1018    SetDetailsPrint none
1019
1020    ; installlangfiles.nsh is generated by configure and just contains a series of
1021    ; !insertmacro INSTALLLANGFILE <lang>
1022    !include installlangfiles.nsh
1023
1024    SetDetailsPrint lastused
1025
1026  ${MementoSectionEnd}
1027
1028!endif
1029
1030${MementoSection} "Shell Extension" SecShellExt
1031
1032  SetOutPath "$INSTDIR"
1033  !define LIBRARY_SHELL_EXTENSION
1034  !define LIBRARY_COM
1035  !define LIBRARY_IGNORE_VERSION
1036
1037  ${If} ${RunningX64}
1038    SetRegView 32
1039  ${EndIf}
1040  !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED ../src/fzshellext/32/.libs\libfzshellext-0.dll $INSTDIR\fzshellext.dll "$INSTDIR"
1041  ${If} ${RunningX64}
1042    SetRegView lastused
1043  ${EndIf}
1044
1045  !define LIBRARY_X64
1046  ${If} ${RunningX64}
1047    !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED ../src/fzshellext/64/.libs\libfzshellext-0.dll $INSTDIR\fzshellext_64.dll "$INSTDIR"
1048  ${Else}
1049    !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED ../src/fzshellext/64/.libs\libfzshellext-0.dll $INSTDIR\fzshellext_64.dll "$INSTDIR"
1050  ${Endif}
1051  !undef LIBRARY_X64
1052
1053${MementoSectionEnd}
1054
1055${MementoUnselectedSection} "Desktop Icon" SecDesktop
1056
1057  SetOutPath "$INSTDIR"
1058  CreateShortCut "$DESKTOP\FileZilla Client.lnk" "$INSTDIR\filezilla.exe" "" "$INSTDIR\filezilla.exe" 0
1059
1060${MementoSectionEnd}
1061
1062${MementoSectionDone}
1063
1064;--------------------------------
1065; Functions
1066;--------------------------------
1067
1068Function PostInstPage
1069
1070  ; Don't advance automatically if details expanded
1071  FindWindow $R0 "#32770" "" $HWNDPARENT
1072  GetDlgItem $R0 $R0 1016
1073  System::Call user32::IsWindowVisible(i$R0)i.s
1074  Pop $R0
1075
1076  StrCmp $R0 0 +2
1077  SetAutoClose false
1078
1079FunctionEnd
1080
1081Function PageFinishPre
1082  ${If} $PERFORM_UPDATE == 1
1083    !insertmacro UAC_AsUser_ExecShell '' '$INSTDIR\filezilla.exe' '' '' SW_SHOWNORMAL
1084    Quit
1085  ${EndIf}
1086FunctionEnd
1087
1088Function CustomFinishRun
1089
1090  !insertmacro UAC_AsUser_ExecShell '' '$INSTDIR\filezilla.exe' '' '' SW_SHOWNORMAL
1091
1092FunctionEnd
1093
1094Function GetInstalledSize
1095  Push $0
1096  Push $1
1097  StrCpy $GetInstalledSize.total 0
1098  ${ForEach} $1 0 256 + 1
1099    ${if} ${SectionIsSelected} $1
1100      SectionGetSize $1 $0
1101      IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
1102    ${Endif}
1103  ${Next}
1104  Pop $1
1105  Pop $0
1106  IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
1107  Push $GetInstalledSize.total
1108FunctionEnd
1109
1110;--------------------------------
1111; Descriptions
1112;--------------------------------
1113
1114  ; Language strings
1115  LangString DESC_SecMain ${LANG_ENGLISH} "Required program files."
1116  LangString DESC_SecIconSets ${LANG_ENGLISH} "Additional icon sets."
1117!if "@FILEZILLA_LINGUAS@" != ""
1118  LangString DESC_SecLang ${LANG_ENGLISH} "Language files."
1119!endif
1120  LangString DESC_SecShellExt ${LANG_ENGLISH} "Shell extension for advanced drag && drop support. Required for drag && drop from FileZilla into Explorer."
1121  LangString DESC_SecDesktop ${LANG_ENGLISH} "Create desktop icon for FileZilla"
1122
1123  ; Assign language strings to sections
1124  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1125    !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain)
1126    !insertmacro MUI_DESCRIPTION_TEXT ${SecIconSets} $(DESC_SecIconSets)
1127!if "@FILEZILLA_LINGUAS@" != ""
1128    !insertmacro MUI_DESCRIPTION_TEXT ${SecLang} $(DESC_SecLang)
1129!endif
1130    !insertmacro MUI_DESCRIPTION_TEXT ${SecShellExt} $(DESC_SecShellExt)
1131    !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
1132  !insertmacro MUI_FUNCTION_DESCRIPTION_END
1133
1134;--------------------------------
1135; Uninstaller Variables
1136;--------------------------------
1137
1138Var un.REMOVE_ALL_USERS
1139Var un.REMOVE_CURRENT_USER
1140
1141;--------------------------------
1142; Uninstaller Functions
1143;--------------------------------
1144
1145Function un.GetUserInfo
1146  ClearErrors
1147  UserInfo::GetName
1148  ${If} ${Errors}
1149    StrCpy $IS_ADMIN 1
1150    Return
1151  ${EndIf}
1152  Pop $USERNAME
1153
1154  ${If} ${UAC_IsAdmin}
1155    StrCpy $IS_ADMIN 1
1156  ${Else}
1157    StrCpy $IS_ADMIN 0
1158  ${EndIf}
1159
1160FunctionEnd
1161
1162Function un.ReadPreviousVersion
1163
1164  ReadRegStr $R0 HKLM "Software\FileZilla Client" ""
1165
1166  ${If} $R0 != ""
1167    ; Detect version
1168    ReadRegStr $R2 HKLM "Software\FileZilla Client" "Version"
1169    ${If} $R2 == ""
1170      StrCpy $R0 ""
1171    ${EndIf}
1172  ${EndIf}
1173
1174  ReadRegStr $R1 HKCU "Software\FileZilla Client" ""
1175
1176  ${If} $R1 != ""
1177    ; Detect version
1178    ReadRegStr $R2 HKCU "Software\FileZilla Client" "Version"
1179    ${If} $R2 == ""
1180      StrCpy $R1 ""
1181    ${EndIf}
1182  ${EndIf}
1183
1184  ${If} $R1 == $INSTDIR
1185    Strcpy $un.REMOVE_CURRENT_USER 1
1186  ${EndIf}
1187  ${If} $R0 == $INSTDIR
1188    Strcpy $un.REMOVE_ALL_USERS 1
1189  ${EndIf}
1190  ${If} $un.REMOVE_CURRENT_USER != 1
1191  ${AndIf} $un.REMOVE_ALL_USERS != 1
1192    ${If} $R1 != ""
1193      Strcpy $un.REMOVE_CURRENT_USER 1
1194      ${If} $R0 == $R1
1195        Strcpy $un.REMOVE_ALL_USERS 1
1196      ${EndIf}
1197    ${Else}
1198      StrCpy $un.REMOVE_ALL_USERS = 1
1199    ${EndIf}
1200  ${EndIf}
1201
1202FunctionEnd
1203
1204Function un.onInit
1205
1206  Call un.GetUserInfo
1207  Call un.ReadPreviousVersion
1208
1209  ${If} $un.REMOVE_ALL_USERS == 1
1210  ${AndIf} $IS_ADMIN == 0
1211    MessageBox MB_ICONSTOP "FileZilla has been installed for all users.$\nPlease restart the uninstaller with Administrator privileges to remove it." /SD IDOK
1212    Abort
1213  ${EndIf}
1214
1215FunctionEnd
1216
1217Function un.RemoveStartmenu
1218
1219  !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
1220
1221  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
1222  Delete "$SMPROGRAMS\$MUI_TEMP\FileZilla.lnk"
1223
1224  ${un.GetParameters} $R0
1225
1226  ${un.GetOptions} $R0 "/keepstartmenudir" $R1
1227  ${If} ${Errors}
1228
1229    ; Delete empty start menu parent diretories
1230    StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
1231
1232    startMenuDeleteLoop:
1233      RMDir $MUI_TEMP
1234      GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
1235
1236      IfErrors startMenuDeleteLoopDone
1237
1238      StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
1239    startMenuDeleteLoopDone:
1240
1241  ${EndUnless}
1242
1243FunctionEnd
1244
1245Function un.ConfirmPagePre
1246
1247  ${un.GetParameters} $R0
1248
1249  ${un.GetOptions} $R0 "/frominstall" $R1
1250  ${Unless} ${Errors}
1251    Abort
1252  ${EndUnless}
1253
1254FunctionEnd
1255
1256Function un.FinishPagePre
1257
1258  ${un.GetParameters} $R0
1259
1260  ${un.GetOptions} $R0 "/frominstall" $R1
1261  ${Unless} ${Errors}
1262    SetRebootFlag false
1263    Abort
1264  ${EndUnless}
1265
1266FunctionEnd
1267
1268;--------------------------------
1269; Uninstaller Section
1270;--------------------------------
1271
1272!if "@FILEZILLA_LINGUAS@" != ""
1273
1274  !macro UNINSTALLLANGFILE LANG
1275
1276    Delete "$INSTDIR\locales\${LANG}\filezilla.mo"
1277    RMDir "$INSTDIR\locales\${LANG}"
1278
1279  !macroend
1280
1281!endif
1282
1283!macro UNINSTALLICONSET SET
1284
1285  DetailPrint "Removing ${SET} icon set"
1286  SetDetailsPrint none
1287
1288  Delete "$INSTDIR\resources\${SET}\theme.xml"
1289  Delete "$INSTDIR\resources\${SET}\16x16\*.png"
1290  Delete "$INSTDIR\resources\${SET}\20x20\*.png"
1291  Delete "$INSTDIR\resources\${SET}\24x24\*.png"
1292  Delete "$INSTDIR\resources\${SET}\32x32\*.png"
1293  Delete "$INSTDIR\resources\${SET}\48x48\*.png"
1294  Delete "$INSTDIR\resources\${SET}\16x16\*.gif"
1295  Delete "$INSTDIR\resources\${SET}\20x20\*.gif"
1296  Delete "$INSTDIR\resources\${SET}\24x24\*.gif"
1297  Delete "$INSTDIR\resources\${SET}\32x32\*.gif"
1298  Delete "$INSTDIR\resources\${SET}\48x48\*.gif"
1299  RMDir "$INSTDIR\resources\${SET}\16x16"
1300  RMDir "$INSTDIR\resources\${SET}\20x20"
1301  RMDir "$INSTDIR\resources\${SET}\24x24"
1302  RMDir "$INSTDIR\resources\${SET}\32x32"
1303  RMDir "$INSTDIR\resources\${SET}\48x48"
1304  RMDir "$INSTDIR\resources\${SET}"
1305
1306  SetDetailsPrint lastused
1307
1308!macroend
1309
1310Section "Uninstall"
1311
1312  ${If} ${RunningX64}
1313    SetRegView 32
1314  ${EndIf}
1315  !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext.dll"
1316  ${If} ${RunningX64}
1317    SetRegView lastused
1318  ${EndIf}
1319
1320  !define LIBRARY_X64
1321  ${If} ${RunningX64}
1322    !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext_64.dll"
1323  ${Else}
1324    !insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext_64.dll"
1325  ${Endif}
1326  !undef LIBRARY_X64
1327
1328  Delete "$INSTDIR\filezilla.exe"
1329  Delete "$INSTDIR\fzsftp.exe"
1330  Delete "$INSTDIR\fzputtygen.exe"
1331
1332  Delete "$INSTDIR\GPL.html"
1333  Delete "$INSTDIR\NEWS"
1334  Delete "$INSTDIR\AUTHORS"
1335
1336  DetailPrint "Removing resource files"
1337  SetDetailsPrint none
1338
1339  Delete "$INSTDIR\resources\xrc\*.xrc"
1340  Delete "$INSTDIR\resources\*.png"
1341  Delete "$INSTDIR\resources\defaultfilters.xml"
1342  Delete "$INSTDIR\resources\finished.wav"
1343  Delete "$INSTDIR\resources\theme.xml"
1344  Delete "$INSTDIR\resources\16x16\*.png"
1345  Delete "$INSTDIR\resources\32x32\*.png"
1346  Delete "$INSTDIR\resources\48x48\*.png"
1347  Delete "$INSTDIR\resources\16x16\*.gif"
1348  Delete "$INSTDIR\resources\32x32\*.gif"
1349  Delete "$INSTDIR\resources\48x48\*.gif"
1350
1351  SetDetailsPrint lastused
1352
1353  !insertmacro UNINSTALLICONSET cyril
1354  !insertmacro UNINSTALLICONSET blukis
1355  !insertmacro UNINSTALLICONSET flatzilla
1356  !insertmacro UNINSTALLICONSET lone
1357  !insertmacro UNINSTALLICONSET minimal
1358  !insertmacro UNINSTALLICONSET opencrystal
1359  !insertmacro UNINSTALLICONSET sun
1360  !insertmacro UNINSTALLICONSET tango
1361
1362!if "@FILEZILLA_LINGUAS@" != ""
1363
1364  DetailPrint "Removing language files"
1365  SetDetailsPrint none
1366
1367  ; uninstalllangfiles.nsh is generated by configure and just contains a series of
1368  ; !insertmacro UNINSTALLLANGFILE <lang>
1369  !include uninstalllangfiles.nsh
1370
1371  SetDetailsPrint lastused
1372
1373!endif
1374
1375  Delete "$INSTDIR\uninstall.exe"
1376
1377  Delete "$INSTDIR\docs\fzdefaults.xml.example"
1378
1379!if "@FILEZILLA_LINGUAS@" != ""
1380  RMDir "$INSTDIR\locales"
1381!endif
1382  RMDir "$INSTDIR\resources\48x48"
1383  RMDir "$INSTDIR\resources\32x32"
1384  RMDir "$INSTDIR\resources\16x16"
1385  RMDir "$INSTDIR\resources\xrc"
1386  RMDir "$INSTDIR\resources"
1387  RMDir "$INSTDIR\docs"
1388
1389  ${un.GetOptions} $R0 "/frominstall" $R1
1390  ${If} ${Errors}
1391    RMDir /REBOOTOK "$INSTDIR"
1392  ${EndIf}
1393
1394  ${If} $un.REMOVE_ALL_USERS == 1
1395    SetShellVarContext all
1396    Call un.RemoveStartmenu
1397
1398    DeleteRegKey /ifempty HKLM "Software\FileZilla Client"
1399    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"
1400
1401    Delete "$DESKTOP\FileZilla Client.lnk"
1402
1403    ; Remove dump key
1404    ${If} ${RunningX64}
1405      SetRegView 64
1406    ${EndIf}
1407    DeleteRegValue HKLM "${DUMP_KEY}\filezilla.exe"  "DumpType"
1408    DeleteRegValue HKLM "${DUMP_KEY}\fzsftp.exe"     "DumpType"
1409    DeleteRegValue HKLM "${DUMP_KEY}\fzputtygen.exe" "DumpType"
1410    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\filezilla.exe"
1411    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\fzsftp.exe"
1412    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\fzputtygen.exe"
1413    ${If} ${RunningX64}
1414      SetRegView lastused
1415    ${EndIf}
1416  ${EndIf}
1417
1418  ${If} $un.REMOVE_CURRENT_USER == 1
1419    SetShellVarContext current
1420    Call un.RemoveStartmenu
1421
1422    DeleteRegKey /ifempty HKCU "Software\FileZilla Client"
1423    DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"
1424
1425    Delete "$DESKTOP\FileZilla Client.lnk"
1426  ${EndIf}
1427
1428  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe"
1429
1430SectionEnd
Note: See TracBrowser for help on using the repository browser.