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 e622912d8a..d9fc2e6108 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 */ @@ -1945,12 +1956,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[128], board_product[128], board_version[128], board_serial[128]; size_t board_vendor_len, board_product_len, board_version_len, board_serial_len; + char chassis_vendor[128], chassis_version[128], chassis_serial[128], chassis_asset_tag[128]; + 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;
#define S(s) s, sizeof(s) bios_vendor_len = get_smbios_string("/sys/class/dmi/id/bios_vendor", S(bios_vendor)); @@ -1964,6 +1978,10 @@ static inline NTSTATUS get_firmware_info(SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti board_product_len = get_smbios_string("/sys/class/dmi/id/board_name", S(board_product)); board_version_len = get_smbios_string("/sys/class/dmi/id/board_version", S(board_version)); board_serial_len = get_smbios_string("/sys/class/dmi/id/board_serial", S(board_serial)); + chassis_vendor_len = get_smbios_string("/sys/class/dmi/id/chassis_vendor", S(chassis_vendor)); + chassis_version_len = get_smbios_string("/sys/class/dmi/id/chassis_version", S(chassis_version)); + chassis_serial_len = get_smbios_string("/sys/class/dmi/id/chassis_serial", S(chassis_serial)); + chassis_asset_tag_len = get_smbios_string("/sys/class/dmi/id/chassis_tag", S(chassis_asset_tag)); #undef S
*required_len = sizeof(struct smbios_prologue); @@ -1978,6 +1996,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); @@ -2064,6 +2086,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 {