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:
1 parent
0db42de77e
commit
78b70e1ab9
11 files changed
+278
-8
No files matched your search
+14
-1
@@ -4,6 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static WineAccessHookExclusions hookExclusions;
|
||||
static WCHAR hookExclusionsValue[32767];
|
||||
|
||||
// Hook DLLs must match the application's architecture. This small PE host
|
||||
// supplies 32-bit menu/editor hooks without requiring 32-bit Linux GLib/Winelib.
|
||||
int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show) {
|
||||
@@ -16,6 +19,16 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show)
|
||||
if (!parentId || bridgeProcess != parentId) return 1;
|
||||
HANDLE parent = OpenProcess(SYNCHRONIZE, FALSE, parentId);
|
||||
if (!parent) return 1;
|
||||
// The parent helper publishes its --exclude-hook-program list here. An
|
||||
// unreadable list must not silently un-exclude a program: run no hooks.
|
||||
DWORD exclusionsLength = GetEnvironmentVariableW(
|
||||
L"WINE_ACCESS_EXCLUDE_HOOK_PROGRAMS", hookExclusionsValue, ARRAYSIZE(hookExclusionsValue));
|
||||
if (exclusionsLength >= ARRAYSIZE(hookExclusionsValue)) {
|
||||
fprintf(stderr, "wine-access: 32-bit hook exclusions unavailable\n");
|
||||
CloseHandle(parent);
|
||||
return 1;
|
||||
}
|
||||
if (exclusionsLength) wine_access_hook_exclusions_parse(&hookExclusions, hookExclusionsValue);
|
||||
|
||||
WCHAR path[4096] = {0};
|
||||
DWORD length = GetModuleFileNameW(NULL, path, 4096);
|
||||
@@ -31,7 +44,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show)
|
||||
HMODULE module = LoadLibraryW(path);
|
||||
HOOKPROC callback = module ? (HOOKPROC)GetProcAddress(module, "WineAccessMenuHook") : NULL;
|
||||
HOOKPROC inputCallback = module ? (HOOKPROC)GetProcAddress(module, "WineAccessInputHook") : NULL;
|
||||
WineAccessForegroundHooks hooks = {module, callback, inputCallback, NULL, NULL, 0};
|
||||
WineAccessForegroundHooks hooks = {module, callback, inputCallback, NULL, NULL, 0, &hookExclusions};
|
||||
if (!callback || !inputCallback)
|
||||
fprintf(stderr, "wine-access: 32-bit menu/editor hooks unavailable (error %lu)\n", GetLastError());
|
||||
if (callback && inputCallback) {
|
||||
|
||||
Reference in new issue
Block a user