I am trying to print the serial number but it gives null, so far the manufacturer and product name prints out fine.
Is there anything I am doing wrong?
Code: Select all
#include <efi.h>
#include <efilib.h>
EFI_STATUS
EFIAPI
efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
EFI_STATUS Status;
SMBIOS_STRUCTURE_POINTER Smbios;
SMBIOS_STRUCTURE_TABLE *SmbiosTable;
UINTN MaximumSize, ProcessedSize = 0;
UINT8 Found = 0, *Raw;
InitializeLib(ImageHandle, SystemTable);
Print(L"Hello!\n");
Status = LibGetSystemConfigurationTable(&SMBIOSTableGuid, (VOID **)&SmbiosTable);
if (Status == EFI_SUCCESS)
{
Print(L"yay!\n");
Smbios.Hdr = (SMBIOS_HEADER *)(UINTN)SmbiosTable->TableAddress;
MaximumSize = (UINTN)SmbiosTable->TableLength;
}
while ((Smbios.Hdr->Type != 0x7F) && (Found < 2))
{
Raw = Smbios.Raw;
if (Smbios.Hdr->Type == 1)
{
Print(L"%a, %a, %a \n", LibGetSmbiosString(&Smbios, Smbios.Type1->Manufacturer),
LibGetSmbiosString(&Smbios, Smbios.Type1->ProductName), LibGetSmbiosString(&Smbios, Smbios.Type1->SerialNumber));
Found++;
}
LibGetSmbiosString(&Smbios, -1);
ProcessedSize += (UINTN)Smbios.Raw - (UINTN)Raw;
if (ProcessedSize > MaximumSize)
{
Print(L"%EAborting system report due to noncompliant SMBIOS%N\n");
return EFI_ABORTED;
}
}
return EFI_SUCCESS;
}