diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index df82b9e5f2..8a912f493e 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -222,8 +222,7 @@ func verifyDaemonSettings(config *config.Config) error { func checkSystem() error { // Validate the OS version. Note that dockerd.exe must be manifested for this // call to return the correct version. - osv := system.GetOSVersion() - if osv.MajorVersion < 10 { + if osversion.Get().MajorVersion < 10 { return fmt.Errorf("This version of Windows does not support the docker daemon") } if osversion.Build() < osversion.RS1 { diff --git a/pkg/parsers/operatingsystem/operatingsystem_windows.go b/pkg/parsers/operatingsystem/operatingsystem_windows.go index a05bc76621..5d58eca4d8 100644 --- a/pkg/parsers/operatingsystem/operatingsystem_windows.go +++ b/pkg/parsers/operatingsystem/operatingsystem_windows.go @@ -3,7 +3,7 @@ package operatingsystem // import "github.com/docker/docker/pkg/parsers/operatin import ( "fmt" - "github.com/docker/docker/pkg/system" + "github.com/Microsoft/hcsshim/osversion" "golang.org/x/sys/windows/registry" ) @@ -52,7 +52,7 @@ func withCurrentVersionRegistryKey(f func(registry.Key) (string, error)) (string // GetOperatingSystemVersion gets the version of the current operating system, as a string. func GetOperatingSystemVersion() (string, error) { - version := system.GetOSVersion() + version := osversion.Get() return fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build), nil } diff --git a/pkg/system/syscall_windows.go b/pkg/system/syscall_windows.go index fceef5f9b7..e81fe3c300 100644 --- a/pkg/system/syscall_windows.go +++ b/pkg/system/syscall_windows.go @@ -87,8 +87,6 @@ func GetOSVersion() OSVersion { } // IsWindowsClient returns true if the SKU is client -// @engine maintainers - this function should not be removed or modified as it -// is used to enforce licensing restrictions on Windows. func IsWindowsClient() bool { osviex := &osVersionInfoEx{OSVersionInfoSize: 284} r1, _, err := procGetVersionExW.Call(uintptr(unsafe.Pointer(osviex))) @@ -102,7 +100,7 @@ func IsWindowsClient() bool { // Unmount is a platform-specific helper function to call // the unmount syscall. Not supported on Windows -func Unmount(dest string) error { +func Unmount(_ string) error { return nil } @@ -123,7 +121,7 @@ func CommandLineToArgv(commandLine string) ([]string, error) { newArgs := make([]string, argc) for i, v := range (*argv)[:argc] { - newArgs[i] = string(windows.UTF16ToString((*v)[:])) + newArgs[i] = windows.UTF16ToString((*v)[:]) } return newArgs, nil @@ -150,7 +148,7 @@ func GetSecurityDescriptorDacl(securityDescriptor *byte, daclPresent *uint32, da r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0) if r1 == 0 { if e1 != 0 { - result = syscall.Errno(e1) + result = e1 } else { result = syscall.EINVAL }