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

Last change on this file since 3185 was 3185, checked in by jrpelegrina, 2 years ago

Update new version: 3.15.02

File size: 37.9 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  ${If} ${AtLeastWin7}
1061    ; Setting AppID
1062    push "FileZilla.Client.AppID"
1063    push "$DESKTOP\FileZilla Client.lnk"
1064    nsis_appid::set_appid
1065  ${EndIf}
1066
1067${MementoSectionEnd}
1068
1069${MementoSectionDone}
1070
1071;--------------------------------
1072; Functions
1073;--------------------------------
1074
1075Function PostInstPage
1076
1077  ; Don't advance automatically if details expanded
1078  FindWindow $R0 "#32770" "" $HWNDPARENT
1079  GetDlgItem $R0 $R0 1016
1080  System::Call user32::IsWindowVisible(i$R0)i.s
1081  Pop $R0
1082
1083  StrCmp $R0 0 +2
1084  SetAutoClose false
1085
1086FunctionEnd
1087
1088Function PageFinishPre
1089  ${If} $PERFORM_UPDATE == 1
1090    !insertmacro UAC_AsUser_ExecShell '' '$INSTDIR\filezilla.exe' '' '' SW_SHOWNORMAL
1091    Quit
1092  ${EndIf}
1093FunctionEnd
1094
1095Function CustomFinishRun
1096
1097  !insertmacro UAC_AsUser_ExecShell '' '$INSTDIR\filezilla.exe' '' '' SW_SHOWNORMAL
1098
1099FunctionEnd
1100
1101Function GetInstalledSize
1102  Push $0
1103  Push $1
1104  StrCpy $GetInstalledSize.total 0
1105  ${ForEach} $1 0 256 + 1
1106    ${if} ${SectionIsSelected} $1
1107      SectionGetSize $1 $0
1108      IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
1109    ${Endif}
1110  ${Next}
1111  Pop $1
1112  Pop $0
1113  IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
1114  Push $GetInstalledSize.total
1115FunctionEnd
1116
1117;--------------------------------
1118; Descriptions
1119;--------------------------------
1120
1121  ; Language strings
1122  LangString DESC_SecMain ${LANG_ENGLISH} "Required program files."
1123  LangString DESC_SecIconSets ${LANG_ENGLISH} "Additional icon sets."
1124!if "@FILEZILLA_LINGUAS@" != ""
1125  LangString DESC_SecLang ${LANG_ENGLISH} "Language files."
1126!endif
1127  LangString DESC_SecShellExt ${LANG_ENGLISH} "Shell extension for advanced drag && drop support. Required for drag && drop from FileZilla into Explorer."
1128  LangString DESC_SecDesktop ${LANG_ENGLISH} "Create desktop icon for FileZilla"
1129
1130  ; Assign language strings to sections
1131  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1132    !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain)
1133    !insertmacro MUI_DESCRIPTION_TEXT ${SecIconSets} $(DESC_SecIconSets)
1134!if "@FILEZILLA_LINGUAS@" != ""
1135    !insertmacro MUI_DESCRIPTION_TEXT ${SecLang} $(DESC_SecLang)
1136!endif
1137    !insertmacro MUI_DESCRIPTION_TEXT ${SecShellExt} $(DESC_SecShellExt)
1138    !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
1139  !insertmacro MUI_FUNCTION_DESCRIPTION_END
1140
1141;--------------------------------
1142; Uninstaller Variables
1143;--------------------------------
1144
1145Var un.REMOVE_ALL_USERS
1146Var un.REMOVE_CURRENT_USER
1147
1148;--------------------------------
1149; Uninstaller Functions
1150;--------------------------------
1151
1152Function un.GetUserInfo
1153  ClearErrors
1154  UserInfo::GetName
1155  ${If} ${Errors}
1156    StrCpy $IS_ADMIN 1
1157    Return
1158  ${EndIf}
1159  Pop $USERNAME
1160
1161  ${If} ${UAC_IsAdmin}
1162    StrCpy $IS_ADMIN 1
1163  ${Else}
1164    StrCpy $IS_ADMIN 0
1165  ${EndIf}
1166
1167FunctionEnd
1168
1169Function un.ReadPreviousVersion
1170
1171  ReadRegStr $R0 HKLM "Software\FileZilla Client" ""
1172
1173  ${If} $R0 != ""
1174    ; Detect version
1175    ReadRegStr $R2 HKLM "Software\FileZilla Client" "Version"
1176    ${If} $R2 == ""
1177      StrCpy $R0 ""
1178    ${EndIf}
1179  ${EndIf}
1180
1181  ReadRegStr $R1 HKCU "Software\FileZilla Client" ""
1182
1183  ${If} $R1 != ""
1184    ; Detect version
1185    ReadRegStr $R2 HKCU "Software\FileZilla Client" "Version"
1186    ${If} $R2 == ""
1187      StrCpy $R1 ""
1188    ${EndIf}
1189  ${EndIf}
1190
1191  ${If} $R1 == $INSTDIR
1192    Strcpy $un.REMOVE_CURRENT_USER 1
1193  ${EndIf}
1194  ${If} $R0 == $INSTDIR
1195    Strcpy $un.REMOVE_ALL_USERS 1
1196  ${EndIf}
1197  ${If} $un.REMOVE_CURRENT_USER != 1
1198  ${AndIf} $un.REMOVE_ALL_USERS != 1
1199    ${If} $R1 != ""
1200      Strcpy $un.REMOVE_CURRENT_USER 1
1201      ${If} $R0 == $R1
1202        Strcpy $un.REMOVE_ALL_USERS 1
1203      ${EndIf}
1204    ${Else}
1205      StrCpy $un.REMOVE_ALL_USERS = 1
1206    ${EndIf}
1207  ${EndIf}
1208
1209FunctionEnd
1210
1211Function un.onInit
1212
1213  Call un.GetUserInfo
1214  Call un.ReadPreviousVersion
1215
1216  ${If} $un.REMOVE_ALL_USERS == 1
1217  ${AndIf} $IS_ADMIN == 0
1218    MessageBox MB_ICONSTOP "FileZilla has been installed for all users.$\nPlease restart the uninstaller with Administrator privileges to remove it." /SD IDOK
1219    Abort
1220  ${EndIf}
1221
1222FunctionEnd
1223
1224Function un.RemoveStartmenu
1225
1226  !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
1227
1228  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
1229  Delete "$SMPROGRAMS\$MUI_TEMP\FileZilla.lnk"
1230
1231  ${un.GetParameters} $R0
1232
1233  ${un.GetOptions} $R0 "/keepstartmenudir" $R1
1234  ${If} ${Errors}
1235
1236    ; Delete empty start menu parent diretories
1237    StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
1238
1239    startMenuDeleteLoop:
1240      RMDir $MUI_TEMP
1241      GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
1242
1243      IfErrors startMenuDeleteLoopDone
1244
1245      StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
1246    startMenuDeleteLoopDone:
1247
1248  ${EndUnless}
1249
1250FunctionEnd
1251
1252Function un.ConfirmPagePre
1253
1254  ${un.GetParameters} $R0
1255
1256  ${un.GetOptions} $R0 "/frominstall" $R1
1257  ${Unless} ${Errors}
1258    Abort
1259  ${EndUnless}
1260
1261FunctionEnd
1262
1263Function un.FinishPagePre
1264
1265  ${un.GetParameters} $R0
1266
1267  ${un.GetOptions} $R0 "/frominstall" $R1
1268  ${Unless} ${Errors}
1269    SetRebootFlag false
1270    Abort
1271  ${EndUnless}
1272
1273FunctionEnd
1274
1275;--------------------------------
1276; Uninstaller Section
1277;--------------------------------
1278
1279!if "@FILEZILLA_LINGUAS@" != ""
1280
1281  !macro UNINSTALLLANGFILE LANG
1282
1283    Delete "$INSTDIR\locales\${LANG}\filezilla.mo"
1284    RMDir "$INSTDIR\locales\${LANG}"
1285
1286  !macroend
1287
1288!endif
1289
1290!macro UNINSTALLICONSET SET
1291
1292  DetailPrint "Removing ${SET} icon set"
1293  SetDetailsPrint none
1294
1295  Delete "$INSTDIR\resources\${SET}\theme.xml"
1296  Delete "$INSTDIR\resources\${SET}\16x16\*.png"
1297  Delete "$INSTDIR\resources\${SET}\20x20\*.png"
1298  Delete "$INSTDIR\resources\${SET}\24x24\*.png"
1299  Delete "$INSTDIR\resources\${SET}\32x32\*.png"
1300  Delete "$INSTDIR\resources\${SET}\48x48\*.png"
1301  Delete "$INSTDIR\resources\${SET}\16x16\*.gif"
1302  Delete "$INSTDIR\resources\${SET}\20x20\*.gif"
1303  Delete "$INSTDIR\resources\${SET}\24x24\*.gif"
1304  Delete "$INSTDIR\resources\${SET}\32x32\*.gif"
1305  Delete "$INSTDIR\resources\${SET}\48x48\*.gif"
1306  RMDir "$INSTDIR\resources\${SET}\16x16"
1307  RMDir "$INSTDIR\resources\${SET}\20x20"
1308  RMDir "$INSTDIR\resources\${SET}\24x24"
1309  RMDir "$INSTDIR\resources\${SET}\32x32"
1310  RMDir "$INSTDIR\resources\${SET}\48x48"
1311  RMDir "$INSTDIR\resources\${SET}"
1312
1313  SetDetailsPrint lastused
1314
1315!macroend
1316
1317Section "Uninstall"
1318
1319  ${If} ${RunningX64}
1320    SetRegView 32
1321  ${EndIf}
1322  !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext.dll"
1323  ${If} ${RunningX64}
1324    SetRegView lastused
1325  ${EndIf}
1326
1327  !define LIBRARY_X64
1328  ${If} ${RunningX64}
1329    !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext_64.dll"
1330  ${Else}
1331    !insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\fzshellext_64.dll"
1332  ${Endif}
1333  !undef LIBRARY_X64
1334
1335  Delete "$INSTDIR\filezilla.exe"
1336  Delete "$INSTDIR\fzsftp.exe"
1337  Delete "$INSTDIR\fzputtygen.exe"
1338
1339  Delete "$INSTDIR\GPL.html"
1340  Delete "$INSTDIR\NEWS"
1341  Delete "$INSTDIR\AUTHORS"
1342
1343  DetailPrint "Removing resource files"
1344  SetDetailsPrint none
1345
1346  Delete "$INSTDIR\resources\xrc\*.xrc"
1347  Delete "$INSTDIR\resources\*.png"
1348  Delete "$INSTDIR\resources\defaultfilters.xml"
1349  Delete "$INSTDIR\resources\finished.wav"
1350  Delete "$INSTDIR\resources\theme.xml"
1351  Delete "$INSTDIR\resources\16x16\*.png"
1352  Delete "$INSTDIR\resources\32x32\*.png"
1353  Delete "$INSTDIR\resources\48x48\*.png"
1354  Delete "$INSTDIR\resources\16x16\*.gif"
1355  Delete "$INSTDIR\resources\32x32\*.gif"
1356  Delete "$INSTDIR\resources\48x48\*.gif"
1357
1358  SetDetailsPrint lastused
1359
1360  !insertmacro UNINSTALLICONSET cyril
1361  !insertmacro UNINSTALLICONSET blukis
1362  !insertmacro UNINSTALLICONSET flatzilla
1363  !insertmacro UNINSTALLICONSET lone
1364  !insertmacro UNINSTALLICONSET minimal
1365  !insertmacro UNINSTALLICONSET opencrystal
1366  !insertmacro UNINSTALLICONSET sun
1367  !insertmacro UNINSTALLICONSET tango
1368
1369!if "@FILEZILLA_LINGUAS@" != ""
1370
1371  DetailPrint "Removing language files"
1372  SetDetailsPrint none
1373
1374  ; uninstalllangfiles.nsh is generated by configure and just contains a series of
1375  ; !insertmacro UNINSTALLLANGFILE <lang>
1376  !include uninstalllangfiles.nsh
1377
1378  SetDetailsPrint lastused
1379
1380!endif
1381
1382  Delete "$INSTDIR\uninstall.exe"
1383
1384  Delete "$INSTDIR\docs\fzdefaults.xml.example"
1385
1386!if "@FILEZILLA_LINGUAS@" != ""
1387  RMDir "$INSTDIR\locales"
1388!endif
1389  RMDir "$INSTDIR\resources\48x48"
1390  RMDir "$INSTDIR\resources\32x32"
1391  RMDir "$INSTDIR\resources\16x16"
1392  RMDir "$INSTDIR\resources\xrc"
1393  RMDir "$INSTDIR\resources"
1394  RMDir "$INSTDIR\docs"
1395
1396  ${un.GetOptions} $R0 "/frominstall" $R1
1397  ${If} ${Errors}
1398    RMDir /REBOOTOK "$INSTDIR"
1399  ${EndIf}
1400
1401  ${If} $un.REMOVE_ALL_USERS == 1
1402    SetShellVarContext all
1403    Call un.RemoveStartmenu
1404
1405    DeleteRegKey /ifempty HKLM "Software\FileZilla Client"
1406    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"
1407
1408    Delete "$DESKTOP\FileZilla Client.lnk"
1409
1410    ; Remove dump key
1411    ${If} ${RunningX64}
1412      SetRegView 64
1413    ${EndIf}
1414    DeleteRegValue HKLM "${DUMP_KEY}\filezilla.exe"  "DumpType"
1415    DeleteRegValue HKLM "${DUMP_KEY}\fzsftp.exe"     "DumpType"
1416    DeleteRegValue HKLM "${DUMP_KEY}\fzputtygen.exe" "DumpType"
1417    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\filezilla.exe"
1418    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\fzsftp.exe"
1419    DeleteRegKey /ifempty HKLM "${DUMP_KEY}\fzputtygen.exe"
1420    ${If} ${RunningX64}
1421      SetRegView lastused
1422    ${EndIf}
1423  ${EndIf}
1424
1425  ${If} $un.REMOVE_CURRENT_USER == 1
1426    SetShellVarContext current
1427    Call un.RemoveStartmenu
1428
1429    DeleteRegKey /ifempty HKCU "Software\FileZilla Client"
1430    DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla Client"
1431
1432    Delete "$DESKTOP\FileZilla Client.lnk"
1433  ${EndIf}
1434
1435  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe"
1436
1437SectionEnd
Note: See TracBrowser for help on using the repository browser.