Skip to content

fix(windows): report the running build as the kernel version - #295

Open
Shubham-Padkonde wants to merge 2 commits into
elastic:mainfrom
Shubham-Padkonde:fix/windows-kernel-version-from-registry
Open

Shubham-Padkonde wants to merge 2 commits into
elastic:mainfrom
Shubham-Padkonde:fix/windows-kernel-version-from-registry

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes #294.

KernelVersion() read the FileVersion of ntoskrnl.exe. Feature updates shipped as enablement packages change the OS build without replacing that file, so it reported the previous feature release.

It now composes <CurrentMajorVersionNumber>.<CurrentMinorVersionNumber>.<CurrentBuildNumber>.<UBR> from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion, the key OperatingSystem() already reads. If any of these values is missing (they exist since Windows 10), it falls back to the previous file-version lookup, so kernelExePath is kept for that path. The result no longer has the (WinBuild.160101.0800) suffix.

The machine I tested on reproduces the issue: before this change KernelVersion() returned 10.0.26100.9278 (WinBuild.160101.0800) while the running build is 26200.9278; with it, 10.0.26200.9278. The new TestKernelVersionMatchesRunningBuild compares the result with OperatingSystem() and fails before the change. The Windows provider tests pass (built with GOOS=windows, run on Windows 11), along with gofmt and go vet.

🤖 Generated with Claude Code

Shubham-Padkonde and others added 2 commits September 19, 2026 10:13
Feature updates delivered as enablement packages change the OS build
without replacing ntoskrnl.exe, so the file version of the kernel image
reported the previous feature release (e.g. 10.0.22621.x on a 22631
host). Read the version from the CurrentVersion registry key instead and
keep the file version as a fallback when the values are unavailable.

Fixes elastic#294

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

[windows] KernelVersion() reports the file version of ntoskrnl.exe, not the running OS build number

1 participant