Skip to content

Commit 2843e70

Browse files
authored
Include Text Object Model 2 in comInterfaces.tom (#20987)
Discovered while working on #20982. Part of #20788. Summary of the issue: NVDA generates comInterfaces.tom from the Text Object Model type library that is registered in Windows. That registration points at riched20.dll, whose copy only has the original Text Object Model. The Text Object Model 2 interfaces and constants are missing. Description of user facing changes: None. Description of developer facing changes: comInterfaces.tom now includes the Text Object Model 2 interfaces and constants. Some symbols in comInterfaces.tom change: ITextDocument2 is now the Text Object Model 2 interface. The older interface of that name is gone. ITextMsgFilter, tomAlignGlyphs, tomAlignSnapGrid and tomMatchFontCharset are gone. Developers with an existing build need to run git clean -fdX source/comInterfaces. comtypes reuses a generated module that already exists, so the old module stays otherwise. Description of development approach: msftedit.dll embeds its own copy of the Text Object Model type library. It has the same GUID and version as the copy in riched20.dll, and it adds the Text Object Model 2 interfaces and constants. The build now passes the path of msftedit.dll to comtypes instead of the GUID. The generated module names stay the same, so comInterfaces.tom keeps working for existing code. Windows has shipped Text Object Model 2 in msftedit.dll since Windows 8, so every supported Windows version and build machine has it. The list of breaking changes comes from comparing every symbol in both type libraries. NVDA itself uses none of the removed or changed symbols.
1 parent 763c914 commit 2843e70

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

‎source/comInterfaces_sconscript‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
#!/usr/bin/env python3
2-
###
3-
# This file is a part of the NVDA project.
4-
# URL: http://www.nvda-project.org/
5-
# Copyright 2013-2017 NV Access Limited.
6-
# This program is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License version 2.0, as published by
8-
# the Free Software Foundation.
9-
# This program is distributed in the hope that it will be useful,
10-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12-
# This license can be found at:
13-
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
14-
###
15-
from collections.abc import Callable # noqa: I001
2+
# A part of NonVisual Desktop Access (NVDA)
3+
# Copyright (C) 2013-2026 NV Access Limited, Leonard de Ruijter
4+
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
5+
# For full terms and any additional permissions, see the NVDA license file: https://github.com/nvaccess/nvda/blob/master/copying.txt
6+
7+
import os
168
import re
9+
from collections.abc import Callable
10+
1711
from SCons.Node.FS import File
1812

1913
Import(
@@ -140,7 +134,7 @@ COM_INTERFACES = {
140134
"ISimpleDOM.py": "typelibs/ISimpleDOMNode.tlb",
141135
"Scripting.py": ("{420B2830-E718-11CF-893D-00A0C9054228}", 1, 0), # Used for browseable messages
142136
"Accessibility.py": ("{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}", 1, 0),
143-
"tom.py": ("{8CC497C9-A1DF-11CE-8098-00AA0047BE5D}", 1, 0),
137+
"tom.py": os.path.join(os.environ["SYSTEMROOT"], "System32", "msftedit.dll"),
144138
"SpeechLib.py": ("{C866CA3A-32F7-11D2-9602-00C04F8EE628}", 5, 0),
145139
"AcrobatAccessLib.py": "typelibs/AcrobatAccess.tlb",
146140
# As long as GitHub Actions is on a Windows version that has an acceptable version of UIAutomationClient,

‎user_docs/en/changes.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ A read completing on the same handle no longer ends the wait while the write is
6868
* The `speech.extensions.pre_speech` extension point now receives an `originalSpeechSequence` keyword argument containing the sequence passed to `speech.speak` before filtering.
6969
Existing handlers which only accept `speechSequence` remain compatible. (#20766, @cary-rowen)
7070
* `speech.speech.getSpellingSpeech` and `speech.shortcutKeys.shouldUseSpellingFunctionality` now only use spelling functionality if the active synthesizer declares support for `CharacterModeCommand` in its `supportedCommands`. (#20831)
71+
* `comInterfaces.tom` is now generated from the Text Object Model type library in `msftedit.dll`. (#20987, @LeonarddeR)
7172

7273
#### API Breaking Changes
7374

@@ -80,6 +81,10 @@ Refer to the [wxPython changelog](https://github.com/wxWidgets/Phoenix/blob/wxPy
8081
* The following symbols have been removed from `winKernel` with no replacement: `PROCESS_ALL_ACCESS`, `PROCESS_VM_OPERATION`, `PROCESS_VM_READ` and `PROCESS_VM_WRITE`. (#20836)
8182
* `config.isAppX` has been removed with no replacement, as support for running NVDA as a Windows Store application has been removed. (#18799, #20681, @makhlwf)
8283
* `gui.blockAction.Context.WINDOWS_STORE_VERSION` has been removed with no replacement. (#18799, #20681, @makhlwf)
84+
* Some symbols in `comInterfaces.tom` have changed, as it is now generated from the type library in `msftedit.dll`: (#20987, @LeonarddeR)
85+
* `ITextDocument2` is now the Text Object Model 2 interface.
86+
The interface previously available under this name has been removed with no replacement.
87+
* `ITextMsgFilter`, `tomAlignGlyphs`, `tomAlignSnapGrid` and `tomMatchFontCharset` have been removed with no replacement.
8388

8489
#### Deprecations
8590

0 commit comments

Comments
 (0)