github.com/uriddle/docker@v0.0.0-20210926094723-4072e6aeb013/pkg/system/syscall_windows.go (about)

     1  package system
     2  
     3  import (
     4  	"fmt"
     5  	"syscall"
     6  )
     7  
     8  // OSVersion is a wrapper for Windows version information
     9  // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx
    10  type OSVersion struct {
    11  	Version      uint32
    12  	MajorVersion uint8
    13  	MinorVersion uint8
    14  	Build        uint16
    15  }
    16  
    17  // GetOSVersion gets the operating system version on Windows. Note that
    18  // docker.exe must be manifested to get the correct version information.
    19  func GetOSVersion() (OSVersion, error) {
    20  	var err error
    21  	osv := OSVersion{}
    22  	osv.Version, err = syscall.GetVersion()
    23  	if err != nil {
    24  		return osv, fmt.Errorf("Failed to call GetVersion()")
    25  	}
    26  	osv.MajorVersion = uint8(osv.Version & 0xFF)
    27  	osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
    28  	osv.Build = uint16(osv.Version >> 16)
    29  	return osv, nil
    30  }
    31  
    32  // Unmount is a platform-specific helper function to call
    33  // the unmount syscall. Not supported on Windows
    34  func Unmount(dest string) error {
    35  	return nil
    36  }