Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/kernel32/cpu.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index d231f9b903..c3d19587ab 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -88,6 +88,17 @@ struct smbios_board { BYTE serial; };
+struct smbios_chassis { + BYTE type; + BYTE length; + WORD handle; + BYTE manufacturer; + BYTE shape; + BYTE version; + BYTE serial; + BYTE asset_tag; +}; + #include "poppack.h"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000) @@ -436,12 +447,15 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD size_t system_manufacturer_size, system_product_size, system_version_size, system_serial_size; char *board_manufacturer, *board_product, *board_version, *board_serial; size_t board_manufacturer_size, board_product_size, board_version_size, board_serial_size; + char *chassis_manufacturer, *chassis_version, *chassis_serial, *chassis_asset_tag; + size_t chassis_manufacturer_size, chassis_version_size, chassis_serial_size, chassis_asset_tag_size; size_t required_size = sizeof(struct smbios_prologue); BYTE string_count; struct smbios_prologue *prologue; struct smbios_bios *bios; struct smbios_system *system; struct smbios_board *board; + struct smbios_chassis *chassis;
bios_manufacturer = get_smbios_string("/sys/class/dmi/id/bios_vendor", &bios_manufacturer_size); bios_version = get_smbios_string("/sys/class/dmi/id/bios_version", &bios_version_size); @@ -454,6 +468,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD board_product = get_smbios_string("/sys/class/dmi/id/board_name", &board_product_size); board_version = get_smbios_string("/sys/class/dmi/id/board_version", &board_version_size); board_serial = get_smbios_string("/sys/class/dmi/id/board_serial", &board_serial_size); + chassis_manufacturer = get_smbios_string("/sys/class/dmi/id/chassis_vendor", &chassis_manufacturer_size); + chassis_version = get_smbios_string("/sys/class/dmi/id/chassis_version", &chassis_version_size); + chassis_serial = get_smbios_string("/sys/class/dmi/id/chassis_serial", &chassis_serial_size); + chassis_asset_tag = get_smbios_string("/sys/class/dmi/id/chassis_tag", &chassis_asset_tag_size);
required_size += sizeof(struct smbios_bios); required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2); @@ -466,6 +484,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD required_size += max(board_manufacturer_size + board_product_size + board_version_size + board_serial_size + 1, 2);
+ required_size += sizeof(struct smbios_chassis); + required_size += max(chassis_manufacturer_size + chassis_version_size + chassis_serial_size + + chassis_asset_tag_size + 1, 2); + if (required_size > size) return required_size;
@@ -548,6 +570,33 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD copy_smbios_string(&buffer, board_version, board_version_size); copy_smbios_string(&buffer, board_serial, board_serial_size); memset(buffer, 0, 1); + buffer = (char*)buffer + 1; + } + else + { + memset(buffer, 0, 2); + buffer = (char*)buffer + 2; + } + + string_count = 0; + chassis = (struct smbios_chassis*)buffer; + chassis->type = 3; + chassis->length = sizeof(struct smbios_chassis); + chassis->handle = 0; + chassis->manufacturer = chassis_manufacturer ? ++string_count : 0; + chassis->shape = 0x2; /* unknown */ + chassis->version = chassis_version ? ++string_count : 0; + chassis->serial = chassis_serial ? ++string_count : 0; + chassis->asset_tag = chassis_asset_tag ? ++string_count : 0; + buffer = (char*)buffer + sizeof(struct smbios_chassis); + + if (string_count) + { + copy_smbios_string(&buffer, chassis_manufacturer, chassis_manufacturer_size); + copy_smbios_string(&buffer, chassis_version, chassis_version_size); + copy_smbios_string(&buffer, chassis_serial, chassis_serial_size); + copy_smbios_string(&buffer, chassis_asset_tag, chassis_asset_tag_size); + memset(buffer, 0, 1); } else { @@ -565,6 +614,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD free(board_product); free(board_version); free(board_serial); + free(chassis_manufacturer); + free(chassis_version); + free(chassis_serial); + free(chassis_asset_tag);
return required_size; #endif