[PATCH 1/2] ole2disp: Implement SafeArrayDestroyDescriptor()

Nikolay Sivov nsivov at codeweavers.com
Tue Jan 12 02:49:29 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

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

 dlls/ole2disp.dll16/ole2disp.c          | 25 +++++++++++++++++++++++++
 dlls/ole2disp.dll16/ole2disp.dll16.spec |  2 +-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/ole2disp.dll16/ole2disp.c b/dlls/ole2disp.dll16/ole2disp.c
index 1774211..539b515 100644
--- a/dlls/ole2disp.dll16/ole2disp.c
+++ b/dlls/ole2disp.dll16/ole2disp.c
@@ -67,6 +67,11 @@ static SEGPTR safearray_alloc(ULONG size)
     return WOWGlobalAllocLock16(GPTR, size, &h);
 }
 
+static void safearray_free(SEGPTR ptr)
+{
+    WOWGlobalUnlockFree16(ptr);
+}
+
 /******************************************************************************
  *    SafeArrayAllocDescriptor [OLE2DISP.38]
  */
@@ -90,6 +95,26 @@ HRESULT WINAPI SafeArrayAllocDescriptor16(UINT16 dims, SEGPTR *ret)
     return S_OK;
 }
 
+/******************************************************************************
+ *    SafeArrayDestroyDescriptor [OLE2DISP.40]
+ */
+HRESULT WINAPI SafeArrayDestroyDescriptor16(SEGPTR s)
+{
+    TRACE("0x%08x\n", s);
+
+    if (s)
+    {
+        SAFEARRAY16 *sa = MapSL(s);
+
+        if (sa->cLocks)
+            return DISP_E_ARRAYISLOCKED;
+
+        safearray_free(s);
+    }
+
+    return S_OK;
+}
+
 /* This implementation of the BSTR API is 16-bit only. It
    represents BSTR as a 16:16 far pointer, and the strings
    as ISO-8859 */
diff --git a/dlls/ole2disp.dll16/ole2disp.dll16.spec b/dlls/ole2disp.dll16/ole2disp.dll16.spec
index 08372c5..997de31 100644
--- a/dlls/ole2disp.dll16/ole2disp.dll16.spec
+++ b/dlls/ole2disp.dll16/ole2disp.dll16.spec
@@ -37,7 +37,7 @@
 37 stub GETACTIVEOBJECT
 38 pascal SafeArrayAllocDescriptor(word ptr) SafeArrayAllocDescriptor16
 39 stub SAFEARRAYALLOCDATA
-40 stub SAFEARRAYDESTROYDESCRIPTOR
+40 pascal SafeArrayDestroyDescriptor(segptr) SafeArrayDestroyDescriptor16
 41 stub SAFEARRAYDESTROYDATA
 42 stub SAFEARRAYREDIM
 43 stub VARI2FROMI4
-- 
2.6.4




More information about the wine-patches mailing list