forked from meganz/MEGAsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer_win.nsi
1091 lines (952 loc) · 55 KB
/
installer_win.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Script generated by the HM NIS Edit Script Wizard.
; Updated to NSIS 3.04
ManifestDPIAware true
RequestExecutionLevel user
Unicode true
#!define BUILD_UNINSTALLER
#!define BUILD_X64_VERSION
#!define ENABLE_DEBUG_MESSAGES
!macro DEBUG_MSG message
!ifdef ENABLE_DEBUG_MESSAGES
MessageBox MB_OK "${message}"
!endif
!macroend
; HM NIS Edit Wizard helper defines
BrandingText "MEGA Limited"
!define PRODUCT_NAME "MEGAsync"
VIAddVersionKey "CompanyName" "MEGA Limited"
VIAddVersionKey "FileDescription" "MEGAsync"
VIAddVersionKey "LegalCopyright" "MEGA Limited 2022"
VIAddVersionKey "ProductName" "MEGAsync"
; Version info
VIProductVersion "4.8.1.0"
VIAddVersionKey "FileVersion" "4.8.1.0"
VIAddVersionKey "ProductVersion" "4.8.1.0"
!define PRODUCT_VERSION "4.8.1"
!define PRODUCT_PUBLISHER "Mega Limited"
!define PRODUCT_WEB_SITE "http://www.mega.nz"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MEGAsync.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
!define CSIDL_STARTUP '0x7' ;Startup path
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
!define CSIDL_COMMON_APPDATA '0x23'
; To be defined depending on your working environment
!ifdef BUILD_X64_VERSION
!define QT_PATH "C:\Qt\5.12.12\msvc2017_64"
!else
!define QT_PATH "C:\Qt\5.12.12\msvc2017"
!endif
!ifdef BUILD_X64_VERSION
!define SRCDIR_MEGASYNC "built64"
!define SRCDIR_UPDATER "built64"
!else
!define SRCDIR_MEGASYNC "built32"
!define SRCDIR_UPDATER "built32"
!endif
!define SRCDIR_MEGASHELLEXT_X32 "built32"
!define SRCDIR_MEGASHELLEXT_X64 "built64"
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_EXECUTIONLEVEL Standard
!define MULTIUSER_EXECUTIONLEVEL_ALLUSERS
!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
!define MEGA_DATA "mega.ini"
!define UNINSTALLER_NAME "uninst.exe"
!include "MUI2.nsh"
!include "Library.nsh"
!include "UAC.nsh"
!include "MultiUser.nsh"
!include "x64.nsh"
#!include "CPUFeatures.nsh"
!include "WinVer.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "installer\app_ico.ico"
!define MUI_UNICON "installer\uninstall_ico.ico"
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; Settings
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "MEGAsync"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!define MUI_FINISHPAGE_RUN ;"$INSTDIR\MEGASync.exe"
!define MUI_FINISHPAGE_RUN_FUNCTION RunFunction
;!define MUI_FINISHPAGE_NOAUTOCLOSE
var APP_NAME
var ICONS_GROUP
;var INSTALLDAY
;var EXPIRATIONDAY
var USERNAME
var CURRENT_USER_INSTDIR
var ALL_USERS_INSTDIR
;var SILENT_USER_INSTDIR
var SILENT_MULTIUSER
; Installer pages
!define MUI_PAGE_CUSTOMFUNCTION_SHOW showHiDpi
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "installer\terms.txt"
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
!insertmacro MUI_PAGE_INSTFILES
;Page Custom RebootPage
!define MUI_PAGE_CUSTOMFUNCTION_SHOW showHiDpi
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; Language files (the ones available in MEGASync, with locale code)
!insertmacro MUI_LANGUAGE "Afrikaans" ;af
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Arabic" ;ar
!insertmacro MUI_LANGUAGE "Armenian"
!insertmacro MUI_LANGUAGE "Basque" ;eu
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Bosnian" ;bs
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Bulgarian" ;bg
!insertmacro MUI_LANGUAGE "Catalan" ;ca
#!insertmacro MUI_LANGUAGE "Cibemba"
!insertmacro MUI_LANGUAGE "Croatian" ;hr
!insertmacro MUI_LANGUAGE "Czech" ;cs
!insertmacro MUI_LANGUAGE "Danish" ;da
!insertmacro MUI_LANGUAGE "Dutch" ;nl
#!insertmacro MUI_LANGUAGE "Efik" ;locale code not found
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Esperanto"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Farsi" ;locale code not found
!insertmacro MUI_LANGUAGE "Finnish" ;fi
!insertmacro MUI_LANGUAGE "French" ;fr
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Georgian"
!insertmacro MUI_LANGUAGE "German" ;de
!insertmacro MUI_LANGUAGE "Greek" ;el
!insertmacro MUI_LANGUAGE "Hebrew" ;he
#!insertmacro MUI_LANGUAGE "Hindi" ;hi
!insertmacro MUI_LANGUAGE "Hungarian" ;hu
!insertmacro MUI_LANGUAGE "Icelandic"
#!insertmacro MUI_LANGUAGE "Igbo"
!insertmacro MUI_LANGUAGE "Indonesian" ;in
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Italian" ;it
!insertmacro MUI_LANGUAGE "Japanese" ;ja
#!insertmacro MUI_LANGUAGE "Khmer"
!insertmacro MUI_LANGUAGE "Korean" ;ko
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Latvian" ;lv
!insertmacro MUI_LANGUAGE "Lithuanian" ;lt
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Macedonian" ;mk
#!insertmacro MUI_LANGUAGE "Malagasy"
!insertmacro MUI_LANGUAGE "Malay" ;ms
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Norwegian" ;no
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Polish" ;pl
!insertmacro MUI_LANGUAGE "Portuguese" ;pt
!insertmacro MUI_LANGUAGE "PortugueseBR" ;pt_BR
!insertmacro MUI_LANGUAGE "Romanian" ;ro
!insertmacro MUI_LANGUAGE "Russian" ;ru
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
#!insertmacro MUI_LANGUAGE "Sesotho"
!insertmacro MUI_LANGUAGE "SimpChinese" ;zh_CN
!insertmacro MUI_LANGUAGE "Slovak" ;sk
!insertmacro MUI_LANGUAGE "Slovenian" ;sl
!insertmacro MUI_LANGUAGE "Spanish" ;es
!insertmacro MUI_LANGUAGE "SpanishInternational"
#!insertmacro MUI_LANGUAGE "Swahili"
!insertmacro MUI_LANGUAGE "Swedish" ;sv
#!insertmacro MUI_LANGUAGE "Tamil"
!insertmacro MUI_LANGUAGE "Thai" ;th
!insertmacro MUI_LANGUAGE "TradChinese" ;zh_TW
!insertmacro MUI_LANGUAGE "Turkish" ;tr
#!insertmacro MUI_LANGUAGE "Twi"
!insertmacro MUI_LANGUAGE "Ukrainian" ;uk
#!insertmacro MUI_LANGUAGE "Uyghur"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Vietnamese" ;vn
!insertmacro MUI_LANGUAGE "Welsh" ;cy
#!insertmacro MUI_LANGUAGE "Yoruba"
#!insertmacro MUI_LANGUAGE "Zulu"
; mi Maori is included in MegaSync, but not here
; ee Ewe is included in MegaSync, but not here
; tl Tagalog is included in MegaSync, but not here
; MUI end ------
Name $APP_NAME
!ifdef BUILD_UNINSTALLER
OutFile "UninstallerGenerator.exe"
!else
!ifdef BUILD_X64_VERSION
OutFile "MEGAsyncSetup64.exe"
!else
OutFile "MEGAsyncSetup32.exe"
!endif
!endif
InstallDir "$PROGRAMFILES\MEGAsync"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails nevershow
ShowUnInstDetails nevershow
Function RunFunction
${UAC.CallFunctionAsUser} RunMegaSync
FunctionEnd
Function RunMegaSync
Exec "$INSTDIR\MEGAsync.exe"
Sleep 2000
FunctionEnd
#CUSTOM PAGE FOR SELECT USER OR ALL USERS
Var Dialog
var SelectedCheckBox
Var Checkbox1
Var Checkbox2
Var SenderValue
Function RebootPage
${If} ${Silent}
Goto done
${EndIf}
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_FINISH_INFO_TITLE) $(MUI_TEXT_FINISH_INFO_TEXT)
nsDialogs::Create 1018
Pop $Dialog
${NSD_CreateLabel} 0 0 100% 24u $(MUI_TEXT_FINISH_INFO_REBOOT)
${NSD_CreateRadioButton} 15u 50u 100% 10u $(MUI_TEXT_FINISH_REBOOTNOW)
Pop $checkbox1
${NSD_AddStyle} $checkbox1 ${WS_GROUP}
${NSD_OnClick} $checkbox1 onRadioClick
${NSD_SetState} $checkbox1 ${BST_CHECKED}
${NSD_CreateRadioButton} 15u 70u 100% 10u $(MUI_TEXT_FINISH_REBOOTLATER)
Pop $checkbox2
${NSD_OnClick} $checkbox2 onRadioClick
nsDialogs::Show
strCmp $SelectedCheckBox "True" reboot
strCmp $SelectedCheckBox "False" done
reboot:
reboot
done:
FunctionEnd
Function onRadioClick
Pop $SenderValue
${If} $SenderValue == $checkbox1
strcpy $SelectedCheckBox "True"
${ElseIf} $SenderValue == $checkbox2
strcpy $SelectedCheckBox "False"
${EndIf}
FunctionEnd
!macro CheckUserToRunElevated
UserInfo::GetOriginalAccountType
IfErrors PluginFail
Pop $1
StrCmp $1 "Admin" RunElevated
StrCmp $1 "Power" RunElevated
StrCmp $1 "User" done
StrCmp $1 "Guest" done
MessageBox MB_OK "Unknown error checking account type"
Goto done
PluginFail:
MessageBox MB_OK "Error! Unable to call UserInfo plug-in!"
RunElevated:
UAC::RunElevated
${Switch} $0
${Case} 0
${IfThen} $1 = 1 ${|} Quit ${|} ;User process. The installer has finished. Quit.
${IfThen} $3 <> 0 ${|} ${Break} ${|} ;Admin process, continue the installation
${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
;MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
Quit
${EndIf}
${Case} 1223
;MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This requires admin privileges, aborting!"
Quit
${Default}
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This installer requires Administrator privileges. Error $0"
Quit
${EndSwitch}
done:
!macroend
Function RunExplorer
ExecDos::exec /ASYNC /DETAILED /DISABLEFSR "explorer.exe"
FunctionEnd
Var BITMAP_WELCOME
Var BANNER_PATH
Function showHiDpi
System::Call USER32::GetDpiForSystem()i.r0
${If} $0 U<= 0
System::Call USER32::GetDC(i0)i.r1
System::Call GDI32::GetDeviceCaps(ir1,i88)i.r0
System::Call USER32::ReleaseDC(i0,ir1)
${EndIf}
${if} $0 > 288
StrCpy $0 288
${ElseIf} $0 < 72
StrCpy $0 72
${EndIf}
strCpy $BITMAP_WELCOME "$BANNER_PATH\leftbanner\left_banner$0.bmp"
${NSD_SetImage} $mui.WelcomePage.Image $BITMAP_WELCOME $mui.WelcomePage.Image.Bitmap
${NSD_SetImage} $mui.FinishPage.Image $BITMAP_WELCOME $mui.FinishPage.Image.Bitmap
FunctionEnd
Var PREVIOUS_OUTPATH
Function .onInit
setRebootFlag false
#Get params when silent installation is launched
${If} ${Silent}
${GetParameters} $R0
ClearErrors
#Init SILENT vars value (by default, not multiuser installation)
#Silent DIR var has no default value, as it depends on multiuser o current user
#and it is set later on
${GetOptions} $R0 /MULTIUSER= $SILENT_MULTIUSER
;strCmp $SILENT_MULTIUSER "true" continue
;strCpy $SILENT_USER_INSTDIR ""
;${GetOptions} $R0 /DIR= $SILENT_USER_INSTDIR
;IfFileExists "$SILENT_USER_INSTDIR\*.*" continue
#Abort if file does not exist
;MessageBox MB_OK "Directory $SILENT_USER_INSTDIR not exists"
;Abort
;continue:
${EndIf}
!insertmacro MULTIUSER_INIT
StrCpy $APP_NAME "${PRODUCT_NAME} ${PRODUCT_VERSION}"
!ifdef BUILD_UNINSTALLER
WriteUninstaller "$EXEDIR\${UNINSTALLER_NAME}"
Quit
!endif
!ifdef BUILD_X64_VERSION
${If} ${RunningX64}
${Else}
MessageBox MB_OK "This is an installer for 64-bit MEGA Desktop App, but you are using a 32-bit Windows. Please, download the 32-bit MEGA Desktop App version from https://mega.nz/desktop."
Quit
${EndIf}
!endif
${IfNot} ${AtLeastWin7}
MessageBox MB_OK "This MEGA Desktop App installer is for Windows 7 or above"
Quit
${EndIf}
;${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
;strCpy $INSTALLDAY "$2$1$0"
;strCpy $EXPIRATIONDAY "20140121"
;${if} $INSTALLDAY >= $EXPIRATIONDAY
; MessageBox mb_IconInformation|mb_TopMost|mb_SetForeground "Thank you for testing MEGAsync.$\r$\nThis beta version is no longer current and has expired.$\r$\nPlease follow @MEGAprivacy on Twitter for updates."
; abort
;${EndIf}
${IfNot} ${Silent}
!insertmacro CheckUserToRunElevated
${EndIf}
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_LOCALAPPDATA}, i0)i.r0'
strCpy $BANNER_PATH $1
#${UAC.CallFunctionAsUser} GetPaths
StrCpy $BANNER_PATH "$BANNER_PATH\MEGAsync"
strCpy $PREVIOUS_OUTPATH GetOutPath
SetOutPath "$BANNER_PATH\leftbanner"
File "installer\leftbanner\*"
SetOutPath $PREVIOUS_OUTPATH
;MessageBox mb_IconInformation|mb_TopMost|mb_SetForeground "CAUTION: This is a private BETA version and will expire on Jan 20, 2014, 23:59. If you encounter a bug, malfunction or design flaw, please let us know by sending an e-mail to [email protected].$\r$\n$\r$\nIn this version, the scope of the sync engine is limited. Please bear in mind that:$\r$\n$\r$\n1. Deletions are only executed on the other side if they occur while the sync is live. Do not delete items from synced folders while this app is not running!$\r$\n2. Windows filenames are case insensitive. Do not place items a MEGA folder whose names would clash on the client. Loss of data would occur.$\r$\n3. Local filesystem items must not be exposed to the sync subsystem more than once. Any dupes, whether by nesting syncs or through filesystem links, will lead to unexpected results and loss of data.$\r$\n$\r$\nLimitiations in the current version that will be rectified in the future:$\r$\n$\r$\n1. No locking: Concurrent creation of identically named files and folders on different clients can result in server-side dupes and unexpected results.$\r$\n2. No in-place versioning: Deleted remote files can be found in the MEGA rubbish bin (SyncDebris folder), deleted local files in your computer's recycle bin.$\r$\n3. No delta writes: Changed files are always overwritten as a whole, which means that it is not a good idea to sync e.g. live database files.$\r$\n4. No direct peer-to-peer syncing: Even two machines in the same local subnet will still sync via the remote MEGA infrastructure.$\r$\n$\r$\nThank you for betatesting MEGAsync. We appreciate your pioneering spirit!"
;!insertmacro MUI_UNGETLANGUAGE
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function GetPaths
#Get DEFAULT VALUES
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_COMMON_APPDATA}, i0)i.r0'
strCpy $ALL_USERS_INSTDIR $1
System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
strCpy $USERNAME $0
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_LOCALAPPDATA}, i0)i.r0'
strCpy $CURRENT_USER_INSTDIR $1
#If Silent, ALL_USERS and INSTDIR are the value selected by the user
;${If} ${Silent}
;${IfNot} $SILENT_USER_INSTDIR == ""
;strCpy $ALL_USERS_INSTDIR $SILENT_USER_INSTDIR
;strCpy $CURRENT_USER_INSTDIR $SILENT_USER_INSTDIR
;${EndIf}
;${EndIf}
ClearErrors
FileOpen $0 "$ALL_USERS_INSTDIR\megatmp.M1.txt" w
IfErrors done
FileWriteUTF16LE $0 "$CURRENT_USER_INSTDIR"
FileClose $0
FileOpen $0 "$ALL_USERS_INSTDIR\megatmp.M2.txt" w
IfErrors done
FileWriteUTF16LE $0 "$USERNAME"
FileClose $0
done:
FunctionEnd
!macro Install3264DLL source target
File "${source}"
AccessControl::SetFileOwner ${target} "$USERNAME"
AccessControl::GrantOnFile ${target} "$USERNAME" "GenericRead + GenericWrite"
!macroend
Section "Principal" SEC01
!insertmacro DEBUG_MSG "Getting needed information"
#Not sure why, if these lines does not exist, the installation is blocked, even when they are repeated in GetPaths
${IfNot} ${Silent}
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_COMMON_APPDATA}, i0)i.r0'
strCpy $ALL_USERS_INSTDIR $1
${EndIf}
${UAC.CallFunctionAsUser} GetPaths
readpaths:
Sleep 1000
FileOpen $R0 "$ALL_USERS_INSTDIR\megatmp.M1.txt" r
IfErrors done
FileReadUTF16LE $R0 "$CURRENT_USER_INSTDIR"
FileOpen $R1 "$ALL_USERS_INSTDIR\megatmp.M2.txt" r
IfErrors done
FileReadUTF16LE $R1 "$USERNAME"
IfErrors done
done:
FileClose $R0
FileClose $R1
StrCmp $CURRENT_USER_INSTDIR "" readpaths 0
StrCmp $USERNAME "" readpaths 0
!insertmacro DEBUG_MSG "Checking install mode"
Delete "$ALL_USERS_INSTDIR\megatmp.M1.txt"
Delete "$ALL_USERS_INSTDIR\megatmp.M2.txt"
${If} ${Silent}
${If} $SILENT_MULTIUSER == "true"
Goto alluser
${ElseIf} $SILENT_MULTIUSER == "false"
${OrIf} $SILENT_MULTIUSER == ""
Goto currentuser
${Else}
MessageBox MB_OK "Incorrect multiuser argument: true or false. Aborting"
Abort
${EndIf}
${Else}
StrCmp "CurrentUser" $MultiUser.InstallMode currentuser
${EndIf}
alluser:
!insertmacro DEBUG_MSG "Install for all"
SetShellVarContext all
StrCpy $INSTDIR "$ALL_USERS_INSTDIR\MEGAsync"
goto modeselected
currentuser:
!insertmacro DEBUG_MSG "Install for current user"
SetShellVarContext current
StrCpy $INSTDIR "$CURRENT_USER_INSTDIR\MEGAsync"
modeselected:
!insertmacro DEBUG_MSG "Closing MEGAsync"
ExecDos::exec /DETAILED /DISABLEFSR "taskkill /f /IM MEGAsync.exe"
Sleep 1000
!insertmacro DEBUG_MSG "Installing files"
SetRebootFlag false
SetOverwrite on
SetOutPath "$INSTDIR"
!ifdef BUILD_X64_VERSION
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vcruntime140.dll" "$INSTDIR\vcruntime140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vcruntime140_1.dll" "$INSTDIR\vcruntime140_1.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140.dll" "$INSTDIR\msvcp140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140_1.dll" "$INSTDIR\msvcp140_1.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140_2.dll" "$INSTDIR\msvcp140_2.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140_atomic_wait.dll" "$INSTDIR\msvcp140_atomic_wait.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140_codecvt_ids.dll" "$INSTDIR\msvcp140_codecvt_ids.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\concrt140.dll" "$INSTDIR\concrt140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vccorlib140.dll" "$INSTDIR\vccorlib140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.OpenMP\vcomp140.dll" "$INSTDIR\vcomp140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\ucrtbase.dll" "$INSTDIR\ucrtbase.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-utility-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-utility-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-time-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-time-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-string-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-string-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-stdio-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-stdio-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-runtime-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-runtime-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-process-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-process-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-private-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-private-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-multibyte-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-multibyte-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-math-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-math-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-locale-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-locale-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-heap-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-heap-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-filesystem-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-filesystem-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-environment-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-environment-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-convert-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-convert-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-conio-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-conio-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-util-l1-1-0.dll" "$INSTDIR\api-ms-win-core-util-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-timezone-l1-1-0.dll" "$INSTDIR\api-ms-win-core-timezone-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-sysinfo-l1-1-0.dll" "$INSTDIR\api-ms-win-core-sysinfo-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-synch-l1-2-0.dll" "$INSTDIR\api-ms-win-core-synch-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-synch-l1-1-0.dll" "$INSTDIR\api-ms-win-core-synch-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-string-l1-1-0.dll" "$INSTDIR\api-ms-win-core-string-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-rtlsupport-l1-1-0.dll" "$INSTDIR\api-ms-win-core-rtlsupport-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-profile-l1-1-0.dll" "$INSTDIR\api-ms-win-core-profile-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-processthreads-l1-1-1.dll" "$INSTDIR\api-ms-win-core-processthreads-l1-1-1.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-processthreads-l1-1-0.dll" "$INSTDIR\api-ms-win-core-processthreads-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-processenvironment-l1-1-0.dll" "$INSTDIR\api-ms-win-core-processenvironment-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-namedpipe-l1-1-0.dll" "$INSTDIR\api-ms-win-core-namedpipe-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-memory-l1-1-0.dll" "$INSTDIR\api-ms-win-core-memory-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-localization-l1-2-0.dll" "$INSTDIR\api-ms-win-core-localization-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-libraryloader-l1-1-0.dll" "$INSTDIR\api-ms-win-core-libraryloader-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-interlocked-l1-1-0.dll" "$INSTDIR\api-ms-win-core-interlocked-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-heap-l1-1-0.dll" "$INSTDIR\api-ms-win-core-heap-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-handle-l1-1-0.dll" "$INSTDIR\api-ms-win-core-handle-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-file-l2-1-0.dll" "$INSTDIR\api-ms-win-core-file-l2-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-file-l1-2-0.dll" "$INSTDIR\api-ms-win-core-file-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-file-l1-1-0.dll" "$INSTDIR\api-ms-win-core-file-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-errorhandling-l1-1-0.dll" "$INSTDIR\api-ms-win-core-errorhandling-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-debug-l1-1-0.dll" "$INSTDIR\api-ms-win-core-debug-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-datetime-l1-1-0.dll" "$INSTDIR\api-ms-win-core-datetime-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-core-console-l1-1-0.dll" "$INSTDIR\api-ms-win-core-console-l1-1-0.dll"
!else
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\vcruntime140.dll" "$INSTDIR\vcruntime140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140.dll" "$INSTDIR\msvcp140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140_1.dll" "$INSTDIR\msvcp140_1.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140_2.dll" "$INSTDIR\msvcp140_2.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140_atomic_wait.dll" "$INSTDIR\msvcp140_atomic_wait.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140_codecvt_ids.dll" "$INSTDIR\msvcp140_codecvt_ids.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\concrt140.dll" "$INSTDIR\concrt140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\vccorlib140.dll" "$INSTDIR\vccorlib140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.OpenMP\vcomp140.dll" "$INSTDIR\vcomp140.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\ucrtbase.dll" "$INSTDIR\ucrtbase.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-utility-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-utility-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-time-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-time-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-string-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-string-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-stdio-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-stdio-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-runtime-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-runtime-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-process-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-process-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-private-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-private-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-multibyte-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-multibyte-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-math-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-math-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-locale-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-locale-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-heap-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-heap-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-filesystem-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-filesystem-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-environment-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-environment-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-convert-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-convert-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-crt-conio-l1-1-0.dll" "$INSTDIR\api-ms-win-crt-conio-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-util-l1-1-0.dll" "$INSTDIR\api-ms-win-core-util-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-timezone-l1-1-0.dll" "$INSTDIR\api-ms-win-core-timezone-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-sysinfo-l1-1-0.dll" "$INSTDIR\api-ms-win-core-sysinfo-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-synch-l1-2-0.dll" "$INSTDIR\api-ms-win-core-synch-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-synch-l1-1-0.dll" "$INSTDIR\api-ms-win-core-synch-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-string-l1-1-0.dll" "$INSTDIR\api-ms-win-core-string-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-rtlsupport-l1-1-0.dll" "$INSTDIR\api-ms-win-core-rtlsupport-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-profile-l1-1-0.dll" "$INSTDIR\api-ms-win-core-profile-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-processthreads-l1-1-1.dll" "$INSTDIR\api-ms-win-core-processthreads-l1-1-1.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-processthreads-l1-1-0.dll" "$INSTDIR\api-ms-win-core-processthreads-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-processenvironment-l1-1-0.dll" "$INSTDIR\api-ms-win-core-processenvironment-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-namedpipe-l1-1-0.dll" "$INSTDIR\api-ms-win-core-namedpipe-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-memory-l1-1-0.dll" "$INSTDIR\api-ms-win-core-memory-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-localization-l1-2-0.dll" "$INSTDIR\api-ms-win-core-localization-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-libraryloader-l1-1-0.dll" "$INSTDIR\api-ms-win-core-libraryloader-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-interlocked-l1-1-0.dll" "$INSTDIR\api-ms-win-core-interlocked-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-heap-l1-1-0.dll" "$INSTDIR\api-ms-win-core-heap-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-handle-l1-1-0.dll" "$INSTDIR\api-ms-win-core-handle-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-file-l2-1-0.dll" "$INSTDIR\api-ms-win-core-file-l2-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-file-l1-2-0.dll" "$INSTDIR\api-ms-win-core-file-l1-2-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-file-l1-1-0.dll" "$INSTDIR\api-ms-win-core-file-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-errorhandling-l1-1-0.dll" "$INSTDIR\api-ms-win-core-errorhandling-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-debug-l1-1-0.dll" "$INSTDIR\api-ms-win-core-debug-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-datetime-l1-1-0.dll" "$INSTDIR\api-ms-win-core-datetime-l1-1-0.dll"
!insertmacro Install3264DLL "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\api-ms-win-core-console-l1-1-0.dll" "$INSTDIR\api-ms-win-core-console-l1-1-0.dll"
!endif
!ifndef BUILD_UNINSTALLER ; if building uninstaller, skip files below
;x86_32 files
File "${QT_PATH}\bin\Qt5Core.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Core.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Core.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Gui.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Gui.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Gui.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Widgets.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Widgets.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Widgets.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Network.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Network.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Network.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Xml.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Xml.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Xml.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Svg.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Svg.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Svg.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\bin\Qt5Concurrent.dll"
AccessControl::SetFileOwner "$INSTDIR\Qt5Concurrent.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\Qt5Concurrent.dll" "$USERNAME" "GenericRead + GenericWrite"
SetOutPath "$INSTDIR\imageformats"
File "${QT_PATH}\plugins\imageformats\qgif.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats" "$USERNAME" "GenericRead + GenericWrite"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qgif.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qgif.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qicns.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qicns.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qicns.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qico.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qico.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qico.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qjpeg.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qjpeg.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qjpeg.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qsvg.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qsvg.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qsvg.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qtga.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qtga.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qtga.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qtiff.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qtiff.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qtiff.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qwbmp.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qwbmp.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qwbmp.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${QT_PATH}\plugins\imageformats\qwebp.dll"
AccessControl::SetFileOwner "$INSTDIR\imageformats\qwebp.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\imageformats\qwebp.dll" "$USERNAME" "GenericRead + GenericWrite"
SetOutPath "$INSTDIR\iconengines"
File "${QT_PATH}\plugins\iconengines\qsvgicon.dll"
AccessControl::SetFileOwner "$INSTDIR\iconengines" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\iconengines" "$USERNAME" "GenericRead + GenericWrite"
AccessControl::SetFileOwner "$INSTDIR\iconengines\qsvgicon.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\iconengines\qsvgicon.dll" "$USERNAME" "GenericRead + GenericWrite"
SetOutPath "$INSTDIR\platforms"
File "${QT_PATH}\plugins\platforms\qwindows.dll"
AccessControl::SetFileOwner "$INSTDIR\platforms" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\platforms" "$USERNAME" "GenericRead + GenericWrite"
AccessControl::SetFileOwner "$INSTDIR\platforms\qwindows.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\platforms\qwindows.dll" "$USERNAME" "GenericRead + GenericWrite"
SetOutPath "$INSTDIR\styles"
File "${QT_PATH}\plugins\styles\qwindowsvistastyle.dll"
AccessControl::SetFileOwner "$INSTDIR\styles" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\styles" "$USERNAME" "GenericRead + GenericWrite"
AccessControl::SetFileOwner "$INSTDIR\styles\qwindowsvistastyle.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\styles\qwindowsvistastyle.dll" "$USERNAME" "GenericRead + GenericWrite"
!endif
;Disable bearer plugin if it's a reinstallation
RMDir /r "$INSTDIR\bearer"
SetOutPath "$INSTDIR"
SetOverwrite on
AllowSkipFiles off
File "${SRCDIR_MEGASYNC}\MEGAsync.exe"
AccessControl::SetFileOwner "$INSTDIR\MEGAsync.exe" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\MEGAsync.exe" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_UPDATER}\MEGAupdater.exe"
AccessControl::SetFileOwner "$INSTDIR\MEGAupdater.exe" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\MEGAupdater.exe" "$USERNAME" "GenericRead + GenericWrite"
!ifdef BUILD_X64_VERSION
!insertmacro Install3264DLL "${SRCDIR_MEGASYNC}\libcrypto-1_1-x64.dll" "$INSTDIR\libcrypto-1_1-x64.dll"
!insertmacro Install3264DLL "${SRCDIR_MEGASYNC}\libssl-1_1-x64.dll" "$INSTDIR\libssl-1_1-x64.dll"
!else
!insertmacro Install3264DLL "${SRCDIR_MEGASYNC}\libcrypto-1_1.dll" "$INSTDIR\libcrypto-1_1.dll"
!insertmacro Install3264DLL "${SRCDIR_MEGASYNC}\libssl-1_1.dll" "$INSTDIR\libssl-1_1.dll"
!endif
File "${SRCDIR_MEGASYNC}\libcurl.dll"
AccessControl::SetFileOwner "$INSTDIR\libcurl.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\libcurl.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\cares.dll"
AccessControl::SetFileOwner "$INSTDIR\cares.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\cares.dll" "$USERNAME" "GenericRead + GenericWrite"
File "installer\qt.conf"
AccessControl::SetFileOwner "$INSTDIR\qt.conf" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\qt.conf" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\avcodec-58.dll"
AccessControl::SetFileOwner "$INSTDIR\avcodec-58.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\avcodec-58.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\avformat-58.dll"
AccessControl::SetFileOwner "$INSTDIR\avformat-58.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\avformat-58.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\avutil-56.dll"
AccessControl::SetFileOwner "$INSTDIR\avutil-56.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\avutil-56.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\swscale-5.dll"
AccessControl::SetFileOwner "$INSTDIR\swscale-5.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\swscale-5.dll" "$USERNAME" "GenericRead + GenericWrite"
File "${SRCDIR_MEGASYNC}\swresample-3.dll"
AccessControl::SetFileOwner "$INSTDIR\swresample-3.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\swresample-3.dll" "$USERNAME" "GenericRead + GenericWrite"
;remove old DLLs that we no longer use (some became static; some have later version number)
Delete "$INSTDIR\avcodec-57.dll"
Delete "$INSTDIR\avformat-57.dll"
Delete "$INSTDIR\avutil-55.dll"
Delete "$INSTDIR\swscale-4.dll"
Delete "$INSTDIR\swresample-2.dll"
Delete "$INSTDIR\libsodium.dll"
Delete "$INSTDIR\pdfium.dll"
!ifndef BUILD_UNINSTALLER ; if building uninstaller, skip this check
File "${SRCDIR_MEGASYNC}\${UNINSTALLER_NAME}"
AccessControl::SetFileOwner "$INSTDIR\${UNINSTALLER_NAME}" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\${UNINSTALLER_NAME}" "$USERNAME" "GenericRead + GenericWrite"
!endif
ExecDos::exec /DETAILED /DISABLEFSR "taskkill /f /IM explorer.exe"
IfFileExists "$INSTDIR\ShellExtX32.dll" 0 new_installation_x32
GetTempFileName $0
Delete $0
Rename "$INSTDIR\ShellExtX32.dll" $0
Delete /REBOOTOK $0
new_installation_x32:
!insertmacro DEBUG_MSG "Registering DLLs"
!ifndef BUILD_X64_VERSION
; Register shell extension 1 (x86_32)
!define LIBRARY_COM
!define LIBRARY_SHELL_EXTENSION
!insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "${SRCDIR_MEGASHELLEXT_X32}\MEGAShellExt.dll" "$INSTDIR\ShellExtX32.dll" "$INSTDIR"
!undef LIBRARY_COM
!undef LIBRARY_SHELL_EXTENSION
AccessControl::SetFileOwner "$INSTDIR\ShellExtX32.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\ShellExtX32.dll" "$USERNAME" "GenericRead + GenericWrite"
!endif
${If} ${RunningX64}
IfFileExists "$INSTDIR\ShellExtX64.dll" 0 new_installation_x64
GetTempFileName $0
Delete $0
Rename "$INSTDIR\ShellExtX64.dll" $0
Delete /REBOOTOK $0
new_installation_x64:
; Register shell extension 1 (x86_64)
!define LIBRARY_X64
!define LIBRARY_COM
!define LIBRARY_SHELL_EXTENSION
!insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "${SRCDIR_MEGASHELLEXT_X64}\MEGAShellExt.dll" "$INSTDIR\ShellExtX64.dll" "$INSTDIR"
!undef LIBRARY_X64
!undef LIBRARY_COM
!undef LIBRARY_SHELL_EXTENSION
AccessControl::SetFileOwner "$INSTDIR\ShellExtX64.dll" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\ShellExtX64.dll" "$USERNAME" "GenericRead + GenericWrite"
${EndIf}
${UAC.CallFunctionAsUser} RunExplorer
# !insertmacro DEBUG_MSG "Adding firewall rule"
# liteFirewall::RemoveRule "$INSTDIR\MEGAsync.exe" "MEGAsync"
# Pop $0
# liteFirewall::AddRule "$INSTDIR\MEGAsync.exe" "MEGAsync"
# Pop $0
!insertmacro DEBUG_MSG "Creating shortcuts"
SetRebootFlag false
StrCmp "CurrentUser" $MultiUser.InstallMode currentuser2
SetShellVarContext all
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MEGAsync.lnk" "$INSTDIR\MEGAsync.exe"
CreateShortCut "$DESKTOP\MEGAsync.lnk" "$INSTDIR\MEGAsync.exe"
WriteIniStr "$INSTDIR\MEGA Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MEGA Website.lnk" "$INSTDIR\MEGA Website.url" "" "$INSTDIR\MEGAsync.exe" 1
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\${UNINSTALLER_NAME}"
!insertmacro MUI_STARTMENU_WRITE_END
goto modeselected2
currentuser2:
${UAC.CallFunctionAsUser} CreateMegaShortcuts
modeselected2:
SectionEnd
Function CreateMegaShortcuts
SetShellVarContext current
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MEGAsync.lnk" "$INSTDIR\MEGAsync.exe"
CreateShortCut "$DESKTOP\MEGAsync.lnk" "$INSTDIR\MEGAsync.exe"
WriteIniStr "$INSTDIR\MEGA Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\MEGA Website.lnk" "$INSTDIR\MEGA Website.url" "" "$INSTDIR\MEGAsync.exe" 1
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\${UNINSTALLER_NAME}"
!insertmacro MUI_STARTMENU_WRITE_END
FunctionEnd
Section -AdditionalIcons
SectionEnd
Section -Post
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\MEGAsync.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINSTALLER_NAME}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\MEGAsync.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" ""
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
AccessControl::SetFileOwner "$INSTDIR\MEGA Website.url" "$USERNAME"
AccessControl::GrantOnFile "$INSTDIR\MEGA Website.url" "$USERNAME" "GenericRead + GenericWrite"
Delete "$INSTDIR\NSIS.Library.RegTool*.exe"
SectionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
StrCpy $APP_NAME "${PRODUCT_NAME}"
ReadIniStr $0 "$ExeDir\${MEGA_DATA}" UAC first
${IF} $0 <> 1
;SetSilent silent
InitPluginsDir
WriteIniStr "$PluginsDir\${MEGA_DATA}" UAC first 1
CopyFiles /SILENT "$EXEPATH" "$PluginsDir\${UNINSTALLER_NAME}"
ExecWait '"$PluginsDir\${UNINSTALLER_NAME}" _?=$INSTDIR' $0
SetErrorLevel $0
Quit
${EndIf}
!insertmacro CheckUserToRunElevated
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function un.UninstallSyncs
ExecDos::exec "$INSTDIR\MEGAsync.exe /uninstall"
FunctionEnd
Section Uninstall
ExecDos::exec /DETAILED "taskkill /f /IM MEGASync.exe"
Sleep 1000
${UAC.CallFunctionAsUser} un.UninstallSyncs
Sleep 1000
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\${UNINSTALLER_NAME}"
;QT4 files
Delete "$INSTDIR\QtNetwork4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\QtSvg4.dll"
Delete "$INSTDIR\QtXml4.dll"
Delete "$INSTDIR\imageformats\qgif4.dll"
Delete "$INSTDIR\imageformats\qico4.dll"
Delete "$INSTDIR\imageformats\qjpeg4.dll"
Delete "$INSTDIR\imageformats\qmng4.dll"
Delete "$INSTDIR\imageformats\qsvg4.dll"
Delete "$INSTDIR\imageformats\qtga4.dll"
Delete "$INSTDIR\imageformats\qtiff4.dll"
;QT5 files
Delete "$INSTDIR\Qt5Core.dll"
Delete "$INSTDIR\Qt5Gui.dll"
Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\Qt5Network.dll"
Delete "$INSTDIR\Qt5Xml.dll"
Delete "$INSTDIR\Qt5Svg.dll"
Delete "$INSTDIR\Qt5Concurrent.dll"
Delete "$INSTDIR\icudt53.dll"
Delete "$INSTDIR\icuin53.dll"
Delete "$INSTDIR\icuuc53.dll"
Delete "$INSTDIR\icudt54.dll"
Delete "$INSTDIR\icuin54.dll"
Delete "$INSTDIR\icuuc54.dll"
Delete "$INSTDIR\imageformats\qdds.dll"
Delete "$INSTDIR\imageformats\qgif.dll"
Delete "$INSTDIR\imageformats\qicns.dll"
Delete "$INSTDIR\imageformats\qico.dll"
Delete "$INSTDIR\imageformats\qjp2.dll"
Delete "$INSTDIR\imageformats\qjpeg.dll"
Delete "$INSTDIR\imageformats\qmng.dll"
Delete "$INSTDIR\imageformats\qsvg.dll"
Delete "$INSTDIR\imageformats\qtga.dll"
Delete "$INSTDIR\imageformats\qtiff.dll"
Delete "$INSTDIR\imageformats\qwbmp.dll"
Delete "$INSTDIR\imageformats\qwebp.dll"
Delete "$INSTDIR\accessible\qtaccessiblecompatwidgets4.dll"
Delete "$INSTDIR\accessible\qtaccessiblewidgets4.dll"
Delete "$INSTDIR\iconengines\qsvgicon.dll"
Delete "$INSTDIR\platforms\qwindows.dll"
Delete "$INSTDIR\styles\qwindowsvistastyle.dll"
Delete "$INSTDIR\bearer\qgenericbearer.dll"
Delete "$INSTDIR\bearer\qnativewifibearer.dll"
Delete "$INSTDIR\leftbanner\*"
;VC++ Redistributable
Delete "$INSTDIR\vcruntime140.dll"
Delete "$INSTDIR\vcruntime140_1.dll"
Delete "$INSTDIR\msvcp140.dll"
Delete "$INSTDIR\msvcp140_1.dll"
Delete "$INSTDIR\msvcp140_2.dll"
Delete "$INSTDIR\msvcp140_codecvt_ids.dll"
Delete "$INSTDIR\msvcp140_atomic_wait.dll"
Delete "$INSTDIR\concrt140.dll"
Delete "$INSTDIR\vccorlib140.dll"
Delete "$INSTDIR\vcomp140.dll"
Delete "$INSTDIR\ucrtbase.dll"
Delete "$INSTDIR\api-ms-win-crt-utility-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-time-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-string-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-stdio-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-runtime-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-process-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-private-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-multibyte-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-math-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-locale-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-heap-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-filesystem-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-environment-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-convert-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-crt-conio-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-util-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-timezone-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-sysinfo-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-synch-l1-2-0.dll"
Delete "$INSTDIR\api-ms-win-core-synch-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-string-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-rtlsupport-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-profile-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-processthreads-l1-1-1.dll"
Delete "$INSTDIR\api-ms-win-core-processthreads-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-processenvironment-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-namedpipe-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-memory-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-localization-l1-2-0.dll"
Delete "$INSTDIR\api-ms-win-core-libraryloader-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-interlocked-l1-1-0.dll"
Delete "$INSTDIR\api-ms-win-core-heap-l1-1-0.dll"