Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ntdll/nt.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index bce7348ba6..9fcb9a8155 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -108,6 +108,17 @@ struct smbios_board { BYTE serial; };
+struct smbios_chassis { + BYTE type; + BYTE length; + WORD handle; + BYTE vendor; + BYTE shape; + BYTE version; + BYTE serial; + BYTE asset_tag; +}; + #include "poppack.h"
/* Firmware table providers */ @@ -1946,12 +1957,15 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti size_t system_vendor_len, system_product_len, system_version_len, system_serial_len; char board_vendor[FWSS], board_product[FWSS], board_version[FWSS], board_serial[FWSS]; size_t board_vendor_len, board_product_len, board_version_len, board_serial_len; + char chassis_vendor[FWSS], chassis_version[FWSS], chassis_serial[FWSS], chassis_asset_tag[FWSS]; + size_t chassis_vendor_len, chassis_version_len, chassis_serial_len, chassis_asset_tag_len; char *buffer = (char*)sfti->TableBuffer; BYTE string_count; struct smbios_prologue *prologue; struct smbios_bios *bios; struct smbios_system *system; struct smbios_board *board; + struct smbios_chassis *chassis;
get_smbios_string("/sys/class/dmi/id/bios_vendor", bios_vendor, &bios_vendor_len); get_smbios_string("/sys/class/dmi/id/bios_version", bios_version, &bios_version_len); @@ -1964,6 +1978,10 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti get_smbios_string("/sys/class/dmi/id/board_name", board_product, &board_product_len); get_smbios_string("/sys/class/dmi/id/board_version", board_version, &board_version_len); get_smbios_string("/sys/class/dmi/id/board_serial", board_serial, &board_serial_len); + get_smbios_string("/sys/class/dmi/id/chassis_vendor", chassis_vendor, &chassis_vendor_len); + get_smbios_string("/sys/class/dmi/id/chassis_version", chassis_version, &chassis_version_len); + get_smbios_string("/sys/class/dmi/id/chassis_serial", chassis_serial, &chassis_serial_len); + get_smbios_string("/sys/class/dmi/id/chassis_tag", chassis_asset_tag, &chassis_asset_tag_len);
*required_len = sizeof(struct smbios_prologue);
@@ -1977,6 +1995,10 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti *required_len += sizeof(struct smbios_board); *required_len += max(board_vendor_len + board_product_len + board_version_len + board_serial_len + 5, 2);
+ *required_len += sizeof(struct smbios_chassis); + *required_len += max(chassis_vendor_len + chassis_version_len + chassis_serial_len + + chassis_asset_tag_len + 5, 2); + sfti->TableBufferLength = *required_len;
*required_len += FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer); @@ -2065,6 +2087,33 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti copy_smbios_string(&buffer, board_version, board_version_len); copy_smbios_string(&buffer, board_serial, board_serial_len); memset(buffer, 0, 1); + buffer++; + } + else + { + memset(buffer, 0, 2); + buffer += 2; + } + + string_count = 0; + chassis = (struct smbios_chassis*)buffer; + chassis->type = 3; + chassis->length = sizeof(struct smbios_chassis); + chassis->handle = 0; + chassis->vendor = chassis_vendor_len ? ++string_count : 0; + chassis->shape = 0x2; /* unknown */ + chassis->version = chassis_version_len ? ++string_count : 0; + chassis->serial = chassis_serial_len ? ++string_count : 0; + chassis->asset_tag = chassis_asset_tag_len ? ++string_count : 0; + buffer += sizeof(struct smbios_chassis); + + if (string_count) + { + copy_smbios_string(&buffer, chassis_vendor, chassis_vendor_len); + copy_smbios_string(&buffer, chassis_version, chassis_version_len); + copy_smbios_string(&buffer, chassis_serial, chassis_serial_len); + copy_smbios_string(&buffer, chassis_asset_tag, chassis_asset_tag_len); + memset(buffer, 0, 1); } else {