github.com/jaypipes/ghw@v0.21.1/pkg/bios/bios_windows.go (about)

     1  // Use and distribution licensed under the Apache license version 2.
     2  //
     3  // See the COPYING file in the root project directory for full text.
     4  //
     5  
     6  package bios
     7  
     8  import (
     9  	"github.com/yusufpapurcu/wmi"
    10  )
    11  
    12  const wqlBIOS = "SELECT InstallDate, Manufacturer, Version FROM CIM_BIOSElement"
    13  
    14  type win32BIOS struct {
    15  	InstallDate  *string
    16  	Manufacturer *string
    17  	Version      *string
    18  }
    19  
    20  func (i *Info) load() error {
    21  	// Getting data from WMI
    22  	var win32BIOSDescriptions []win32BIOS
    23  	if err := wmi.Query(wqlBIOS, &win32BIOSDescriptions); err != nil {
    24  		return err
    25  	}
    26  	if len(win32BIOSDescriptions) > 0 {
    27  		i.Vendor = *win32BIOSDescriptions[0].Manufacturer
    28  		i.Version = *win32BIOSDescriptions[0].Version
    29  		i.Date = *win32BIOSDescriptions[0].InstallDate
    30  	}
    31  	return nil
    32  }