Report hook exclusion count in ready record

Phase 1 of the Wine/Proton stage (decisions 5, 18): the helper ready record now carries hook_exclusions with the deduplicated stored exclusion count, so Cthulhu can confirm a helper applied the --exclude-hook-program flags it was sent. Older helpers without the field parse as zero.
This commit is contained in:
hjozwiak committed 2026-11-01 23:25:43 -05:00
1 parent 78b70e1ab9
commit 20d2169d56
3 files changed
+32 -1

No files matched your search

+2
View File
@@ -1383,11 +1383,13 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, char *, int) {
// Callback availability is distinct from foreground attachment. There may
// be no matching application when this startup snapshot is emitted.
std::fprintf(stderr, "wine-access: ready {\"reader\":\"%s\",\"controls_enabled\":%s,"
"\"hook_exclusions\":%d,"
"\"controller\":%s,\"review\":%s,\"msaa_worker\":%s,\"win_events\":%s,"
"\"menu_hook\":%s,\"input_hook\":%s,"
"\"menu_hook_available\":%s,\"input_hook_available\":%s,"
"\"host32_started\":%s,\"control_poll\":%s}\n",
readerEndpoint.busName, dialogReaderEnabled ? "true" : "false",
hookExclusions.count,
controllerActive ? "true" : "false", reviewActive ? "true" : "false",
msaaActive ? "true" : "false", hook ? "true" : "false",
foregroundHooks.menu ? "true" : "false", foregroundHooks.input ? "true" : "false",
+28 -1
View File
@@ -93,6 +93,7 @@ with wine_test_directory(prefix="wine-access-diagnostics-") as temporary:
for field in ("controls_enabled", "review", "msaa_worker", "win_events", "control_poll"):
assert ready[field], (field, ready)
assert not ready["controller"]
assert ready["hook_exclusions"] == 0, ready
for field in ("menu_hook_available", "input_hook_available", "host32_started"):
assert ready[field] == (not missingHooks), (field, ready)
# Hooks attach only to a matching foreground UI thread, which
@@ -112,8 +113,34 @@ with wine_test_directory(prefix="wine-access-diagnostics-") as temporary:
helper.terminate()
helper.wait(timeout=5)
helper = None
# Exclusion flags are counted in the ready record: duplicates
# collapse, invalid values are rejected and reported.
logPath = testDir / "exclusions.log"
with logPath.open("w") as diagnostics:
helper = subprocess.Popen(
[str(executable), "--no-controller",
"--exclude-hook-program", "Game.exe",
"--exclude-hook-program", "game.EXE",
"--exclude-hook-program", "Other Program.exe",
"--exclude-hook-program", "../bad.exe"],
env=env, stdout=subprocess.DEVNULL, stderr=diagnostics)
deadline = time.monotonic() + 5
while "wine-access: ready " not in logPath.read_text() and time.monotonic() < deadline:
while GLib.MainContext.default().iteration(False):
pass
assert helper.poll() is None, logPath.read_text()
time.sleep(0.01)
lines = logPath.read_text().splitlines()
ready = next(json.loads(line.removeprefix("wine-access: ready "))
for line in lines if line.startswith("wine-access: ready "))
assert ready["hook_exclusions"] == 2, ready
assert "wine-access: hook exclusions for 2 program(s)" in lines
assert "wine-access: ignoring invalid --exclude-hook-program value" in lines
helper.terminate()
helper.wait(timeout=5)
helper = None
finally:
subprocess.run(["wineserver", "-k"], env=env, timeout=10, check=False)
if helper is not None:
helper.wait(timeout=10)
print("PASS: version without reader/with singleton, unavailable reader, healthy and missing-hook startup")
print("PASS: version without reader/with singleton, unavailable reader, healthy and missing-hook startup, hook exclusion counts")
+2
View File
@@ -47,6 +47,8 @@ int main() {
oversized[WINE_ACCESS_MAX_HOOK_EXCLUSION_LENGTH] = 0;
ok &= check(wine_access_hook_exclusions_add(&exclusions, oversized.data()),
"maximum-size exclusion is accepted");
ok &= check(exclusions.count == 2,
"rejected exclusions do not change the stored count");
static WineAccessHookExclusions parsed;
const int added = wine_access_hook_exclusions_parse(