-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoDDU_CLI.py
More file actions
2610 lines (2335 loc) · 132 KB
/
AutoDDU_CLI.py
File metadata and controls
2610 lines (2335 loc) · 132 KB
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
Version_of_AutoDDU_CLI = "0.2.0"
LICENSE = """
MIT License
Copyright (c) 2022-present Daniel Suarez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import json
import os
import platform
import shutil
import subprocess
import sys
import time
import traceback
import urllib.request
# import wexpect
import zipfile
from datetime import datetime, timezone, date
from subprocess import CREATE_NEW_CONSOLE
#import ntplib
import wmi
from win32com.shell import shell, shellcon
import winreg
import ctypes
from win32event import CreateMutex
from win32api import CloseHandle, GetLastError
from winerror import ERROR_ALREADY_EXISTS
import webbrowser
import psutil
import urllib.error
import posixpath
import codecs
from tqdm import tqdm
import packaging.version
import multiprocessing
import win32com.client
import importlib.metadata
import dns.resolver
import tempfile
import ssl
import xmltodict
import difflib
import zlib
import socket
import struct
import httpx
import urllib.parse
import signify.authenticode
import re
advanced_options_dict_global = {"disablewindowsupdatecheck": 0, "bypassgpureq": 0, "provideowngpuurl": [],
"disabletimecheck": 0, # Kept here even though it does nothing. This is for backwards compatibility reason
# For example lets say someone runs latest version but it has a problem, then they're told to try an old version,
# if it's old enough it will expect this to be in config, and it will fail if it isn't, even though there was
# never a public AutoDDU release that actually did something with this variable.
"RemovePhysX": 0, "disableinternetturnoff": 0, "donotdisableoverclocks": 0,
"disabledadapters": [], "avoidspacecheck": 0, "amdenterprise" : 0,
"nvidiastudio" : 0, "startedinsafemode" : 0, "inteldriverassistant" : 0,
"dnsoverwrite" : 0, "pciidsfallback" : 0, 'changegpumode':0} # ONLY USE FOR INITIALIZATION IF PERSISTENTFILE IS TO 0. NEVER FOR CHECKING IF IT HAS CHANGED.
clear = lambda: os.system('cls')
Appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, 0, 0)
Appdata_AutoDDU_CLI = os.path.join(Appdata, "AutoDDU_CLI")
Persistent_File_location = os.path.join(Appdata, "AutoDDU_CLI", "PersistentDDU_Log.txt")
root_for_ddu_assembly = os.path.join(Appdata, "AutoDDU_CLI", "DDU_Parser")
ddu_AssemblyInfo = os.path.join(Appdata, "AutoDDU_CLI", "DDU_Parser\\", "AssemblyInfo.vb")
ddu_zip_path = os.path.join(Appdata, "AutoDDU_CLI", "DDU_Parser\\", "DDU.exe")
ddu_extracted_path = os.path.join(Appdata, "AutoDDU_CLI", "DDU_Extracted")
Users_directory = os.path.dirname(shell.SHGetFolderPath(0, shellcon.CSIDL_PROFILE, 0, 0))
exe_location = os.path.join(Appdata_AutoDDU_CLI, "AutoDDU_CLI.exe")
Script_Location_For_startup = os.path.join(Appdata_AutoDDU_CLI ,"AutoDDU_CLI.lnk")
log_file_location = os.path.join(Appdata_AutoDDU_CLI, "AutoDDU_LOG.txt")
PROGRAM_FILESX86 = shell.SHGetFolderPath(0, shellcon.CSIDL_PROGRAM_FILESX86, 0, 0)
Jsoninfofileslocation = os.path.join(Appdata_AutoDDU_CLI, "JsonInfoFiles")
EOL_NVIDIA = ['NV1', 'NV3', 'NV4', 'NV5', 'MCP04', 'NV40', 'NV40GL', 'CK804', 'nForce2', 'nForce', 'MCP2A', 'MCP2S', 'G70', 'G70M', 'G70GL', 'NV0A',
'NV41', 'NV41M', 'NV41GLM', 'NV42GL', 'NV41GL', 'nForce3', 'CK8S', 'NV43', 'G70/G71', 'NV45GL', 'NV39', 'NV35', 'NV37GL', 'NV38GL', 'NV19',
'NV10', 'NV10GL', 'NV11', 'NV11M', 'NV11GL', 'NV43M', 'NV43GL', 'NV15', 'NV15GL', 'NV44', 'NV44M', 'NV17', 'NV17M', 'NV17GL', 'NV18', 'NV18M',
'NV18GL', 'G80', 'G80GL', 'G72', 'G7', 'G72M', 'G72GLM', 'G72GL', 'NV1F', 'NV20', 'NV20GL', 'NV48', 'NV44A', 'C51PV', 'C51', 'C51G', 'NV25',
'NV25GL', 'MCP51', 'NV28', 'NV28M', 'NV28GL', 'NV28GLM', 'G71', 'G71M', 'G71GLM', 'G71GL', 'NV2A', 'MCPX', 'G73', 'NV30', 'NV30GL', 'NV31',
'NV31G', 'NV31M', 'NV31GLM', 'NV34', 'NV34M', 'NV34GL', 'NV38', 'NV35GL', 'NV36', 'NV36M', 'NV36GL', 'MCP55', 'G73M', 'G73GLM', 'G73GL', 'C55',
'C61', 'MCP61', 'G84', 'G84M', 'G84GL', 'G84GLM', 'G92', 'G86', 'G86M', 'G86GLM', 'MCP65', 'C67', 'C68', 'MCP67', 'MCP78S', 'MCP73', 'NF200',
'GT200b', 'GT200', 'GT200GL', 'G92M', 'G92GL', 'G92GLM', 'G94', 'G94M', 'G94GL', 'G94GLM', 'G96C', 'G96', 'G96CM', 'G96M', 'G96GL', 'G96CGL',
'G96GLM', 'G98', 'G98M', 'G98GL', 'G98GLM', 'MCP77', 'MCP72XE/MCP72P/MCP78U/MCP78S', 'C73', 'C77', 'C78', 'C79', 'MCP7A', 'MCP79',
'MCP89', 'GT216', 'GT216M', 'GT216GL', 'GT216GLM', 'GT218', 'GT218M', 'GT218GL', 'GT218GLM', 'GT215', 'GT215M', 'GT215GLM',
'Xavier', 'MCP78U', 'MCP72P' , 'MCP72XE','GK104', 'GK106', 'GK208', 'GK110', 'GK107', 'GK107M', 'GK107GL', 'GK107GLM', 'GK110B',
'GK110GL', 'GK110BGL', 'GK180GL', 'GK210GL', 'GK104GL', 'GK104M', 'GK104GLM', 'GK106M',
'GK106GL', 'GK106GLM', 'GK208B', 'GK208M', 'GK208BM', 'GK20', 'GK208GLM','GF100', 'GF100M', 'GF100G', 'GF100GL', 'GF100GLM', 'GF106',
'GF108', 'GF104', 'GF116', 'GF106M', 'GF106GL', 'GF106GLM', 'GF108M', 'GF108GL', 'GF108GLM', 'GF119', 'GF110', 'GF114', 'GF104M',
'GF104GLM', 'GF11', 'GF119M', 'GF110GL', 'GF117M', 'GF114M', 'GF116M']
unrecoverable_error_print = (r"""
An unrecoverable error has occured in this totally bug free
software.
Chika is disappointed, but at least this error shows what went wrong.
Please share the stacktrace below to Evernow so he can fix it.
In addition, above the stacktrace is the directory of where
DDU and your drivers are downloaded if they were downloaded.
{ddu_extracted_path}
{Appdata}
""".format(ddu_extracted_path=ddu_extracted_path, Appdata=Appdata_AutoDDU_CLI))
login_or_not = """
You should be logged in automatically to a
user profile we created, if it doesn't then login
yourself manually (password is Evident@Omega@Winnings4@Matted@Swear@Handled
).
"""
AutoDDU_CLI_Settings = os.path.join(Appdata_AutoDDU_CLI, "AutoDDU_CLI_Settings.json")
# Suggestion by Arron to bypass fucked PATH environment variable
powershelldirectory = r"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
def TestForStupidityPart43():
# This protects against people willy nilly going to the github repo
# and just grabbing the python file and running it, which won't bloody
# work due to numerious assumptions specific to PyInstaller.
# This has happened twice now.
if not (getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS')):
print("""
You did not run AutoDDU_CLI correctly. You likely
grabbed the python file from the GitHub instead
of downloading the executable. Do not run
the python file raw, as numerious code paths are
made with the expectation of it running as a
frozen executable.
Opening browser to download executable now.
""")
webbrowser.open('https://github.com/Evernow/AutoDDU_CLI/raw/main/signedexecutable/AutoDDU_CLI.exe')
time.sleep(1)
os._exit(1)
def HandleChangingGPUProcess():
for vendor in ['amd','intel','nvidia']:
download_helper(f'https://raw.githubusercontent.com/24HourSupport/CommonSoftware/main/{vendor}_gpu.json',os.path.join(Jsoninfofileslocation,f'{vendor}_gpu.json'),False)
with open(os.path.join(Jsoninfofileslocation,'nvidia_gpu.json')) as json_file:
nvidia_gpu = json.load(json_file)
with open(os.path.join(Jsoninfofileslocation,'amd_gpu.json')) as json_file:
amd_gpu = json.load(json_file)
with open(os.path.join(Jsoninfofileslocation,'intel_gpu.json')) as json_file:
intel_gpu = json.load(json_file)
GPUDrivers = {1: amd_gpu, 2: intel_gpu, 3:nvidia_gpu}
UserResponseToContinue = -1
while UserResponseToContinue == -1:
print("""
You are placing AutoDDU into change GPU mode.
This is made for when you have a current GPU
and are changing it to a different GPU.
It will involve performing DDU in safe mode,
and then when DDU is finished AutoDDU will
shutdown your PC instead of restarting it,
then when shutdown you will then change
the GPU to your new one and boot up.
Is this what you want to do or do you
instead wish to perform DDU without changing GPUs?
1 - I wish to change my GPU after doing DDU.
2 - I am not going to change my GPU.""")
try:
UserResponseToContinue = int(input('Type the number for your response and press enter: '))
if UserResponseToContinue != 1 and UserResponseToContinue != 2:
UserResponseToContinue = -1
raise ValueError
except ValueError:
print("Invalid option selected. Refreshing in 5 seconds.")
time.sleep(5)
clear()
if UserResponseToContinue == 2:
return 0
else:
print()
VendorChoice = -1
while VendorChoice == -1:
print("""
Which GPU vendor are you switching to?
In other word, which vendor made your future
GPU?
Your CURRENT GPU vendor is NOT IMPORTANT unless
it just happens to be the same vendor. All these
questions relate to your FUTURE GPU, not your
current one.
1 - AMD.
2 - Intel.
3 - NVIDIA.
4 - I'll install drivers myself.""")
try:
VendorChoice = int(input('Type the number for your response and press enter: '))
if VendorChoice != 1 and VendorChoice != 2 and VendorChoice != 3 and VendorChoice != 4:
VendorChoice = -1
raise ValueError
except ValueError:
print("Invalid option selected. Refreshing in 5 seconds.")
time.sleep(5)
clear()
if VendorChoice == 4:
return None
time.sleep(0.1)
stringforuser = 'Please select which GPU driver is for your future GPU: \n'
drivers = []
for branch in GPUDrivers[VendorChoice]:
stringforuser += f"""{len(drivers)+1} / {GPUDrivers[VendorChoice][branch]['description']} \n \\ {(GPUDrivers[VendorChoice][branch]['link'])[GPUDrivers[VendorChoice][branch]['link'].rfind('/')+1:]} - {GPUDrivers[VendorChoice][branch]['version']}\n\n"""
drivers.append(GPUDrivers[VendorChoice][branch]['link'])
stringforuser += f'{len(drivers)+1} / I have no idea (starts search GPU process).'
print(stringforuser)
user_choice_for_driver = None
while user_choice_for_driver == None:
try:
user_choice_for_driver = int(input('Your choice: '))
if user_choice_for_driver not in list(range(1,len(drivers)+2)):
raise ValueError
except ValueError:
print("Invalid option selected. Refreshing in 5 seconds.")
time.sleep(5)
VendorChoice_dict = {1: 'amd', 2: 'intel', 3:'nvidia'}
if user_choice_for_driver == len(drivers)+1:
return [UserInput(VendorChoice_dict[VendorChoice])]
else:
return [drivers[user_choice_for_driver-1]]
def SearchGPU(gpu_vendor,provided_name):
download_helper(f'https://raw.githubusercontent.com/24HourSupport/CommonSoftware/main/{gpu_vendor}_gpu.json',os.path.join(Jsoninfofileslocation,f'{gpu_vendor}_gpu.json'),False)
with open(os.path.join(Jsoninfofileslocation,f'{gpu_vendor}_gpu.json')) as json_file:
gpu_json = json.load(json_file)
download_helper("https://raw.githubusercontent.com/24HourSupport/CommonSoftware/main/PCI-IDS.json", os.path.join(Jsoninfofileslocation,'PCI-IDS.json'),False)
with open(os.path.join(Jsoninfofileslocation,'PCI-IDS.json')) as json_file:
PCIIDS_DATA = json.load(json_file)
vendor_id_dict = {'nvidia':'10de', 'amd':'1002', 'intel':'8086'}
gpu_names = {}
for branch in gpu_json:
gpu_names_wip = []
for gpu in gpu_json[branch]['SupportedGPUs']:
try:
gpunamefromdatabse = PCIIDS_DATA[vendor_id_dict[gpu_vendor]]['devices'][gpu.lower()]['name']
# Get Rid of Radeon name before the below split
gpunamefromdatabse = gpunamefromdatabse.replace('Radeon','')
gpunamefromdatabse = gpunamefromdatabse[gpunamefromdatabse.find('[')+1:gpunamefromdatabse.find(']')]
if gpu_vendor == 'amd': #
# AMD shares PCI IDS between GPUs almost 100% of the time
# For example: Radeon RX 6700S / 6800S / 6650 XT is extremely common.
# This really screws up our search results, so lets just split by / and include all of them seperately.
for amd_gpu in gpunamefromdatabse.split('/'):
gpu_names_wip.append(amd_gpu.strip())
break # Too much madness can happen if we do the usual we do for Intel and NVIDIA, so lets leave it here.
# Get rid of stuff from the name that will just confuse users and doesn't affect anything here to begin with.
gpunamefromdatabse = gpunamefromdatabse.replace('Mobile','').replace('Max-Q','').replace('Laptop','').replace('Lite Hash Rate','').replace('Refresh','').replace('/','')
# Get rid of extra spaces from here: https://stackoverflow.com/a/1546883/17484902
gpunamefromdatabse = ' '.join(gpunamefromdatabse.split())
gpu_names_wip.append(gpunamefromdatabse.strip())
# Lets get rid of brand names since someone may type for example "RTX 3060" and not "Geforce RTX 3060", but leave quadro name as those are
# fairly rare and taint our results otherwise.
gpunamefromdatabse = gpunamefromdatabse.replace('GeForce','')
gpu_names_wip.append(gpunamefromdatabse.strip())
except KeyError:
pass
# This protects against PCI IDS not having a GPU that's in the SupportedGPUs list, which happens pretty frequently with AMD and Intel.
# Get rid of duplicates that can easily occur
gpu_names_wip = list(set(gpu_names_wip))
# We do this by priority so we can then later sort by priority so we're checker the ones that should be used for a specific
# GPU first. This avoids giving all NVIDIA users studio drivers or all AMD users PRO drivers.
gpu_names[gpu_json[branch]['priority']] = gpu_names_wip
gpu_names = dict(sorted(gpu_names.items()))
# Get a list of similar strings to the one the user provided, max of 3 results per branch
matching_names = {}
for branch in gpu_names:
results = difflib.get_close_matches(provided_name, gpu_names[branch],3,cutoff=.5)
for result in results:
if (result not in matching_names.keys()):
matching_names[result] = branch
return(matching_names)
def UserInput(gpu_vendor):
driver = None
attempts = 0
while driver == None:
attempts += 1
if attempts %5 == 0:
userchoicewhetherhehasalife = None
while userchoicewhetherhehasalife == None:
print("""
You attempted this 5 more times,
you sure you want to continue?
1 - Yes I want to continue
2 - No I want to just install drivers myself""")
try:
userchoicewhetherhehasalife = int(input('Your Choice:'))
if userchoicewhetherhehasalife != 1 and userchoicewhetherhehasalife != 2:
userchoicewhetherhehasalife = None
raise ValueError
except ValueError:
userchoicewhetherhehasalife = None
print("Invalid option selected. Refreshing in 5 seconds.")
time.sleep(5)
if userchoicewhetherhehasalife == 1:
continue
else:
return None
print("""
You initiated the search option.
You can put in the name of your GPU
as accurate as possible and we will
list you potential matches in our
database, from which you pick the closest
approximation to your FUTURE gpu.""")
provided_name = input('Enter the name of your FUTURE GPU: ')
if len(provided_name) < 3 or (not provided_name.isascii()):
print('Please put a valid potential name that is at least 3')
print('characters long and contains only english characters.')
print('Showing prompt to enter a name again in 10 seconds.')
time.sleep(10)
clear()
continue
results_of_user_search = SearchGPU(gpu_vendor,provided_name)
if len(results_of_user_search) > 1:
user_show_results = '\nThese are the potential GPUs we know of given the name you provided.\n'
processed_results = []
for result in results_of_user_search.keys():
user_show_results += f'{len(processed_results)+1} / {result} \n'
processed_results.append(result)
user_show_results +=(f'{len(processed_results)+1} / None of these match, I wish to enter another name.\n')
user_show_results +=(f'{len(processed_results)+2} / None of these match, I wish to install drivers myself.\n')
print(user_show_results)
choice_from_search = None
while choice_from_search == None:
print('Enter the number of the result which most closely matches your FUTURE GPU.')
try:
choice_from_search = int(input('Enter the number corresponding to the closest GPU: '))
if choice_from_search not in list(range(1,len(processed_results)+3)):
choice_from_search = None
raise ValueError
except ValueError:
print("Invalid option selected. Refreshing in 5 seconds.")
time.sleep(5)
if choice_from_search == len(processed_results)+1:
continue
if choice_from_search == len(processed_results)+2:
return None
download_helper(f'https://raw.githubusercontent.com/24HourSupport/CommonSoftware/main/{gpu_vendor}_gpu.json',os.path.join(Jsoninfofileslocation,f'{gpu_vendor}_gpu.json'),False)
with open(os.path.join(Jsoninfofileslocation,f'{gpu_vendor}_gpu.json')) as json_file:
gpu_json = json.load(json_file)
for branch in gpu_json:
if gpu_json[branch]['priority'] == results_of_user_search[processed_results[(choice_from_search-1)]]:
return gpu_json[branch]['link']
else: # No results
print("No results came from your search, try again.")
print("Try to be as clear as possible, if you fail 5 times")
print("We will offer an option to provide your own drivers.")
print("Gonna ask again for the name of the FUTURE GPU in 15 seconds")
time.sleep(15)
def LogBasicSysInfo():
# Info useful sometimes in tracking down problems, for example norwegian and german have caused issues..
knownCPUArchitectures = {0: 'x86', 1: 'MIPS', 2: 'Alpha', 'PowerPC': 3,
5:'ARM', 6:'ia64', 9:'x64', 12:'ARM64'}
for profile in wmi.WMI().Win32_Processor() : # Technically someone can have more than one CPU, so worth being in a loop...
if profile.Architecture in knownCPUArchitectures.keys():
logger('CPU architecture: ' + knownCPUArchitectures[profile.Architecture])
else:
logger('CPU architecture unknown, Windows identified it as: ' + str(profile.Architecture))
logger('Windows identifiers for CPU architecture can be found here: https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor')
logger('CPU name is: ' + str(profile.Name))
logger('CPU enabled cores is: ' + str(profile.NumberOfEnabledCore))
locale = wmi.WMI().Win32_OperatingSystem ()[0].Locale
logger('Locale: ' + str(locale))
language = wmi.WMI().Win32_OperatingSystem ()[0].OSLanguage
logger('language: ' + str(language))
installdate = wmi.WMI().Win32_OperatingSystem ()[0].InstallDate
logger('installdate: ' + str(installdate))
NameOfWindows = wmi.WMI().Win32_OperatingSystem ()[0].Name
logger('NameOfWindows: ' + str(NameOfWindows))
# This allows us to see the full build number which is VERY useful for determining
# which channel of insider someone is on.
VersionOfWindows = subprocess.check_output('ver', shell=True )
logger('VersionOfWindows: ' + str(VersionOfWindows))
AreWeBootedOnaUSB = wmi.WMI().Win32_OperatingSystem ()[0].PortableOperatingSystem
logger('AreWeBootedOnaUSB: ' + str(AreWeBootedOnaUSB))
MotherboardModel = wmi.WMI().Win32_BaseBoard ()[0].Product
logger('MotherboardModel: ' + str(MotherboardModel))
MotherboardManuf = wmi.WMI().Win32_BaseBoard ()[0].Manufacturer
logger('MotherboardManuf: ' + str(MotherboardManuf))
# Invaluable to know which release was built with so we if we get a
# python specific error we know which line number to go to in the cpython repo.
logger('Python version: ' + sys.version)
# Tells us whether Windows is currently in debug mode, useful as behavior is slightly different and can explain performance issues
DebugMode = wmi.WMI().Win32_OperatingSystem()[0].Debug
logger('DebugMode: ' + str(DebugMode))
# Logs all open processes
processes = list()
for process in wmi.WMI().Win32_Process(["Name"]): # This guy is a genius: https://stackoverflow.com/questions/61762991/counting-number-of-running-processes-with-wmi-python-is-slow
processes.append(process.Name)
processes = str(processes)
# Sucks, I know, but like, holy shit I am going insane debugging some of these issues
# which I am convinced are caused by some wacky app
zlibz = str(zlib.compress(str(processes).encode()))
logger("Below is the a list of all open processes put as a string and then compressed with zlib")
logger(zlibz)
def GPUZINFO():
try:
try:
os.remove(os.path.join(Appdata_AutoDDU_CLI,'GPUOutput.xml'))
except:
pass
download_helper("https://raw.githubusercontent.com/24HourSupport/CommonSoftware/main/GPU-Z.exe", os.path.join(Appdata_AutoDDU_CLI,'GPU-Z.exe'),False)
subprocess.call([os.path.join(Appdata_AutoDDU_CLI,'GPU-Z.exe'),'-minimized','-dump','GPUOutput.xml'],
cwd=Appdata_AutoDDU_CLI , stderr=subprocess.DEVNULL)
with open(os.path.join(Appdata_AutoDDU_CLI,'GPUOutput.xml'), encoding='utf-8') as file:
my_xml = file.read()
my_dict = xmltodict.parse(my_xml)
logger("In GPU-Z, expect a lot of verbose crap while this method is new.")
cardlist = []
logger(str(my_dict['gpuz_dump']['card']))
if type(my_dict['gpuz_dump']['card']) == dict: #Workaround issues relating to how multi gpu setups appear.
cardlist.append(my_dict['gpuz_dump']['card'])
my_dict['gpuz_dump']['card'] = cardlist
logger(str(my_dict['gpuz_dump']['card']))
logger(str(my_dict))
GPUsFound = {}
for gpu in (my_dict['gpuz_dump']['card']):
logger(str(gpu))
# 1002 = AMD ; 8086 = Intel ; 10de = NVIDIA ; 121a = Voodoo (unlikely but I mean.. doesn't hurt?)
if gpu['vendorid'].lower() == '1002' or gpu['vendorid'].lower() == '8086' or gpu['vendorid'].lower() == '10de' or gpu['vendorid'].lower() == '121a':
GPUsFound[str(gpu['cardname'])] = [str(gpu['gpuname']), str(gpu['vendorid']).lower(), str(gpu['deviceid']).lower()]
logger("Gonna return from the GPU-Z method")
logger(str(GPUsFound))
return (GPUsFound)
except:
logger("GPU-Z method failed with the following error, gonna fallback to PCIIDS method")
logger(str(traceback.format_exc()))
return {} # This triggers the fallback to the PCI-IDS method
def TestMultiprocessingTarget(enable):
wrxAdapter = wmi.WMI( namespace="StandardCimv2").query("SELECT * FROM MSFT_NetAdapter")
list_of_names = list()
list_test = list()
for adapter in wrxAdapter:
list_of_names.append(adapter.Name)
if adapter.Virtual == False and adapter.LinkTechnology != 10:
pass
def TestMultiprocessing():
# Check because some system configurations are incompatible with multiprocessing.
proc = multiprocessing.Process(target=TestMultiprocessingTarget, args=(True,))
proc.start()
time.sleep(1)
if proc.is_alive():
time.sleep(10)
proc.terminate()
def VerifyDDUAccountCreated():
listofusers = []
for profile in wmi.WMI().Win32_UserAccount() :
if len(profile.Name) > 0:
listofusers.append(profile.Name)
logger("List of users in Windows install is:")
logger(str(listofusers))
if obtainsetting("ProfileUsed") not in listofusers:
return False
return True
def RestartPending():
# Checks to see if a restart is pending for updates, this is to prevent issues with us restarting and not landing in safe mode.
key = r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
k = winreg.OpenKey(reg, key) # if the key exists then we have an update pending that needs a restart to finish.
logger("Got a pending Windows update restart.")
return True
except:
logger("I believe there is not a Windows update restart pending.")
logger(str(traceback.format_exc()))
return False
def extract_issuer(string):
pattern = r'CN=([^,]+)'
match = re.search(pattern, string)
if match:
return match.group(1)
else:
return None
def CheckPublisherOfDriver(filename):
logger(f"Checking the signature of the file {filename}")
with open(filename, "rb") as file_obj:
try:
signees = [] # An executable can be signed by multiple
# For example NVIDIA executables are signed by NVIDIA and Digicert. Not sure why it appears this way, doesn't on Windows explorer.
pe = signify.authenticode.SignedPEFile(file_obj)
for signed_data in pe.signed_datas:
for cert in signed_data.certificates:
signees.append(extract_issuer(cert.subject.dn))
logger(f"A signee for this file is {cert.subject.dn}")
result, e = pe.explain_verify()
if result != signify.authenticode.AuthenticodeVerificationResult.OK: # Cert failed to verify
logger(f"Result of the verification is {result, e}")
logger(f"Unable to verify signature of file.")
return None
if 'NVIDIA Corporation' in signees:
return 'NVIDIA'
if 'Advanced Micro Devices Inc.' in signees:
return 'AMD'
if 'Intel Corporation' in signees:
return 'intel'
except Exception as e:
logger("Error while parsing: " + str(e))
return None
def IsKasperskyInstalled():
software = []
for p in wmi.WMI().Win32_Product():
if p.Caption is not None:
software.append (str(p.Caption))
for softwarepossibility in software:
if 'kaspersky' in softwarepossibility.lower():
return True
return False
def CheckIfBackupAccountExists():
userprofiles = list()
for group in wmi.WMI().Win32_UserAccount():
userprofiles.append(group.Caption.replace((group.Domain + '\\'), ''))
if 'BackupDDUProfile' in userprofiles:
return True
else:
return False
def BackupLocalAccount():
# Prevents a situation where the user has an MS Account on W11 Home
# And they cannot log back in after DDU (where DDU profile no longer exists)
# Due to MS requiring an internet connection.
if CheckIfBackupAccountExists() == False:
firstcommand = "net user /add BackupDDUProfile"
secondcommand = f"net localgroup {AdminGroupName()} BackupDDUProfile /add"
subprocess.run(firstcommand, shell=True, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.run(secondcommand, shell=True, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def AdminGroupName():
# This exists because german localizes group names, so administrator is not the name of the admin group
# in german. https://youtu.be/APbJcnH1brg
for group in wmi.WMI().Win32_Group(): # https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-group
if group.SID == 'S-1-5-32-544': # https://docs.microsoft.com/en-US/windows/security/identity-protection/access-control/security-identifiers
adminname = group.Caption.replace((group.Domain + '\\'), '')
return(adminname)
def serialize_req(obj):
return json.dumps(obj, separators=(',', ':'))
def getDispDrvrByDevid(query_obj, timeout=10):
ENDPOINT = 'https://gfwsl.geforce.com/nvidia_web_services/' \
'controller.gfeclientcontent.NG.php/' \
'com.nvidia.services.GFEClientContent_NG.getDispDrvrByDevid'
url = posixpath.join(ENDPOINT, serialize_req(query_obj))
http_req = urllib.request.Request(
url,
data=None,
headers={
'User-Agent': 'NvBackend/36.0.0.0'
}
)
with urllib.request.urlopen(http_req, None, timeout) as resp:
coding = resp.headers.get_content_charset()
coding = coding if coding is not None else 'utf-8-sig'
decoder = codecs.getreader(coding)(resp)
res = json.load(decoder)
return res
def get_latest_geforce_driver(dev_id):
notebook=False
x86_64=True
os_version="10.0"
os_build="19044"
language=1033
beta=False
dch=True
crd=False
timeout=10
query_obj = {
"dIDa": dev_id, # Device PCI IDs:
# ["DEVID_VENID_DEVID_VENID"]
"osC": os_version, # OS version (Windows 10)
"osB": os_build, # OS build
"is6": "1" if x86_64 else "0", # 0 - 32bit, 1 - 64bit
"lg": str(language), # Language code
"iLp": "1" if notebook else "0", # System Is Laptop
"prvMd": "0", # Private Model?
"gcV": "3.25.1.27", # GeForce Experience client version
"gIsB": "1" if beta else "0", # Beta?
"dch": "1" if dch else "0", # 0 - Standard Driver, 1 - DCH Driver
"upCRD": "1" if crd else "0", # Searched driver: 0 - GameReady Driver, 1 - CreatorReady Driver
"isCRD": "1" if crd else "0", # Installed driver: 0 - GameReady Driver, 1 - CreatorReady Driver
}
try:
res = getDispDrvrByDevid(query_obj, timeout)
except urllib.error.HTTPError as e:
logger(e)
if e.code == 404:
res = None
else:
raise e
return res
def FindOutOfBranchDriver(vendorid_deviceid):
# '1BE0_10DE'
drv = get_latest_geforce_driver([vendorid_deviceid])
if drv is None:
return None
else:
return drv['DriverAttributes']['DownloadURLAdmin']
def checkifvaliddownload(url):
logger(f"Checking if custom URL {str(url)} is valid")
try:
my_referer = "https://www.amd.com/en/support/graphics/amd-radeon-6000-series/amd-radeon-6700-series/amd-radeon-rx-6700-xt"
file = urllib.request.Request(url)
file.add_header('Referer', my_referer)
file.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0')
file = urllib.request.urlopen(file, timeout=5)
logger(f"Got size of custom URL to be {str(file.length)}")
if file.length < 6000000: # 6MB, which is size of intel driver assistant
return False
else:
return True
except:
logger("Failed valid check with error " +str(traceback.format_exc()) )
return False
def checkBatteryLevel():
try:
if psutil.sensors_battery() != None and int(psutil.sensors_battery().percent) < 40 and psutil.sensors_battery().power_plugged == False:
print("Your battery is less than 40%")
print("Please connect your laptop to power, then continue with instructions below.")
HandleOtherLanguages()
except:
logger("Failed to check battery level with")
logger(str(traceback.format_exc()))
def cleanupAutoLogin():
try:
Winlogon_key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, 'Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon')
if winreg.QueryValueEx(Winlogon_key, 'DefaultUserName')[0] == obtainsetting("ProfileUsed"):
failed = 0
try:
winreg.DeleteValue(Winlogon_key, 'AutoAdminLogon')
except:
failed = 1
logger("Failed in cleanupAutoLogin 1")
logger(str(traceback.format_exc()))
try:
winreg.DeleteValue(Winlogon_key, 'DefaultUserName')
except:
failed = 1
logger("Failed in cleanupAutoLogin 2")
logger(str(traceback.format_exc()))
try:
winreg.DeleteValue(Winlogon_key, 'DefaultPassword')
except:
failed = 1
logger("Failed in cleanupAutoLogin 3")
logger(str(traceback.format_exc()))
try:
winreg.DeleteValue(Winlogon_key, 'AutoLogonCount')
except:
# I think this is normal to occur so...
logger("EXPECTED failure in cleanupAutoLogin 4")
logger(str(traceback.format_exc()))
else:
failed = 1
logger("Did not log because DefaultUserName did not match ProfileUsed, used is {used} and defaultusername is {default}".format(default=winreg.QueryValueEx(Winlogon_key, 'DefaultUserName')[0], user=obtainsetting("ProfileUsed")))
winreg.CloseKey(Winlogon_key)
print("Finished AutoLogin cleanup")
logger("Finished cleanupAutoLogin successfully")
except:
failed = 1
logger("Failed in cleanupAutoLogin 5")
logger(str(traceback.format_exc()))
if failed == 1:
print("WARNING: Something MAY have gone wrong in some cleanup")
print("DDU finished just fine, just that when we log you out,")
print("you MAY be logged back into this DDU profile, if you are")
print("please log out then then restart, you may have to do this FIVE times for it to stop.")
print("We'll continue in 30 seconds.")
time.sleep(30)
def PendingUpdatesCount():
# https://stackoverflow.com/questions/70792656/how-do-i-get-pending-windows-updates-in-python
# https://github.com/Evernow/AutoDDU_CLI/issues/14
try:
wua = win32com.client.Dispatch("Microsoft.Update.Session")
avilable_update_seeker = wua.CreateUpdateSearcher()
search_available = avilable_update_seeker.Search("IsInstalled=0 and Type='Software'")
pendingupdates = int(search_available.Updates.Count )
logger("Got pending updates to be " + str(pendingupdates))
return pendingupdates
except:
logger("Failed to check Pending updates with following error")
logger(str(traceback.format_exc()))
logger("Gonna be trying to log every element of Microsoft Update Session")
try:
# I don't have a lot of data on how this fails, but know for a fact that it does in some situations,
# and in those situations the person usually leaves and logs don't provide useful info, so this is why
# I added all these logs.
logger("Going to try to dispatch Microsoft.Update.Session")
wua = win32com.client.Dispatch("Microsoft.Update.Session")
logger(str(wua))
logger("Going to try to create update searcher")
avilable_update_seeker = wua.CreateUpdateSearcher()
logger(str(avilable_update_seeker))
logger("Going to try search with the specific variables to know which updates ain't installed")
search_available = avilable_update_seeker.Search("IsInstalled=0 and Type='Software'")
logger(str(search_available))
logger("Going to try to get result from previous search")
logger(search_available.Updates.Count)
if type(search_available.Updates.Count) ==int:
logger("No idea how but this check didn't fail??")
else:
logger("Type of Updates.Count is not the expected one, it is")
logger(str(type(search_available.Updates.Count)))
except:
logger("Failed in logging extra info with")
logger(str(traceback.format_exc()))
print("Something is crucially wrong with")
print("your Windows Updates service.")
print("This is a major issue and can cause a great pain later on.")
print("We recommend running SFC and DISM, then restarting.")
print("If you don't know what this is then show this message")
print("to the person who sent you this, they likely know.")
print("If this keeps happening and you're sure there's no problems")
print("then here we offer the option to also continue like")
print("if nothing is wrong, but we only recommend doing this")
print("once you've corrected the problem,if to correct this")
print("you need to restart it's fine, AutoDDU will continue on")
print("when you launch it later. We'll show option to continue in 60 seconds.")
time.sleep(60)
HandleOtherLanguages()
def HandlePendingUpdates():
print("We're checking to see if there's pending updates, this can take a few minutes.")
if PendingUpdatesCount() > 0:
print(r"""
There's pending Windows Updates. Having pending
Windows Updates can cause issues when rebooting into
safe mode. For this reason we're going to pause
and you will have to go to Windows Updates in Settings app
and check for updates (may have to check manually multiple times)
and apply these updates. If these updates require a restart then
restart when asked, and then when you're back up you can
launch AutoDDU yourself afterwards. If no restart is needed then just
apply the updates and once applied come back here, we'll show
an option to continue in 10 minutes. You usually do not
need to install optional updates. If you're still getting
this message and see no pending updates, check manually for updates
by clicking the 'Check for Updates' button. If you believe you
applied all Windows updates and don't want to wait 10 mins then close
and reopen AutoDDU.""")
print("")
time.sleep(600)
if PendingUpdatesCount() > 0:
print("""
We are still seeing pending updates. Are you sure you
want us to continue? This can cause great annoyances later on.
Do the below prompt if you want to continue, if you don't then do whatever
you need to do to not have updates pending, it is fine to close AutoDDU
and restart if needed, we'll go from where we ended once you open
AutoDDU again. Or if you're in the process of installing them and
they do not need a restart just do the below prompt to continue once
they're installed.""")
HandleOtherLanguages()
def suspendbitlocker():
try:
p = str(subprocess.Popen(
f"{powershelldirectory} Suspend-BitLocker -MountPoint 'C:' -RebootCount 3",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, creationflags=CREATE_NEW_CONSOLE).communicate())
logger("Suspended bitlocker with output " + str(p))
except:
logger("Did not suspend bitlocker with output " + p)
def handleoutofdate():
download_helper("https://raw.githubusercontent.com/Evernow/AutoDDU_CLI/main/Version.json", os.path.join(Jsoninfofileslocation,'Version.json'),False)
with open(os.path.join(Jsoninfofileslocation,'Version.json')) as json_file:
data = json.load(json_file)
if (packaging.version.parse(Version_of_AutoDDU_CLI)) < packaging.version.parse(data['version']):
logger("Version did not match, version in local variable is {local} while version on GitHub is {git}".format(git=data['version'], local=Version_of_AutoDDU_CLI))
print("You are running a version that is not the latest.")
print("Do you want to continue?")
print("Type in 'Yes' and we'll continue along")
print("using this outdated version.")
print("")
print("Type 'No' and we'll exit linking you to the latest release so you can launch it.")
answer = ""
while "yes" not in answer.lower() and "no" not in answer.lower():
answer = input("Type in Yes or No then enter key: ")
if "no" in answer.lower():
webbrowser.open('https://github.com/Evernow/AutoDDU_CLI/raw/main/signedexecutable/AutoDDU_CLI.exe')
time.sleep(1)
os._exit(1)
print("")
def insafemode():
bootstate = wmi.WMI().Win32_ComputerSystem()[0].BootupState.encode("ascii", "ignore").decode(
"utf-8")
if "safe" in bootstate.lower():
return True
else:
return False
# https://stackoverflow.com/a/65501621/17484902
class singleinstance:
""" Limits application to single instance """
def __init__(self):
self.mutexname = "AutoDDUCLI_{91473d5a-5f6e-4266-ab87-22115e93b84b}"
self.mutex = CreateMutex(None, False, self.mutexname)
self.lasterror = GetLastError()
def alreadyrunning(self):
return (self.lasterror == ERROR_ALREADY_EXISTS)
def __del__(self):
if self.mutex:
CloseHandle(self.mutex)
def accountforoldcontinues(num):
if os.path.exists(Persistent_File_location):
if abs(int(time.time()) - os.path.getmtime(Persistent_File_location)) > 86400:
try:
os.remove(Persistent_File_location)
os.remove(AutoDDU_CLI_Settings)
logger("Deleted persistent file in 24hrs check")
except:
if num == 1:
raise Exception("Failure in accountforoldcontinues")
print("""
Warning: Saw this session is continuing after over
24 hours. This is possibily a bug.
I tried to restart but it failed. This could cuase issues.""")
logger("Failed to delete persistent file in 24hrs check")
logger(str(traceback.format_exc()))
def internet_on():
remaining_tries = 5
while remaining_tries > 0:
try:
download_helper('https://www.google.com/', os.path.join(Appdata_AutoDDU_CLI,'Internet_Check_Ignore_This'),False,0,True,True)
return True
except:
remaining_tries = remaining_tries - 1
logger(f"Failed to verify if we're online, gonna give it {remaining_tries} more tries.")
logger(str(traceback.format_exc()))
return False
def time_checker():
# Returns true when time Windows is following is within 48 hours
# of what the actual time is. This catches issues where
# someone's PC has not been turned on for a long time and cannot
# sync with Microsoft's time servers (like idiot blocks Microsoft domains)
try:
server = 'us.pool.ntp.org'
client = ntplib.NTPClient()
response = client.request(server, version=3)
# Time from U.S. NTP timeserver
internet_time = int(time.mktime((datetime.fromtimestamp(response.tx_time, timezone.utc)).timetuple()))
# Time computer is following
local_time = time.time()
if (internet_time - 172800) <= local_time <= (internet_time + 172800): # Check if within 48 hours
return True
return False
except:
logger("Checking the time failed")
logger(str(traceback.format_exc()))
print("INFO: TIME CHECK FAILED (NON FATAL)", flush=True)
print("WARNING: THIS CAN CAUSE ISSUES.", flush=True)
print("WILL CONTINUE IN 10 SECONDS", flush=True)
time.sleep(10)
def get_free_space():
twenty_gigabytes = 20474836480
return shutil.disk_usage(Appdata).free > twenty_gigabytes
def findnottaken():
# TODO: this is dumb, but I don't like the risk of deleting user profile folders... Windows deletes these after a
# while anyways if they aren't associated with a user.
ddu_next = "DDU"
subfolders = list()
for entry_name in os.listdir(Users_directory):
entry_path = os.path.join(Users_directory, entry_name)
if os.path.isdir(entry_path):
subfolders.append(entry_name.upper())
while ddu_next in subfolders:
ddu_next = ddu_next + "U"
logger("Used users are: " + str(subfolders))
logger("Ended up using user: " + str(ddu_next))
return ddu_next
def obtainsetting(index):
with open(AutoDDU_CLI_Settings, 'r+') as f:
advanced_options_dict = json.load(f)
return advanced_options_dict[index]
def default_config():
advanced_options_dict_global["ProfileUsed"] = findnottaken()
if not os.path.exists(Appdata_AutoDDU_CLI):
os.makedirs(Appdata_AutoDDU_CLI)
with open(AutoDDU_CLI_Settings, "w+") as outfile:
json.dump(advanced_options_dict_global, outfile)
def AdvancedMenu():
logger("User entered AdvancedMenu")
option = -1
while option != "12":
clear()
time.sleep(0.5)
print("WARNING: THIS MAY BEHAVE UNEXPECTADLY!", flush=True)
print('1 --' + AdvancedMenu_Options(1), flush=True) # Disable Windows Updates check
print('2 --' + AdvancedMenu_Options(2), flush=True) # Bypass supported GPU requirement
print('3 --' + AdvancedMenu_Options(3), flush=True) # Provide my own driver URLs
print('4 --' + AdvancedMenu_Options(4), flush=True) # RemovePhyX