Update OS version sections to support Windows 11
This commit is contained in:
parent
dc2c9955e6
commit
a9581c9152
1 changed files with 16 additions and 8 deletions
|
|
@ -68,14 +68,24 @@ KNOWN_HIVE_NAMES = {
|
||||||
winreg.HKEY_LOCAL_MACHINE: 'HKLM',
|
winreg.HKEY_LOCAL_MACHINE: 'HKLM',
|
||||||
winreg.HKEY_USERS: 'HKU',
|
winreg.HKEY_USERS: 'HKU',
|
||||||
}
|
}
|
||||||
OS_VERSION = platform.win32_ver()[0]
|
|
||||||
OS_VERSION = 8.1 if OS_VERSION == '8.1' else int(OS_VERSION)
|
|
||||||
RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory
|
RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory
|
||||||
RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory
|
RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory
|
||||||
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
|
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
|
||||||
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
|
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
|
||||||
SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE')
|
SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE')
|
||||||
|
|
||||||
|
# STATIC OS VARIABLES
|
||||||
|
WIN32_VER = platform.win32_ver()
|
||||||
|
OS_BUILD_VERSION_FULL = WIN32_VER[1]
|
||||||
|
OS_BUILD_VERSION = int(OS_BUILD_VERSION_FULL.split('.')[2])
|
||||||
|
PLATFORM_VER = WIN32_VER[0]
|
||||||
|
if PLATFORM_VER == '8.1':
|
||||||
|
OS_VERSION = 8.1
|
||||||
|
elif OS_BUILD_VERSION >= 22000:
|
||||||
|
OS_VERSION = 11
|
||||||
|
else:
|
||||||
|
OS_VERSION = int(PLATFORM_VER)
|
||||||
|
|
||||||
|
|
||||||
# Activation Functions
|
# Activation Functions
|
||||||
def activate_with_bios():
|
def activate_with_bios():
|
||||||
|
|
@ -267,21 +277,19 @@ def get_os_name(as_list=False, check=True):
|
||||||
outdated or unsupported.
|
outdated or unsupported.
|
||||||
"""
|
"""
|
||||||
key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
||||||
build_version = int(reg_read_value("HKLM", key, "CurrentBuild"))
|
details = WINDOWS_BUILDS.get(OS_BUILD_VERSION_FULL, f'Build {OS_BUILD_VERSION}')
|
||||||
build_version_full = platform.win32_ver()[1]
|
|
||||||
details = WINDOWS_BUILDS.get(build_version_full, f'Build {build_version}')
|
|
||||||
display_name = (
|
display_name = (
|
||||||
f'{reg_read_value("HKLM", key, "ProductName")} {ARCH}-bit {details}'
|
f'{reg_read_value("HKLM", key, "ProductName")} {ARCH}-bit {details}'
|
||||||
)
|
)
|
||||||
if build_version >= 22000:
|
if OS_BUILD_VERSION >= 22000:
|
||||||
display_name = display_name.replace('Windows 10', 'Windows 11')
|
display_name = display_name.replace('Windows 10', 'Windows 11')
|
||||||
|
|
||||||
# Check for support issues
|
# Check for support issues
|
||||||
if check:
|
if check:
|
||||||
if build_version in OUTDATED_BUILD_NUMBERS:
|
if OS_BUILD_VERSION in OUTDATED_BUILD_NUMBERS:
|
||||||
raise GenericWarning(f'{display_name} (outdated)')
|
raise GenericWarning(f'{display_name} (outdated)')
|
||||||
|
|
||||||
if build_version < OLDEST_SUPPORTED_BUILD:
|
if OS_BUILD_VERSION < OLDEST_SUPPORTED_BUILD:
|
||||||
raise GenericError(f'{display_name} (unsupported)')
|
raise GenericError(f'{display_name} (unsupported)')
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue