[4/4] ole32: Implement StgConvertVariantToProperty.

Vincent Povirk madewokherd at gmail.com
Thu Oct 4 17:12:55 CDT 2012


-------------- next part --------------
From a24fa578bb2027ffefbedd25416f3fbfb8730774 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 4 Oct 2012 17:08:04 -0500
Subject: [PATCH 4/4] ole32: Implement StgConvertVariantToProperty.

---
 dlls/ole32/stg_prop.c          |   28 ++++++++++++++++++++++++++--
 dlls/ole32/tests/propvariant.c |    2 +-
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index be901e6..e5115c3 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -2780,7 +2780,31 @@ SERIALIZEDPROPERTYVALUE* WINAPI StgConvertVariantToProperty(const PROPVARIANT *p
     USHORT CodePage, SERIALIZEDPROPERTYVALUE *pprop, ULONG *pcb, PROPID pid,
     BOOLEAN fReserved, ULONG *pcIndirect)
 {
-    FIXME("%p,%d,%p,%p,%d,%d,%p\n", pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
+    HRESULT hr;
+    ULONG buffer_size;
+
+    TRACE("%p,%d,%p,%p,%d,%d,%p\n", pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
+
+    if (pvar->vt == VT_EMPTY)
+    {
+        *pcb = 0;
+        return pprop;
+    }
+
+    if (pprop)
+        buffer_size = *pcb;
+    else
+        buffer_size = 0;
+
+    hr = PropertyStorage_WriteProperty(pvar, CodePage, (BYTE*)pprop, buffer_size,
+        pcb, pid, pcIndirect);
+
+    if (FAILED(hr))
+    {
+        /* FIXME: Not sure how to report this. */
+        ERR("PropertyStorage_WriteProperty failed, hr=%x\n", hr);
+        return NULL;
+    }
 
-    return NULL;
+    return pprop;
 }
diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c
index 2de480a..22f8012 100644
--- a/dlls/ole32/tests/propvariant.c
+++ b/dlls/ole32/tests/propvariant.c
@@ -441,7 +441,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == NULL, "got nonnull propvalue\n");
-    todo_wine ok(len == 8, "unexpected length %d\n", len);
+    ok(len == 8, "unexpected length %d\n", len);
 
     if (len == 0xdeadbeef)
     {
-- 
1.7.9.5


More information about the wine-patches mailing list