Add native per-program hook exclusions

Parse --exclude-hook-program in the helper, gate foreground hooks and dialog reading by program, and forward the list to the 32-bit hook host. Emit the flags from the Orca extension and cover the matching, validation, and manager behavior with regression tests.
This commit is contained in:
hjozwiak committed 2026-11-01 21:15:59 -05:00
1 parent 0db42de77e
commit 78b70e1ab9
11 files changed
+278 -8

No files matched your search

+6 -1
View File
@@ -2,12 +2,14 @@
#pragma once
#include <windows.h>
#include "bootstrapper_hook.h"
#include "hook_exclusions.h"
typedef struct WineAccessForegroundHooks {
HMODULE module;
HOOKPROC menu_callback, input_callback;
HHOOK menu, input;
DWORD thread;
const WineAccessHookExclusions *exclusions;
} WineAccessForegroundHooks;
static inline void wine_access_release_hooks(WineAccessForegroundHooks *hooks) {
@@ -26,8 +28,11 @@ static inline void wine_access_update_hooks(WineAccessForegroundHooks *hooks, BO
HANDLE process = pid ? OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid) : NULL;
BOOL wow64 = FALSE;
BOOL known = process && IsWow64Process(process, &wow64);
// An excluded program's thread never receives the hooks; its controller
// speech does not need them and its anti-tamper code may object to them.
BOOL excluded = process && wine_access_process_hook_excluded(hooks->exclusions, process);
if (process) CloseHandle(process);
if (!known || wow64 != target_wow64) thread = 0;
if (!known || wow64 != target_wow64 || excluded) thread = 0;
if (thread == hooks->thread) return;
wine_access_release_hooks(hooks);
if (!thread || !hooks->menu_callback || !hooks->input_callback) return;