11 Jul
2023
11 Jul
'23
12:50 p.m.
On Tue Jul 11 11:27:34 2023 +0000, Connor McAdams wrote:
We could, but we'd need to pull the ipid from the IStream, which is already done in `std_unmarshal_interface()`. It would probably be cleaner to do it without the extra argument, but then we'd need to pull the data from the IStream twice, once in `CoUnmarshalInterface()`, and then again in `std_unmarshal_interface()`. I guess we could add a helper function like:
static HRESULT std_unmarshal_get_dest_context(IStream *stream, MSHCTX *dest_context,
void **dest_context_data)
{
struct OR_STANDARD obj;
struct apartment *apt;
IStream *stream2;
HRESULT hr;
ULONG res;
*dest_context = 0;
*dest_context_data = NULL;
if (!(apt = apartment_get_current_or_mta()))
return CO_E_NOTINITIALIZED;
hr = IStream_Clone(stream, &stream2);
if (FAILED(hr))
{
apartment_release(apt);
return hr;
}
hr = IStream_Read(stream2, &obj, FIELD_OFFSET(struct OR_STANDARD, saResAddr.aStringArray), &res);
IStream_Release(stream2);
if (hr != S_OK)
{
apartment_release(apt);
return STG_E_READFAULT;
}
hr = ipid_get_dest_context(&obj.std.ipid, dest_context, dest_context_data);
apartment_release(apt);
return hr;
}
Which we would call from `CoUnmarshalInterface()` prior to calling `std_unmarshal_interface()`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3198#note_38646