#!/usr/bin/env python3 """Build and include a Windows x86_64 runtime using the shared packaged catalog.""" import argparse import json import os from pathlib import Path import shutil import struct import subprocess import zipfile from assemble_runtime import checked_file, digest, iter_archive_files SYSTEM_DLLS = { "advapi32.dll", "bcrypt.dll", "bcryptprimitives.dll", "comdlg32.dll", "crypt32.dll", "dinput8.dll", "gdi32.dll", "hid.dll", "imm32.dll", "iphlpapi.dll", "kernel32.dll", "msvcrt.dll", "ntdll.dll", "ole32.dll", "oleaut32.dll", "powrprof.dll", "psapi.dll", "rpcrt4.dll", "secur32.dll", "setupapi.dll", "shell32.dll", "shlwapi.dll", "ucrtbase.dll", "user32.dll", "userenv.dll", "version.dll", "winmm.dll", "winspool.drv", "ws2_32.dll", } def pe_imports(path): """Read checked PE32+ headers and DLL imports without host-specific tools.""" payload = path.read_bytes() def u32(offset): return struct.unpack_from(" 13: if optional_size < 224 or any(struct.unpack_from("