-
-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathMSEdgeRedirect_Wrapper.au3
1340 lines (1151 loc) · 57.7 KB
/
MSEdgeRedirect_Wrapper.au3
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
#include-once
#include <Misc.au3>
#include <Array.au3>
#include <String.au3>
#include <GuiComboBox.au3>
#include <WinAPIFiles.au3>
#include <EditConstants.au3>
#include <FileConstants.au3>
#include <FontConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <AutoItConstants.au3>
#include <WindowsConstants.au3>
#include "Includes\_Logging.au3"
#include "Includes\_Theming.au3"
#include "Includes\_Settings.au3"
#include "Includes\_Countries.au3"
#include "Includes\_Translation.au3"
#include "Includes\TaskScheduler.au3"
; TODO: Why have <Setting>PATH values for Custom handlers... Rewrite that.
Global $sVersion
Global $bIsPriv = _IsPriviledgedInstall()
Global Enum $bNoApps, $bNoBing, $bNoChat, $bNoFeed, $bNoImgs, $bNoMSN, $bNoNews, $bNoPDFs, $bNoPilot, $bNoTray, $bNoUpdates, $sFeed, $sFeedPath, $sImages, $sImagePath, $sNews, $sPDFApp, $sSearch, $sSearchPath, $sStartMenu, $bStartup, $sWeather, $sWeatherPath
If @Compiled Then
$sVersion = FileGetVersion(@ScriptFullPath)
Else
$sVersion = "x.x.x.x"
EndIf
Func RunInstall(ByRef $aConfig, ByRef $aSettings, $bSilent = False)
Local $aPIDs
Local $sArgs = ""
Local Enum $bManaged = 1, $vMode
SetOptionsRegistry("NoApps" , $aSettings[$bNoApps] , $aConfig)
SetOptionsRegistry("NoBing" , $aSettings[$bNoBing] , $aConfig)
SetOptionsRegistry("NoChat" , $aSettings[$bNoChat] , $aConfig)
SetOptionsRegistry("NoFeed" , $aSettings[$bNoFeed] , $aConfig)
SetOptionsRegistry("NoImgs" , $aSettings[$bNoImgs] , $aConfig)
SetOptionsRegistry("NoMSN" , $aSettings[$bNoMSN] , $aConfig)
SetOptionsRegistry("NoNews" , $aSettings[$bNoNews] , $aConfig)
SetOptionsRegistry("NoPDFs" , $aSettings[$bNoPDFs] , $aConfig)
SetOptionsRegistry("NoPilot" , $aSettings[$bNoPilot] , $aConfig)
SetOptionsRegistry("NoTray" , $aSettings[$bNoTray] , $aConfig)
SetOptionsRegistry("NoUpdates" , $aSettings[$bNoUpdates] , $aConfig)
SetOptionsRegistry("Feed" , $aSettings[$sFeed] , $aConfig)
SetOptionsRegistry("FeedPath" , $aSettings[$sFeedPath] , $aConfig)
SetOptionsRegistry("Images" , $aSettings[$sImages] , $aConfig)
SetOptionsRegistry("ImagePath" , $aSettings[$sImagePath] , $aConfig)
SetOptionsRegistry("News" , $aSettings[$sNews] , $aConfig)
SetOptionsRegistry("PDFApp" , $aSettings[$sPDFApp] , $aConfig)
SetOptionsRegistry("Search" , $aSettings[$sSearch] , $aConfig)
SetOptionsRegistry("SearchPath" , $aSettings[$sSearchPath] , $aConfig)
SetOptionsRegistry("Weather" , $aSettings[$sWeather] , $aConfig)
SetOptionsRegistry("WeatherPath", $aSettings[$sWeatherPath], $aConfig)
$aPIDs = ProcessList("msedgeredirect.exe")
For $iLoop = 1 To $aPIDs[0][0] Step 1
If $aPIDs[$iLoop][1] <> @AutoItPID Then ProcessClose($aPIDs[$iLoop][1])
Next
If $aConfig[$vMode] Then
If Not FileCopy(@ScriptFullPath, $sDrive & "\Program Files\MSEdgeRedirect\MSEdgeRedirect.exe", $FC_CREATEPATH+$FC_OVERWRITE) Then
FileWrite($hLogs[$Install], _NowCalc() & " - [CRITICAL] Unable to copy application to " & $sDrive & "'\Program Files\MSEdgeRedirect\MSEdgeRedirect.exe'" & @CRLF)
If Not $bSilent Then
MsgBox($MB_ICONERROR + $MB_OK, _
"[CRITICAL]", _
"Unable to copy application to " & $sDrive & "'\Program Files\MSEdgeRedirect\MSEdgeRedirect.exe'")
EndIf
Exit 29 ; ERROR_WRITE_FAULT
EndIf
Else
If $aSettings[$bNoTray] Then $sArgs = "/hide"
If Not FileCopy(@ScriptFullPath, @LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe", $FC_CREATEPATH+$FC_OVERWRITE) Then
FileWrite($hLogs[$Install], _NowCalc() & " - [CRITICAL] Unable to copy application to '" & @LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe'" & @CRLF)
If Not $bSilent Then
MsgBox($MB_ICONERROR + $MB_OK, _
"[CRITICAL]", _
"Unable to copy application to '" & @LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe'")
EndIf
Exit 29 ; ERROR_WRITE_FAULT
EndIf
If $aSettings[$bStartup] Then
If Not FileCreateShortcut(@LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe", @StartupDir & "\MSEdgeRedirect.lnk", @LocalAppDataDir & "\MSEdgeRedirect\", $sArgs) Then
FileWrite($hLogs[$Install], _NowCalc() & " - [WARNING] Unable to create application link in '" & @StartupDir & "\MSEdgeRedirect.lnk'" & @CRLF)
EndIf
EndIf
EndIf
EndFunc
Func RunPDFCheck($bSilent = False)
If StringRegExp(RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice", "ProgId"), "(?i)(ms|microsoft)edge.*") Then
If Not $bSilent Then
MsgBox($MB_ICONERROR+$MB_OK, _
"Edge Set As Default PDF Handler", _
"You must set a different Default PDF Handler to use this feature!")
EndIf
Return False
EndIf
Return True
EndFunc
Func RunRemoval($bUpdate = False)
Local $hTS
Local $aPIDs
Local $sHive = ""
Local $sLocation = ""
$aPIDs = ProcessList("msedgeredirect.exe")
For $iLoop = 1 To $aPIDs[0][0] Step 1
If $aPIDs[$iLoop][1] <> @AutoItPID Then ProcessClose($aPIDs[$iLoop][1])
Next
If $bUpdate Then
$sHive = _IsInstalled()[1]
Else
If $bIsAdmin Then
$sHive = "HKLM"
Else
$sHive = "HKCU"
EndIf
EndIf
If $sHive = "HKLM" Then
$sLocation = $sDrive & "\Program Files\MSEdgeRedirect\"
ElseIf $sHive = "HKCU" THen
$sLocation = @LocalAppDataDir & "\MSEdgeRedirect\"
Else
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "Failed to Determine Registry Hive for Uninstall." & @CRLF)
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "DEBUG: " & _ArrayToString(_IsInstalled()) & @CRLF)
Exit 1359 ; ERROR_INTERNAL_ERROR
EndIf
; App Paths
RegDelete($sHive & "\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSEdgeRedirect.exe")
; App Settings
RegDelete($sHive & "\SOFTWARE\Robert Maehl Software\MSEdgeRedirect")
; URI Handler for Pre Win11 22494 Installs
RegDelete($sHive & "\Software\Classes\MSEdgeRedirect.microsoft-edge")
; Generic Program Info
RegDelete($sHive & "\Software\Classes\MSEdgeRedirect")
RegDelete($sHive & "\Software\Classes\Applications\MSEdgeRedirect.exe")
; IFEO
RegDelete($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe")
; Uninstall Info
RegDelete($sHive & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MSEdgeRedirect")
; Start Menu Shortcuts
FileDelete(@StartupDir & "\MSEdgeRedirect.lnk")
DirRemove(@ProgramsCommonDir & "\MSEdgeRedirect", $DIR_REMOVE)
DirRemove(@AppDataDir & "\Microsoft\Windows\Start Menu\Programs\MSEdgeRedirect", $DIR_REMOVE)
; Parent Registry Key
RegEnumKey($sHive & "\SOFTWARE\Robert Maehl Software", 1)
If @error Then RegDelete($sHive & "\SOFTWARE\Robert Maehl Software")
If $bIsAdmin Then
For $iLoop = 1 To $aEdges[0] Step 1
If $iLoop = $aEdges[0] Then ExitLoop ; Skip ie_to_edge_stub
If FileExists(StringReplace($aEdges[$iLoop], "msedge.exe", "msedge_no_ifeo.exe")) Then ; Pre-0.7.3.0
FileDelete(StringReplace($aEdges[$iLoop], "msedge.exe", "msedge_no_ifeo.exe"))
EndIf
If FileExists(StringReplace($aEdges[$iLoop], "Application\msedge.exe", "IFEO\")) Then ; 0.7.3.0+
DirRemove(StringReplace($aEdges[$iLoop], "Application\msedge.exe", "IFEO\"))
EndIf
If FileExists(StringReplace($aEdges[$iLoop], "\msedge.exe", "\msedge_IFEO.exe")) Then ; 0.8.0.0+
FileDelete(StringReplace($aEdges[$iLoop], "\msedge.exe", "\msedge_IFEO.exe"))
EndIf
Next
$hTS = _TS_Open() ; 0.7.2.0
_TS_TaskDelete($hTS, "\MSEdgeRedirect\Update Edge.xml")
_TS_TaskDelete($hTS, "\MSEdgeRedirect\Update Edge Beta.xml")
_TS_TaskDelete($hTS, "\MSEdgeRedirect\Update Edge Canary.xml")
_TS_TaskDelete($hTS, "\MSEdgeRedirect\Update Edge Dev.xml")
_TS_FolderDelete($hTS, "\MSEdgeRedirect")
_TS_Close($hTS)
EndIf
If $bUpdate Then
FileDelete($sLocation & "*")
Else
Run(@ComSpec & " /c " & 'ping google.com && del /Q "' & $sLocation & '*"', "", @SW_HIDE)
Exit
EndIf
EndFunc
Func RunRepair()
If $bIsAdmin Then
For $iLoop = 1 To $aEdges[0] Step 1
RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER" & $iLoop, "Debugger")
If @error Then
;;;
Else
If $iLoop = $aEdges[0] Then ; Skip IEtoEdgeStub
;;;
Else
_WinAPI_CreateSymbolicLink(StringReplace($aEdges[$iLoop], "\msedge.exe", "\msedge_IFEO.exe"), $aEdges[$iLoop])
EndIf
EndIf
Next
Exit
Else
Exit 5 ; ERROR_ACCESS_DENIED
EndIf
EndFunc
Func RunSetup($bUpdate = False, $bSilent = False, $iPage = 0, $hSetupFile = @ScriptDir & "\Setup.ini")
Local $hMsg
Local $sArgs = ""
Local $iMode = $iPage
Local $sEdges
Local $sEngine
Local $sImgEng
Local $sFeedEng
Local $sHandler
Local $bResumed = False
Local $hChannels[5]
Local $aChannels[5] = [True, False, False, False, True]
Local $sWeatherEng
Local $aConfig[3] = [$hSetupFile, False, "Service"] ; Default Setup.ini Values
Local Enum $hFile, $bManaged, $vMode
Local $aSettings[23] = [False, False, False, False, False, False, False, False, False, False, False, "", "", "", "", "", "", "", "", "Full", True, "", ""]
If $iPage < 0 Then
$iPage = Abs($iPage)
$bResumed = True
EndIf
If $bSilent Then
If $bUpdate Then
$aSettings[$bNoApps] = _Bool(_GetSettingValue("NoApps"))
$aSettings[$bNoBing] = _Bool(_GetSettingValue("NoBing"))
$aSettings[$bNoChat] = _Bool(_GetSettingValue("NoChat"))
$aSettings[$bNoFeed] = _Bool(_GetSettingValue("NoFeed"))
$aSettings[$bNoImgs] = _Bool(_GetSettingValue("NoImgs"))
$aSettings[$bNoMSN] = _Bool(_GetSettingValue("NoMSN"))
$aSettings[$bNoNews] = _Bool(_GetSettingValue("NoNews"))
$aSettings[$bNoPDFs] = _Bool(_GetSettingValue("NoPDFs"))
$aSettings[$bNoPilot] = _Bool(_GetSettingValue("NoPilot"))
$aSettings[$bNoTray] = _Bool(_GetSettingValue("NoTray"))
$aSettings[$bNoUpdates] = _Bool(_GetSettingValue("NoUpdates"))
If $aSettings[$bNoBing] Then
$aSettings[$sSearch] = _GetSettingValue("Search")
$aSettings[$sSearchPath] = _GetSettingValue("SearchPath")
EndIf
If $aSettings[$bNoFeed] Then
$aSettings[$sFeed] = _GetSettingValue("Feed")
$aSettings[$sFeedPath] = _GetSettingValue("FeedPath")
EndIf
If $aSettings[$bNoImgs] Then
$aSettings[$sImages] = _GetSettingValue("Images")
$aSettings[$sImagePath] = _GetSettingValue("ImagePath")
EndIf
If $aSettings[$bNoPDFs] Then $aSettings[$sPDFApp] = _GetSettingValue("PDFApp")
If $aSettings[$bNoMSN] Then
$aSettings[$sWeather] = _GetSettingValue("Weather")
$aSettings[$sWeatherPath] = _GetSettingValue("WeatherPath")
EndIf
If $aSettings[$bNoNews] Then $aSettings[$sNews] = _GetSettingValue("News")
EndIf
If $aConfig[$hFile] = "WINGET" Then
$aConfig[$vMode] = $bIsAdmin
; Bypass file checks, IniReads, use default values
ElseIf Not FileExists($aConfig[$hFile]) And Not $bUpdate Then
Exit 2 ; ERROR_FILE_NOT_FOUND
Else
$aConfig[$bManaged] = _Bool(IniRead($aConfig[$hFile], "Config", "Managed", False))
$aConfig[$vMode] = IniRead($aConfig[$hFile], "Config", "Mode", "Service")
If $aConfig[$vMode] = "Active" Then
$aConfig[$vMode] = True
Else
$aConfig[$vMode] = False
EndIf
; TODO: Merge with _GetSettingValue(Value, Forced Location)
$aSettings[$bNoApps] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoApps", $aSettings[$bNoApps]))
$aSettings[$bNoBing] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoBing", $aSettings[$bNoBing]))
$aSettings[$bNoChat] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoChat", $aSettings[$bNoChat]))
$aSettings[$bNoFeed] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoFeed", $aSettings[$bNoFeed]))
$aSettings[$bNoImgs] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoImgs", $aSettings[$bNoImgs]))
$aSettings[$bNoMSN] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoMSN", $aSettings[$bNoMSN]))
$aSettings[$bNoNews] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoNews", $aSettings[$bNoNews]))
$aSettings[$bNoPDFs] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoPDFs", $aSettings[$bNoPDFs]))
$aSettings[$bNoPilot] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoPilot", $aSettings[$bNoPilot]))
$aSettings[$bNoTray] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoTray", $aSettings[$bNoTray]))
$aSettings[$bNoUpdates] = _Bool(IniRead($aConfig[$hFile], "Settings", "NoUpdates", $aSettings[$bNoUpdates]))
$aSettings[$sFeed] = _Bool(IniRead($aConfig[$hFile], "Settings", "Feed", $aSettings[$sFeed]))
$aSettings[$sFeedPath] = _Bool(IniRead($aConfig[$hFile], "Settings", "FeedPath", $aSettings[$sFeedPath]))
$aSettings[$sImages] = _Bool(IniRead($aConfig[$hFile], "Settings", "Images", $aSettings[$sImages]))
$aSettings[$sImagePath] = _Bool(IniRead($aConfig[$hFile], "Settings", "ImagePath", $aSettings[$sImagePath]))
$aSettings[$sNews] = _Bool(IniRead($aConfig[$hFile], "Settings", "News", $aSettings[$sNews]))
$aSettings[$sPDFApp] = IniRead($aConfig[$hFile], "Settings", "PDFApp", $aSettings[$sPDFApp])
$aSettings[$sSearchPath] = IniRead($aConfig[$hFile], "Settings", "SearchPath", $aSettings[$sSearchPath])
$aSettings[$sStartMenu] = IniRead($aConfig[$hFile], "Settings", "StartMenu", $aSettings[$sStartMenu])
$aSettings[$sSearch] = IniRead($aConfig[$hFile], "Settings", "Search", $aSettings[$sSearch])
$aSettings[$bStartup] = _Bool(IniRead($aConfig[$hFile], "Settings", "Startup", $aSettings[$bStartup]))
$aSettings[$sWeather] = IniRead($aConfig[$hFile], "Settings", "Weather", $aSettings[$sWeather])
$aSettings[$sWeatherPath] = IniRead($aConfig[$hFile], "Settings", "WeatherPath", $aSettings[$sWeatherPath])
$sEdges = IniRead($aConfig[$hFile], "Settings", "Edges", "")
If StringInStr($sEdges, "Stable") Then $aChannels[0] = True
If StringInStr($sEdges, "Beta") Then $aChannels[1] = True
If StringInStr($sEdges, "Dev") Then $aChannels[2] = True
If StringInStr($sEdges, "Canary") Then $aChannels[3] = True
If StringInStr($sEdges, "Removed") Then $aChannels[4] = True
EndIf
If ($aConfig[$bManaged] Or $aConfig[$vMode]) And Not $bIsAdmin Then
If $aConfig[$hFile] = "WINGET" Then
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "Failed to Self Escalate for Deployment." & @CRLF)
Else
Exit 5 ; ERROR_ACCESS_DENIED
EndIf
EndIf
For $iLoop = 0 To UBound($aChannels) - 1 Step 1
If $aChannels[$iLoop] = True Then ExitLoop
If $iLoop = UBound($aChannels) - 1 Then
If $aConfig[$hFile] = "WINGET" Then
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "Failed to Self Validate IEFO Channels." & @CRLF)
Else
Exit 1359 ; ERROR_INTERNAL_ERROR
EndIf
EndIf
Next
For $iLoop = $bNoApps To $bNoUpdates Step 1
If Not IsBool($aSettings[$iLoop]) Then
If $aConfig[$hFile] = "WINGET" Then
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "Failed to Self Validate Boolean Settings." & @CRLF)
Else
Exit 1359 ; ERROR_INTERNAL_ERROR
EndIf
EndIf
Next
If Not IsBool($aSettings[$bStartup]) Then
If $aConfig[$hFile] = "WINGET" Then
FileWrite($hLogs[$PEBIAT], _NowCalc() & " - " & "Failed to Self Validate Startup Boolean." & @CRLF)
Else
Exit 1359 ; ERROR_INTERNAL_ERROR
EndIf
EndIf
If $bUpdate Then RunRemoval(True)
RunInstall($aConfig, $aSettings, $bSilent)
SetAppRegistry($aConfig)
SetAppShortcuts($aConfig, $aSettings)
If $aConfig[$vMode] Then
SetIFEORegistry($aChannels)
Else
If $aSettings[$bNoTray] Then $sArgs = "/hide"
ShellExecute(@LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe", $sArgs, @LocalAppDataDir & "\MSEdgeRedirect\")
EndIf
Exit
Else
Local $aPages[6]
Local Enum $hLicense, $hMode, $hSettings, $hFinish, $hExit, $hCountry, $hExit2
If @Compiled And Not _GetSettingValue("NoUpdates") Then RunUpdateCheck()
If StringInStr($bUpdate, "HKLM") And Not $bIsAdmin And Not @Compiled Then
MsgBox($MB_ICONERROR+$MB_OK, _
"Admin Required", _
"Unable to update an Admin Install without Admin Rights!")
FileWrite($hLogs[$AppFailures], _NowCalc() & " - " & "Non Admin Update Attempt on Admin Install. EXITING!" & @CRLF)
For $iLoop = 0 To UBound($hLogs) - 1
FileClose($hLogs[$iLoop])
Next
Exit 5 ; ERROR_ACCESS_DENIED
EndIf
; Disable Scaling
If @OSVersion = 'WIN_10' or 'WIN_11' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 1)
Local $hInstallGUI = GUICreate("MSEdgeRedirect " & $sVersion & " Setup", 640, 480)
GUICtrlCreateLabel("", 0, 0, 180, 420)
GUICtrlSetBkColor(-1, 0x00A4EF)
GUICtrlCreateIcon("", -1, 26, 26, 128, 128)
If @Compiled Then
_SetBkSelfIcon(-1, "", 0x00A4EF, @ScriptFullPath, 201, 128, 128)
Else
_SetBkIcon(-1, "", 0x00A4EF, @ScriptDir & "\assets\MSEdgeRedirect.ico", -1, 128, 128)
EndIf
Local $hHelp = GUICtrlCreateButton("Help", 20, 435, 90, 30)
Local $hBack = GUICtrlCreateButton("< Back", 330, 435, 90, 30)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNext = GUICtrlCreateButton("Next >", 420, 435, 90, 30)
Select
Case $iPage = $hLicense
GUICtrlSetState(-1, $GUI_DISABLE)
Case $iPage = $hSettings And $bResumed
If $bUpdate Then
GUICtrlSetData(-1, "Update")
Else
GUICtrlSetData(-1, "Install")
EndIf
Case $iPage = $hLicense
ContinueCase
Case $iPage = $hCountry
GUICtrlSetState(-1, $GUI_DISABLE)
ContinueCase
Case $iPage = $hSettings
GUICtrlSetData(-1, "Save")
EndSelect
Local $hCancel = GUICtrlCreateButton("Cancel", 530, 435, 90, 30)
#Region License Page
$aPages[$hLicense] = GUICreate("", 460, 420, 180, 0, $WS_POPUP, $WS_EX_MDICHILD, $hInstallGUI)
GUISetBkColor(0xFFFFFF)
FileInstall("./LICENSE", @LocalAppDataDir & "\MSEdgeRedirect\License.txt")
If $bUpdate Then
GUICtrlCreateLabel("Please read the following License. You must accept the terms of the license before continuing with the upgrade.", 20, 20, 420, 40)
Else
GUICtrlCreateLabel("Please read the following License. You must accept the terms of the license before continuing with the installation.", 20, 20, 420, 40)
EndIf
GUICtrlCreateEdit("TL;DR: It's FOSS, you can edit it, repackage it, eat it (not recommended), or throw it at your neighbor Steve (depends on the Steve), but changes to it must be LGPL v3 too." & _
@CRLF & @CRLF & _
FileRead(@LocalAppDataDir & "\MSEdgeRedirect\License.txt"), 20, 60, 420, 280, $ES_READONLY + $WS_VSCROLL)
Local $hAgree = GUICtrlCreateRadio("I accept this license", 20, 350, 420, 20)
Local $hDisagree = GUICtrlCreateRadio("I don't accept this license", 20, 370, 420, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUISwitch($hInstallGUI)
#EndRegion
#Region Mode Page
$aPages[$hMode] = GUICreate("", 460, 420, 180, 0, $WS_POPUP, $WS_EX_MDICHILD, $hInstallGUI)
GUISetBkColor(0xFFFFFF)
If $bUpdate Then
GUICtrlCreateLabel("MSEdgeRedirect " & $sVersion & " Update", 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
; GUICtrlCreateLabel("Click Next to continue the Update of MSEdgeRedirect after customizing your preferred mode", 20, 40, 420, 40)
; GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
Else
GUICtrlCreateLabel("Install MSEdgeRedirect " & $sVersion, 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
; GUICtrlCreateLabel("Click Next to continue the Install of MSEdgeRedirect after customizing your preferred mode", 20, 40, 420, 40)
; GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
EndIf
GUICtrlCreateGroup("Mode", 20, 60, 420, 340)
GUICtrlCreateIcon("imageres.dll", 78, 30, 80, 16, 16)
Local $hEurope = GUICtrlCreateRadio("Europe Mode" & @CRLF & _
@CRLF & _
"System Wide Change using a Native Windows Feature" & @CRLF & _
@CRLF & _
"MSEdgeRedirect DOES NOT INSTALL. Locale and Settings changes are made to set Windows 'in EU' and respect the default browser.", _
50, 80, 380, 80, $BS_TOP+$BS_MULTILINE)
If (@OSVersion = "WIN_11" And @OSBuild < 22621) Or (@OSVersion = "WIN_10" AND @OSBuild < 19045) Then GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("", 50, 165, 380, 1, $SS_SUNKEN)
Local $hService = GUICtrlCreateRadio("Service Mode" & @CRLF & _
@CRLF & _
"Adminless, Less Intrusive, Single User Install" & @CRLF & _
@CRLF & _
"MSEdgeRedirect stays running in the background. Detected Edge data is redirected to your default browser. Uses 1-10% CPU depending on System.", _
50, 175, 380, 80, $BS_TOP+$BS_MULTILINE)
If Not $bIsAdmin Then GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateLabel("", 50, 260, 380, 1, $SS_SUNKEN)
GUICtrlCreateIcon("imageres.dll", 78, 30, 270, 16, 16)
Local $hActive = GUICtrlCreateRadio("Active Mode - RECOMMENDED" & @CRLF & _
@CRLF & _
"Best Performing, System Wide, Customizable, and Compatible Install" & @CRLF & _
@CRLF & _
"MSEdgeRedirect is ran instead of Edge, similarly to the old EdgeDeflector app. Does not run in background. Compatible with AveYo's Edge Removal Tool.", _
50, 270, 380, 80, $BS_TOP+$BS_MULTILINE)
If $bIsAdmin Then GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateLabel("", 50, 355, 380, 1, $SS_SUNKEN)
Local $hOthers = GUICtrlCreateRadio("Show Me MSEdgeRedirect Alternatives", _
50, 365, 380, 20, $BS_TOP)
GUISwitch($hInstallGUI)
#EndRegion
#Region Settings Page
$aPages[$hSettings] = GUICreate("", 460, 420, 180, 0, $WS_POPUP, $WS_EX_MDICHILD, $hInstallGUI)
GUISetBkColor(0xFFFFFF)
If $bUpdate Then
GUICtrlCreateLabel("MSEdgeRedirect " & $sVersion & " Update", 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
; GUICtrlCreateLabel("Click Install to continue the Update of MSEdgeRedirect after customizing your preferred settings", 20, 40, 420, 40)
; GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
Else
GUICtrlCreateLabel("Install MSEdgeRedirect " & $sVersion, 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
; GUICtrlCreateLabel("Click Install to continue the Install of MSEdgeRedirect after customizing your preferred settings", 20, 40, 420, 40)
; GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
EndIf
GUICtrlCreateGroup("Active Mode Options", 20, 60, 420, 70)
$hChannels[0] = GUICtrlCreateCheckbox("Edge Stable", 50, 80, 95, 20)
$hChannels[1] = GUICtrlCreateCheckbox("Edge Beta", 145, 80, 95, 20)
$hChannels[2] = GUICtrlCreateCheckbox("Edge Dev", 240, 80, 95, 20)
$hChannels[3] = GUICtrlCreateCheckbox("Edge Canary", 335, 80, 95, 20)
$hChannels[4] = GUICtrlCreateCheckbox("Edge Removed Using AveYo's Edge Remover (Auto Detected)", 50, 100, 380, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
Select
Case Not $bIsAdmin And @Compiled
GUICtrlSetState($hChannels[0], $GUI_DISABLE)
GUICtrlSetState($hChannels[1], $GUI_DISABLE)
GUICtrlSetState($hChannels[2], $GUI_DISABLE)
GUICtrlSetState($hChannels[3], $GUI_DISABLE)
Case FileExists($aEdges[5]) ; IEtoEdgeStub
GUICtrlSetState($hChannels[4], $GUI_CHECKED)
ContinueCase
Case Else
If $bUpdate Or $iMode = $hSettings Then
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER1", "Debugger") Then GUICtrlSetState($hChannels[0], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER2", "Debugger") Then GUICtrlSetState($hChannels[1], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER3", "Debugger") Then GUICtrlSetState($hChannels[2], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER4", "Debugger") Then GUICtrlSetState($hChannels[3], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER5", "Debugger") Then GUICtrlSetState($hChannels[4], $GUI_CHECKED)
Else
GUICtrlSetState($hChannels[0], $GUI_CHECKED)
EndIf
EndSelect
GUICtrlCreateGroup("Service Mode Options", 20, 140, 420, 50)
Local $hNoIcon = GUICtrlCreateCheckbox("Hide Service Mode from Tray", 50, 160, 180, 20)
Local $hStartup = GUICtrlCreateCheckbox("Start Service Mode With Windows", 240, 160, 180, 20)
If $bIsAdmin Then
GUICtrlSetState($hStartup, $GUI_DISABLE)
GUICtrlSetState($hNoIcon, $GUI_DISABLE)
ElseIf $bUpdate Then
GUICtrlSetState($hStartup, FileExists(@StartupDir & "\MSEdgeRedirect.lnk"))
GUICtrlSetState($hNoIcon, _GetSettingValue("NoApps"))
EndIf
GUICtrlCreateGroup("Additional Redirections", 20, 200, 420, 210)
Local $hNoFeed = GUICtrlCreateCheckbox("Bing Discover:", 50, 220, 180, 20)
Local $hFeedSRC = GUICtrlCreateCombo("", 50, 240, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "Ask|Baidu|Custom|Google|Yahoo", "Google")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hSearch = GUICtrlCreateCheckbox("Bing Search:", 50, 265, 180, 20)
Local $hEngine = GUICtrlCreateCombo("", 50, 285, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "Ask|Baidu|Brave|Custom|DuckDuckGo|Ecosia|Google|Lemmy|Sogou|StartPage|Yahoo|Yandex", "Google")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoNews = GUICtrlCreateCheckbox("MSN News: (ALPHA)", 50, 310, 180, 20)
Local $hNewSRC = GUICtrlCreateCombo("", 50, 330, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "DuckDuckGo|Google", "Google")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoMSN = GUICtrlCreateCheckbox("MSN Weather:", 50, 355, 180, 20)
Local $hWeather = GUICtrlCreateCombo("", 50, 375, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "AccuWeather|Custom|Weather.com|Weather.gov|Windy|WUnderground|Ventusky|Yandex", "Weather.com")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoImgs = GUICtrlCreateCheckbox("Bing Images:", 240, 220, 180, 20)
Local $hImgSRC = GUICtrlCreateCombo("", 240, 240, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "Baidu|Brave|Custom|DuckDuckGo|Ecosia|Google|Sogou|StartPage|Yahoo|Yandex", "Google")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoPDFs = GUICtrlCreateCheckbox("PDF Viewer:", 240, 265, 180, 20)
Local $hPDFSrc = GUICtrlCreateCombo("", 240, 285, 180, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, "Default|Custom", "Default")
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoPilot = GUICtrlCreateCheckbox("Disable Windows CoPilot", 240, 305, 180, 20)
If @OSVersion <> "WIN_11" Then GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoChat = GUICtrlCreateCheckbox("Redirect Bing Chat", 240, 325, 180, 20)
If @OSVersion <> "WIN_11" Then GUICtrlSetState(-1, $GUI_DISABLE)
Local $hNoApps = GUICtrlCreateCheckbox("Redirect Windows Store 'Apps'", 240, 345, 180, 20)
If $bUpdate Then
GUICtrlSetState($hNoApps, _GetSettingValue("NoApps"))
GUICtrlSetState($hSearch, _GetSettingValue("NoBing"))
If _IsChecked($hSearch) Then
GUICtrlSetState($hEngine, $GUI_ENABLE)
GUICtrlSetData($hEngine, _GetSettingValue("Search"))
$sEngine = _GetSettingValue("SearchPath")
EndIf
GUICtrlSetState($hNoChat, _GetSettingValue("NoChat"))
GUICtrlSetState($hNoFeed, _GetSettingValue("NoFeed"))
If _IsChecked($hNoFeed) Then
GUICtrlSetState($hFeedSRC, $GUI_ENABLE)
GUICtrlSetData($hFeedSRC, _GetSettingValue("Feed"))
$sFeedEng = _GetSettingValue("FeedPath")
EndIf
GUICtrlSetState($hNoImgs, _GetSettingValue("NoImgs"))
If _IsChecked($hNoImgs) Then
GUICtrlSetState($hImgSRC, $GUI_ENABLE)
GUICtrlSetData($hImgSRC, _GetSettingValue("Images"))
$sImgEng = _GetSettingValue("ImagePath")
EndIf
GUICtrlSetState($hNoMSN, _GetSettingValue("NoMSN"))
If _IsChecked($hNoMSN) Then
GUICtrlSetState($hWeather, $GUI_ENABLE)
GUICtrlSetData($hWeather, _GetSettingValue("Weather"))
$sWeatherEng = _GetSettingValue("WeatherPath")
EndIf
GUICtrlSetState($hNoNews, _GetSettingValue("NoNews"))
If _IsChecked($hNoNews) Then
GUICtrlSetState($hNewSRC, $GUI_ENABLE)
GUICtrlSetData($hNewSRC, _GetSettingValue("News"))
EndIf
GUICtrlSetState($hNoPDFs, _GetSettingValue("NoPDFs"))
If _IsChecked($hNoPDFs) Then
GUICtrlSetState($hPDFSrc, $GUI_ENABLE)
If StringInStr(_GUICtrlComboBox_GetList($hPDFSrc), _GetSettingValue("PDFApp")) Then
GUICtrlSetData($hPDFSrc, _GetSettingValue("PDFApp"))
Else
GUICtrlSetData($hPDFSrc, "Custom")
EndIf
$sHandler = _GetSettingValue("PDFApp")
EndIf
GUICtrlSetState($hNoPilot, _GetSettingValue("NoPilot"))
EndIf
GUISwitch($hInstallGUI)
#EndRegion
#Region Finish Page
$aPages[$hFinish] = GUICreate("", 460, 420, 180, 0, $WS_POPUP, $WS_EX_MDICHILD, $hInstallGUI)
GUISetBkColor(0xFFFFFF)
If $bUpdate Then
GUICtrlCreateLabel("Updated Successfully", 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
Else
GUICtrlCreateLabel("Installed Successfully", 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
EndIf
Local $hLaunch = GUICtrlCreateCheckbox("Launch Service Mode Now", 20, 200, 190, 20)
Local $hAppLnk = GUICtrlCreateCheckbox("Create Start Menu Shortcuts", 20, 220, 190, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
Local $hDonate = GUICtrlCreateCheckbox("Donate to the Project via PayPal", 20, 240, 190, 20)
Local $hHelpUs = GUICtrlCreateCheckbox("Help us get off Google's Blacklist", 20, 260, 190, 20)
GUISwitch($hInstallGUI)
#EndRegion
#Region EuropeModePage
$aPages[$hCountry] = GUICreate("", 460, 420, 180, 0, $WS_POPUP, $WS_EX_MDICHILD, $hInstallGUI)
GUISetBkColor(0xFFFFFF)
GUICtrlCreateLabel("Configure European Country", 20, 10, 420, 30)
GUICtrlSetFont(-1, 20, $FW_BOLD, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
GUICtrlCreateLabel("You may need to enable this via ViveTool (IDs: 43699941, 44353396)!", 20, 40, 420, 40)
GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "", $CLEARTYPE_QUALITY)
GUICtrlCreateGroup("Current Values", 20, 70, 210, 145)
Local $aNations[3] = [RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\DeviceRegion", "DeviceRegion"), _
RegRead("HKEY_USERS\.DEFAULT\Control Panel\International\Geo", "Nation"), _
RegRead("HKEY_CURRENT_USER\Control Panel\International\Geo", "Nation")]
Local $aIDs[2] = [RegRead("HKEY_USERS\.DEFAULT\Control Panel\International\Geo", "Name"), RegRead("HKEY_CURRENT_USER\Control Panel\International\Geo", "Name")]
Local $aOld[6]
FileWrite($hLogs[$Install], _NowCalc() & " - " & "Read Pre-European Install Values of: " & _ArrayToString($aNations) & " & " & _ArrayToString($aIDs) & @CRLF)
GUICtrlCreateLabel("Machine Region:", 30, 90, 95, 20)
$aOld[0] = GUICtrlCreateLabel($aNations[0], 125, 90, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Default Region ID:", 30, 110, 95, 20)
$aOld[1] = GUICtrlCreateLabel($aIDs[0], 125, 110, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Default Region:", 30, 130, 95, 20)
$aOld[2] = GUICtrlCreateLabel($aNations[1], 125, 130, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("User Region ID:", 30, 150, 95, 20)
$aOld[3] = GUICtrlCreateLabel($aIDs[1], 125, 150, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("User Region:", 30, 170, 95, 20)
$aOld[4] = GUICtrlCreateLabel($aNations[2], 125, 170, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Is ID in ISRPS.json:", 30, 190, 95, 20)
$aOld[5] = GUICtrlCreateLabel("", 125, 190, 95, 20, $SS_RIGHT)
Local $sTemp = ""
$sTemp = StringInStr(FileRead("C:\Windows\System32\IntegratedServicesRegionPolicySet.json"), '"' & $aIDs[0] & '"') ? "✓" : "X"
$sTemp &= " / "
$sTemp &= StringInStr(FileRead("C:\Windows\System32\IntegratedServicesRegionPolicySet.json"), '"' & $aIDs[1] & '"') ? "✓" : "X"
GUICtrlSetData(-1, $sTemp)
GUICtrlCreateGroup("New Values", 230, 70, 210, 145)
Local $aNew[6]
GUICtrlCreateLabel("Machine Region:", 240, 90, 95, 20)
$aNew[0] = GUICtrlCreateLabel("", 335, 90, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Default Region ID:", 240, 110, 95, 20)
$aNew[1] = GUICtrlCreateLabel("", 335, 110, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Default Region:", 240, 130, 95, 20)
$aNew[2] = GUICtrlCreateLabel("", 335, 130, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("User Region ID:", 240, 150, 95, 20)
$aNew[3] = GUICtrlCreateLabel("", 335, 150, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("User Region:", 240, 170, 95, 20)
$aNew[4] = GUICtrlCreateLabel("", 335, 170, 95, 20, $SS_RIGHT)
GUICtrlCreateLabel("Is ID in ISRPS.json:", 240, 190, 95, 20)
$aNew[5] = GUICtrlCreateLabel("", 335, 190, 95, 20, $SS_RIGHT)
GUICtrlCreateGroup("Method Selection", 20, 220, 420, 190)
GUICtrlCreateLabel("Method 1: Set the PC to be in EEA. Will not be reverted by Windows Update.", 30, 240, 400, 20)
GUICtrlCreateLabel("EEA Country:", 30, 265, 200, 20)
Local $hEEA = GUICtrlCreateCombo("", 230, 260, 200, 20, $CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1, _ArrayToString($aCountries, "|", -1, -1, "|", 0, 0), "Germany")
Local $hSetEEA = GUICtrlCreateButton("Set All to Selected EEA Country", 30, 285, 400, 30)
GUICtrlCreateLabel("Method 2: Tell the PC your ID/Nation is in the EEA. This will probably be reverted often via Windows Update. (COMING SOON)", 30, 340, 400, 30)
Local $hAddEEA = GUICtrlCreateButton("Add Current Values to ISRPS", 30, 370, 400, 30)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISwitch($hInstallGUI)
#EndRegion
GUISetState(@SW_SHOW, $hInstallGUI)
GUISetState(@SW_SHOW, $aPages[$iPage])
Local $iIndex
While True
$hMsg = GUIGetMsg()
Select
Case $hMsg = $GUI_EVENT_CLOSE or $hMsg = $hCancel
Exit
Case $hMsg = $hAgree or $hMsg = $hDisagree
If _IsChecked($hAgree) Then
GUICtrlSetState($hNext, $GUI_ENABLE)
Else
GUICtrlSetState($hNext, $GUI_DISABLE)
EndIf
Case $hMsg = $hHelp
Switch $iPage
Case $hLicense
ShellExecute("https://msedgeredirect.com/wiki/Installer-Overview#license-page")
Case $hMode
ShellExecute("https://msedgeredirect.com/wiki/Installer-Overview#mode-page")
Case $hSettings
ShellExecute("https://msedgeredirect.com/wiki/Installer-Overview#settings-page")
Case $hFinish
ShellExecute("https://msedgeredirect.com/wiki/Installer-Overview#finish-page")
Case Else
EndSwitch
Case $hMsg = $hBack
Switch $iPage - 1
Case $hLicense
GUICtrlSetState($hBack, $GUI_DISABLE)
GUICtrlSetState($hNext, $GUI_ENABLE)
Case $hMode
GUICtrlSetData($hNext, "Next >")
Case $hSettings
If $bUpdate Then
GUICtrlSetData($hNext, "Update")
Else
GUICtrlSetData($hNext, "Install")
EndIf
EndSwitch
GUISetState(@SW_HIDE, $aPages[$iPage])
GUISetState(@SW_SHOW, $aPages[$iPage - 1])
$iPage -= 1
Case $hMsg = $hNext
Switch $iPage + 1
Case $hMode
GUICtrlSetState($hBack, $GUI_ENABLE)
Case $hSettings
If @Compiled And Not $bResumed Then
Select
Case _IsChecked($hEurope)
ShellExecute(@ScriptFullPath, "/ContinueEurope", @ScriptDir, "RunAs")
Exit
Case _IsChecked($hActive)
ShellExecute(@ScriptFullPath, "/ContinueActive", @ScriptDir, "RunAs")
Exit
Case _IsChecked($hOthers)
ShellExecute("https://github.com/rcmaehl/MSEdgeRedirect/wiki/Alternative-Apps-Comparison-Chart")
Exit
EndSelect
ElseIf $bUpdate Then
GUICtrlSetData($hNext, "Update")
Else
GUICtrlSetData($hNext, "Install")
EndIf
Case $hFinish
If @Compiled Then
# 8.0.0.0 Refactor
Select
Case $bUpdate And $iMode <> $hSettings
ContinueCase
Case $bUpdate And $bResumed
RunRemoval(True)
Case Else
FileDelete(@StartupDir & "\MSEdgeRedirect.lnk")
EndSelect
If $iMode = $hSettings Then
$aConfig[$vMode] = $bIsAdmin
Else
$aConfig[$vMode] = _IsChecked($hActive)
EndIf
$aSettings[$bNoApps] = _IsChecked($hNoApps)
$aSettings[$bNoBing] = _IsChecked($hSearch)
$aSettings[$bNoChat] = _IsChecked($hNoChat)
$aSettings[$bNoFeed] = _IsChecked($hNoFeed)
$aSettings[$bNoImgs] = _IsChecked($hNoImgs)
$aSettings[$bNoMSN] = _IsChecked($hNoMSN)
$aSettings[$bNoNews] = _IsChecked($hNoNews)
$aSettings[$bNoPDFs] = _IsChecked($hNoPDFs)
$aSettings[$bNoPilot] = _IsChecked($hNoPilot)
$aSettings[$bNoTray] = _IsChecked($hNoIcon)
$aSettings[$sFeed] = GUICtrlRead($hFeedSRC)
$aSettings[$sFeedPath] = $sFeedEng
$aSettings[$sImages] = GUICtrlRead($hImgSRC)
$aSettings[$sImagePath] = $sImgEng
$aSettings[$sNews] = GUICtrlRead($hNewSRC)
$aSettings[$sPDFApp] = $sHandler
$aSettings[$sSearch] = GUICtrlRead($hEngine)
$aSettings[$sSearchPath] = $sEngine
$aSettings[$bStartup] = _IsChecked($hStartup)
$aSettings[$sWeather] = GUICtrlRead($hWeather)
$aSettings[$sWeatherPath] = $sWeatherEng
GUISetState(@SW_HIDE, $hSettings)
RunInstall($aConfig, $aSettings)
SetAppRegistry($aConfig)
If $aConfig[$vMode] Then
For $iLoop = 0 To UBound($aChannels) - 1 Step 1
$aChannels[$iLoop] = _IsChecked($hChannels[$iLoop])
Next
SetIFEORegistry($aChannels)
EndIf
If $iMode = $hSettings Then Return
GUICtrlSetData($hNext, "Finish")
GUICtrlSetState($hHelp, $GUI_DISABLE)
GUICtrlSetState($hBack, $GUI_DISABLE)
GUICtrlSetState($hCancel, $GUI_DISABLE)
If _IsChecked($hActive) Then
GUICtrlSetState($hLaunch, $GUI_DISABLE)
Else
GUICtrlSetState($hLaunch, $GUI_CHECKED)
EndIf
EndIf
Case $hExit
If @Compiled Then
If _IsChecked($hAppLnk) Then SetAppShortcuts($aConfig, $aSettings)
If _IsChecked($hDonate) Then ShellExecute("https://paypal.me/rhsky")
If _IsChecked($hHelpUs) Then ShellExecute("https://safebrowsing.google.com/safebrowsing/report_error/?url=https://github.com/rcmaehl/MSEdgeRedirect")
If Not $aConfig[$vMode] And _IsChecked($hLaunch) Then
If $aSettings[$bNoTray] Then $sArgs = "/hide"
ShellExecute(@LocalAppDataDir & "\MSEdgeRedirect\MSEdgeRedirect.exe", $sArgs, @LocalAppDataDir & "\MSEdgeRedirect\")
EndIf
Exit
EndIf
Case $hExit2
If @Compiled Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\DeviceRegion", "DeviceRegion", "REG_DWORD", GUICtrlRead($aNew[0]))
RegWrite("HKEY_USERS\.DEFAULT\Control Panel\International\Geo", "Name", "REG_SZ", GUICtrlRead($aNew[1]))
RegWrite("HKEY_USERS\.DEFAULT\Control Panel\International\Geo", "Nation", "REG_SZ", GUICtrlRead($aNew[2]))
RegWrite("HKEY_CURRENT_USER\Control Panel\International\Geo", "Name", "REG_SZ", GUICtrlRead($aNew[3]))
RegWrite("HKEY_CURRENT_USER\Control Panel\International\Geo", "Nation", "REG_SZ", GUICtrlRead($aNew[4]))
EndIf
MsgBox($MB_OK + $MB_ICONINFORMATION + $MB_TOPMOST, "Reboot Required", "A Reboot/Restart is required to Complete the Regional Changes of Europe Mode.")
Exit
EndSwitch
GUISetState(@SW_HIDE, $aPages[$iPage])
GUISetState(@SW_SHOW, $aPages[$iPage + 1])
$iPage += 1
Case $hMsg = $hActive or $hMsg = $hService
If _IsChecked($hService) Then
;GUICtrlSetState($hInstall, $GUI_ENABLE)
GUICtrlSetState($hStartup, $GUI_ENABLE)
GUICtrlSetState($hNoIcon, $GUI_ENABLE)
GUICtrlSetState($hChannels[0], $GUI_DISABLE)
GUICtrlSetState($hChannels[1], $GUI_DISABLE)
GUICtrlSetState($hChannels[2], $GUI_DISABLE)
GUICtrlSetState($hChannels[3], $GUI_DISABLE)
Else
GUICtrlSetState($hStartup, $GUI_DISABLE)
GUICtrlSetState($hNoIcon, $GUI_DISABLE)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe\0", "Debugger") Then
GUICtrlSetState($hChannels[0], $GUI_DISABLE)
GUICtrlSetState($hChannels[1], $GUI_DISABLE)
GUICtrlSetState($hChannels[2], $GUI_DISABLE)
GUICtrlSetState($hChannels[3], $GUI_DISABLE)
GUICtrlSetState($hChannels[4], $GUI_DISABLE)
GUICtrlSetState($hChannels[4], $GUI_CHECKED)
Else
If $bUpdate Or $iMode = $hSettings Then
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER1", "Debugger") Then GUICtrlSetState($hChannels[0], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER2", "Debugger") Then GUICtrlSetState($hChannels[1], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER3", "Debugger") Then GUICtrlSetState($hChannels[2], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER4", "Debugger") Then GUICtrlSetState($hChannels[3], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\MSER5", "Debugger") Then GUICtrlSetState($hChannels[4], $GUI_CHECKED)
If RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe\0", "Debugger") Then GUICtrlSetState($hChannels[4], $GUI_CHECKED)
Else
GUICtrlSetState($hChannels[0], $GUI_ENABLE)
GUICtrlSetState($hChannels[1], $GUI_ENABLE)
GUICtrlSetState($hChannels[2], $GUI_ENABLE)
GUICtrlSetState($hChannels[3], $GUI_ENABLE)
GUICtrlSetState($hChannels[0], $GUI_CHECKED)
EndIf
EndIf
ContinueCase
EndIf
Case $hMsg = $hChannels[0] Or $hMsg = $hChannels[1] Or $hMsg = $hChannels[2] Or $hMsg = $hChannels[3]
;GUICtrlSetState($hInstall, $GUI_DISABLE)
For $iLoop = 0 To UBound($aChannels) - 1 Step 1
If _IsChecked($hChannels[$iLoop]) Then
;GUICtrlSetState($hInstall, $GUI_ENABLE)
ExitLoop
EndIf
Next
Case $hMsg = $hSearch
If _IsChecked($hSearch) Then
GUICtrlSetState($hEngine, $GUI_ENABLE)
Else
GUICtrlSetState($hEngine, $GUI_DISABLE)
EndIf
Case $hMsg = $hEngine And GUICtrlRead($hEngine) = "Custom"
$sEngine = InputBox("Enter Search Engine URL", "Enter the URL format of the custom Search Engine to use, including the %query% placeholder.", "https://duckduckgo.com/?q=%query%")
If @error Then GUICtrlSetData($hEngine, "Google")
Case $hMsg = $hNoFeed
If _IsChecked($hNoFeed) Then
GUICtrlSetState($hFeedSRC, $GUI_ENABLE)
Else
GUICtrlSetState($hFeedSRC, $GUI_DISABLE)
EndIf
Case $hMsg = $hNoImgs
If _IsChecked($hNoImgs) Then
GUICtrlSetState($hImgSRC, $GUI_ENABLE)
Else
GUICtrlSetState($hImgSRC, $GUI_DISABLE)
EndIf
Case $hMsg = $hFeedSRC And GUICtrlRead($hFeedSRC) = "Custom"
$sFeedEng = InputBox("Enter Feed URL", "Enter the URL format of the custom Feed to use.", "https://news.google.com")
If @error Then GUICtrlSetData($hFeedSRC, "Google")
Case $hMsg = $hImgSRC And GUICtrlRead($hImgSRC) = "Custom"
$sImgEng = InputBox("Enter Image Search Engine URL", "Enter the URL format of the custom Image Search Engine to use, including the %query% placeholder.", "https://duckduckgo.com/?ia=images&iax=images&q=%query%")
If @error Then GUICtrlSetData($hImgSRC, "Google")
Case $hMsg = $hNoMSN
If _IsChecked($hNoMSN) Then
GUICtrlSetState($hWeather, $GUI_ENABLE)
Else
GUICtrlSetState($hWeather, $GUI_DISABLE)
EndIf
Case $hMsg = $hWeather And GUICtrlRead($hWeather) = "Custom"
$sWeatherEng = InputBox("Enter Weather Engine URL", "Enter the URL format of the custom Weather Engine to use, including the %lat%, %long%, and (optionally) %locale% placeholders.", "https://www.accuweather.com/en/search-locations?query=")
If @error Then GUICtrlSetData($hImgSRC, "Weather.com")