Skip to content

Conversation

@michaelDCurran
Copy link
Member

  • Add all remaining winBindings.kernel32 definitions. Actual calls not replaced yet.
  • Add all remaining required winBindings definitions for kernel32, and replace all raw ctypes calls. Also move some structures where required.

Link to issue number:

None.

Summary of the issue:

There are still many raw ctypes calls to kernel32 functions in the code base. These must be moved to winBindings, with correct definitions per Microsoft documentation to ensure accurate execution on 64 bit.

Description of user facing changes:

None.

Description of developer facing changes:

Description of development approach:

Add all required kernel32 definitions to winBindings, verifying each against Microsoft Documentation.
Replace the raw ctypes calls through out the code base with the winBindings definitions.
Any ctypes structures required by these definitions have also been moved to winBindings, and appropriate deprecation code added.

Testing strategy:

General smoke testing of an installed binary copy.

Known issues with pull request:

None known.

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 10, 2025 06:34
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 10, 2025 06:34
Copy link
Contributor

Copilot AI left a comment

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 moves all remaining kernel32 ctypes calls to the winBindings module. The purpose is to replace raw ctypes calls to kernel32 with properly defined functions in winBindings.kernel32, ensuring correct execution on 64-bit systems and providing better type safety.

Key changes include:

  • Adding comprehensive kernel32 function definitions to winBindings.kernel32
  • Replacing raw ctypes calls throughout the codebase with winBindings equivalents
  • Moving related structures (SYSTEMTIME, FILETIME, TIME_ZONE_INFORMATION, etc.) to winBindings.kernel32

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source/winBindings/kernel32.py Adds hundreds of kernel32 function definitions with proper type annotations and documentation
source/winKernel.py Replaces raw ctypes calls with winBindings equivalents and moves structures
source/languageHandler.py Updates locale-related function calls to use winBindings
source/wincon.py Replaces console API calls and moves structures
Various other files Updates scattered kernel32 calls throughout the codebase
Comments suppressed due to low confidence (1)

source/winBindings/kernel32.py:1

  • Extra space after 'PAPCFUNC' in the all tuple.
# A part of NonVisual Desktop Access (NVDA)

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

@SaschaCowley
Copy link
Member

Could you please also update changes.md? At present, the API changes I noted when reviewing were:

  • appModuleHandler.processEntry32W -> winBindings.kernel32.PROCESSENTRY32
  • winKernel.kernel32 -> winBindings.kernel32.dll
  • winKernel.SYSTEMTIME -> winBindings.kernel32.SYSTEMTIME
  • winKernel.FILETIME -> winBindings.kernel32.FILETIME
  • winKernel.TIME_ZONE_INFORMATION -> winBindings.kernel32.TIME_ZONE_INFORMATION
  • wincon.COORD -> winBindings.kernel32.COORD
  • wincon.CONSOLE_SCREEN_BUFFER_INFO -> winBindings.kernel32.CONSOLE_SCREEN_BUFFER_INFO
  • wincon.CONSOLE_SELECTION_INFO -> winBindings.kernel32.CONSOLE_SELECTION_INFO
  • wincon.CHAR_INFO-> winBindings.kernel32.CHAR_INFO
  • wincon.PHANDLER_ROUTINE -> winBindings.kernel32.PHANDLER_ROUTINE

michaelDCurran and others added 12 commits September 14, 2025 10:53
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…LAPPED_COMPLETION_ROUTINE to match Microsoft docs. Remove duplicate struct from hwIo.ioThread and deprecate as a moved symbol to winBindigns.kernel32.
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
…PCROUTINE, but it is optional. Unfortunablely ctypes does not allow this, so it must be c_void_p so the caller, such as in watchdog.py can pass in None.
Copy link
Member

@SaschaCowley SaschaCowley left a comment

Choose a reason for hiding this comment

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

A couple of small new things. Please note that the following comments remain unresolved:
source/winBindings/kernel32.py line 420
source/winBindings/kernel32.py line 455
source/wincon.py lines 11-14
source/wincon.py line 30

@michaelDCurran michaelDCurran merged commit 47e6cf5 into master Sep 15, 2025
38 of 40 checks passed
@michaelDCurran michaelDCurran deleted the kernel32 branch September 15, 2025 08:39
@github-actions github-actions bot added this to the 2026.1 milestone Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants