Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/kernel32/process.c | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 6797475438..1a4a2c3243 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -103,6 +103,16 @@ struct smbios_bios { UINT64 characteristics; };
+struct smbios_system { + BYTE type; + BYTE length; + WORD handle; + BYTE manufacturer; + BYTE product; + BYTE version; + BYTE serial; +}; + #include "poppack.h"
static DWORD shutdown_flags = 0; @@ -4201,14 +4211,21 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD #ifdef linux char *bios_manufacturer, *bios_version, *bios_date; size_t bios_manufacturer_size, bios_version_size, bios_date_size; + char *system_manufacturer, *system_product, *system_version, *system_serial; + size_t system_manufacturer_size, system_product_size, system_version_size, system_serial_size; size_t required_size = sizeof(struct smbios_prologue); BYTE string_count; struct smbios_prologue *prologue; struct smbios_bios *bios; + struct smbios_system *system;
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); bios_date = get_smbios_string("/sys/class/dmi/id/bios_date", &bios_date_size); + system_manufacturer = get_smbios_string("/sys/class/dmi/id/sys_vendor", &system_manufacturer_size); + system_product = get_smbios_string("/sys/class/dmi/id/product", &system_product_size); + system_version = get_smbios_string("/sys/class/dmi/id/product_version", &system_version_size); + system_serial = get_smbios_string("/sys/class/dmi/id/product_serial", &system_serial_size);
required_size += sizeof(struct smbios_bios); if (bios_manufacturer_size || bios_version_size || bios_date_size) @@ -4216,6 +4233,13 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD else required_size += 2;
+ required_size += sizeof(struct smbios_system); + if (system_manufacturer_size || system_product_size || system_version_size || system_serial_size) + required_size += system_manufacturer_size + system_product_size + system_version_size + + system_serial_size + 1; + else + required_size += 2; + if (required_size > size) return required_size;
@@ -4246,6 +4270,32 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD copy_smbios_string(&buffer, bios_version, bios_version_size); copy_smbios_string(&buffer, bios_date, bios_date_size); memset(buffer, 0, 1); + buffer = (char*)buffer + 1; + } + else + { + memset(buffer, 0, 2); + buffer = (char*)buffer + 2; + } + + string_count = 0; + system = (struct smbios_system*)buffer; + system->type = 1; + system->length = sizeof(struct smbios_system); + system->handle = 0; + system->manufacturer = system_manufacturer ? ++string_count : 0; + system->product = system_product ? ++string_count : 0; + system->version = system_version ? ++string_count : 0; + system->serial = system_serial ? ++string_count : 0; + buffer = (char*)buffer + sizeof(struct smbios_system); + + if (string_count) + { + copy_smbios_string(&buffer, system_manufacturer, system_manufacturer_size); + copy_smbios_string(&buffer, system_product, system_product_size); + copy_smbios_string(&buffer, system_version, system_version_size); + copy_smbios_string(&buffer, system_serial, system_serial_size); + memset(buffer, 0, 1); } else { @@ -4255,6 +4305,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD free(bios_manufacturer); free(bios_version); free(bios_date); + free(system_manufacturer); + free(system_product); + free(system_version); + free(system_serial);
return required_size; #endif