Check if activated before getting the BIOS key

This commit is contained in:
2Shirt 2021-09-27 20:48:55 -06:00
parent bc320b4d87
commit 528602d98e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -72,6 +72,11 @@ def activate_with_bios():
#####################################################
bios_key = None
table = b"MSDM"
# Check if activation is needed
if is_activated():
raise GenericWarning('System already activated')
# Get BIOS key
if acpi.FindAcpiTable(table) is True:
rawtable = acpi.GetAcpiTable(table)
#http://msdn.microsoft.com/library/windows/hardware/hh673514
@ -82,10 +87,6 @@ def activate_with_bios():
if not bios_key:
raise GenericError('BIOS key not found.')
# Check if activation is needed
if is_activated():
raise GenericWarning('System already activated')
# Install Key
cmd = ['cscript', '//nologo', SLMGR, '/ipk', bios_key]
run_program(cmd, check=False)