예제 #1
0
        public void GetTables()
        {
            int i = 8;
            while (i < m_dwLen)
            {
                SMBIOStable p_oTable = new SMBIOStable();
                p_oTable.m_bTableType = m_pbBIOSData[i];
                p_oTable.m_bFormattedSectionLength = m_pbBIOSData[i + 1];
                p_oTable.m_wHandle = BitConverter.ToInt16(m_pbBIOSData, i + 2);

                int wUnformattedSectionStart = i + p_oTable.m_bFormattedSectionLength;
                p_oTable.p_bFormattedSection = m_pbBIOSData.Skip(i).Take(p_oTable.m_bFormattedSectionLength).ToArray();

                for (int j = i + p_oTable.m_bFormattedSectionLength; ; j++)
                {
                    if ((m_pbBIOSData[j] == 0) && (m_pbBIOSData[j + 1] == 0))
                    {
                        p_oTable.p_bUnformattedSection = m_pbBIOSData.Skip(i + p_oTable.m_bFormattedSectionLength).Take(j - i - p_oTable.m_bFormattedSectionLength).ToArray();
                        i = j + 2;
                        break;
                    }
                }
                if (p_oTable.p_bUnformattedSection.Length > 0) p_oTable.p_sStrings = Encoding.ASCII.GetString(p_oTable.p_bUnformattedSection).Split('\0');
                p_oSMBIOStables.Add(p_oTable);
            }
            Console.WriteLine("SMBIOS " + m_byMajorVersion + "." + m_byMinorVersion + " present.");
            Console.WriteLine(p_oSMBIOStables.Count + " structures occupying " + m_dwLen + " bytes.");
        }
