[PATCH 3/3] ole32: Implement StgOpenPropStg.

Alex Henrie alexhenrie24 at gmail.com
Sun Apr 10 17:22:26 CDT 2016


For https://bugs.winehq.org/show_bug.cgi?id=16971

Modeled after IPropertySetStorage_fnOpen, see
https://msdn.microsoft.com/en-us/library/windows/desktop/aa380340%28v=vs.85%29.aspx

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ole32/ole32.spec |  1 +
 dlls/ole32/stg_prop.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index 7120daf..eab8664 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -270,6 +270,7 @@
 @ stdcall StgIsStorageFile(wstr)
 @ stdcall StgIsStorageILockBytes(ptr)
 @ stub StgOpenAsyncDocfileOnIFillLockBytes
+@ stdcall StgOpenPropStg(ptr ptr long long ptr)
 @ stdcall StgOpenStorage(wstr ptr long ptr long ptr)
 @ stdcall StgOpenStorageEx(wstr long long long ptr ptr ptr ptr)
 @ stdcall StgOpenStorageOnILockBytes(ptr ptr long long long ptr)
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index c3db945..04e0244 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -2810,3 +2810,46 @@ end:
     TRACE("returning 0x%08x\n", r);
     return r;
 }
+
+HRESULT WINAPI StgOpenPropStg(IUnknown *unk, REFFMTID fmt, DWORD flags,
+                              DWORD reserved, IPropertyStorage **prop_stg)
+{
+    IStorage *stg;
+    IStream *stm;
+    HRESULT r;
+
+    TRACE("%p %s %08x %d %p\n", unk, debugstr_guid(fmt), flags, reserved, prop_stg);
+
+    if (!fmt || reserved)
+    {
+        r = E_INVALIDARG;
+        goto end;
+    }
+
+    if (flags & PROPSETFLAG_NONSIMPLE)
+    {
+        r = IUnknown_QueryInterface(unk, &IID_IStorage, (void **)&stg);
+        if (FAILED(r))
+            goto end;
+
+        /* FIXME: if (flags & PROPSETFLAG_NONSIMPLE), we need to open a
+         * storage, not a stream.  For now, disallow it.
+         */
+        FIXME("PROPSETFLAG_NONSIMPLE not supported\n");
+        IStorage_Release(stg);
+        r = STG_E_INVALIDFLAG;
+    }
+    else
+    {
+        r = IUnknown_QueryInterface(unk, &IID_IStream, (void **)&stm);
+        if (FAILED(r))
+            goto end;
+
+        r = PropertyStorage_ConstructFromStream(stm, fmt,
+                STGM_READWRITE|STGM_SHARE_EXCLUSIVE, prop_stg);
+    }
+
+end:
+    TRACE("returning 0x%08x\n", r);
+    return r;
+}
-- 
2.8.0




More information about the wine-patches mailing list