From 528602d98e37e91ff425b3983d6c66c331c56058 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Mon, 27 Sep 2021 20:48:55 -0600 Subject: [PATCH] Check if activated before getting the BIOS key --- scripts/wk/os/win.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/wk/os/win.py b/scripts/wk/os/win.py index 82e768af..b32866ca 100644 --- a/scripts/wk/os/win.py +++ b/scripts/wk/os/win.py @@ -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)