UIA NVDAObject's controllerFor property: catch KeyError seen on Windows 7 due to bad UIA client library marshalling and a limitation in comtypes.#14275
Merged
Conversation
…ws 7 due to bad UIA client library marshalling and a limitation in comtypes.
Contributor
Are you planning to report this against comtypes? |
Member
Author
|
Seems the comtypes project is aware of the limitation. See line 881 of
comtypes/automation.py,
In the _ctype_to_vartype dictionary:
```
# These are not yet implemented:
## POINTER(IUnknown): VT_UNKNOWN,
## POINTER(IDispatch): VT_DISPATCH,
}
```
|
seanbudd
approved these changes
Oct 20, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Fixes #14270
Summary of the issue:
when searching in the Windows 7 start menu or navigating in Windows 7 Explorer, the NVDA error sound is heard and the following traceback is printed to the log:
the KeyError is raised by comtypes as it does not know how to unpack a variant of type VT_Unknown | VT_Array.
However, the reason this variant is returned in the first place is because the UIA client library directly returns the provider's VT_Unknown | VT_Array variant on Windows 7, Which is useless for a client.
On Newer Windows versions, the client library correctly marshals this to IUIAutomationElementArray per the UI Automation documentation.
Description of user facing changes
No error sound is heard and traceback is only printed to the log at debugWarning.
Description of development approach
Catch KeyError when fetching the UIA_ControllerFor property.
An alternative could have been to limit the fetching of the controllerfor property to versions above Windows 7, but as official windows 7 UI automation documentation states that controllerFor is supported, it is unclear then as to exactly what versions are affected.
Testing strategy:
Known issues with pull request:
None known.
Change log entries:
None needed.
New features
Changes
Bug fixes
For Developers
Code Review Checklist: