Get BIOS values with GetSystemFirmwareTable written in Clarion

I wrote a while ago some code to get the values from the BIOS
with using https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemfirmwaretable

GetSystemFirmwareTable
UINT GetSystemFirmwareTable(
DWORD FirmwareTableProviderSignature,
DWORD FirmwareTableID,
PVOID pFirmwareTableBuffer,
DWORD BufferSize
);

On my PC this is the output

Up here the code:

ReadBios ROUTINE

FirmwareTableProviderSignature = (Val('R') * 256 * 256 * 256) + (Val('S') * 256 * 256) + (Val('M') * 256) + Val('B')
FirmwareTableID = (Val('P') * 256 * 256 * 256) + (Val('C') * 256 * 256) + (Val('A') * 256) + Val('F')
ReturnedBytesTable = GetSystemFirmwareTable(FirmwareTableProviderSignature, FirmwareTableID,Address(BufferBios),Size(BufferBios))
SizeBufferBios = Size(BufferBios)
If ReturnedBytesTable > SizeBufferBios
	ReturnedBytesTable = SizeBufferBios - 1
End
Clear(QBiosRaw)
Free(QBiosRaw)
LP = 1


Loop ReturnedBytesTable TIMES
	Clear(QBiosRaw)
	QBiosRaw.Pos =  LP
	QBiosRaw.Byte = Val(BufferBios[LP])
	QBiosRaw.Char = BufferBios[LP]
	!QBiosRaw.Hex = st.ByteToHex(QBiosRaw.Byte)
    QBiosRaw.Hex = HexFromByte(QBiosRaw.Byte)
	Add(QBiosRaw)
	LP = LP + 1
End

HeaderLen = 4
StartSection = 9
StartStrings = 0

LP = 1
Loop ReturnedBytesTable Times
	!Get(QBiosRaw,LP)
	Case LP
	Of 9
		LI = LP
		BIOSInf:Table = Val(BufferBios[LI])
		LI = LI + 1
		BIOSInf:FormattedLength = Val(BufferBios[LI])
		QBiosSec:FormattedLength = Val(BufferBios[LI])
		StartStrings = StartSection + BIOSInf:FormattedLength
		LI = LI + 1
		BIOSInf:Handle = GetU16(BufferBios[LI : LI+1])
		QBiosSec:Handle = BIOSInf:Handle
		LI = LI + 2
		BIOSInf:VendorStringOrdinal = Val(BufferBios[LI])
		LI = LI + 1
		BIOSInf:BiosVersionStringOrdinal = Val(BufferBios[LI])
		LI = LI + 1
		BIOSInf:BIOSStartingSegment = GetU16(BufferBios[LI : LI+1])
		LI = LI + 2
		BIOSInf:BiosReleaseDateStringOrdinal = Val(BufferBios[LI])
		LI = LI + 1
		BIOSInf:BIOSROMSize = Val(BufferBios[LI])
		LI = LI + 1

