Skip to content

Commit

Permalink
bpo-46638: Makes registry virtualisation setting stable when building…
Browse files Browse the repository at this point in the history
… MSIX packages (GH-31130)

(cherry picked from commit 3a5afc1)
  • Loading branch information
miss-islington committed Feb 7, 2022
1 parent 0d74efc commit 76b0727
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
@@ -0,0 +1,4 @@
Ensures registry virtualization is consistently disabled. For 3.10 and
earlier, it remains enabled (some registry writes are protected), while for
3.11 and later it is disabled (registry modifications affect all
applications).
14 changes: 11 additions & 3 deletions PC/layout/support/appxmanifest.py
Expand Up @@ -412,14 +412,22 @@ def get_appxmanifest(ns):
if value:
node.text = value

winver = sys.getwindowsversion()[:3]
try:
winver = tuple(int(i) for i in os.getenv("APPX_DATA_WINVER", "").split(".", maxsplit=3))
except (TypeError, ValueError):
winver = ()

# Default "known good" version is 10.0.22000, first Windows 11 release
winver = winver or (10, 0, 22000)

if winver < (10, 0, 17763):
winver = 10, 0, 17763
find_or_add(xml, "m:Dependencies/m:TargetDeviceFamily").set(
"MaxVersionTested", "{}.{}.{}.0".format(*winver)
"MaxVersionTested", "{}.{}.{}.{}".format(*(winver + (0, 0, 0, 0)[:4]))
)

if winver > (10, 0, 17763):
# Only for Python 3.11 and later. Older versions do not disable virtualization
if (VER_MAJOR, VER_MINOR) >= (3, 11) and winver > (10, 0, 17763):
disable_registry_virtualization(xml)

app = add_application(
Expand Down
2 changes: 1 addition & 1 deletion PC/layout/support/constants.py
Expand Up @@ -16,7 +16,7 @@ def _unpack_hexversion():
hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16)
except (TypeError, ValueError):
hexversion = sys.hexversion
return struct.pack(">i", sys.hexversion)
return struct.pack(">i", hexversion)


def _get_suffix(field4):
Expand Down

0 comments on commit 76b0727

Please sign in to comment.