Skip to content

EDR-7621 - Source the OS block from WMI instead of frozen registry values - #3

Open
Schogol wants to merge 1 commit into
carbonengine:masterfrom
Schogol:fix/os-block-wmi
Open

EDR-7621 - Source the OS block from WMI instead of frozen registry values#3
Schogol wants to merge 1 commit into
carbonengine:masterfrom
Schogol:fix/os-block-wmi

Conversation

@Schogol

@Schogol Schogol commented Aug 9, 2026

Copy link
Copy Markdown

Disclaimer: This fix was created using Claude

The Issue

The {OS} block in pdmdata.txt reports stale values on Windows 11. On a Windows 11 machine (build 26200):
{OS}
TYPE : Windows
NAME : Windows 10 Pro <- should be "Windows 11 Pro"
BITNESS : x64
MAJOR_VERSION : 10
MINOR_VERSION : 0
BUILD_NUMBER : 26200
KERNEL_VERSION : 6.3 <- should be "10.0"

Two fields are wrong: NAME reads "Windows 10 Pro", and KERNEL_VERSION reads "6.3".

The Cause

Both fields were read directly from legacy values under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion that Windows does not update on Windows 11:

  • NAME came from ProductName, which reads "Windows 10 ..." on Windows 11 (both fresh installs and upgrades).

  • KERNEL_VERSION came from CurrentVersion, which reads "6.3" - the value has not changed since Windows 8.1.

Neither reflects the true current OS. MAJOR_VERSION/MINOR_VERSION (10/0) are correct but do not distinguish Windows 10 from 11 (both are NT 10.0); the reliable discriminators are the build number (CurrentBuild >= 22000 = Windows 11) and WMI. The same values flow into every consumer: the gatherer builds the OS block from these getters, and pdm-proto-wrapper forwards them into its protobuf (os.name / version fields) for the launcher.

The Fix

Source the OS block from a single, cached Win32_OperatingSystem WMI query (Caption, Version, BuildNumber) and feed NAME, MAJOR/MINOR/BUILD, and KERNEL_VERSION from it; strip the leading "Microsoft " from Caption to keep the prior NAME format. Each field falls back to its registry value if WMI is unavailable. WMI reports the true current OS, so NAME becomes "Windows 11 Pro" and KERNEL_VERSION "10.0". Win32/registry paths are kept for all other data (WMI is only used where the registry value is wrong).Verification (Windows 11, build 26200)

The full pdm library + pdmCLI build succeeds; the rebuilt pdmCLI emits NAME = Windows 11 Pro, KERNEL_VERSION = 10.0, MAJOR/MINOR/BUILD = 10/0/26200.

The module's gtest suite passes 7/7, including Unicode.DataIsValidUTF8, which validates the emitted OS strings.

grafik

The OS fields were read from HKLM\...\CurrentVersion registry values, two
of which Windows freezes and never updates: ProductName stays "Windows 10
..." and CurrentVersion stays "6.3" on Windows 10/11. So NAME was reported
as "Windows 10 Pro" and KERNEL_VERSION as "6.3" on Windows 11.

Query Win32_OperatingSystem once (Caption, Version, BuildNumber) and feed
NAME, MAJOR/MINOR/BUILD and KERNEL_VERSION from it; NAME strips the leading
"Microsoft " to keep the prior format. The result is cached in a single
query, and each field falls back to its registry value when WMI is
unavailable.
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.

1 participant