! If Val(BufferBios[LI]) < 255
! BIOSInf:BIOSROMSize = (Val(BufferBios[LI])-1) * 65536
! ELSE
! !BIOSInf:BIOSROMSize = (Val(BufferBios[LI])-1) * 65536
! End
!Extended BIOS ROM

		BIOSInf:BIOSCharacteristics = GetBits64ReverseEach(BufferBios[LI : LI + 7])
		

		LI = LI + 8
		
		If BIOSInf:BIOSCharacteristics[4] = '1'
			BIOSInf:BIOSCharacteristicsNotSupported = 1
		End
		If BIOSInf:BIOSCharacteristics[5] = '1'
			BIOSInf:ISASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[6] = '1'
			 BIOSInf:MCASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[7] = '1'
			 BIOSInf:EISASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[8] = '1'
			 BIOSInf:PCISupported = 1
		End
		If BIOSInf:BIOSCharacteristics[9] = '1'
			 BIOSInf:PCMCIASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[10] = '1'
			 BIOSInf:PlugAndPlaySupported = 1
		End
		If BIOSInf:BIOSCharacteristics[11] = '1'
			 BIOSInf:APMSupported = 1
		End
		If BIOSInf:BIOSCharacteristics[12] = '1'
			 BIOSInf:BIOSUpgradeable = 1
		End
		If BIOSInf:BIOSCharacteristics[13] = '1'
			 BIOSInf:BIOSShadowingAllowed = 1
		End
		If BIOSInf:BIOSCharacteristics[14] = '1'
			 BIOSInf:VLVESASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[15] = '1'
			 BIOSInf:ESCDSupportAvailable = 1
		End
		If BIOSInf:BIOSCharacteristics[16] = '1'
			 BIOSInf:BootFromCDSupported = 1
		End
		If BIOSInf:BIOSCharacteristics[17] = '1'
			 BIOSInf:SelectableBootSupported = 1
		End
		If BIOSInf:BIOSCharacteristics[18] = '1'
			 BIOSInf:BIOSROMSocketed = 1
		End
		If BIOSInf:BIOSCharacteristics[19] = '1'
			 BIOSInf:BootFromPCMCIASupported = 1
		End
		If BIOSInf:BIOSCharacteristics[20] = '1'
			 BIOSInf:EDDSpecSupported = 1
		End
		
		
		BIOSInf:BIOSEXT1Len = BIOSInf:FormattedLength - 012h
		
		BIOSInf:BIOSEXT1Bits = GetBits8(Val(BufferBios[LI]))
		LI = LI + 1
		
		If BIOSInf:BIOSEXT1Bits[8] = '1'
			BIOSInf:BIOSEXT1_ACPISupported = 1
		End
		If BIOSInf:BIOSEXT1Bits[7] = '1'
			BIOSInf:BIOSEXT1_USBLegacySupported = 1
		End
		If BIOSInf:BIOSEXT1Bits[6] = '1'
			BIOSInf:BIOSEXT1_AGPSupported = 1
		End
		If BIOSInf:BIOSEXT1Bits[5] = '1'
			BIOSInf:BIOSEXT1_I2OBootSupported = 1
		End
		If BIOSInf:BIOSEXT1Bits[4] = '1'
			BIOSInf:BIOSEXT1_LS120BootSupport = 1
		End
		If BIOSInf:BIOSEXT1Bits[3] = '1'
			BIOSInf:BIOSEXT1_AtapiZipBootSupport = 1
		End
		If BIOSInf:BIOSEXT1Bits[2] = '1'
			BIOSInf:BIOSEXT1_1394BootSupport = 1
		End
		If BIOSInf:BIOSEXT1Bits[1] = '1'
			BIOSInf:BIOSEXT1_SmartBatterySupport = 1
		End
		
		
		BIOSInf:BIOSEXT2Bits = GetBits8(BufferBios[LI] )
		LI = LI + 1
		
		If BIOSInf:BIOSEXT2Bits[8] = '1'
			BIOSInf:BIOSEXT2_BootSpecSupport = 1
		End
		If BIOSInf:BIOSEXT2Bits[7] = '1'
			BIOSInf:BIOSEXT2_FuncKeyNetworkBootSuppor = 1
		End
		If BIOSInf:BIOSEXT2Bits[6] = '1'
			BIOSInf:BIOSEXT2_EnableTargetContent = 1
		End
		If BIOSInf:BIOSEXT2Bits[5] = '1'
			BIOSInf:BIOSEXT2_UEFISpecSupport = 1
		End
		If BIOSInf:BIOSEXT2Bits[4] = '1'
			BIOSInf:BIOSEXT2_SMBIOSVirtualMachine = 1
		End

		

		
		LOrdinal = 1
		LI = StartStrings
		StartString = LI
		NextTable = 0
		Loop
			Case Val(BufferBios[LI])
			Of 0
				If LOrdinal = BIOSInf:VendorStringOrdinal
					If StartString < LI
						BIOSInf:Vendor = BufferBios[StartString : LI-1]
					Else
						BIOSInf:Vendor = BufferBios[StartString]
					End
					StartString = LI + 1
				ElsIf LOrdinal = BIOSInf:BiosVersionStringOrdinal
					If StartString < LI
						BIOSInf:BIOSVersion = BufferBios[StartString : LI-1]
					Else
						BIOSInf:BIOSVersion = BufferBios[StartString]
					End
					StartString = LI + 1						
				ElsIf LOrdinal = BIOSInf:BiosReleaseDateStringOrdinal
					If StartString < LI
						BIOSInf:BIOSReleaseDate = BufferBios[StartString : LI-1]
					Else
						BIOSInf:BIOSReleaseDate = BufferBios[StartString]
					End
					StartString = LI + 1						
				End
				LOrdinal = LOrdinal + 1					
			End
			If Val(BufferBios[LI]) = 0 And Val(BufferBios[LI+1]) = 0
				If LI + 2 > NextTable
					NextTable = LI + 2
				Else
					NextTable = ReturnedBytesTable
				End
				BREAK
			End				
			LI = LI + 1
			If LI + 2 > ReturnedBytesTable
				BREAK
			End
		End
		QBiosSec:StartPos = 1
		QBiosSec:Type = 0
		Add(QBiosSections)
	Of NextTable
	
		LOffset = 0
		
		LI = LP
		StartSection = LP
		QBiosSec:StartPos = StartSection
		TableType  = Val(BufferBios[LI])
		QBiosSec:Type = TableType
		
		Get(QBIOSRAW,LI)
		QBIORAW:Offset = LOffset
		QBIORAW:OffsetHex = HexFromByte(LOffset)
		QBIORAW:Name = 'NextTable:' & NextTable & ', Type:' & TableType
		Put(QBIOSRAW)					
		
		LI = LI + 1
		LOffset = LOffset + 1
		Get(QBIOSRAW,LI)
		QBIORAW:Offset = LOffset
		QBIORAW:OffsetHex = HexFromByte(LOffset)
		Put(QBIOSRAW)				
		
		QBiosSec:FormattedLength = Val(BufferBios[LI])
		EndSection = StartSection + QBiosSec:FormattedLength - 1
		
		LI = LI + 1			
		LOffset = LOffset + 1
		Get(QBIOSRAW,LI)
		QBIORAW:Offset = LOffset
		QBIORAW:OffsetHex = HexFromByte(LOffset)
		Put(QBIOSRAW)	
		
		QBiosSec:Handle = GetU16(BufferBios[LI : LI+1])
		
		LI = LI + 1
		LOffset = LOffset + 1
		Get(QBIOSRAW,LI)
		QBIORAW:Offset = LOffset
		QBIORAW:OffsetHex = HexFromByte(LOffset)
		Put(QBIOSRAW)				
		
		LI = LI + 1
		LOffset = LOffset + 1
		Get(QBIOSRAW,LI)
		QBIORAW:Offset = LOffset
		QBIORAW:OffsetHex = HexFromByte(LOffset)
		Put(QBIOSRAW)				
		
		! init
		LI = LI - 1
		LOffset = LOffset - 1
		
		Case TableType
		Of 1
			Clear(BIOSTP1)
		Of 2
			Clear(QBIOSType02)
			QBIOSType02.Handle = QBiosSec:Handle
		Of 3
			Clear(QBIOSType03)
			QBIOSType03.Handle = QBiosSec:Handle
		Of 4
			Clear(QBIOSType04)
			QBIOSType04.Handle = QBiosSec:Handle
		Of 8
			Clear(QBIOSType08)
			QBIOSType08.Handle = QBiosSec:Handle
		Of 9
			Clear(QBIOSType09)
			QBIOSType09.Handle = QBiosSec:Handle
		End
		
		Loop
			LI = LI + 1
			LOffset = LOffset + 1
			Get(QBIOSRAW,LI)
			QBIORAW:Offset = LOffset
			QBIORAW:OffsetHex = HexFromByte(LOffset)
			Case TableType
			Of 1
				Case (QBIORAW:OffsetHex)
				Of '04'
					BIOST1:ManufacturerOrdinal = Val(BufferBios[LI])
				Of '05'
					BIOST1:ProductNameOrdinal = Val(BufferBios[LI])
				Of '06'
					BIOST1:VersionOrdinal = Val(BufferBios[LI])
				Of '07'
					BIOST1:SerialNumberOrdinal = Val(BufferBios[LI])
				Of '08'
					BIOST1:UUIDBytes = BufferBios[LI : LI + 15]
					BIOST1:UUIDHex = ConvertToGuid(BIOST1:UUIDBytes)
				Of '18'
					BIOST1:WakeUpType = Val(BufferBios[LI])
				Of '19'
					BIOST1:SKUNumberOrdinal = Val(BufferBios[LI])
				Of '1A'
					BIOST1:FamilyOrdinal = Val(BufferBios[LI])
				End
			Of 2
				Case (QBIORAW:OffsetHex)
				Of '04'
					QBIOSType02.ManufacturerOrdinal = Val(BufferBios[LI])
				Of '05'
					QBIOSType02.ProductOrdinal = Val(BufferBios[LI])
				Of '06'
					QBIOSType02.VersionOrdinal = Val(BufferBios[LI])
				Of '07'
					QBIOSType02.SerialNumberOrdinal = Val(BufferBios[LI])
				Of '08'
					QBIOSType02.AssetTagOrdinal = Val(BufferBios[LI])
				Of '09'
					QBIOSType02.FeatureFlags = Val(BufferBios[LI])
					QBIOSType02.FeatureFlagsBits = GetBits8(QBIOSType02.FeatureFlags)
					If QBIOSType02.FeatureFlagsBits[8] = '1' ! [] changed order
						QBIOSType02.FeatureFlagIsHostingBoard = 1
					End
					If QBIOSType02.FeatureFlagsBits[7] = '1'
						QBIOSType02.FeatureFlagRequiresDaughterBoard = 1
					End
					If QBIOSType02.FeatureFlagsBits[6] = '1'
						QBIOSType02.FeatureFlagBoardIsRemovable = 1
					End
					If QBIOSType02.FeatureFlagsBits[5] = '1'
						QBIOSType02.FeatureFlagIsReplaceable = 1
					End
					If QBIOSType02.FeatureFlagsBits[4] = '1'
						QBIOSType02.FeatureFlagIsHotSwappable = 1
					End
				Of '0A'
					QBIOSType02.LocationInChassisOrdinal = Val(BufferBios[LI])
				Of '0B'
					QBIOSType02.ChassisHandle = GetU16(BufferBios[LI : LI + 1])
				Of '0D'
					QBIOSType02.BoardType = Val(BufferBios[LI])
					Case QBIOSType02.BoardType
					Of BoardType_Unknown
						QBIOSType02.BoardTypeString = 'Unknown'
					Of BoardType_Other
						QBIOSType02.BoardTypeString = 'Other'
					Of BoardType_ServerBlade
						QBIOSType02.BoardTypeString = 'ServerBlade'
					Of BoardType_ConnectivitySwitch
						QBIOSType02.BoardTypeString = 'ConnectivitySwitch'
					Of BoardType_SystemManagementModule 
						QBIOSType02.BoardTypeString = 'SystemManagementModule'
					Of BoardType_ProcessorModule
						QBIOSType02.BoardTypeString = 'ProcessorModule'
					Of BoardType_IOModule
						QBIOSType02.BoardTypeString = 'IOModule'
					Of BoardType_MemoryModule
						QBIOSType02.BoardTypeString = 'MemoryModule'
					Of BoardType_Daughterboard
						QBIOSType02.BoardTypeString = 'Daughterboard'
					Of BoardType_Motherboard
						QBIOSType02.BoardTypeString = 'Motherboard'
					Of BoardType_ProcessorMemoryModule
						QBIOSType02.BoardTypeString = 'ProcessorMemoryModule'
					Of BoardType_ProcessorIOModule
						QBIOSType02.BoardTypeString = 'ProcessorIOModule'
					Of BoardType_Interconnectboard
						QBIOSType02.BoardTypeString = 'Interconnectboard'
					End
				Of '0E'
					QBIOSType02.ContaintedHandlesTotal = Val(BufferBios[LI])
				Of '0F'
					
					!QBIOSType02. = Val(BufferBios[LI])
				End					
			Of 3
				Case (QBIORAW:OffsetHex)
				Of '04'
					QBIOST03:ManufacturerOrdinal = Val(BufferBios[LI])
				Of '05'
					QBIOST03:TypeByte = Val(BufferBios[LI])
					QBIOST03:TypeBits = GetBits8(QBIOST03:TypeByte)
					
					If QBIOST03:TypeBits[8] = '1'
						QBIOST03:ChassisLock = 1
					End
					QBIOST03:TypeEnumValue  = BShift(QBIOST03:TypeByte,-1)
					!QBIOST03:TypeEnumValue  = BShift(QBIOST03:TypeEnumValue,1)
					Case QBIOST03:TypeEnumValue
					Of ChassisType_Other
						QBIOST03:ChassisType = 'Other'
					Of ChassisType_Unknown
						QBIOST03:ChassisType = 'Unknown'
					Of ChassisType_Desktop
						QBIOST03:ChassisType = 'Desktop'
					Of ChassisType_LowProfileDesktop
						QBIOST03:ChassisType = 'LowProfileDesktop'
					Of ChassisType_PizzaBox
						QBIOST03:ChassisType = 'PizzaBox'
					Of ChassisType_MiniTower
						QBIOST03:ChassisType = 'MiniTower'
					Of ChassisType_Tower
						QBIOST03:ChassisType = 'Tower'
					Of ChassisType_Portable
						QBIOST03:ChassisType = 'Portable'
					Of ChassisType_Laptop
						QBIOST03:ChassisType = 'Laptop'
					Of ChassisType_Notebook
						QBIOST03:ChassisType = 'Notebook'
					Of ChassisType_HandHeld
						QBIOST03:ChassisType = 'HandHeld'
					Of ChassisType_DockingStation
						QBIOST03:ChassisType = 'DockingStation'
					Of ChassisType_AllinOne
						QBIOST03:ChassisType = 'AllinOne'
					Of ChassisType_SubNotebook
						QBIOST03:ChassisType = 'SubNotebook'
					Of ChassisType_SpaceSaving
						QBIOST03:ChassisType = 'SpaceSaving'
					Of ChassisType_LunchBox
						QBIOST03:ChassisType = 'LunchBox'
					Of ChassisType_MainServerChassis
						QBIOST03:ChassisType = 'MainServerChassis'
					Of ChassisType_ExpansionChassis
						QBIOST03:ChassisType = 'ExpansionChassis'
					Of ChassisType_SubChassis
						QBIOST03:ChassisType = 'SubChassis'
					Of ChassisType_BusExpansionChassis
						QBIOST03:ChassisType = 'BusExpansionChassis'							
					Of ChassisType_PeripheralChassis
						QBIOST03:ChassisType = 'PeripheralChassis'
					Of ChassisType_RAIDChassis
						QBIOST03:ChassisType = 'RAIDChassis'
					Of ChassisType_RackMountChassis
						QBIOST03:ChassisType = 'RackMountChassis'
					Of ChassisType_SealedCasePC
						QBIOST03:ChassisType = 'SealedCasePC'
					Of ChassisType_MultiSystemChassis
						QBIOST03:ChassisType = 'MultiSystemChassis'
					Of ChassisType_CompactPCI
						QBIOST03:ChassisType = 'CompactPCI'
					Of ChassisType_AdvancedTCA
						QBIOST03:ChassisType = 'AdvancedTCA'
					Of ChassisType_Blade
						QBIOST03:ChassisType = 'Blade'
					Of ChassisType_Tablet
						QBIOST03:ChassisType = 'Tablet'
					Of ChassisType_Convertible
						QBIOST03:ChassisType = 'Convertible'
					Of ChassisType_Detachable
						QBIOST03:ChassisType = 'Detachable'
					Of ChassisType_IoTGateway
						QBIOST03:ChassisType = 'IoTGateway'
					Of ChassisType_EmbeddedPC
						QBIOST03:ChassisType = 'EmbeddedPC'
					Of ChassisType_MiniPC
						QBIOST03:ChassisType = 'MiniPC'
					Of ChassisType_StickPC
						QBIOST03:ChassisType = 'StickPC'
					End
				Of '06'
					QBIOST03:VersionOrdinal = Val(BufferBios[LI])
				Of '07'
					QBIOST03:SerialNumberOrdinal = Val(BufferBios[LI])
				Of '08'
					QBIOST03:AssetTagNumberOrdinal = Val(BufferBios[LI])
				Of '09'
					QBIOST03:BootUpStateByte = Val(BufferBios[LI])
					Case QBIOST03:BootUpStateByte
					Of ChassisStates_Other
						QBIOST03:BootUpState = 'Other'
					Of ChassisStates_Unknown
						QBIOST03:BootUpState = 'Unknown'
					Of ChassisStates_Safe
						QBIOST03:BootUpState = 'Safe'
					Of ChassisStates_Warning
						QBIOST03:BootUpState = 'Warning'
					Of ChassisStates_Critical
						QBIOST03:BootUpState = 'Critical'
					Of ChassisStates_NonRecoverable
						QBIOST03:BootUpState = 'NonRecoverable'
					End
				Of '0A'
					QBIOST03:PowerSupplyStateByte = Val(BufferBios[LI])
					Case QBIOST03:PowerSupplyStateByte
					Of ChassisStates_Other
						QBIOST03:PowerSupplyState = 'Other'
					Of ChassisStates_Unknown
						QBIOST03:PowerSupplyState = 'Unknown'
					Of ChassisStates_Safe
						QBIOST03:PowerSupplyState = 'Safe'
					Of ChassisStates_Warning
						QBIOST03:PowerSupplyState = 'Warning'
					Of ChassisStates_Critical
						QBIOST03:PowerSupplyState = 'Critical'
					Of ChassisStates_NonRecoverable
						QBIOST03:PowerSupplyState = 'NonRecoverable'
					End						
				Of '0B'
					QBIOST03:ThermalStateByte = Val(BufferBios[LI])
					Case QBIOST03:ThermalStateByte
					Of ChassisStates_Other
						QBIOST03:ThermalState = 'Other'
					Of ChassisStates_Unknown
						QBIOST03:ThermalState = 'Unknown'
					Of ChassisStates_Safe
						QBIOST03:ThermalState = 'Safe'
					Of ChassisStates_Warning
						QBIOST03:ThermalState = 'Warning'
					Of ChassisStates_Critical
						QBIOST03:ThermalState = 'Critical'
					Of ChassisStates_NonRecoverable
						QBIOST03:ThermalState = 'NonRecoverable'
					End						
				Of '0C'
					QBIOST03:SecurityStatusByte = Val(BufferBios[LI])
					Case QBIOST03:SecurityStatusByte
					Of SecurityStatus_Other
						QBIOST03:SecurityStatus = 'Other'
					Of SecurityStatus_Unknown
						QBIOST03:SecurityStatus = 'Unknown'
					Of SecurityStatus_None
						QBIOST03:SecurityStatus = 'None'
					Of SecurityStatus_ExternalIntLockout
						QBIOST03:SecurityStatus = 'ExternalIntLockout'
					Of SecurityStatus_ExternalIntEnabled
						QBIOST03:SecurityStatus = 'ExternalIntEnabled'
					End
				Of '0D'
					QBIOST03:OEMDefined = GetU16(BufferBios[LI : LI +1])
				Of '11'
					QBIOST03:Height = Val(BufferBios[LI])
				Of '12'
					QBIOST03:NumberOfPowerCords = Val(BufferBios[LI])
				Of '13'
					QBIOST03:ContainedElemCount = Val(BufferBios[LI])
				Of '14'
					QBIOST03:NumberOfPowerCords = Val(BufferBios[LI])

