[PATCH 0/2] MR9887: wbemprox: Add Win32_SystemEnclosure.SerialNumber.
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/wbemprox/builtin.c | 10 ++++++++++ dlls/wbemprox/tests/query.c | 1 + 2 files changed, 11 insertions(+) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index f79c0f7b2b1..e0bc2968f39 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -527,6 +527,7 @@ static const struct column col_systemenclosure[] = { L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC }, { L"Name", CIM_STRING }, { L"Tag", CIM_STRING }, + { L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC }, }; static const struct column col_systemsecurity[] = { @@ -1124,6 +1125,7 @@ struct record_systemenclosure const WCHAR *manufacturer; const WCHAR *name; const WCHAR *tag; + const WCHAR *serial_number; }; struct record_videocontroller { @@ -4572,6 +4574,13 @@ done: return ret; } +static WCHAR *get_systemenclosure_serialnumber( const char *buf, UINT len ) +{ + WCHAR *ret = get_smbios_string( SMBIOS_TYPE_SYSTEM, 0, offsetof(struct smbios_system, serial), buf, len ); + if (!ret) return wcsdup( L"0" ); + return ret; +} + static enum fill_status fill_systemenclosure( struct table *table, const struct expr *cond ) { struct record_systemenclosure *rec; @@ -4593,6 +4602,7 @@ static enum fill_status fill_systemenclosure( struct table *table, const struct rec->manufacturer = get_systemenclosure_manufacturer( buf, len ); rec->name = L"System Enclosure"; rec->tag = L"System Enclosure 0"; + rec->serial_number = get_systemenclosure_serialnumber( buf, len ); if (!match_row( table, row, cond, &status )) free_row_values( table, row ); else row++; diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 5be4ade6dce..260e191adbe 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -976,6 +976,7 @@ static void test_Win32_SystemEnclosure( IWbemServices *services ) check_property( obj, L"Manufacturer", VT_BSTR, CIM_STRING ); check_property( obj, L"Name", VT_BSTR, CIM_STRING ); check_property( obj, L"Tag", VT_BSTR, CIM_STRING ); + check_property( obj, L"SerialNumber", VT_BSTR, CIM_STRING ); IWbemClassObject_Release( obj ); done: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9887
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/wbemprox/builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index e0bc2968f39..1df0885861f 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -526,7 +526,7 @@ static const struct column col_systemenclosure[] = { L"LockPresent", CIM_BOOLEAN }, { L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC }, { L"Name", CIM_STRING }, - { L"Tag", CIM_STRING }, + { L"Tag", CIM_STRING|COL_FLAG_KEY }, { L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC }, }; static const struct column col_systemsecurity[] = -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9887
DCS World Steam Edition depends on that (the first patch; the second is just that I spotted looking at query results on Windows that Tag is the key column). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9887#note_126939
Hans Leidekker (@hans) commented about dlls/wbemprox/tests/query.c:
check_property( obj, L"Manufacturer", VT_BSTR, CIM_STRING ); check_property( obj, L"Name", VT_BSTR, CIM_STRING ); check_property( obj, L"Tag", VT_BSTR, CIM_STRING ); + check_property( obj, L"SerialNumber", VT_BSTR, CIM_STRING );
Please keep properties sorted here and elsewhere. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9887#note_127036
Hans Leidekker (@hans) commented about dlls/wbemprox/builtin.c:
return ret; }
+static WCHAR *get_systemenclosure_serialnumber( const char *buf, UINT len ) +{ + WCHAR *ret = get_smbios_string( SMBIOS_TYPE_SYSTEM, 0, offsetof(struct smbios_system, serial), buf, len );
That should be smbios_chassis. Note that this value is read from /sys/class/dmi/id/chassis_serial on Linux which can only be read by root and we fall back to returning the static string "Chassis Serial Number". My PC BIOS has "Default string" here which isn't very unique either so this may not be a problem in practice. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9887#note_127038
On Thu Jan 15 11:19:34 2026 +0000, Hans Leidekker wrote:
That should be smbios_chassis. Note that this value is read from /sys/class/dmi/id/chassis_serial on Linux which can only be read by root and we fall back to returning the static string "Chassis Serial Number". My PC BIOS has "Default string" here which isn't very unique either so this may not be a problem in practice. Yes, I got tripped by the fact that here on Windows the field is the same as Win32_ComputerSystemProduct.IdentifyingNumber and Win32_Bios.SerialNumber, but chassis number looks like the correct field indeed.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9887#note_127059
participants (3)
-
Hans Leidekker (@hans) -
Paul Gofman -
Paul Gofman (@gofman)