diff -r 0e09d845eb00 -r 654696eeebe8 Hardware/SMBIOS/SMBIOSGroup.cs --- a/Hardware/SMBIOS/SMBIOSGroup.cs Tue Feb 09 19:42:33 2010 +0000 +++ b/Hardware/SMBIOS/SMBIOSGroup.cs Thu Feb 11 13:22:17 2010 +0000 @@ -56,34 +56,34 @@ return; List structureList = new List(); - + try { ManagementObjectCollection collection = new ManagementObjectSearcher( "root\\WMI", "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables").Get(); - + byte[] raw = null; foreach (ManagementObject mo in collection) { raw = (byte[])mo["SMBiosData"]; break; - } - + } + if (raw != null && raw.Length > 0) { int offset = 0; byte type = raw[offset]; while (offset < raw.Length && type != 127) { - + type = raw[offset]; offset++; int length = raw[offset]; offset++; - ushort handle = (ushort)((raw[offset] << 8) | raw[offset + 1]); + ushort handle = (ushort)((raw[offset] << 8) | raw[offset + 1]); offset += 2; - + byte[] data = new byte[length]; Array.Copy(raw, offset - 4, data, 0, length); offset += length - 4; - + List stringsList = new List(); if (raw[offset] == 0) offset++; - while (raw[offset] != 0) { + while (raw[offset] != 0) { StringBuilder sb = new StringBuilder(); while (raw[offset] != 0) { sb.Append((char)raw[offset]); offset++; @@ -105,7 +105,7 @@ } } } - } catch (NotImplementedException) { } + } catch (NotImplementedException) { } catch (ManagementException) { } table = structureList.ToArray(); }