Fix app module loading when no process handle can be fetched#18833
Conversation
|
@LeonarddeR have you/do you plan to test this with 64 bit builds of NVDA? |
|
I can pretty easily test this from x64 source, yes. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where NVDA was unable to retrieve information for applications when the standard process handle acquisition fails. The fix implements a fallback mechanism that searches for windows belonging to the problematic process and derives a process handle from those windows.
Key changes:
- Added a fallback mechanism using window enumeration when direct process handle acquisition fails
- Improved error handling in process handle acquisition functions
- Enhanced app module loading robustness for applications like 1Password
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| user_docs/en/changes.md | Documents the bug fix in the changelog |
| source/winUser.py | Adds utility function for finding top-level windows by predicate |
| source/winKernel.py | Improves error handling in openProcess function |
| source/winBindings/user32.py | Adds Windows API bindings for window enumeration |
| source/oleacc.py | Updates function signature and improves error handling |
| source/appModuleHandler.py | Implements the main fallback logic for process handle acquisition |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
I have been able to test this on X64 and it seems to work well for 1password. I'm receiving some debug warnings about csrss.exe though. However, I don't see why NVDA needs an app module for csrss.exe at all. |
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
Fixes #18859 Related to #18870 Summary of the issue: Since winBindings and #18833, NVDA spits continuous debug warnings about the inability to get a process handle for csrss.exe Description of user facing changes: No errors. Description of developer facing changes: None Description of development approach: Create a csrss appModule that always assumes csrss.exe to be alive. CSRSS is an essential GUI process, therefore it can safely be considered always alive. It hosts the desktop object. Before winBindings, the app module was also assumed always alive due to an obfuscated bug.
Link to issue number:
Fixes #18826
Summary of the issue:
NVDA sometimes can't get a process handle for an app module reliably.
Description of user facing changes:
Oo some systems, no longer an error on every focus events for some apps, particularly 1Password.
Description of developer facing changes:
NOne
Description of development approach:
When no process handle can be fetched the regular way, enumerate all top level windows until a window is found that belongs to the process, then call
oleacc.GetProcessHandleFromHwndto create a handle.Testing strategy:
Tested str from #18826
Known issues with pull request:
Still a bit rough, gathering feedback before continuing
Code Review Checklist:
-x[ ] Security precautions taken.