Avoid crash when launching SDIO under Windows 11

This commit is contained in:
2Shirt 2024-06-12 19:26:15 -07:00
parent 97842e82f2
commit d00d625142
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 16 additions and 0 deletions

View file

@ -74,6 +74,14 @@ if __name__ == '__main__':
log_dir = wk.log.format_log_path(tool=True).parent
USE_NETWORK = False
# Windows 11 workaround
if wk.os.win.OS_VERSION == 11:
appid_services = ['appid', 'appidsvc', 'applockerfltr']
for svc in appid_services:
wk.os.win.stop_service(svc)
if any([wk.os.win.get_service_status(s) != 'stopped' for s in appid_services]):
raise wk.std.GenericWarning('Failed to stop AppID services')
# Try to mount server
try:
USE_NETWORK = use_network_sdio()

View file

@ -41,11 +41,13 @@ from wk.os.win import (
get_os_activation,
get_os_name,
get_raw_disks,
get_service_status,
get_volume_usage,
is_activated,
is_secure_boot_enabled,
reg_set_value,
reg_write_settings,
stop_service,
winget_check,
winget_import,
winget_upgrade,
@ -945,6 +947,12 @@ def open_microsoft_store_updates() -> None:
def open_snappy_driver_installer_origin() -> None:
"""Open Snappy Driver Installer Origin."""
if OS_VERSION == 11:
appid_services = ['appid', 'appidsvc', 'applockerfltr']
for svc in appid_services:
stop_service(svc)
if any([get_service_status(s) != 'stopped' for s in appid_services]):
raise GenericWarning('Failed to stop AppID services')
run_tool('SDIO', 'SDIO', cwd=True, pipe=True, popen=True)