http://bugs.winehq.org/show_bug.cgi?id=33887
Bug #: 33887 Summary: Patches for marshaling VT_UNKNOWN in SAFEARRAYS Product: Wine Version: 1.6-rc3 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: oleaut32 AssignedTo: wine-bugs@winehq.org ReportedBy: rosen.diankov@gmail.com Classification: Unclassified
Many applications marshal SAFEARRAY structures with IUnknown interfaces in them. The following short patches in dlls/oleaut32/usrmarshal.c should implement support for them.
One thing I'm not sure yet is if the marshaling requires 4-byte alignment. Seems to work as is though:
in <code> ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY *ppsa) </code>
add <code> case SF_UNKNOWN: case SF_DISPATCH: case SF_HAVEIID: { IUnknown** ppUnknown; FIXME("size interfaces 0x%x\n", sftype); for (ppUnknown = psa->pvData; ulCellCount; ulCellCount--, ppUnknown++) { size += interface_variant_size(pFlags, &IID_IUnknown, *ppUnknown); } break; } </code>
In <code> unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa) </code>
add
<code> case SF_UNKNOWN: case SF_DISPATCH: case SF_HAVEIID: { IUnknown** ppUnknown; FIXME("marshal interfaces 0x%x\n", sftype); for (ppUnknown = psa->pvData; ulCellCount; ulCellCount--, ppUnknown++) { /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */ Buffer = interface_variant_marshal(pFlags, Buffer, &IID_IUnknown, *ppUnknown); } break; } </code>
in
<code> unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa) </code>
<code> case SF_UNKNOWN: case SF_DISPATCH: case SF_HAVEIID: { IUnknown** ppUnknown; FIXME("unmarshal interfaces 0x%x\n", sftype); for (ppUnknown = (*ppsa)->pvData; cell_count; cell_count--, ppUnknown++) { /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */ Buffer = interface_variant_unmarshal(pFlags, Buffer, &IID_IUnknown, ppUnknown); } break; } </code>