//go:build windows
// +build windows

package machineid

import (
	"golang.org/x/sys/windows/registry"
)

func getMachineID() (s string, err error) {
	var (
		key registry.Key
	)
	if key, err = registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`, registry.QUERY_VALUE|registry.WOW64_64KEY); err != nil {
		return
	}
	defer func() {
		_ = key.Close()
	}()
	s, _, err = key.GetStringValue("MachineGuid")
	return
}
