Exemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        /// Gets the property collection for this structure.
        /// </summary>
        /// <param name="properties">Collection of properties of this structure.</param>
        protected override void Parse(SmbiosPropertiesTable properties)
        {
            #region validate parameter/s
            SentinelHelper.ArgumentNull(properties);
            #endregion

            #region versions
            var tpmCapabilityVendorIdEntry = GetTpmCapabilityVendorId(RawVendorId);
            properties.Add(DmiProperty.TpmDevice.VendorId, tpmCapabilityVendorIdEntry.ASCII);
            properties.Add(DmiProperty.TpmDevice.VendorIdDescription, tpmCapabilityVendorIdEntry.Description);
            properties.Add(DmiProperty.TpmDevice.MajorSpecVersion, MajorSpecVersion);
            properties.Add(DmiProperty.TpmDevice.MinorSpecVersion, MinorSpecVersion);

            var firmwareVersion = TpmFirmwareVersion.Unknown;
            if (MajorSpecVersion >= 0x01 && MajorSpecVersion <= 0x02)
            {
                firmwareVersion =
                    MajorSpecVersion == 0x01
                        ? TpmFirmwareVersion.Parse(RawFirmwareVersion1)
                        : new TpmFirmwareVersion {
                    MajorVersion = GetDoubleWord(0x0a), MinorVersion = GetDoubleWord(0x0e)
                };
            }

            properties.Add(DmiProperty.TpmDevice.FirmwareVersion, firmwareVersion);
            properties.Add(DmiProperty.TpmDevice.Description, DescriptionVersion2);
            properties.Add(DmiProperty.TpmDevice.Characteristics, GetTpmCharacteristics(Characteristics));
            properties.Add(DmiProperty.TpmDevice.OemDefined, OemDefined);
            #endregion
        }
        /// <inheritdoc/>
        /// <summary>
        /// Populates the property collection for this structure.
        /// </summary>
        /// <param name="properties">Collection of properties of this structure.</param>
        protected override void PopulateProperties(SmbiosPropertiesTable properties)
        {
            if (StructureInfo.StructureVersion < SmbiosStructureVersion.Latest)
            {
                return;
            }

            TpmCapabilityVendorId tpmCapabilityVendorIdEntry = GetTpmCapabilityVendorId(RawVendorId);

            properties.Add(SmbiosProperty.TpmDevice.VendorId, tpmCapabilityVendorIdEntry.ASCII);
            properties.Add(SmbiosProperty.TpmDevice.VendorIdDescription, tpmCapabilityVendorIdEntry.Description);
            properties.Add(SmbiosProperty.TpmDevice.MajorSpecVersion, MajorSpecVersion);
            properties.Add(SmbiosProperty.TpmDevice.MinorSpecVersion, MinorSpecVersion);

            var firmwareVersion = TpmFirmwareVersion.Unknown;

            if (MajorSpecVersion >= 0x01 && MajorSpecVersion <= 0x02)
            {
                firmwareVersion =
                    MajorSpecVersion == 0x01
                        ? TpmFirmwareVersion.Parse(RawFirmwareVersion1)
                        : new TpmFirmwareVersion
                {
                    MajorVersion = (int)Reader.GetDoubleWord(0x0a),
                    MinorVersion = (int)Reader.GetDoubleWord(0x0e)
                };
            }

            properties.Add(SmbiosProperty.TpmDevice.FirmwareVersion, firmwareVersion);
            properties.Add(SmbiosProperty.TpmDevice.Description, DescriptionVersion2);
            properties.Add(SmbiosProperty.TpmDevice.Characteristics, GetTpmCharacteristics(Characteristics));
            properties.Add(SmbiosProperty.TpmDevice.OemDefined, OemDefined);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        /// <summary>
        /// Gets a value that represents the value of the specified property.
        /// </summary>
        /// <param name="propertyKey">Property key to be obtained.</param>
        /// <returns>
        /// Property value
        /// </returns>
        protected override object GetValueTypedProperty(PropertyKey propertyKey)
        {
            object value = null;
            SmbiosType043Property propertyId = (SmbiosType043Property)propertyKey.PropertyId;

            switch (propertyId)
            {
                #region [0x04] - [Vendor Id]

                #region [0x04] - [Vendor Id] - [Code] - [string]
            case SmbiosType043Property.VendorId:
            {
                var tpmCapabilityVendorIdEntry = GetTpmCapabilityVendorId(RawVendorId);
                value = tpmCapabilityVendorIdEntry.ASCII;
            }
            break;
                #endregion

                #region [0x04] - [Vendor Id] - [Description] - [string]
            case SmbiosType043Property.VendorIdDescription:
            {
                var tpmCapabilityVendorIdEntry = GetTpmCapabilityVendorId(RawVendorId);
                value = tpmCapabilityVendorIdEntry.Description;
            }
            break;
                #endregion

                #endregion

                #region [0x08] - [Major Spec Version] - [byte]
            case SmbiosType043Property.MajorSpecVersion:
                value = MajorSpecVersion;
                break;
                #endregion

                #region [0x09] - [Minor Spec Version] - [byte]
            case SmbiosType043Property.MinorSpecVersion:
                value = MinorSpecVersion;
                break;
                #endregion

                #region [0x0a] - [Firmware Version] - [TpmFirmwareVersion]
            case SmbiosType043Property.FirmwareVersion:
                var firmwareVersion = TpmFirmwareVersion.Unknown;
                if (MajorSpecVersion >= 0x01 && MajorSpecVersion <= 0x02)
                {
                    firmwareVersion =
                        MajorSpecVersion == 0x01
                                ? TpmFirmwareVersion.Parse(RawFirmwareVersion1)
                                : new TpmFirmwareVersion {
                        MajorVersion = GetDoubleWord(0x0a), MinorVersion = GetDoubleWord(0x0e)
                    };
                }

                value = firmwareVersion;
                break;
                #endregion

                #region [0x12] - [Description Version 2] - [string]
            case SmbiosType043Property.Description:
                value = DescriptionVersion2;
                break;
                #endregion

                #region [0x13] - [Characteristics] - [ReadOnlyCollection<string>]
            case SmbiosType043Property.Characteristics:
                value = GetTpmCharacteristics(Characteristics);
                break;
                #endregion

                #region [0x1b] - [OEM Defined] - [int]
            case SmbiosType043Property.OemDefined:
                value = OemDefined;
                break;
                #endregion
            }

            return(value);
        }