fix: distinguish UIA dialog chrome from native consent controls
This commit is contained in:
1 parent
9806ef8f66
commit
99a708b40c
2 files changed
+61
-3
No files matched your search
@@ -161,13 +161,26 @@ def exact_prompt(snapshot):
|
||||
if (snapshot.phase != DialogPhase.PCB_STARTING or snapshot.process_name.casefold() != 'expeditionpcb.exe'
|
||||
or snapshot.process_role != 'pcb' or snapshot.window_class != '#32770' or snapshot.title != 'Expedition PCB'):
|
||||
return False
|
||||
buttons = [c for c in snapshot.controls if c.class_name == 'Button']
|
||||
static = [c for c in snapshot.controls if c.class_name == 'Static' and c.name.strip()]
|
||||
controls = []
|
||||
for control in snapshot.controls:
|
||||
self_window = (control.handle == snapshot.hwnd and control.control_id == 0
|
||||
and control.class_name == snapshot.window_class and control.name == snapshot.title
|
||||
and control.control_type == 'Window' and control.patterns == ('Window',))
|
||||
uia_chrome = (control.handle == 0 and control.control_id == 0
|
||||
and control.class_name == '' and control.automation_id == ''
|
||||
and not control.selected and not control.checked and (
|
||||
control.control_type == 'TitleBar' and control.name == '' and control.patterns == ('Value',)
|
||||
or control.control_type == 'Button' and not control.enabled
|
||||
and control.name in ('关闭', 'Close') and control.patterns == ('Invoke',)))
|
||||
if not self_window and not uia_chrome:
|
||||
controls.append(control)
|
||||
buttons = [c for c in controls if c.class_name == 'Button']
|
||||
static = [c for c in controls if c.class_name == 'Static' and c.name.strip()]
|
||||
return (len(buttons) == 2 and {c.control_id for c in buttons} == {6, 7}
|
||||
and all(c.enabled for c in buttons) and len(static) == 1 and static[0].control_id == 65535
|
||||
and ' '.join(static[0].name.split()) == ' '.join(PROMPT_TEXT.split())
|
||||
and all(c.class_name == 'Button' or c.class_name == 'Static' and c.control_id in (20, 65535)
|
||||
for c in snapshot.controls))
|
||||
for c in controls))
|
||||
|
||||
|
||||
def _validate_current_processes(job, prelaunch, target_pid, launcher_pid, worker_pid, companion_pids):
|
||||
|
||||
Reference in new issue
Block a user