On Tue Jul 11 12:50:06 2023 +0000, Connor McAdams wrote:
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()`.
Yeah, that's not great.
We could overload `dest_context` with an 'unknown' value, but your current version is fine.