Nikolay Sivov : ole2disp: Implement SafeArrayAllocDescriptor().
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 11 08:22:28 CST 2016
Module: wine
Branch: master
Commit: d8287b55009890c63adf15f7809b527a5c5885c7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8287b55009890c63adf15f7809b527a5c5885c7
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Jan 10 21:47:06 2016 +0300
ole2disp: Implement SafeArrayAllocDescriptor().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole2disp.dll16/ole2disp.c | 51 +++++++++++++++++++++++++++++++++
dlls/ole2disp.dll16/ole2disp.dll16.spec | 2 +-
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/dlls/ole2disp.dll16/ole2disp.c b/dlls/ole2disp.dll16/ole2disp.c
index 43336c4..1774211 100644
--- a/dlls/ole2disp.dll16/ole2disp.c
+++ b/dlls/ole2disp.dll16/ole2disp.c
@@ -30,6 +30,7 @@
#include "ole2.h"
#include "oleauto.h"
#include "winerror.h"
+#include "wownt32.h"
#include "wine/windef16.h"
#include "wine/winbase16.h"
@@ -39,6 +40,56 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
+#define E_OUTOFMEMORY16 MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 2)
+#define E_INVALIDARG16 MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
+
+/* 16-bit SAFEARRAY implementation */
+typedef struct tagSAFEARRAYBOUND16
+{
+ ULONG cElements;
+ LONG lLbound;
+} SAFEARRAYBOUND16;
+
+typedef struct tagSAFEARRAY16
+{
+ USHORT cDims;
+ USHORT fFeatures;
+ USHORT cbElements;
+ USHORT cLocks;
+ ULONG handle;
+ SEGPTR pvData;
+ SAFEARRAYBOUND16 rgsabound[1];
+} SAFEARRAY16;
+
+static SEGPTR safearray_alloc(ULONG size)
+{
+ HANDLE16 h;
+ return WOWGlobalAllocLock16(GPTR, size, &h);
+}
+
+/******************************************************************************
+ * SafeArrayAllocDescriptor [OLE2DISP.38]
+ */
+HRESULT WINAPI SafeArrayAllocDescriptor16(UINT16 dims, SEGPTR *ret)
+{
+ SAFEARRAY16 *sa;
+ ULONG size;
+
+ TRACE("%u, %p\n", dims, ret);
+
+ if (!dims)
+ return E_INVALIDARG16;
+
+ size = sizeof(SAFEARRAY16) + sizeof(SAFEARRAYBOUND16) * (dims - 1);
+ *ret = safearray_alloc(size);
+ if (!*ret)
+ return E_OUTOFMEMORY16;
+
+ sa = MapSL(*ret);
+ sa->cDims = dims;
+ 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 e4655f0..08372c5 100644
--- a/dlls/ole2disp.dll16/ole2disp.dll16.spec
+++ b/dlls/ole2disp.dll16/ole2disp.dll16.spec
@@ -35,7 +35,7 @@
35 pascal RegisterActiveObject(ptr ptr long ptr) RegisterActiveObject16
36 stub REVOKEACTIVEOBJECT
37 stub GETACTIVEOBJECT
-38 stub SAFEARRAYALLOCDESCRIPTOR
+38 pascal SafeArrayAllocDescriptor(word ptr) SafeArrayAllocDescriptor16
39 stub SAFEARRAYALLOCDATA
40 stub SAFEARRAYDESTROYDESCRIPTOR
41 stub SAFEARRAYDESTROYDATA
More information about the wine-cvs
mailing list