Hans Leidekker : wbemprox: Implement Win32_PhysicalMemory.DeviceLocator.

Alexandre Julliard julliard at winehq.org
Mon Mar 25 16:54:57 CDT 2019


Module: wine
Branch: master
Commit: 66b2b3ea6836838e8c49e963ffceddb42836ee5f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=66b2b3ea6836838e8c49e963ffceddb42836ee5f

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Mar 25 10:06:04 2019 +0100

wbemprox: Implement Win32_PhysicalMemory.DeviceLocator.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46894
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wbemprox/builtin.c     | 18 ++++++++++++------
 dlls/wbemprox/tests/query.c | 10 ++++++++++
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index b206a2a..fc04f3f 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -204,6 +204,8 @@ static const WCHAR prop_destinationW[] =
     {'D','e','s','t','i','n','a','t','i','o','n',0};
 static const WCHAR prop_deviceidW[] =
     {'D','e','v','i','c','e','I','d',0};
+static const WCHAR prop_devicelocatorW[] =
+    {'D','e','v','i','c','e','L','o','c','a','t','o','r',0};
 static const WCHAR prop_dhcpenabledW[] =
     {'D','H','C','P','E','n','a','b','l','e','d',0};
 static const WCHAR prop_directionW[] =
@@ -617,8 +619,9 @@ static const struct column col_physicalmedia[] =
 };
 static const struct column col_physicalmemory[] =
 {
-    { prop_capacityW,   CIM_UINT64 },
-    { prop_memorytypeW, CIM_UINT16, VT_I4 }
+    { prop_capacityW,      CIM_UINT64 },
+    { prop_devicelocatorW, CIM_STRING },
+    { prop_memorytypeW,    CIM_UINT16, VT_I4 }
 };
 static const struct column col_pnpentity[] =
 {
@@ -1043,8 +1046,9 @@ struct record_physicalmedia
 };
 struct record_physicalmemory
 {
-    UINT64 capacity;
-    UINT16 memorytype;
+    UINT64       capacity;
+    const WCHAR *devicelocator;
+    UINT16       memorytype;
 };
 struct record_pnpentity
 {
@@ -2639,6 +2643,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
 
 static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond )
 {
+    static const WCHAR dimm0W[] = {'D','I','M','M',' ','0',0};
     struct record_physicalmemory *rec;
     enum fill_status status = FILL_STATUS_UNFILTERED;
     UINT row = 0;
@@ -2646,8 +2651,9 @@ static enum fill_status fill_physicalmemory( struct table *table, const struct e
     if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
     rec = (struct record_physicalmemory *)table->data;
-    rec->capacity   = get_total_physical_memory();
-    rec->memorytype = 9; /* RAM */
+    rec->capacity      = get_total_physical_memory();
+    rec->devicelocator = heap_strdupW( dimm0W );
+    rec->memorytype    = 9; /* RAM */
     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 e8ddbcc..b622ac2 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1489,6 +1489,7 @@ static void test_Win32_PhysicalMemory( IWbemServices *services )
 {
     static const WCHAR capacityW[] = {'C','a','p','a','c','i','t','y',0};
     static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0};
+    static const WCHAR devicelocatorW[] = {'D','e','v','i','c','e','L','o','c','a','t','o','r',0};
     static const WCHAR queryW[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
          'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
@@ -1523,6 +1524,15 @@ static void test_Win32_PhysicalMemory( IWbemServices *services )
 
         type = 0xdeadbeef;
         VariantInit( &val );
+        hr = IWbemClassObject_Get( obj, devicelocatorW, 0, &val, &type, NULL );
+        ok( hr == S_OK, "failed to get devicelocator %08x\n", hr );
+        ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) );
+        ok( type == CIM_STRING, "unexpected type 0x%x\n", type );
+        trace( "devicelocator %s\n", wine_dbgstr_w(V_BSTR( &val )) );
+        VariantClear( &val );
+
+        type = 0xdeadbeef;
+        VariantInit( &val );
         hr = IWbemClassObject_Get( obj, memorytypeW, 0, &val, &type, NULL );
         ok( hr == S_OK, "failed to get memory type %08x\n", hr );
         ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) );




More information about the wine-cvs mailing list