Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/kernel32/process.c | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index b9942b9ec9..f257b4c191 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -123,6 +123,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"
static DWORD shutdown_flags = 0; @@ -4225,12 +4236,15 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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); @@ -4243,6 +4257,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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); if (bios_manufacturer_size || bios_version_size || bios_date_size) @@ -4264,6 +4282,13 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD else required_size += 2;
+ required_size += sizeof(struct smbios_chassis); + if (chassis_manufacturer_size || chassis_version_size || chassis_serial_size || chassis_asset_tag_size) + required_size += chassis_manufacturer_size + chassis_version_size + chassis_serial_size + + chassis_asset_tag_size + 1; + else + required_size += 2; + if (required_size > size) return required_size;
@@ -4346,6 +4371,33 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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 { @@ -4363,6 +4415,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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