oleaut32: Fix SafeArrayGetElement() for FADF_RECORD arrays.
This commit is contained in:
parent
4c02dc867f
commit
2ce06e5727
@ -990,18 +990,26 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
|
|||||||
else
|
else
|
||||||
*lpDest = NULL;
|
*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;
|
||||||
LPUNKNOWN *lpUnknown = lpvSrc;
|
|
||||||
|
|
||||||
if (*lpUnknown)
|
if (*src_unk)
|
||||||
IUnknown_AddRef(*lpUnknown);
|
IUnknown_AddRef(*src_unk);
|
||||||
}
|
*dest_unk = *src_unk;
|
||||||
|
}
|
||||||
|
else if (psa->fFeatures & FADF_RECORD)
|
||||||
|
{
|
||||||
|
IRecordInfo *record;
|
||||||
|
|
||||||
|
SafeArrayGetRecordInfo(psa, &record);
|
||||||
|
hRet = IRecordInfo_RecordCopy(record, lpvSrc, pvData);
|
||||||
|
IRecordInfo_Release(record);
|
||||||
|
}
|
||||||
|
else
|
||||||
/* Copy the data over */
|
/* Copy the data over */
|
||||||
memcpy(pvData, lpvSrc, psa->cbElements);
|
memcpy(pvData, lpvSrc, psa->cbElements);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SafeArrayUnlock(psa);
|
SafeArrayUnlock(psa);
|
||||||
}
|
}
|
||||||
|
@ -1203,6 +1203,12 @@ static void test_SafeArrayGetPutElement(void)
|
|||||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||||
ok(irec->recordcopy == 1, "got %d\n", irec->recordcopy);
|
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);
|
hres = SafeArrayDestroy(sa);
|
||||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||||
ok(irec->ref == 1, "got %d\n", irec->ref);
|
ok(irec->ref == 1, "got %d\n", irec->ref);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user