Skip to content

And more winBindings#18860

Merged
SaschaCowley merged 24 commits into
masterfrom
moreWinBindings2
Sep 5, 2025
Merged

And more winBindings#18860
SaschaCowley merged 24 commits into
masterfrom
moreWinBindings2

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member
  • Add / use winBindings defintions for shlwapi.dll
  • Add / use winBindings definitions for GetDeviceCaps from gdi32.dll
  • Add / use winBindings definitions for mshtml.dll
  • Add / use winBindings required definitions for urlmon.dll
  • Add / use winBindings required definitions from wtsapi32.dll
  • Add / use winBindings required definitions from winmm.dll
  • Add / use winbindings defintions for CreateProcessAsUser and GetTokenInformation from advapi32.dll. Completing all required functions from this dll. Also moved STARTUPINFO and PROCESS_INFORMATION structures from winKernel to winBindings.advapi32
  • IAccessible NVDAObject: hardcode IID_ITextServices rather than looking it up in msftedi.dll. It never changes.
  • Add / use winBindings required definitions for version.dll
  • Add / use winBindings required defintions for shell32.dll. Move ShellExecutInfo structure from shlobj to winBindings.shell32.
  • Add / use all remaining winBindings definitions from gdi32.dll
  • Add / use winBindings required defintions for gdiplus.dll. Move some structures from wingdi.py to winBindings.gdiplus
  • Add deprecation handling for some moved structs

Link to issue number:

None.

Summary of the issue:

Raw ctypes calls may not be 64 bit compatible. They should be replaced.

Description of user facing changes:

None.

Description of development approach:

Replaced more raw ctyps calls with winBindings definitions.
With this PR and previous PRs, 146 functions have now been replaced, with 118 to go.

Testing strategy:

General smoke testing.

Known issues with pull request:

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Copilot AI review requested due to automatic review settings September 3, 2025 07:03
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 3, 2025 07:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR continues the ongoing effort to replace raw ctypes calls with properly typed winBindings definitions to improve 64-bit compatibility. The PR adds and utilizes winBindings definitions for multiple Windows DLLs including shlwapi, gdi32, mshtml, urlmon, wtsapi32, winmm, advapi32, version, shell32, and gdiplus.

Key changes include:

  • Addition of new winBindings modules for various Windows DLLs with proper function signatures and structures
  • Migration of existing code from raw ctypes calls to use the new winBindings definitions
  • Movement of some structures from legacy modules to winBindings with deprecation handling
  • Hardcoding of IID_ITextServices rather than dynamic lookup for better reliability

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
source/windowUtils.py Updates GetDeviceCaps call to use winBindings.gdi32
source/winKernel.py Moves STARTUPINFO/PROCESS_INFORMATION structures to winBindings.advapi32 with deprecation handling
source/winGDI.py Replaces GDI+ and GDI32 raw calls with winBindings equivalents and adds deprecation handling
source/winBindings/*.py New winBindings modules for various Windows DLLs with proper type definitions
source/visionEnhancementProviders/NVDAHighlighter.py Adds import for winBindings.gdi32
source/ui.py Updates mshtml and urlmon calls to use winBindings
source/systemUtils.py Updates advapi32 and shell32 calls to use winBindings
source/synthDrivers/sapi4.py Updates winmm calls to use winBindings
source/shlobj.py Updates shell32 calls to use winBindings with deprecation handling
source/shellapi.py Updates shell32 calls and moves structures to winBindings
source/screenBitmap.py Updates gdi32 calls to use winBindings
source/gui/installerGui.py Updates shell32 calls to use winBindings
source/fonts/init.py Updates gdi32 calls to use winBindings
source/fileUtils.py Updates version.dll calls to use winBindings
source/config/init.py Updates shell32 calls to use winBindings
source/NVDAObjects/window/excel.py Updates gdi32 calls to use winBindings
source/NVDAObjects/IAccessible/init.py Hardcodes IID_ITextServices instead of dynamic lookup
source/NVDAHelper/init.py Updates shlwapi calls and fixes CreateProcessAsUser call

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread source/NVDAHelper/__init__.py
Comment thread source/winBindings/gdiplus.py Outdated

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SaschaCowley Your extra changes all look good to me. Thanks for cleaning up my rather rough work. Re changing things like gdiplus to winBindings.gdiplus in wingdi.py: I went back and forth on this. I think what you have reads well and better handles deprecation handling. However, it is worth noting that there will then be an extra attribute lookup every time. Tiny per call, but can add up in the long run.

@SaschaCowley SaschaCowley enabled auto-merge (squash) September 5, 2025 00:09
@SaschaCowley SaschaCowley merged commit a70f307 into master Sep 5, 2025
39 of 40 checks passed
@SaschaCowley SaschaCowley deleted the moreWinBindings2 branch September 5, 2025 00:34
@github-actions github-actions Bot added this to the 2026.1 milestone Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants