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
@@ -13,7 +13,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "wine_access"))
|
||||
|
||||
import manager as manager_module # noqa: E402
|
||||
from manager import (HelperManager, controller_only_arguments, # noqa: E402
|
||||
extra_helper_arguments, loader_for, prefix_for)
|
||||
excluded_hook_arguments, extra_helper_arguments,
|
||||
loader_for, prefix_for)
|
||||
|
||||
|
||||
class FakeProcess:
|
||||
@@ -125,6 +126,23 @@ class DiscoveryTests(unittest.TestCase):
|
||||
self.assertEqual(controller_only_arguments(set(), [], True),
|
||||
["--no-dialog-reader"])
|
||||
|
||||
def test_excluded_hook_arguments(self):
|
||||
self.assertEqual(excluded_hook_arguments([]), [])
|
||||
self.assertEqual(excluded_hook_arguments(None), [])
|
||||
self.assertEqual(
|
||||
excluded_hook_arguments(["Diablo IV.exe", "Game.EXE"]),
|
||||
["--exclude-hook-program", "diablo iv.exe",
|
||||
"--exclude-hook-program", "game.exe"])
|
||||
self.assertEqual(
|
||||
excluded_hook_arguments(("Game.EXE",)),
|
||||
["--exclude-hook-program", "game.exe"])
|
||||
|
||||
def test_excluded_hook_arguments_drop_invalid_names(self):
|
||||
listed = ["", "../Game.exe", r"C:\Game.exe", " Game.exe",
|
||||
"Game.exe ", "a" * 256, 7, "Valid.exe"]
|
||||
self.assertEqual(excluded_hook_arguments(listed),
|
||||
["--exclude-hook-program", "valid.exe"])
|
||||
|
||||
def test_discovery_collects_program_names(self):
|
||||
self.fake.add(17, "wine", {"WINEPREFIX": "/p/x"}, r"S:\games\Game.exe")
|
||||
self.fake.add(18, "wine", {"WINEPREFIX": "/p/x"}, r"S:\games\launcher.exe")
|
||||
|
||||
Reference in new issue
Block a user