Fixed Issue 138.
authormoel.mich
Sat, 13 Nov 2010 20:20:03 +0000
changeset 242881aedb94bc6
parent 241 52007c404f32
child 243 07a9329cd87c
Fixed Issue 138.
Hardware/Mainboard/SMBIOS.cs
     1.1 --- a/Hardware/Mainboard/SMBIOS.cs	Thu Nov 11 21:22:24 2010 +0000
     1.2 +++ b/Hardware/Mainboard/SMBIOS.cs	Sat Nov 13 20:20:03 2010 +0000
     1.3 @@ -48,6 +48,7 @@
     1.4      private readonly byte[] raw;
     1.5      private readonly Structure[] table;
     1.6  
     1.7 +    private readonly Version version;
     1.8      private readonly BIOSInformation biosInformation;
     1.9      private readonly BaseBoardInformation baseBoardInformation;
    1.10  
    1.11 @@ -84,19 +85,26 @@
    1.12          List<Structure> structureList = new List<Structure>();
    1.13  
    1.14          raw = null;
    1.15 +        byte majorVersion = 0;
    1.16 +        byte minorVersion = 0;
    1.17          try {
    1.18            ManagementObjectCollection collection;
    1.19            using (ManagementObjectSearcher searcher = 
    1.20              new ManagementObjectSearcher("root\\WMI", 
    1.21 -              "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables")) {
    1.22 +              "SELECT * FROM MSSMBios_RawSMBiosTables")) {
    1.23              collection = searcher.Get();
    1.24            }
    1.25           
    1.26            foreach (ManagementObject mo in collection) {
    1.27              raw = (byte[])mo["SMBiosData"];
    1.28 +            majorVersion = (byte)mo["SmbiosMajorVersion"];
    1.29 +            minorVersion = (byte)mo["SmbiosMinorVersion"];            
    1.30              break;
    1.31            }
    1.32          } catch { }
    1.33 +
    1.34 +        if (majorVersion > 0 || minorVersion > 0)
    1.35 +          version = new Version(majorVersion, minorVersion);
    1.36    
    1.37          if (raw != null && raw.Length > 0) {
    1.38            int offset = 0;
    1.39 @@ -147,6 +155,11 @@
    1.40      public string GetReport() {
    1.41        StringBuilder r = new StringBuilder();
    1.42  
    1.43 +      if (version != null) {
    1.44 +        r.Append("SMBIOS Version: "); r.AppendLine(version.ToString(2));
    1.45 +        r.AppendLine();
    1.46 +      }
    1.47 +
    1.48        if (BIOS != null) {
    1.49          r.Append("BIOS Vendor: "); r.AppendLine(BIOS.Vendor);
    1.50          r.Append("BIOS Version: "); r.AppendLine(BIOS.Version);