Also show alert box for Secure Boot issues
This commit is contained in:
parent
588fa8d51a
commit
a643b38bbe
1 changed files with 18 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ def check_connection():
|
||||||
else:
|
else:
|
||||||
abort()
|
abort()
|
||||||
|
|
||||||
def check_secure_boot_status():
|
def check_secure_boot_status(show_alert=False):
|
||||||
"""Checks UEFI Secure Boot status via PowerShell."""
|
"""Checks UEFI Secure Boot status via PowerShell."""
|
||||||
boot_mode = get_boot_mode()
|
boot_mode = get_boot_mode()
|
||||||
cmd = ['PowerShell', '-Command', 'Confirm-SecureBootUEFI']
|
cmd = ['PowerShell', '-Command', 'Confirm-SecureBootUEFI']
|
||||||
|
|
@ -51,18 +51,30 @@ def check_secure_boot_status():
|
||||||
# It's on, do nothing
|
# It's on, do nothing
|
||||||
return
|
return
|
||||||
elif 'False' in out:
|
elif 'False' in out:
|
||||||
|
if show_alert:
|
||||||
|
show_alert_box('Secure Boot DISABLED')
|
||||||
raise SecureBootDisabledError
|
raise SecureBootDisabledError
|
||||||
else:
|
else:
|
||||||
|
if show_alert:
|
||||||
|
show_alert_box('Secure Boot status UNKNOWN')
|
||||||
raise SecureBootUnknownError
|
raise SecureBootUnknownError
|
||||||
else:
|
else:
|
||||||
if boot_mode != 'UEFI':
|
if boot_mode != 'UEFI':
|
||||||
|
if (show_alert and
|
||||||
|
global_vars['OS']['Version'] in ('8', '8.1', '10')):
|
||||||
|
# OS supports Secure Boot
|
||||||
|
show_alert_box('Secure Boot DISABLED\n\nOS installed LEGACY')
|
||||||
raise OSInstalledLegacyError
|
raise OSInstalledLegacyError
|
||||||
else:
|
else:
|
||||||
# Check error message
|
# Check error message
|
||||||
err = result.stderr.decode()
|
err = result.stderr.decode()
|
||||||
if 'Cmdlet not supported' in err:
|
if 'Cmdlet not supported' in err:
|
||||||
|
if show_alert:
|
||||||
|
show_alert_box('Secure Boot UNAVAILABLE?')
|
||||||
raise SecureBootNotAvailError
|
raise SecureBootNotAvailError
|
||||||
else:
|
else:
|
||||||
|
if show_alert:
|
||||||
|
show_alert_box('Secure Boot ERROR')
|
||||||
raise GenericError
|
raise GenericError
|
||||||
|
|
||||||
def get_boot_mode():
|
def get_boot_mode():
|
||||||
|
|
@ -170,5 +182,10 @@ def run_rkill():
|
||||||
dest = non_clobber_rename(dest)
|
dest = non_clobber_rename(dest)
|
||||||
shutil.move(item.path, dest)
|
shutil.move(item.path, dest)
|
||||||
|
|
||||||
|
def show_alert_box(message, title='Wizard Kit Warning'):
|
||||||
|
"""Show Windows alert box with message."""
|
||||||
|
message_box = ctypes.windll.user32.MessageBoxW
|
||||||
|
message_box(None, message, title, 0x00001030)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("This file is not meant to be called directly.")
|
print("This file is not meant to be called directly.")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue