Skip to content

Use devenv app module for SQL Server Management Studio #18176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions source/appModuleHandler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Patrick Zajda, Joseph Lee,
# Copyright (C) 2006-2025 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Patrick Zajda, Joseph Lee,
# Babbage B.V., Mozilla Corporation, Julien Cochuyt, Leonard de Ruijter, Cyrille Bougot
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
Expand Down Expand Up @@ -489,10 +489,10 @@ def __init__(self, processID, appName=None):

self._inprocRegistrationHandle = None

def _getExecutableFileInfo(self):
# Used for obtaining file name and version for the executable.
# This is needed in case immersive app package returns an error,
# dealing with a native app, or a converted desktop app.
processExecutablePath: str
"""The path to the executable of the current process."""

def _get_processExecutablePath(self) -> str:
# Create the buffer to get the executable name
exeFileName = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
length = ctypes.wintypes.DWORD(ctypes.wintypes.MAX_PATH)
Expand All @@ -503,8 +503,13 @@ def _getExecutableFileInfo(self):
ctypes.byref(length),
):
raise ctypes.WinError()
fileName = exeFileName.value
fileinfo = getFileVersionInfo(fileName, "ProductName", "ProductVersion")
return exeFileName.value

def _getExecutableFileInfo(self):
# Used for obtaining file name and version for the executable.
# This is needed in case immersive app package returns an error,
# dealing with a native app, or a converted desktop app.
fileinfo = getFileVersionInfo(self.processExecutablePath, "ProductName", "ProductVersion")
return (fileinfo["ProductName"], fileinfo["ProductVersion"])

def _getImmersivePackageInfo(self):
Expand Down
8 changes: 5 additions & 3 deletions source/appModules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2009-2024 NV Access Limited, Łukasz Golonka, Joseph Lee
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
# Copyright (C) 2009-2025 NV Access Limited, Łukasz Golonka, Joseph Lee, Leonard de Ruijter
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.


EXECUTABLE_NAMES_TO_APP_MODS: dict[str, str] = {
Expand Down Expand Up @@ -43,6 +43,8 @@
# Spring Tool Suite is based on Eclipse and should use its appModule.
"springtoolsuite4": "eclipse",
"sts": "eclipse",
# Microsoft SQL Server Management Studio is based on Visual Studio
"ssms": "devenv",
# Various versions of Teamtalk.
"teamtalk3": "teamtalk4classic",
# App module for Windows 10/11 Modern Keyboard aka new touch keyboard panel
Expand Down
18 changes: 15 additions & 3 deletions source/appModules/devenv.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2010-2025 NV Access Limited, Soronel Haetir, Babbage B.V., Francisco Del Roio,
# Leonard de Ruijter
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2010-2022 NV Access Limited, Soronel Haetir, Babbage B.V., Francisco Del Roio,
# Leonard de Ruijter

"""App module for Microsoft Visual Studio and Microsoft SQL Server Management Studio."""

import os.path
import objbase
import comtypes
from locationHelper import RectLTWH
from logHandler import log
import textInfos.offsets

from fileUtils import getFileVersionInfo
from NVDAObjects.behaviors import EditableText, EditableTextWithoutAutoSelectDetection
from NVDAObjects.window import Window
from comtypes.automation import IDispatch
Expand Down Expand Up @@ -40,7 +44,15 @@ class AppModule(appModuleHandler.AppModule):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._DTECache = {}
vsMajor, vsMinor, rest = self.productVersion.split(".", 2)
slnDllPath = os.path.join(os.path.dirname(self.processExecutablePath), "vssln.dll")
if self.appName.lower() == "ssms" and os.path.exists(slnDllPath):
# Use the underlying Visual Studio version number,
# Not the SQL Server Management Studio version number.
fileinfo = getFileVersionInfo(slnDllPath, "ProductVersion")
productVersion = fileinfo["ProductVersion"]
else:
productVersion = self.productVersion
vsMajor, vsMinor, rest = productVersion.split(".", 2)
self.vsMajor, self.vsMinor = int(vsMajor), int(vsMinor)

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
Expand Down
2 changes: 2 additions & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* In Microsoft Word, when UIA is enabled, NVDA will no longer braille redundant table end markers when the cursor is in a table cell. (#15828, @LeonarddeR)
* In Geekbench 6.4, NVDA can again read the ribbon and options within. (#17892, @mzanm)
* NVDA no longer fails to read check list items in Microsoft Loop when viewed in Google Chrome / Microsoft Edge. (#18130)
* NVDA now respects its line number reporting setting in Microsoft SQL Server Management Studio 21. (#18176, @LeonarddeR)

### Changes for Developers

Expand All @@ -27,6 +28,7 @@ Please refer to [the developer guide](https://www.nvaccess.org/files/nvda/docume
* NVDA now uses [uv](https://docs.astral.sh/uv/) as Python package/project manager. (#17935, #17978, @LeonarddeR)
* Running `scons` from the source repository will automatically suggest a strategy to install uv when it is not yet available.
* Added the "externalPythonDependencies" category as an extra debug logging category. When enabled, debug logging messages from external dependencies (such as comtypes) will be delivered to NVDA's log. (#18067, @LeonarddeR)
* Microsoft SQL Server Management Studio now uses the Visual Studio app module, as SSMS is based on Visual Studio. (#18176, @LeonarddeR)

#### Deprecations

Expand Down