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 689f6d730c..f31438ef6f 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -113,6 +113,16 @@ struct smbios_system { unsigned char serial; };
+struct smbios_board { + 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; @@ -4213,11 +4223,14 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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); unsigned char 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); @@ -4226,6 +4239,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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); if (!bios_manufacturer_size && !bios_version_size && !bios_date_size) @@ -4240,6 +4257,13 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD required_size += system_manufacturer_size + system_product_size + system_version_size + system_serial_size + 1;
+ required_size += sizeof(struct smbios_board); + if (!board_manufacturer_size && !board_product_size && !board_version_size && !board_serial_size) + required_size += 2; + else + required_size += board_manufacturer_size + board_product_size + board_version_size + + board_serial_size + 1; + if (required_size > size) return required_size;
@@ -4292,6 +4316,7 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD if (!system_manufacturer && !system_product && !system_version && !system_serial) { memset(buffer, 0, 2); + buffer = (char*)buffer + 2; } else { @@ -4300,6 +4325,31 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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; + } + + 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 (!board_manufacturer && !board_product && !board_version && !board_serial) + { + memset(buffer, 0, 2); + } + else + { + 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); }
free(bios_manufacturer); @@ -4309,6 +4359,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID 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