[PATCH 2/2] wbemprox: Implement Win32_OperatingSystem.OperatingSystemSKU.

Hans Leidekker hans at codeweavers.com
Mon Mar 25 04:06:05 CDT 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46895
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/wbemprox/builtin.c     | 11 +++++++++++
 dlls/wbemprox/tests/query.c | 13 +++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index fc04f3f85f..d4c263078e 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -314,6 +314,8 @@ static const WCHAR prop_numlogicalprocessorsW[] =
     {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
 static const WCHAR prop_numprocessorsW[] =
     {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
+static const WCHAR prop_operatingsystemskuW[] =
+    {'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m','S','K','U',0};
 static const WCHAR prop_osarchitectureW[] =
     {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
 static const WCHAR prop_oslanguageW[] =
@@ -588,6 +590,7 @@ static const struct column col_os[] =
     { prop_localdatetimeW,          CIM_DATETIME|COL_FLAG_DYNAMIC },
     { prop_localeW,                 CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_nameW,                   CIM_STRING|COL_FLAG_DYNAMIC },
+    { prop_operatingsystemskuW,     CIM_UINT32, VT_I4 },
     { prop_osarchitectureW,         CIM_STRING },
     { prop_oslanguageW,             CIM_UINT32, VT_I4 },
     { prop_osproductsuiteW,         CIM_UINT32, VT_I4 },
@@ -1015,6 +1018,7 @@ struct record_operatingsystem
     const WCHAR *localdatetime;
     const WCHAR *locale;
     const WCHAR *name;
+    UINT32       operatingsystemsku;
     const WCHAR *osarchitecture;
     UINT32       oslanguage;
     UINT32       osproductsuite;
@@ -3197,6 +3201,12 @@ static WCHAR *get_osversion( OSVERSIONINFOEXW *ver )
     if (ret) sprintfW( ret, fmtW, ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber );
     return ret;
 }
+static DWORD get_operatingsystemsku(void)
+{
+    DWORD ret = PRODUCT_UNDEFINED;
+    GetProductInfo( 6, 0, 0, 0, &ret );
+    return ret;
+}
 
 static enum fill_status fill_os( struct table *table, const struct expr *cond )
 {
@@ -3222,6 +3232,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond )
     rec->localdatetime          = get_localdatetime();
     rec->locale                 = get_locale();
     rec->name                   = get_osname( rec->caption );
+    rec->operatingsystemsku     = get_operatingsystemsku();
     rec->osarchitecture         = get_osarchitecture();
     rec->oslanguage             = GetSystemDefaultLangID();
     rec->osproductsuite         = 2461140; /* Windows XP Professional  */
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index b622ac278c..510e7aad70 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1234,6 +1234,7 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
     static const WCHAR csdversionW[] = {'C','S','D','V','e','r','s','i','o','n',0};
     static const WCHAR freephysicalmemoryW[] = {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
     static const WCHAR nameW[] = {'N','a','m','e',0};
+    static const WCHAR operatingsystemskuW[] = {'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m','S','K','U',0};
     static const WCHAR osproductsuiteW[] = {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
     static const WCHAR ostypeW[] = {'O','S','T','y','p','e',0};
     static const WCHAR suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0};
@@ -1315,6 +1316,18 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
 
     type = 0xdeadbeef;
     VariantInit( &val );
+    hr = IWbemClassObject_Get( obj, operatingsystemskuW, 0, &val, &type, NULL );
+    ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND) /* winxp */, "failed to get operatingsystemsku %08x\n", hr );
+    if (hr == S_OK)
+    {
+        ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) );
+        ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
+        trace( "operatingsystemsku: %08x\n", V_I4( &val ) );
+        VariantClear( &val );
+    }
+
+    type = 0xdeadbeef;
+    VariantInit( &val );
     hr = IWbemClassObject_Get( obj, osproductsuiteW, 0, &val, &type, NULL );
     ok( hr == S_OK, "failed to get osproductsuite %08x\n", hr );
     ok( V_VT( &val ) == VT_I4 || broken(V_VT( &val ) == VT_NULL) /* winxp */, "unexpected variant type 0x%x\n", V_VT( &val ) );
-- 
2.11.0




More information about the wine-devel mailing list