Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 854
    • Issues 854
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 48
    • Merge requests 48
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !2351

gutils.c: Improve g_get_os_info() for Windows 10/Server 2008 R2+

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Chun-wei Fan requested to merge improve-win32-version into main Nov 22, 2021
  • Overview 3
  • Commits 3
  • Pipelines 2
  • Changes 3

Hi,

In issue #2443 (closed) it was pointed out that we aren't showing the right info for Windows 11 (and Windows 10/Server 2019 releases after 20H2, so this MR attempts to improve things by:

  • Reducing the calls to RtlGetVersion() to at most once whenever GLib is used in a program, since that should be all that is necessary (we won't get different results from it on the same running system). This will reduce the number of times that we need to go through LoadLibrary()/GetProcAddress() on non-UWP code as well.

  • Make the OSVERSIONINFOEXW that we get from RtlGetVersion() reusable, as we want to check for more fine-grained items like the build number, so that we can distinguish between Windows 10 or 11, and between Windows Server 2016 or 2019 or 2022. This means g_get_os_info() will tell us that we are on Windows 11 instead of Windows 10, and Windows Server 2016/2019/2022 instead of Windows 10 Server.

  • Look again in the registry to find the right Windows 10 update to display since ReleaseId was superseded by DisplayVersion since Windows 10/Server 2019 20H2 and later.

  • Also, improve the info shown when running on Windows Server 2008 R2 and later, so that instead of Windows 7/8/8.1 Server we now have Windows Server 2008 R2/2012/2012 R2 respectively.

This should fix issue #2443 (closed), and might fit into the glib-2-70 branch as well.

With blessings, thank you!

Edited Nov 22, 2021 by Chun-wei Fan
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: improve-win32-version