Skip to content

[Win32] Add explicit supported OS version check and set to build 14393 #2054

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Apr 23, 2025

Currently, there is no explicit minimum version required for executing SWT applications. However, some versions are implicitly not supported anymore as library methods are linked that are not present in older OS versions. In addition, we still have some methods dynamically linked and their execution guarded by a version constraint for version that are out of support. In particular, this holds for every Windows version older than build 14393, which is the 1607 update for Windows 10 and the release of Windows Server 2016, the latter being the latest still supported server version of Windows except for the extended support of Windows Server 2012.

This change adds an explicit Windows version check at initialization to avoid that applications fail to start with incomprehensible linkage errors but a proper error message. It sets the minimum required Windows version to build 14393. To this end, it adds an additional SWT DLL only for retrieving the OS version, as the required Windows API call will no be executable on unsupported OS versions otherwise, as the ordinary SWT DLL will fail to load before executing the version check.

With that explicit minimum supported OS version for Windows, all code guards for older than the minimum supported Windows version became obsolete. This change removes those guards and those OS methods that became unused. It also makes those methods, whose calls are not version-guarded anymore, statically instead of dynamically linked. This fixes some issue with wrong values returned by the AdjustWindowRectExForDpi method when used via dynamic linking.

This change also adds a check for SWT libraries being loadable (in particular in terms of a matching OS) on startup for every OS.

See also #2026 (comment)

Supercedes and thus closes #2026

Fixes eclipse-platform/eclipse.platform.ui#2852

Fixes #2011

Note

As a follow-up change, I will remove the methods added to the OsVersion class from the OS class to reduce duplication.

Copy link
Contributor

github-actions bot commented Apr 23, 2025

Test Results

   539 files  ±0     539 suites  ±0   30m 48s ⏱️ -2s
 4 337 tests ±0   4 321 ✅ +1   15 💤 ±0  1 ❌  - 1 
16 601 runs  ±0  16 463 ✅ +1  137 💤 ±0  1 ❌  - 1 

For more details on these failures, see this check.

Results for commit 780d4b9. ± Comparison against base commit 28fdeb6.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the win32-explicit-version-check branch 2 times, most recently from 2bb2a2b to 9e2dbad Compare April 23, 2025 15:32
@HeikoKlare HeikoKlare marked this pull request as ready for review April 23, 2025 20:33
Currently, there is no explicit minimum version required for executing
SWT applications. However, some versions are implicitly not supported
anymore as library methods are linked that are not present in older OS
versions. In addition, we still have some methods dynamically linked and
their execution guarded by a version constraint for version that are out
of support. In particular, this holds for every Windows version older
than build 14393, which is the 1607 update for Windows 10 and the
release of Windows Server 2016, the latter being the latest still
supported server version of Windows except for the extended support of
Windows Server 2012.

This change adds an explicit Windows version check at initialization to
avoid that applications fail to start with incomprehensible linkage
errors but a proper error message. It sets the minimum required Windows
version to build 14393. To this end, it adds an additional SWT DLL only
for retrieving the OS version, as the required Windows API call will no
be executable on unsupported OS versions otherwise, as the ordinary SWT
DLL will fail to load before executing the version check.

This change also adds a check for SWT libraries being loadable (in
particular in terms of a matching OS) on startup for every OS.
…ipse-platform#2011

With introducing an explicit minimum supported OS version for Windows,
all code guards for older than the minimum supported Windows version
became obsolete.

This change removes those guards and those OS methods that became
unused. It also makes those methods, whose calls are not version-guarded
anymore, statically instead of dynamically linked. This fixes some issue
with wrong values returned by the AdjustWindowRectExForDpi method when
used via dynamic linking.

Fixes eclipse-platform/eclipse.platform.ui#2852

Fixes eclipse-platform#2011
@HeikoKlare HeikoKlare force-pushed the win32-explicit-version-check branch from a733d33 to 780d4b9 Compare April 24, 2025 17:01
Copy link
Contributor

@akoch-yatta akoch-yatta left a comment

Choose a reason for hiding this comment

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

Changes look good to me. I tested it locally with Win11 and it worked as expected. I tested the error case by adjusting the expected Windows version.

@fedejeanne
Copy link
Contributor

Failing test is unrelated: #2063

@HeikoKlare HeikoKlare marked this pull request as draft April 25, 2025 13:11
@HeikoKlare
Copy link
Contributor Author

This PR is ready, but I converted it back to draft just to indicate that it should not be merged right now, as this one requires a build of the natives, which is currently not possible without Jenkins being available. If we merged now, SWT master state would be broken for everyone checking it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants