Commit 2ce06e57 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Fix SafeArrayGetElement() for FADF_RECORD arrays.

parent 4c02dc86
......@@ -990,19 +990,27 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
else
*lpDest = NULL;
}
else
else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH))
{
if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH))
IUnknown **src_unk = lpvSrc;
IUnknown **dest_unk = pvData;
if (*src_unk)
IUnknown_AddRef(*src_unk);
*dest_unk = *src_unk;
}
else if (psa->fFeatures & FADF_RECORD)
{
LPUNKNOWN *lpUnknown = lpvSrc;
IRecordInfo *record;
if (*lpUnknown)
IUnknown_AddRef(*lpUnknown);
SafeArrayGetRecordInfo(psa, &record);
hRet = IRecordInfo_RecordCopy(record, lpvSrc, pvData);
IRecordInfo_Release(record);
}
else
/* Copy the data over */
memcpy(pvData, lpvSrc, psa->cbElements);
}
}
SafeArrayUnlock(psa);
}
return hRet;
......
......@@ -1203,6 +1203,12 @@ static void test_SafeArrayGetPutElement(void)
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(irec->recordcopy == 1, "got %d\n", irec->recordcopy);
index = 0;
irec->recordcopy = 0;
hres = SafeArrayGetElement(sa, &index, (void*)0xdeadbeef);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(irec->recordcopy == 1, "got %d\n", irec->recordcopy);
hres = SafeArrayDestroy(sa);
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(irec->ref == 1, "got %d\n", irec->ref);
......
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