! Of ‘15’
! QBIOST03:NumberOfPowerCords = Val(BufferBios[LI])
End
Of 4
Case (QBIORAW:OffsetHex)
Of ‘04’
QBIOSType04.SocketDesignationOrdinal = Val(BufferBios[LI])
Of ‘05’
QBIOSType04.ProcessorTypeEnum = Val(BufferBios[LI])
Case QBIOSType04.ProcessorTypeEnum
Of CPUType_Other
QBIOSType04.ProcessorType = ‘Other’
Of CPUType_Unknown
QBIOSType04.ProcessorType = ‘Unknown’
Of CPUType_CentralProcessor
QBIOSType04.ProcessorType = ‘Central Processor’
Of CPUType_MathProcessor
QBIOSType04.ProcessorType = ‘Math Processor’
Of CPUType_DSPProcessor
QBIOSType04.ProcessorType = ‘DSP Processor’
Of CPUType_VideoProcessor
QBIOSType04.ProcessorType = ‘Video Processor’
End
Of ‘06’
QBIOST04:ProcessorFamilyEnum = Val(BufferBios[LI])
QBIOST04:ProcessorFamily = GetCpuFamily(QBIOST04:ProcessorFamilyEnum)
Of ‘07’
QBIOSType04.ProcessorManufacturerOrdinal = Val(BufferBios[LI])
Of ‘08’
QBIOST04:ProcessorIdBits = GetBits64(BufferBios[LI : LI + 7])
Of ‘10’
QBIOST04:ProcessorVersionOrdinal = Val(BufferBios[LI])
Of ‘11’
QBIOST04:Voltage = Val(BufferBios[LI]) ! todo is not good yet
QBIOST04:VoltageBits = GetBits8(QBIOST04:Voltage)
If QBIOST04:VoltageBits[1] = ‘1’ ! bit 7
QBIOST04:VoltageIsLegacy = 1
QBIOST04:VoltageLegacy10X = BAND(QBIOST04:Voltage,01111111b) !BSHIFT(QBIOST04:Voltage,-1)
ELSE
If QBIOST04:VoltageBits[8] = ‘1’
QBIOST04:Voltage5V = 1
End
If QBIOST04:VoltageBits[7] = ‘1’
QBIOST04:Voltage33V = 1
End
If QBIOST04:VoltageBits[6] = ‘1’
QBIOST04:Voltage29 = 1
End
End
Of ‘12’
QBIOST04:ExternalClock = GetU16(BufferBios[LI : LI + 1])
Of ‘14’
QBIOST04:MaxSpeed = GetU16(BufferBios[LI : LI + 1])
Of ‘16’
QBIOST04:CurrentSpeed = GetU16(BufferBios[LI : LI + 1])
Of ‘19’
QBIOST04:ProcessorUpgradeEnum = Val(BufferBios[LI])
QBIOST04:ProcessorUpgrade = GetCpuUpgrade(QBIOST04:ProcessorUpgradeEnum)
Of ‘1A’
QBIOST04:L1CacheHandle = GetU16(BufferBios[LI : LI + 1])
Of ‘1C’
QBIOST04:L2CacheHandle = GetU16(BufferBios[LI : LI + 1])
Of ‘1E’
QBIOST04:L3CacheHandle = GetU16(BufferBios[LI : LI + 1])
Of ‘20’
QBIOST04:SerialNumberOrdinal = Val(BufferBios[LI])
Of ‘21’
QBIOST04:AssetTagOrdinal = Val(BufferBios[LI])
Of ‘22’
QBIOST04:PartNumberOrdinal = Val(BufferBios[LI])
Of ‘23’
QBIOST04:CoreCountByte = Val(BufferBios[LI])
Of ‘24’
QBIOST04:CoreEnabled = Val(BufferBios[LI])
Of ‘25’
QBIOST04:ThreadCount = Val(BufferBios[LI])
Of ‘26’
QBIOST04:ProcessorCharacteristic = GetU16(BufferBios[LI : LI + 1])
QBIOST04:ProcessorCharacteristicBits = GetBits8(Val(BufferBios[LI])) & GetBits8(Val(BufferBios[LI+1]))
Of ‘28’
QBIOST04:ProcessorFamily2Enum = GetU16(BufferBios[LI : LI + 1])
QBIOST04:ProcessorFamily2 = GetCpuFamily(QBIOST04:ProcessorFamily2Enum)
Of ‘2A’
QBIOST04:CoreCount2 = Val(BufferBios[LI])
Of ‘2C’
QBIOST04:CoreEnabled2 = GetU16(BufferBios[LI : LI + 1])
! If QBIOST04:CoreCountByte = 0 And QBIOST04:CoreEnabled2 = 0
! QBIOST04:CoreCountString = ‘Unknown’
! ElsIf QBIOST04:CoreCountByte = 020h And QBIOST04:CoreEnabled2 = 0
! QBIOST04:CoreCountString = ‘32’

				Of '2E'
					QBIOST04:ThreadCount2 = GetU16(BufferBios[LI : LI + 1])
                End
                !https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf
			Of 8
				Case (QBIORAW:OffsetHex)
				Of '04'
					QBIOST08:InternalRefDesOrdinal = Val(BufferBios[LI])
				Of '05'
					QBIOST08:InternalConnectorTypeEnum = Val(BufferBios[LI])
					QBIOST08:InternalConnector = GetConnectorTypeName(QBIOST08:InternalConnectorTypeEnum)
				Of '06'
					QBIOST08:ExternalRefDesOrdinal = Val(BufferBios[LI])
				Of '07'
					QBIOST08:ExternalConnectorTypeEnum = Val(BufferBios[LI])
					QBIOST08:ExternalConnectorType = GetConnectorTypeName(QBIOST08:ExternalConnectorTypeEnum)
				Of '08'
					QBIOST08:PortTypeEnum = Val(BufferBios[LI])
					QBIOST08:PortType = GetPortTypeName(QBIOST08:PortTypeEnum)
				END
			Of 9
				Case (QBIORAW:OffsetHex)
				Of '04'
					QBIOST09:SlotDesignationOrdinal = Val(BufferBios[LI])
				Of '05'
					QBIOST09:SlotTypeEnum = Val(BufferBios[LI])
					QBIOST09:SlotType = GetSlotTypeName(QBIOST09:SlotTypeEnum)
				Of '06'
					QBIOST09:SlotDataBusWidthEnum = Val(BufferBios[LI])
					QBIOST09:SlotDataBusWidth = GetSlotDataBusWidth(QBIOST09:SlotDataBusWidthEnum)
				Of '07'
					QBIOST09:CurrentUsageEnum = Val(BufferBios[LI])
					Case QBIOST09:CurrentUsageEnum
					Of 01h
						QBIOST09:CurrentUsage = 'Other'
					Of 02h
						QBIOST09:CurrentUsage = 'Unknown'
					Of 03h
						QBIOST09:CurrentUsage = 'Available'
					Of 04h
						QBIOST09:CurrentUsage = 'In Use'
					End
				Of '08'
					QBIOST09:SlotLengthEnum = Val(BufferBios[LI])
					Case QBIOST09:SlotLengthEnum
					Of 01h
						QBIOST09:SlotLength = 'Other'
					Of 02h
						QBIOST09:SlotLength = 'Unknown'
					Of 03h
						QBIOST09:SlotLength = 'Short'
					Of 04h
						QBIOST09:SlotLength = 'Long'
					Of 05h
						QBIOST09:SlotLength = '2.5" drive form factor'
					Of 06h
						QBIOST09:SlotLength = '3.5" drive form factor'
					End						
				Of '09'
					QBIOST09:SlotID = GetU16(BufferBios[LI : LI + 1])
				Of '0B'
					QBIOST09:SlotChar1 = Val(BufferBios[LI])
					QBIOST09:SlotChar1Bits = GetBits8(QBIOST09:SlotChar1)
					If QBIOST09:SlotChar1Bits[8] = '1'
						QBIOST09:SlotChar1_Unknown = 1
					End
					If QBIOST09:SlotChar1Bits[7] = '1'
						QBIOST09:SlotChar1_Prov5Volt = 1
					End
					If QBIOST09:SlotChar1Bits[6] = '1'
						QBIOST09:SlotChar1_Prov33Volt = 1
					End
					If QBIOST09:SlotChar1Bits[5] = '1'
						QBIOST09:SlotChar1_IsShared = 1
					End
					If QBIOST09:SlotChar1Bits[4] = '1'
						QBIOST09:SlotChar1_SupPCCard16 = 1
					End
					If QBIOST09:SlotChar1Bits[3] = '1'
						QBIOST09:SlotChar1_SupCardBus = 1
					End
					If QBIOST09:SlotChar1Bits[2] = '1'
						QBIOST09:SlotChar1_SupZoomVideo = 1
					End
					If QBIOST09:SlotChar1Bits[1] = '1'
						QBIOST09:SlotChar1_SupModemRingResume = 1
					End
				Of '0C'
					QBIOST09:SlotChar2 = Val(BufferBios[LI])
					QBIOST09:SlotChar2Bits = GetBits8(QBIOST09:SlotChar2)
					If QBIOST09:SlotChar2Bits[8] = '1'
						QBIOST09:SlotChar2_SupPME = 1
					End
					If QBIOST09:SlotChar2Bits[7] = '1'
						QBIOST09:SlotChar2_SupHotPlug = 1
					End
					If QBIOST09:SlotChar2Bits[6] = '1'
						QBIOST09:SlotChar2_SupSMBusSignal = 1
					End						
				Of '0D'
					QBIOST09:SegmentGroupNumber = GetU16(BufferBios[LI : LI + 1])
				Of '0F'
					QBIOST09:BusNumber = Val(BufferBios[LI])
				Of '10'
					QBIOST09:DeviceFunction = Val(BufferBios[LI])
					QBIOST09:DeviceFunctionBits = GetBits8(QBIOST09:DeviceFunction)
					QBIOST09:DeviceNumber = BSHIFT(QBIOST09:DeviceFunction,-3)  !BAND(BSHIFT(QBIOST09:DeviceFunction,3),11111000b)
					QBIOST09:FunctionNumber = BAND(QBIOST09:DeviceFunction,00000111b)
				END					
			End

			Put(QBIOSRAW)				
			If LI >= EndSection
				BREAK
			End
		End
		Get(QBIOSRAW,EndSection)
		QBIORAW:Name = 'EndSection at ' & EndSection
		Put(QBIOSRAW)
		LOrdinal = 1
		LI = EndSection
		
		StartString = LI + 1
		Loop
			LI = LI + 1
			If LI + 2 > ReturnedBytesTable
				Break
			End
			Case Val(BufferBios[LI])
			Of 0
				Case TableType
				Of 1
					If LOrdinal = BIOST1:ManufacturerOrdinal
						If StartString < LI
							BIOST1:Manufacturer = BufferBios[StartString : LI-1]
						Else
							BIOST1:Manufacturer = BufferBios[StartString]
						End
					ElsIf LOrdinal = BIOST1:ProductNameOrdinal
						If StartString < LI
							BIOST1:ProductName = BufferBios[StartString : LI-1]
						Else
							BIOST1:ProductName = BufferBios[StartString]
						End
					ElsIf LOrdinal = BIOST1:VersionOrdinal
						If StartString < LI
							BIOST1:Version = BufferBios[StartString : LI-1]
						Else
							BIOST1:Version = BufferBios[StartString]
						End
					ElsIf LOrdinal = BIOST1:SerialNumberOrdinal
						If StartString < LI
							BIOST1:SerialNumber = BufferBios[StartString : LI-1]
						Else
							BIOST1:SerialNumber = BufferBios[StartString]
						End
					ElsIf LOrdinal = BIOST1:SKUNumberOrdinal
						If StartString < LI
							BIOST1:SKUNumber = BufferBios[StartString : LI-1]
						Else
							BIOST1:SKUNumber = BufferBios[StartString]
						End
					ElsIf LOrdinal = BIOST1:FamilyOrdinal
						If StartString < LI
							BIOST1:Family = BufferBios[StartString : LI-1]
						Else
							BIOST1:Family = BufferBios[StartString]
						End
					End
				Of 2
					If LOrdinal = QBIOST02:ManufacturerOrdinal
						If StartString < LI
							QBIOST02:Manufacturer = BufferBios[StartString : LI-1]
						Else
							QBIOST02:Manufacturer = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST02:ProductOrdinal
						If StartString < LI
							QBIOST02:Product = BufferBios[StartString : LI-1]
						Else
							QBIOST02:Product = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST02:VersionOrdinal
						If StartString < LI
							QBIOST02:Version = BufferBios[StartString : LI-1]
						Else
							QBIOST02:Version = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST02:SerialNumberOrdinal
						If StartString < LI
							QBIOST02:SerialNumber = BufferBios[StartString : LI-1]
						Else
							QBIOST02:SerialNumber = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST02:AssetTagOrdinal
						If StartString < LI
							QBIOST02:AssetTag = BufferBios[StartString : LI-1]
						Else
							QBIOST02:AssetTag = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST02:LocationInChassisOrdinal
						If StartString < LI
							QBIOST02:LocationInChassis = BufferBios[StartString : LI-1]
						Else
							QBIOST02:LocationInChassis = BufferBios[StartString]
						End
					End		
				Of 3
					If LOrdinal = QBIOST03:ManufacturerOrdinal
						If StartString < LI
							QBIOST03:Manufacturer = BufferBios[StartString : LI-1]
						Else
							QBIOST03:Manufacturer = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST03:VersionOrdinal
						If StartString < LI
							QBIOST03:Version = BufferBios[StartString : LI-1]
						Else
							QBIOST03:Version = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST03:SerialNumberOrdinal
						If StartString < LI
							QBIOST03:SerialNumber = BufferBios[StartString : LI-1]
						Else
							QBIOST03:SerialNumber = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST03:AssetTagNumberOrdinal
						If StartString < LI
							QBIOST03:AssetTagNumber = BufferBios[StartString : LI-1]
						Else
							QBIOST03:AssetTagNumber = BufferBios[StartString]
						End
					End
				Of 4
					If LOrdinal = QBIOST04:SocketDesignationOrdinal
						If StartString < LI
							QBIOST04:SocketDesignation = BufferBios[StartString : LI-1]
						Else
							QBIOST04:SocketDesignation = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST04:ProcessorManufacturerOrdinal
						If StartString < LI
							QBIOST04:ProcessorManufacturer = BufferBios[StartString : LI-1]
						Else
							QBIOST04:ProcessorManufacturer = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST04:ProcessorVersionOrdinal
						If StartString < LI
							QBIOST04:ProcessorVersion = BufferBios[StartString : LI-1]
						Else
							QBIOST04:ProcessorVersion = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST04:SerialNumberOrdinal
						If StartString < LI
							QBIOST04:SerialNumber = BufferBios[StartString : LI-1]
						Else
							QBIOST04:SerialNumber = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST04:AssetTagOrdinal
						If StartString < LI
							QBIOST04:AssetTag = BufferBios[StartString : LI-1]
						Else
							QBIOST04:AssetTag = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST04:PartNumberOrdinal
						If StartString < LI
							QBIOST04:PartNumber = BufferBios[StartString : LI-1]
						Else
							QBIOST04:PartNumber = BufferBios[StartString]
						End
					End
				Of 8
					If LOrdinal = QBIOST08:InternalRefDesOrdinal
						If StartString < LI
							QBIOST08:InternalRef = BufferBios[StartString : LI-1]
						Else
							QBIOST08:InternalRef = BufferBios[StartString]
						End
					ElsIf LOrdinal = QBIOST08:ExternalRefDesOrdinal
						If StartString < LI
							QBIOST08:ExternalRefDes = BufferBios[StartString : LI-1]
						Else
							QBIOST08:ExternalRefDes = BufferBios[StartString]
						End
					End
				Of 9
					If LOrdinal = QBIOST09:SlotDesignationOrdinal
						If StartString < LI
							QBIOST09:SlotDesignation = BufferBios[StartString : LI-1]
						Else
							QBIOST09:SlotDesignation = BufferBios[StartString]
						End
					End
				End
				LOrdinal = LOrdinal + 1					
				StartString = LI + 1
			End
			If Val(BufferBios[LI]) = 0 And Val(BufferBios[LI+1]) = 0 And Val(BufferBios[LI+2]) <> 0
				Add(QBiosSections)
				Clear(QBiosSections)
				If LI + 2 > NextTable
					NextTable = LI + 2
				Else
					NextTable = ReturnedBytesTable
				End
				BREAK
			End				
		End			
		Case TableType
		Of 2
			Add(QBIOSType02)
		Of 3
			Add(QBIOSType03)
		Of 4
			Add(QBIOSType04)
		Of 8
			Add(QBIOSType08)
		Of 9
			Add(QBIOSType09)
		End
	End
	
	LP = LP + 1
	If LP + 2 > ReturnedBytesTable
		BREAK
	End
