Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .changelog/201.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
HostInfo.NativeArchitecture is not available on Windows system prior Windows 10 version 1709.
```
11 changes: 11 additions & 0 deletions providers/windows/arch_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package windows

import (
"errors"

"golang.org/x/sys/windows"

gowindows "github.com/elastic/go-windows"
Expand All @@ -44,8 +46,17 @@ func NativeArchitecture() (string, error) {
// the pseudo handle doesn't need to be closed
var currentProcessHandle = windows.CurrentProcess()

// IsWow64Process2 was introduced in version 1709 (build 16299 acording to the tables)
// https://learn.microsoft.com/en-us/windows/release-health/release-information
// https://learn.microsoft.com/en-us/windows/release-health/windows-server-release-info
err := windows.IsWow64Process2(currentProcessHandle, &processMachine, &nativeMachine)
if err != nil {
if errors.Is(err, windows.ERROR_PROC_NOT_FOUND) {
major, minor, build := windows.RtlGetNtVersionNumbers()
if major < 10 || (major == 10 && minor == 0 && build < 16299) {
return "", nil
}
}
return "", err
}

Expand Down