Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 1720 of file marshal.c.
Referenced by _marshal_interface(), apartment_hostobject(), CoMarshalInterThreadInterfaceInStream(), CompositeMonikerMarshalImpl_MarshalInterface(), CoRegisterClassObject(), interface_variant_marshal(), RegisterDragDrop(), RunningObjectTableImpl_Register(), set_src_dataobject(), StdGlobalInterfaceTable_RegisterInterfaceInGlobal(), and WdtpInterfacePointer_UserMarshal().
{ HRESULT hr; CLSID marshaler_clsid; OBJREF objref; LPMARSHAL pMarshal; TRACE("(%p, %s, %p, %x, %p,", pStream, debugstr_guid(riid), pUnk, dwDestContext, pvDestContext); dump_MSHLFLAGS(mshlFlags); TRACE(")\n"); if (!pUnk || !pStream) return E_INVALIDARG; objref.signature = OBJREF_SIGNATURE; objref.iid = *riid; /* get the marshaler for the specified interface */ hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal); if (hr != S_OK) { ERR("Failed to get marshaller, 0x%08x\n", hr); return hr; } hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &marshaler_clsid); if (hr != S_OK) { ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr); goto cleanup; } /* FIXME: implement handler marshaling too */ if (IsEqualCLSID(&marshaler_clsid, &CLSID_DfMarshal)) { TRACE("Using standard marshaling\n"); objref.flags = OBJREF_STANDARD; /* write the common OBJREF header to the stream */ hr = IStream_Write(pStream, &objref, FIELD_OFFSET(OBJREF, u_objref), NULL); if (hr != S_OK) { ERR("Failed to write OBJREF header to stream, 0x%08x\n", hr); goto cleanup; } } else { TRACE("Using custom marshaling\n"); objref.flags = OBJREF_CUSTOM; objref.u_objref.u_custom.clsid = marshaler_clsid; objref.u_objref.u_custom.cbExtension = 0; objref.u_objref.u_custom.size = 0; hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &objref.u_objref.u_custom.size); if (hr != S_OK) { ERR("Failed to get max size of marshal data, error 0x%08x\n", hr); goto cleanup; } /* write constant sized common header and OR_CUSTOM data into stream */ hr = IStream_Write(pStream, &objref, FIELD_OFFSET(OBJREF, u_objref.u_custom.pData), NULL); if (hr != S_OK) { ERR("Failed to write OR_CUSTOM header to stream with 0x%08x\n", hr); goto cleanup; } } TRACE("Calling IMarshal::MarshalInterace\n"); /* call helper object to do the actual marshaling */ hr = IMarshal_MarshalInterface(pMarshal, pStream, riid, pUnk, dwDestContext, pvDestContext, mshlFlags); if (hr != S_OK) { ERR("Failed to marshal the interface %s, %x\n", debugstr_guid(riid), hr); goto cleanup; } cleanup: IMarshal_Release(pMarshal); TRACE("completed with hr 0x%08x\n", hr); return hr; }