End 

If Clip(BIOST1:Version) = 'Default string' 
    BIOST1:Version = ''
END
If Clip(QBIOST02:Product) = 'Default string' 
    QBIOST02:Product = ''
END    
If Clip(BIOST1:ProductName) = 'Default string' 
    BIOST1:ProductName = ''
END    
If Clip(BIOST1:SerialNumber) = 'Default string' 
    BIOST1:SerialNumber = ''
END    
If Clip(QBIOSType03.SerialNumber) = 'Default string'
    QBIOSType03.SerialNumber = ''
End    

Get(QBIOSType02,1)
Get(QBIOSType04,1)

LXGBiosBoardAndCPU.BiosVendor               = Clip(BIOSInf:Vendor)  
LXGBiosBoardAndCPU.BiosVersion              = Clip(BIOSInf:BIOSVersion)
LXGBiosBoardAndCPU.BiosReleaseDate          = Clip(BIOSInf:BIOSReleaseDate)
LXGBiosBoardAndCPU.BoardManufacturer        = Clip(QBIOST02:Manufacturer)
LXGBiosBoardAndCPU.BoardProductName         = Clip(QBIOST02:Product)
LXGBiosBoardAndCPU.BoardUUID                = Clip(BIOST1:UUIDHex)
LXGBiosBoardAndCPU.BoardProduct             = Clip(BIOST1:ProductName)
LXGBiosBoardAndCPU.BoardProductVersion      = Clip(BIOST1:Version)
LXGBiosBoardAndCPU.BoardType                = Clip(QBIOST02:BoardTypeString)
LXGBiosBoardAndCPU.CPUFamily                = Clip(QBIOST04:ProcessorFamily)
LXGBiosBoardAndCPU.CPUManufacturer          = Clip(QBIOST04:ProcessorManufacturer)
LXGBiosBoardAndCPU.CPUProductVersion        = Clip(QBIOST04:ProcessorVersion)
LXGBiosBoardAndCPU.CPUMaxSpeed              = QBIOST04:MaxSpeed
LXGBiosBoardAndCPU.CPUCurrentSpeed          = QBIOST04:CurrentSpeed
LXGBiosBoardAndCPU.CPUTotal                 = Records(QBIOSType04)
LXGBiosBoardAndCPU.CoresPerCPU              = QBIOST04:CoreCountByte
LXGBiosBoardAndCPU.ThreadsPerCPU            = QBIOST04:ThreadCount
LXGBiosBoardAndCPU.BiosSerial               = QBIOSType03.SerialNumber
3 Likes