[PATCH v2 6/7] wbemprox: Add SystemType property to Win32_Computersystem.

Hans Leidekker hans at codeweavers.com
Thu Apr 28 05:43:24 CDT 2022


From: Louis Lenders <xerox.xerox2000x at gmail.com>

v2: Use a helper that maps directly from processor architecture.

Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=52887
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/wbemprox/builtin.c     | 11 +++++++++++
 dlls/wbemprox/tests/query.c |  1 +
 2 files changed, 12 insertions(+)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 27e1084b21e..98a32313461 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -105,6 +105,7 @@ static const struct column col_compsys[] =
     { L"Name",                      CIM_STRING|COL_FLAG_DYNAMIC },
     { L"NumberOfLogicalProcessors", CIM_UINT32 },
     { L"NumberOfProcessors",        CIM_UINT32 },
+    { L"SystemType",                CIM_STRING },
     { L"TotalPhysicalMemory",       CIM_UINT64 },
     { L"UserName",                  CIM_STRING|COL_FLAG_DYNAMIC },
 };
@@ -541,6 +542,7 @@ struct record_computersystem
     const WCHAR *name;
     UINT32       num_logical_processors;
     UINT32       num_processors;
+    const WCHAR *systemtype;
     UINT64       total_physical_memory;
     const WCHAR *username;
 };
@@ -1580,6 +1582,14 @@ static WCHAR *get_computername(void)
     return ret;
 }
 
+static const WCHAR *get_systemtype(void)
+{
+    SYSTEM_INFO info;
+    GetNativeSystemInfo( &info );
+    if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return L"x64 based PC";
+    return L"x86 based PC";
+}
+
 static WCHAR *get_username(void)
 {
     WCHAR *ret;
@@ -1614,6 +1624,7 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co
     rec->model                  = L"Wine";
     rec->name                   = get_computername();
     rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors );
+    rec->systemtype             = get_systemtype();
     rec->total_physical_memory  = get_total_physical_memory();
     rec->username               = get_username();
     if (!match_row( table, row, cond, &status )) free_row_values( table, row );
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 54d80b9e196..f8508cd1405 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -752,6 +752,7 @@ static void test_Win32_ComputerSystem( IWbemServices *services )
     }
 
     check_property( obj, L"NumberOfProcessors", VT_I4, CIM_UINT32 );
+    check_property( obj, L"SystemType", VT_BSTR, CIM_STRING );
 
     type = 0xdeadbeef;
     VariantInit( &value );
-- 
2.30.2




More information about the wine-devel mailing list