On 11/23/21 10:16 PM, Connor McAdams wrote:
+static ULONG interface_safearray_size(ULONG *pFlags, ULONG Start, REFIID riid, IUnknown *punk) +{
- TRACE("(%x,%d,%p)\n", *pFlags, Start, punk);
- return Start + interface_variant_size(pFlags, riid, punk);
+}
You might as well add "Start" parameter to interface_variant_size(), and possibly rename it too, since it's no longer used only for variants.
@@ -916,8 +956,21 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf case SF_DISPATCH: case SF_UNKNOWN: case SF_HAVEIID:
FIXME("marshal interfaces\n");
{
IUnknown **lpUnk;
for (lpUnk = psa->pvData; ulCellCount; ulCellCount--, lpUnk++)
{
if (sftype == SF_HAVEIID)
Buffer = interface_variant_marshal(pFlags, Buffer, &guid, *lpUnk);
else if (sftype == SF_UNKNOWN)
Buffer = interface_variant_marshal(pFlags, Buffer, &IID_IUnknown, *lpUnk);
else
Buffer = interface_variant_marshal(pFlags, Buffer, &IID_IDispatch, *lpUnk);
}
break;
}
sftype won't change between iterations, so you only need to set some "GUID *" once, and use a single helper call.
{
IUnknown **lpUnk;
for (lpUnk = (*ppsa)->pvData; cell_count; cell_count--, lpUnk++)
{
if (sftype == SF_HAVEIID)
Buffer = interface_variant_unmarshal(pFlags, Buffer, &guid, lpUnk);
else if (sftype == SF_UNKNOWN)
Buffer = interface_variant_unmarshal(pFlags, Buffer, &IID_IUnknown, lpUnk);
else
Buffer = interface_variant_unmarshal(pFlags, Buffer, &IID_IDispatch, lpUnk);
}
break;
}
Same.
@@ -795,6 +819,22 @@ ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY case SF_DISPATCH: case SF_UNKNOWN: case SF_HAVEIID:
{
IUnknown **lpUnk;
GUID guid;
if (sftype == SF_HAVEIID)
SafeArrayGetIID(psa, &guid);
else if (sftype == SF_UNKNOWN)
memcpy(&guid, &IID_IUnknown, sizeof(guid));
else
memcpy(&guid, &IID_IDispatch, sizeof(guid));
for (lpUnk = psa->pvData; ulCellCount; ulCellCount--, lpUnk++)
size = interface_safearray_size(pFlags, size, &guid, *lpUnk);
break;
} FIXME("size interfaces\n"); break;
FIXME should be removed now that you implement this part.