예제 #2
0
 public void ParseTable(SMBIOStable table)
 {
     Console.WriteLine("\nHandle " + table.m_wHandle + ", DMI type " + table.m_bTableType + ", " + table.m_bFormattedSectionLength + " bytes");
     switch (table.m_bTableType)
     {
         case 0: //BIOS
             Console.WriteLine("BIOS information");
             Console.WriteLine("\tVendor: " + table.p_sStrings[table.p_bFormattedSection[4] - 1]);
             Console.WriteLine("\tBIOS Version: " + table.p_sStrings[table.p_bFormattedSection[5] - 1]);
             Console.WriteLine("\tBIOS Release date: " + table.p_sStrings[table.p_bFormattedSection[8] - 1]);
             break;
         case 1: //System information
             Console.WriteLine("System information");
             Console.WriteLine("\tManufacturer: " + table.p_sStrings[table.p_bFormattedSection[4] - 1]);
             Console.WriteLine("\tProduct Name: " + table.p_sStrings[table.p_bFormattedSection[5] - 1]);
             Console.WriteLine("\tVersion: " + (table.p_bFormattedSection[6] != 0 ? table.p_sStrings[table.p_bFormattedSection[6] - 1] : ""));
             Console.WriteLine("\tSerial Number: " + table.p_sStrings[table.p_bFormattedSection[7] - 1]);
             Console.WriteLine("\tUUID: " + dmi_system_uuid(new ArraySegment<byte>(table.p_bFormattedSection, 8, 16).ToArray(), (ushort)(m_byMajorVersion + (m_byMinorVersion << 8))));
             Console.WriteLine("\tWake-up type: " + dmi_system_wake_up_type(table.p_bFormattedSection[24]));
             Console.WriteLine("\tSKU Number: " + (table.p_bFormattedSection[25] != 0 ? table.p_sStrings[table.p_bFormattedSection[25] - 1] : ""));
             Console.WriteLine("\tFamily: " + (table.p_bFormattedSection[26] != 0 ? table.p_sStrings[table.p_bFormattedSection[26] - 1] : ""));
             break;
         case 4: //Processor
             Console.WriteLine("Procesor information");
             Console.WriteLine("\tSocket Designation: " + table.p_sStrings[table.p_bFormattedSection[4] - 1]);
             Console.WriteLine("\tType: " + dmi_processor_type(table.p_bFormattedSection[5]));
             Console.WriteLine("\tFamily: " + dmi_processor_family(table.p_bFormattedSection[6]));
             Console.WriteLine("\tVoltage: " + dmi_processor_voltage(table.p_bFormattedSection[17]));
             Console.WriteLine("\tUpgrade: " + dmi_processor_upgrade(table.p_bFormattedSection[25]));
             break;
         case 9: //System slot
             Console.WriteLine("System slot information");
             Console.WriteLine("\tSlot designation: " + table.p_sStrings[table.p_bFormattedSection[4] - 1]);
             Console.WriteLine("\tSlot type: " + dmi_slot_type(table.p_bFormattedSection[5]));
             Console.WriteLine("\tSlot Data Bus Width: " + dmi_slot_bus_width(table.p_bFormattedSection[6]));
             Console.WriteLine("\tCurrent usage: " + dmi_slot_usage(table.p_bFormattedSection[7]));
             Console.WriteLine("\tSlot length: " + dmi_slot_length(table.p_bFormattedSection[8]));
             Console.WriteLine("\tSlot ID: " + dmi_slot_id(table.p_bFormattedSection[9], table.p_bFormattedSection[10], table.p_bFormattedSection[5]));
             Console.WriteLine("\tSlot Characteristics: " + dmi_slot_characteristics(table.p_bFormattedSection[11], table.p_bFormattedSection[12]));
             //Console.WriteLine("\tBus Address: " + table.p_bFormattedSection[13] + ":" + table.p_bFormattedSection[15] + ":" + table.p_bFormattedSection[16]);
             if (table.m_bFormattedSectionLength < 0x11) break;
             Console.WriteLine("\tBus Address: " + dmi_slot_segment_bus_func((ushort)(table.p_bFormattedSection[13] + (table.p_bFormattedSection[14] << 8)), table.p_bFormattedSection[15], table.p_bFormattedSection[16]));
             break;
         case 10: //On Board Devices Information
             Console.WriteLine("Onboard device information");
             Console.WriteLine(dmi_on_board_devices(new ArraySegment<byte>(table.p_bFormattedSection, 4, table.p_bFormattedSection.Length - 4).ToArray(), Convert.ToByte((table.p_bFormattedSection.Length - 4) / 2), table.p_sStrings));
             break;
         case 12: //System Configuration Options (Type 12)
             Console.WriteLine("System Configuration Options");
             Console.WriteLine(dmi_system_configuration_options(table.p_bFormattedSection[4], table.p_sStrings));
             break;
         case 13: //BIOS Language information
             Console.WriteLine("BIOS Language information");
             Console.WriteLine("\tAvailable Languages: " + dmi_bios_languages(table.p_bFormattedSection[4], table.p_sStrings));
             Console.WriteLine("\tLanguage format: " + dmi_bios_language_format(table.p_bFormattedSection[5]));
             Console.WriteLine("\tCurrent Language: " + table.p_sStrings[table.p_bFormattedSection[21] - 1]);
             break;
         case 21: //Built-in Pointing Device (Type 21)
             Console.WriteLine("Built-in Pointing Device");
             Console.WriteLine("\tType: " + dmi_pointing_device_type(table.p_bFormattedSection[4]));
             Console.WriteLine("\tInterface: " + dmi_pointing_device_interface(table.p_bFormattedSection[5]));
             Console.WriteLine("\tButtons: " + table.p_bFormattedSection[6]);
             break;
         case 24: //Hardware security (type 24)
             Console.WriteLine("Hardware Security");
             Console.WriteLine("\tPower-On Password Status: " + dmi_hardware_security_status((byte)(table.p_bFormattedSection[4] >> 6)));
             Console.WriteLine("\tKeyboard Password Status: " + dmi_hardware_security_status((byte)((table.p_bFormattedSection[4] >> 4) & 0x03)));
             Console.WriteLine("\tAdministrator Password Status: " + dmi_hardware_security_status((byte)((table.p_bFormattedSection[4] >> 2) & 0x03)));
             Console.WriteLine("\tFront Panel Reset Status: " + dmi_hardware_security_status((byte)(table.p_bFormattedSection[4] & 0x03)));
             break;
         default:
             Console.WriteLine("Unsupported table type.");
             break;
     }
 }