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 b8df3c40c0..689f6d730c 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -103,6 +103,16 @@ struct smbios_bios { unsigned long long characteristics; };
+struct smbios_system { + unsigned char type; + unsigned char length; + unsigned short handle; + unsigned char manufacturer; + unsigned char product; + unsigned char version; + unsigned char 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); unsigned char 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 += bios_manufacturer_size + bios_version_size + bios_date_size + 1;
+ required_size += sizeof(struct smbios_system); + if (!system_manufacturer_size && !system_product_size && !system_version_size && !system_serial_size) + required_size += 2; + else + required_size += system_manufacturer_size + system_product_size + system_version_size + + system_serial_size + 1; + if (required_size > size) return required_size;
@@ -4243,6 +4267,7 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD if (!bios_manufacturer && !bios_version && !bios_date) { memset(buffer, 0, 2); + buffer = (char*)buffer + 2; } else { @@ -4250,11 +4275,40 @@ 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; + } + + 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 (!system_manufacturer && !system_product && !system_version && !system_serial) + { + memset(buffer, 0, 2); + } + else + { + 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); }
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