28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
"""Exercise real PE callbacks in an isolated Wine prefix (both architectures)."""
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
from wine_test_environment import wine_test_directory
|
|
|
|
build = Path(sys.argv[1]).resolve()
|
|
with wine_test_directory(prefix="wine-access-hook-safety-") as temporary:
|
|
env = os.environ.copy()
|
|
env.update(WINEPREFIX=str(Path(temporary) / "prefix"), WINEDEBUG="-all",
|
|
WINEDLLOVERRIDES="mscoree,mshtml=", CTHULHU_WINE_ACCESS_MANAGED="1")
|
|
try:
|
|
subprocess.run(["wineboot", "-u"], env=env, check=True, timeout=45)
|
|
failed = False
|
|
for arch in (32, 64):
|
|
dll = build / ("wine-access-menu32.dll" if arch == 32 else "wine-access-menu.dll")
|
|
result = subprocess.run(["wine", str(build / f"hook-safety-fixture{arch}.exe"),
|
|
"Z:" + str(dll).replace("/", "\\")],
|
|
env=env, timeout=20)
|
|
print(f"{arch}-bit hook safety: exit {result.returncode}", flush=True)
|
|
failed |= result.returncode != 0
|
|
sys.exit(1 if failed else 0)
|
|
finally:
|
|
subprocess.run(["wineserver", "-k"], env=env, timeout=5)
|
|
subprocess.run(["wineserver", "-w"], env=env, timeout=5)
|