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 f31438ef6f..c81cc54a56 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -123,6 +123,17 @@ struct smbios_board { unsigned char serial; };
+struct smbios_chassis { + unsigned char type; + unsigned char length; + unsigned short handle; + unsigned char manufacturer; + unsigned char shape; + unsigned char version; + unsigned char serial; + unsigned char 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); unsigned char 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 required_size += board_manufacturer_size + board_product_size + board_version_size + board_serial_size + 1;
+ required_size += sizeof(struct smbios_chassis); + if (!chassis_manufacturer_size && !chassis_version_size && !chassis_serial_size && !chassis_asset_tag_size) + required_size += 2; + else + required_size += chassis_manufacturer_size + chassis_version_size + chassis_serial_size + + chassis_asset_tag_size + 1; + if (required_size > size) return required_size;
@@ -4342,6 +4367,7 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD if (!board_manufacturer && !board_product && !board_version && !board_serial) { memset(buffer, 0, 2); + buffer = (char*)buffer + 2; } else { @@ -4350,6 +4376,32 @@ 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; + } + + 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 (!chassis_manufacturer && !chassis_version && !chassis_serial && !chassis_asset_tag) + { + memset(buffer, 0, 2); + } + else + { + 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); }
free(bios_manufacturer); @@ -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