Commit 2813e922 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Michael Stefaniuc

ole2disp: Implement SafeArrayAllocDescriptor().

Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit d8287b55) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent c4e92a2f
......@@ -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 */
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment