Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ntdll/nt.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index c46c3cd01d..5137b8e5dc 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -88,6 +88,16 @@ struct smbios_bios { UINT64 characteristics; };
+struct smbios_system { + BYTE type; + BYTE length; + WORD handle; + BYTE vendor; + BYTE product; + BYTE version; + BYTE serial; +}; + #include "poppack.h"
/* Firmware table providers */ @@ -1921,15 +1931,22 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti { char bios_vendor[128], bios_version[128], bios_date[128]; size_t bios_vendor_len, bios_version_len, bios_date_len; + char system_vendor[128], system_product[128], system_version[128], system_serial[128]; + size_t system_vendor_len, system_product_len, system_version_len, system_serial_len; char *buffer = (char*)sfti->TableBuffer; BYTE string_count; struct smbios_prologue *prologue; struct smbios_bios *bios; + struct smbios_system *system;
#define S(s) s, sizeof(s) bios_vendor_len = get_smbios_string("/sys/class/dmi/id/bios_vendor", S(bios_vendor)); bios_version_len = get_smbios_string("/sys/class/dmi/id/bios_version", S(bios_version)); bios_date_len = get_smbios_string("/sys/class/dmi/id/bios_date", S(bios_date)); + system_vendor_len = get_smbios_string("/sys/class/dmi/id/sys_vendor", S(system_vendor)); + system_product_len = get_smbios_string("/sys/class/dmi/id/product", S(system_product)); + system_version_len = get_smbios_string("/sys/class/dmi/id/product_version", S(system_version)); + system_serial_len = get_smbios_string("/sys/class/dmi/id/product_serial", S(system_serial)); #undef S
*required_len = sizeof(struct smbios_prologue); @@ -1937,6 +1954,10 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti *required_len += sizeof(struct smbios_bios); *required_len += max(bios_vendor_len + bios_version_len + bios_date_len + 4, 2);
+ *required_len += sizeof(struct smbios_system); + *required_len += max(system_vendor_len + system_product_len + system_version_len + + system_serial_len + 5, 2); + sfti->TableBufferLength = *required_len;
*required_len += FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer); @@ -1971,6 +1992,32 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti copy_smbios_string(&buffer, bios_version, bios_version_len); copy_smbios_string(&buffer, bios_date, bios_date_len); memset(buffer, 0, 1); + buffer++; + } + else + { + memset(buffer, 0, 2); + buffer += 2; + } + + string_count = 0; + system = (struct smbios_system*)buffer; + system->type = 1; + system->length = sizeof(struct smbios_system); + system->handle = 0; + system->vendor = system_vendor_len ? ++string_count : 0; + system->product = system_product_len ? ++string_count : 0; + system->version = system_version_len ? ++string_count : 0; + system->serial = system_serial_len ? ++string_count : 0; + buffer += sizeof(struct smbios_system); + + if (string_count) + { + copy_smbios_string(&buffer, system_vendor, system_vendor_len); + copy_smbios_string(&buffer, system_product, system_product_len); + copy_smbios_string(&buffer, system_version, system_version_len); + copy_smbios_string(&buffer, system_serial, system_serial_len); + memset(buffer, 0, 1); } else {