From 4e886e8ca035955cd3a174dcb05b12fde9b7807d Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Mon, 24 Feb 2020 15:42:51 -0800 Subject: [PATCH] wbemprox: Add embedded controller and system BIOS release numbers to Win32_BIOS. Signed-off-by: Brendan Shanks Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wbemprox/builtin.c | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index c680ae23c3e..bfe913a32ae 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -254,6 +254,10 @@ static const WCHAR prop_driverversionW[] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}; static const WCHAR prop_drivetypeW[] = {'D','r','i','v','e','T','y','p','e',0}; +static const WCHAR prop_embeddedcontrollermajorversionW[] = + {'E','m','b','e','d','d','e','d','C','o','n','t','r','o','l','l','e','r','M','a','j','o','r','V','e','r','s','i','o','n',0}; +static const WCHAR prop_embeddedcontrollerminorversionW[] = + {'E','m','b','e','d','d','e','d','C','o','n','t','r','o','l','l','e','r','M','i','n','o','r','V','e','r','s','i','o','n',0}; static const WCHAR prop_familyW[] = {'F','a','m','i','l','y',0}; static const WCHAR prop_filesystemW[] = @@ -424,6 +428,10 @@ static const WCHAR prop_strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0}; static const WCHAR prop_suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0}; +static const WCHAR prop_systembiosmajorversionW[] = + {'S','y','s','t','e','m','B','i','o','s','M','a','j','o','r','V','e','r','s','i','o','n',0}; +static const WCHAR prop_systembiosminorversionW[] = + {'S','y','s','t','e','m','B','i','o','s','M','i','n','o','r','V','e','r','s','i','o','n',0}; static const WCHAR prop_systemdirectoryW[] = {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0}; static const WCHAR prop_systemdriveW[] = @@ -496,6 +504,8 @@ static const struct column col_bios[] = { { prop_currentlanguageW, CIM_STRING }, { prop_descriptionW, CIM_STRING }, + { prop_embeddedcontrollermajorversionW, CIM_UINT8 }, + { prop_embeddedcontrollerminorversionW, CIM_UINT8 }, { prop_identificationcodeW, CIM_STRING }, { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_nameW, CIM_STRING }, @@ -504,6 +514,8 @@ static const struct column col_bios[] = { prop_smbiosbiosversionW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_smbiosmajorversionW, CIM_UINT16 }, { prop_smbiosminorversionW, CIM_UINT16 }, + { prop_systembiosmajorversionW, CIM_UINT8 }, + { prop_systembiosminorversionW, CIM_UINT8 }, { prop_versionW, CIM_STRING|COL_FLAG_KEY } }; static const struct column col_cdromdrive[] = @@ -975,6 +987,8 @@ struct record_bios { const WCHAR *currentlanguage; const WCHAR *description; + UINT8 ecmajorversion; + UINT8 ecminorversion; const WCHAR *identificationcode; const WCHAR *manufacturer; const WCHAR *name; @@ -983,6 +997,8 @@ struct record_bios const WCHAR *smbiosbiosversion; UINT16 smbiosmajorversion; UINT16 smbiosminorversion; + UINT8 systembiosmajorversion; + UINT8 systembiosminorversion; const WCHAR *version; }; struct record_cdromdrive @@ -1495,6 +1511,11 @@ struct smbios_bios BYTE date; BYTE size; UINT64 characteristics; + BYTE characteristics_ext[2]; + BYTE system_bios_major_release; + BYTE system_bios_minor_release; + BYTE ec_firmware_major_release; + BYTE ec_firmware_minor_release; }; struct smbios_chassis @@ -1729,6 +1750,54 @@ static WCHAR *get_bios_smbiosbiosversion( const char *buf, UINT len ) return ret; } +static BYTE get_bios_ec_firmware_major_release( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_bios *bios; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF; + + bios = (const struct smbios_bios *)hdr; + if (bios->hdr.length >= 0x18) return bios->ec_firmware_major_release; + else return 0xFF; +} + +static BYTE get_bios_ec_firmware_minor_release( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_bios *bios; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF; + + bios = (const struct smbios_bios *)hdr; + if (bios->hdr.length >= 0x18) return bios->ec_firmware_minor_release; + else return 0xFF; +} + +static BYTE get_bios_system_bios_major_release( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_bios *bios; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF; + + bios = (const struct smbios_bios *)hdr; + if (bios->hdr.length >= 0x18) return bios->system_bios_major_release; + else return 0xFF; +} + +static BYTE get_bios_system_bios_minor_release( const char *buf, UINT len ) +{ + const struct smbios_header *hdr; + const struct smbios_bios *bios; + + if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF; + + bios = (const struct smbios_bios *)hdr; + if (bios->hdr.length >= 0x18) return bios->system_bios_minor_release; + else return 0xFF; +} + static enum fill_status fill_bios( struct table *table, const struct expr *cond ) { struct record_bios *rec; @@ -1745,6 +1814,8 @@ static enum fill_status fill_bios( struct table *table, const struct expr *cond rec = (struct record_bios *)table->data; rec->currentlanguage = NULL; rec->description = bios_descriptionW; + rec->ecmajorversion = get_bios_ec_firmware_major_release( buf, len ); + rec->ecminorversion = get_bios_ec_firmware_minor_release( buf, len ); rec->identificationcode = NULL; rec->manufacturer = get_bios_manufacturer( buf, len ); rec->name = bios_descriptionW; @@ -1753,6 +1824,8 @@ static enum fill_status fill_bios( struct table *table, const struct expr *cond rec->smbiosbiosversion = get_bios_smbiosbiosversion( buf, len ); rec->smbiosmajorversion = get_bios_smbiosmajorversion( buf, len ); rec->smbiosminorversion = get_bios_smbiosminorversion( buf, len ); + rec->systembiosmajorversion = get_bios_system_bios_major_release( buf, len ); + rec->systembiosminorversion = get_bios_system_bios_minor_release( buf, len ); rec->version = bios_versionW; if (!match_row( table, row, cond, &status )) free_row_values( table, row ); else row++;