Make typelib marshaler use IRpcChannelBuffer::GetBuffer if possible.
diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c
index eded5c6..cf82a31 100644
--- a/dlls/oleaut32/tmarshal.c
+++ b/dlls/oleaut32/tmarshal.c
@@ -2214,11 +2214,34 @@
return hres;
ITypeInfo_Release(tinfo);
+ HeapFree(GetProcessHeap(), 0, args);
+
xmsg->cbBuffer = buf.curoff;
- I_RpcGetBuffer((RPC_MESSAGE *)xmsg);
- memcpy(xmsg->Buffer, buf.base, buf.curoff);
- HeapFree(GetProcessHeap(),0,args);
- return S_OK;
+ if (rpcchanbuf)
+ {
+ hres = IRpcChannelBuffer_GetBuffer(rpcchanbuf, xmsg, &This->iid);
+ if (hres != S_OK)
+ ERR("IRpcChannelBuffer_GetBuffer failed with error 0x%08lx\n", hres);
+ }
+ else
+ {
+ /* FIXME: remove this case when we start sending an IRpcChannelBuffer
+ * object with builtin OLE */
+ RPC_STATUS status = I_RpcGetBuffer((RPC_MESSAGE *)xmsg);
+ if (status != RPC_S_OK)
+ {
+ ERR("I_RpcGetBuffer failed with error %ld\n", status);
+ hres = E_FAIL;
+ }
+ }
+
+ if (hres == S_OK)
+ memcpy(xmsg->Buffer, buf.base, buf.curoff);
+
+ HeapFree(GetProcessHeap(), 0, buf.base);
+
+ TRACE("returning\n");
+ return hres;
}
static LPRPCSTUBBUFFER WINAPI
@@ -2231,6 +2254,7 @@
TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface) {
TMStubImpl *This = (TMStubImpl *)iface;
+ FIXME("()\n");
return This->ref; /*FIXME? */
}