Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2021-12-08 21:29:10 -07:00
commit 011d96089b
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 14 additions and 16 deletions

View file

@ -66,10 +66,6 @@ KNOWN_HIVE_NAMES = {
winreg.HKEY_CURRENT_USER: 'HKCU', winreg.HKEY_CURRENT_USER: 'HKCU',
winreg.HKEY_LOCAL_MACHINE: 'HKLM', winreg.HKEY_LOCAL_MACHINE: 'HKLM',
winreg.HKEY_USERS: 'HKU', winreg.HKEY_USERS: 'HKU',
winreg.HKEY_CLASSES_ROOT: 'HKEY_CLASSES_ROOT',
winreg.HKEY_CURRENT_USER: 'HKEY_CURRENT_USER',
winreg.HKEY_LOCAL_MACHINE: 'HKEY_LOCAL_MACHINE',
winreg.HKEY_USERS: 'HKEY_USERS',
} }
OS_VERSION = platform.win32_ver()[0] OS_VERSION = platform.win32_ver()[0]
OS_VERSION = 8.1 if OS_VERSION == '8.1' else int(OS_VERSION) OS_VERSION = 8.1 if OS_VERSION == '8.1' else int(OS_VERSION)

View file

@ -185,13 +185,13 @@ def end_session(menus):
# Disable Autologon # Disable Autologon
try: try:
autologon_selected = reg_read_value( use_autologon_in_autorepairs = reg_read_value(
'HKCU', AUTO_REPAIR_KEY, 'Use Autologon', 'HKCU', AUTO_REPAIR_KEY, 'Use Autologon',
) )
except FileNotFoundError: except FileNotFoundError:
autologon_selected = False
# Assuming it isn't being used # Assuming it isn't being used
if autologon_selected and is_autologon_enabled(): use_autologon_in_autorepairs = False
if use_autologon_in_autorepairs and is_autologon_enabled():
run_tool('Sysinternals', 'Autologon', '-accepteula', download=True) run_tool('Sysinternals', 'Autologon', '-accepteula', download=True)
reg_set_value( reg_set_value(
'HKLM', r'Software\Microsoft\Windows NT\CurrentVersion\Winlogon', 'HKLM', r'Software\Microsoft\Windows NT\CurrentVersion\Winlogon',
@ -245,8 +245,10 @@ def init(menus):
# Check if autologon is needed # Check if autologon is needed
if not session_started and is_autologon_enabled(): if not session_started and is_autologon_enabled():
# Avoid running Autologon and keep current settings LOG.warning('Skipping Autologon to preserve current settings.')
menus['Options'].options['Use Autologon']['Disabled'] = True
menus['Options'].options['Use Autologon']['Selected'] = False menus['Options'].options['Use Autologon']['Selected'] = False
reg_set_value('HKCU', AUTO_REPAIR_KEY, 'Use Autologon', 0, 'DWORD')
save_selection_settings(menus) save_selection_settings(menus)
# Start or resume a repair session # Start or resume a repair session
@ -273,6 +275,13 @@ def init_run(options):
'Sysinternals', 'Autologon', '-accepteula', 'Sysinternals', 'Autologon', '-accepteula',
download=True, msg_good='DONE', download=True, msg_good='DONE',
) )
if is_autologon_enabled():
# Update session settings to remove during end_session()
reg_set_value('HKCU', AUTO_REPAIR_KEY, 'Use Autologon', 1, 'DWORD')
else:
# A password wasn't provided or the account doesn't have one
options['Use Autologon']['Disabled'] = True
options['Use Autologon']['Selected'] = False
if options['Sync Clock']['Selected']: if options['Sync Clock']['Selected']:
TRY_PRINT.run( TRY_PRINT.run(
'Syncing Clock...', run_tool, 'Neutron', 'Neutron', msg_good='DONE', 'Syncing Clock...', run_tool, 'Neutron', 'Neutron', msg_good='DONE',
@ -392,14 +401,7 @@ def run_auto_repairs(base_menus):
save_selection_settings(menus) save_selection_settings(menus)
print_info('Initializing...') print_info('Initializing...')
init_run(menus['Options'].options) init_run(menus['Options'].options)
reg_set_value( save_selection_settings(menus)
'HKCU', AUTO_REPAIR_KEY, 'Use Autologon',
int(is_autologon_enabled()), 'DWORD',
)
if not is_autologon_enabled():
# Either it wasn't selected or a password wasn't entered
menus['Options'].options['Use Autologon']['Selected'] = False
save_selection_settings(menus)
if not session_started: if not session_started:
init_session(menus['Options'].options) init_session(menus['Options'].options)
print_info('Running repairs') print_info('Running repairs')