Commit beceaa82 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole2disp: Implement SafeArrayAllocData().

parent 1529f082
......@@ -72,6 +72,23 @@ static void safearray_free(SEGPTR ptr)
WOWGlobalUnlockFree16(ptr);
}
static ULONG safearray_getcellcount(const SAFEARRAY16 *sa)
{
const SAFEARRAYBOUND16 *sab = sa->rgsabound;
USHORT count = sa->cDims;
ULONG cells = 1;
while (count--)
{
if (!sab->cElements)
return 0;
cells *= sab->cElements;
sab++;
}
return cells;
}
/******************************************************************************
* SafeArrayAllocDescriptor [OLE2DISP.38]
*/
......@@ -96,6 +113,23 @@ HRESULT WINAPI SafeArrayAllocDescriptor16(UINT16 dims, SEGPTR *ret)
}
/******************************************************************************
* SafeArrayAllocData [OLE2DISP.39]
*/
HRESULT WINAPI SafeArrayAllocData16(SAFEARRAY16 *sa)
{
ULONG size;
TRACE("%p\n", sa);
if (!sa)
return E_INVALIDARG16;
size = safearray_getcellcount(sa);
sa->pvData = safearray_alloc(size * sa->cbElements);
return sa->pvData ? S_OK : E_OUTOFMEMORY16;
}
/******************************************************************************
* SafeArrayDestroyDescriptor [OLE2DISP.40]
*/
HRESULT WINAPI SafeArrayDestroyDescriptor16(SEGPTR s)
......
......@@ -36,7 +36,7 @@
36 stub REVOKEACTIVEOBJECT
37 stub GETACTIVEOBJECT
38 pascal SafeArrayAllocDescriptor(word ptr) SafeArrayAllocDescriptor16
39 stub SAFEARRAYALLOCDATA
39 pascal SafeArrayAllocData(ptr) SafeArrayAllocData16
40 pascal SafeArrayDestroyDescriptor(segptr) SafeArrayDestroyDescriptor16
41 stub SAFEARRAYDESTROYDATA
42 stub SAFEARRAYREDIM
......
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