Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/kernel32/cpu.c | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c index 4dd9bb628a..95eea25a57 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -68,6 +68,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"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000) @@ -412,18 +422,29 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *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); required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2);
+ required_size += sizeof(struct smbios_system); + required_size += max(system_manufacturer_size + system_product_size + system_version_size + + system_serial_size + 1, 2); + if (required_size > size) return required_size;
@@ -454,6 +475,32 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *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 { @@ -463,6 +510,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *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