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 95eea25a57..d231f9b903 100644 --- a/dlls/kernel32/cpu.c +++ b/dlls/kernel32/cpu.c @@ -78,6 +78,16 @@ struct smbios_system { BYTE serial; };
+struct smbios_board { + BYTE type; + BYTE length; + WORD handle; + BYTE manufacturer; + BYTE product; + BYTE version; + BYTE serial; +}; + #include "poppack.h"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000) @@ -424,11 +434,14 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD 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; + char *board_manufacturer, *board_product, *board_version, *board_serial; + size_t board_manufacturer_size, board_product_size, board_version_size, board_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; + struct smbios_board *board;
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); @@ -437,6 +450,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD 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); + board_manufacturer = get_smbios_string("/sys/class/dmi/id/board_vendor", &board_manufacturer_size); + 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);
required_size += sizeof(struct smbios_bios); required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2); @@ -445,6 +462,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD required_size += max(system_manufacturer_size + system_product_size + system_version_size + system_serial_size + 1, 2);
+ required_size += sizeof(struct smbios_board); + required_size += max(board_manufacturer_size + board_product_size + board_version_size + + board_serial_size + 1, 2); + if (required_size > size) return required_size;
@@ -501,6 +522,32 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD copy_smbios_string(&buffer, system_version, system_version_size); copy_smbios_string(&buffer, system_serial, system_serial_size); memset(buffer, 0, 1); + buffer = (char*)buffer + 1; + } + else + { + memset(buffer, 0, 2); + buffer = (char*)buffer + 2; + } + + string_count = 0; + board = (struct smbios_board*)buffer; + board->type = 2; + board->length = sizeof(struct smbios_board); + board->handle = 0; + board->manufacturer = board_manufacturer ? ++string_count : 0; + board->product = board_product ? ++string_count : 0; + board->version = board_version ? ++string_count : 0; + board->serial = board_serial ? ++string_count : 0; + buffer = (char*)buffer + sizeof(struct smbios_board); + + if (string_count) + { + copy_smbios_string(&buffer, board_manufacturer, board_manufacturer_size); + copy_smbios_string(&buffer, board_product, board_product_size); + copy_smbios_string(&buffer, board_version, board_version_size); + copy_smbios_string(&buffer, board_serial, board_serial_size); + memset(buffer, 0, 1); } else { @@ -514,6 +561,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD free(system_product); free(system_version); free(system_serial); + free(board_manufacturer); + free(board_product); + free(board_version); + free(board_serial);
return required_size; #endif