Nikolay Sivov : ole32: Return optional name in IEnumSTATPROPSTG::Next().

Alexandre Julliard julliard at winehq.org
Tue Nov 12 16:56:06 CST 2019


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Nov 12 12:00:11 2019 +0300

ole32: Return optional name in IEnumSTATPROPSTG::Next().

Based on patch by Michael Müller.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/stg_prop.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index 70b8cd3b0e..5518429b31 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -177,6 +177,7 @@ struct enum_stat_prop_stg
 {
     IEnumSTATPROPSTG IEnumSTATPROPSTG_iface;
     LONG refcount;
+    PropertyStorage_impl *storage;
     STATPROPSTG *stats;
     size_t current;
     size_t count;
@@ -222,6 +223,7 @@ static ULONG WINAPI enum_stat_prop_stg_Release(IEnumSTATPROPSTG *iface)
 
     if (!refcount)
     {
+        IPropertyStorage_Release(&penum->storage->IPropertyStorage_iface);
         heap_free(penum->stats);
         heap_free(penum);
     }
@@ -233,6 +235,7 @@ static HRESULT WINAPI enum_stat_prop_stg_Next(IEnumSTATPROPSTG *iface, ULONG cel
 {
     struct enum_stat_prop_stg *penum = impl_from_IEnumSTATPROPSTG(iface);
     ULONG count = 0;
+    WCHAR *name;
 
     TRACE("%p, %u, %p, %p.\n", iface, celt, ret, fetched);
 
@@ -240,7 +243,19 @@ static HRESULT WINAPI enum_stat_prop_stg_Next(IEnumSTATPROPSTG *iface, ULONG cel
         penum->current = 0;
 
     while (count < celt && penum->current < penum->count)
-        ret[count++] = penum->stats[penum->current++];
+    {
+        *ret = penum->stats[penum->current++];
+
+        if (dictionary_find(penum->storage->propid_to_name, UlongToPtr(ret->propid), (void **)&name))
+        {
+            SIZE_T size = (lstrlenW(name) + 1) * sizeof(WCHAR);
+            ret->lpwstrName = CoTaskMemAlloc(size);
+            if (ret->lpwstrName)
+                memcpy(ret->lpwstrName, name, size);
+        }
+        ret++;
+        count++;
+    }
 
     if (fetched)
         *fetched = count;
@@ -321,6 +336,8 @@ static HRESULT create_enum_stat_prop_stg(PropertyStorage_impl *storage, IEnumSTA
 
     enum_obj->IEnumSTATPROPSTG_iface.lpVtbl = &enum_stat_prop_stg_vtbl;
     enum_obj->refcount = 1;
+    enum_obj->storage = storage;
+    IPropertyStorage_AddRef(&storage->IPropertyStorage_iface);
 
     count = 0;
     dictionary_enumerate(storage->propid_to_prop, prop_enum_stat_count, &count);




More information about the wine-cvs mailing list