4 * Copyright 2002 Marcus Meissner
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42 #include "wine/unicode.h"
43 #include "wine/winbase16.h"
44 #include "compobj_private.h"
47 #include "wine/debug.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(ole);
51 extern const CLSID CLSID_DfMarshal;
53 /* Marshalling just passes a unique identifier to the remote client,
54 * that makes it possible to find the passed interface again.
56 * So basically we need a set of values that make it unique.
58 * Process Identifier, Object IUnknown ptr, IID
60 * Note that the IUnknown_QI(ob,xiid,&ppv) always returns the SAME ppv value!
64 get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) {
68 if ((hres = CoGetPSClsid(riid,&pxclsid)))
70 return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf);
73 typedef struct _wine_marshal_data {
78 typedef struct _mid2unknown {
83 typedef struct _mid2stub {
90 static mid2stub *stubs = NULL;
91 static int nrofstubs = 0;
93 static mid2unknown *proxies = NULL;
94 static int nrofproxies = 0;
96 void MARSHAL_Invalidate_Stub_From_MID(wine_marshal_id *mid) {
99 for (i=0;i<nrofstubs;i++) {
100 if (!stubs[i].valid) continue;
102 if (MARSHAL_Compare_Mids(mid,&(stubs[i].mid))) {
103 stubs[i].valid = FALSE;
112 MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub) {
115 for (i=0;i<nrofstubs;i++) {
116 if (!stubs[i].valid) continue;
118 if (MARSHAL_Compare_Mids(mid,&(stubs[i].mid))) {
119 *stub = stubs[i].stub;
120 IUnknown_AddRef((*stub));
128 MARSHAL_Find_Stub(wine_marshal_id *mid,LPUNKNOWN *pUnk) {
131 for (i=0;i<nrofstubs;i++) {
132 if (!stubs[i].valid) continue;
134 if (MARSHAL_Compare_Mids(mid,&(stubs[i].mid))) {
135 *pUnk = stubs[i].pUnkServer;
136 IUnknown_AddRef((*pUnk));
144 MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN pUnk,IRpcStubBuffer *stub) {
146 if (!MARSHAL_Find_Stub(mid,&xPunk)) {
147 FIXME("Already have entry for (%lx/%s)!\n",mid->objectid,debugstr_guid(&(mid->iid)));
151 stubs=HeapReAlloc(GetProcessHeap(),0,stubs,sizeof(stubs[0])*(nrofstubs+1));
153 stubs=HeapAlloc(GetProcessHeap(),0,sizeof(stubs[0]));
154 if (!stubs) return E_OUTOFMEMORY;
155 stubs[nrofstubs].stub = stub;
156 stubs[nrofstubs].pUnkServer = pUnk;
157 memcpy(&(stubs[nrofstubs].mid),mid,sizeof(*mid));
158 stubs[nrofstubs].valid = TRUE; /* set to false when released by ReleaseMarshalData */
164 MARSHAL_Disconnect_Proxies() {
167 TRACE("Disconnecting %d proxies\n", nrofproxies);
169 for (i = 0; i < nrofproxies; i++)
170 IRpcProxyBuffer_Disconnect((IRpcProxyBuffer*)proxies[i].pUnk);
176 MARSHAL_Register_Proxy(wine_marshal_id *mid,LPUNKNOWN punk) {
179 for (i=0;i<nrofproxies;i++) {
180 if (MARSHAL_Compare_Mids(mid,&(proxies[i].mid))) {
181 ERR("Already have mid?\n");
186 proxies = HeapReAlloc(GetProcessHeap(),0,proxies,sizeof(proxies[0])*(nrofproxies+1));
188 proxies = HeapAlloc(GetProcessHeap(),0,sizeof(proxies[0]));
189 memcpy(&(proxies[nrofproxies].mid),mid,sizeof(*mid));
190 proxies[nrofproxies].pUnk = punk;
192 IUnknown_AddRef(punk);
196 /********************** StdMarshal implementation ****************************/
197 typedef struct _StdMarshalImpl {
198 IMarshalVtbl *lpvtbl;
203 LPVOID pvDestContext;
207 static HRESULT WINAPI
208 StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) {
210 if (IsEqualIID(&IID_IUnknown,riid) || IsEqualIID(&IID_IMarshal,riid)) {
212 IUnknown_AddRef(iface);
215 FIXME("No interface for %s.\n",debugstr_guid(riid));
216 return E_NOINTERFACE;
220 StdMarshalImpl_AddRef(LPMARSHAL iface) {
221 StdMarshalImpl *This = (StdMarshalImpl *)iface;
222 return InterlockedIncrement(&This->ref);
226 StdMarshalImpl_Release(LPMARSHAL iface) {
227 StdMarshalImpl *This = (StdMarshalImpl *)iface;
228 ULONG ref = InterlockedDecrement(&This->ref);
230 if (!ref) HeapFree(GetProcessHeap(),0,This);
234 static HRESULT WINAPI
235 StdMarshalImpl_GetUnmarshalClass(
236 LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
237 void* pvDestContext, DWORD mshlflags, CLSID* pCid
239 memcpy(pCid,&CLSID_DfMarshal,sizeof(CLSID_DfMarshal));
243 static HRESULT WINAPI
244 StdMarshalImpl_GetMarshalSizeMax(
245 LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
246 void* pvDestContext, DWORD mshlflags, DWORD* pSize
248 *pSize = sizeof(wine_marshal_id)+sizeof(wine_marshal_data);
252 static HRESULT WINAPI
253 StdMarshalImpl_MarshalInterface(
254 LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext,
255 void* pvDestContext, DWORD mshlflags
258 wine_marshal_data md;
262 IRpcStubBuffer *stub;
263 IPSFactoryBuffer *psfacbuf;
265 TRACE("(...,%s,...)\n",debugstr_guid(riid));
267 IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)&pUnk);
268 mid.processid = GetCurrentProcessId();
269 mid.objectid = (DWORD)pUnk; /* FIXME */
270 IUnknown_Release(pUnk);
271 memcpy(&mid.iid,riid,sizeof(mid.iid));
272 md.dwDestContext = dwDestContext;
273 md.mshlflags = mshlflags;
274 hres = IStream_Write(pStm,&mid,sizeof(mid),&res);
275 if (hres) return hres;
276 hres = IStream_Write(pStm,&md,sizeof(md),&res);
277 if (hres) return hres;
279 if (SUCCEEDED(MARSHAL_Find_Stub_Buffer(&mid,&stub))) {
280 /* Find_Stub_Buffer gives us a ref but we want to keep it, as if we'd created a new one */
281 TRACE("Found RpcStubBuffer %p\n", stub);
284 hres = get_facbuf_for_iid(riid,&psfacbuf);
285 if (hres) return hres;
287 hres = IPSFactoryBuffer_CreateStub(psfacbuf,riid,pv,&stub);
288 IPSFactoryBuffer_Release(psfacbuf);
290 FIXME("Failed to create a stub for %s\n",debugstr_guid(riid));
293 IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)&pUnk);
294 MARSHAL_Register_Stub(&mid,pUnk,stub);
295 IUnknown_Release(pUnk);
299 static HRESULT WINAPI
300 StdMarshalImpl_UnmarshalInterface(
301 LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv
304 wine_marshal_data md;
307 IPSFactoryBuffer *psfacbuf;
308 IRpcProxyBuffer *rpcproxy;
309 IRpcChannelBuffer *chanbuf;
311 TRACE("(...,%s,....)\n",debugstr_guid(riid));
312 hres = IStream_Read(pStm,&mid,sizeof(mid),&res);
313 if (hres) return hres;
314 hres = IStream_Read(pStm,&md,sizeof(md),&res);
315 if (hres) return hres;
316 if (SUCCEEDED(MARSHAL_Find_Stub(&mid,(LPUNKNOWN*)ppv))) {
317 FIXME("Calling back to ourselves for %s!\n",debugstr_guid(riid));
320 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_NULL)) {
321 /* should return proxy manager IUnknown object */
322 FIXME("Special treatment required for IID of %s\n", debugstr_guid(riid));
324 hres = get_facbuf_for_iid(riid,&psfacbuf);
325 if (hres) return hres;
326 hres = IPSFactoryBuffer_CreateProxy(psfacbuf,NULL,riid,&rpcproxy,ppv);
328 FIXME("Failed to create a proxy for %s\n",debugstr_guid(riid));
332 MARSHAL_Register_Proxy(&mid, (LPUNKNOWN) rpcproxy);
334 hres = PIPE_GetNewPipeBuf(&mid,&chanbuf);
335 IPSFactoryBuffer_Release(psfacbuf);
337 ERR("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid));
339 /* Connect the channel buffer to the proxy and release the no longer
341 * NOTE: The proxy should have taken an extra reference because it also
342 * aggregates the object, so we can safely release our reference to it. */
343 IRpcProxyBuffer_Connect(rpcproxy,chanbuf);
344 IRpcProxyBuffer_Release(rpcproxy);
345 /* IRpcProxyBuffer takes a reference on the channel buffer and
346 * we no longer need it, so release it */
347 IRpcChannelBuffer_Release(chanbuf);
352 static HRESULT WINAPI
353 StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) {
357 IRpcStubBuffer *stub = NULL;
360 hres = IStream_Read(pStm,&mid,sizeof(mid),&res);
361 if (hres) return hres;
363 for (i=0; i < nrofstubs; i++)
365 if (!stubs[i].valid) continue;
367 if (MARSHAL_Compare_Mids(&mid, &(stubs[i].mid)))
369 stub = stubs[i].stub;
376 FIXME("Could not map MID to stub??\n");
380 res = IRpcStubBuffer_Release(stub);
381 stubs[i].valid = FALSE;
382 TRACE("stub refcount of %p is %ld\n", stub, res);
387 static HRESULT WINAPI
388 StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved) {
389 FIXME("(), stub!\n");
393 IMarshalVtbl stdmvtbl = {
394 StdMarshalImpl_QueryInterface,
395 StdMarshalImpl_AddRef,
396 StdMarshalImpl_Release,
397 StdMarshalImpl_GetUnmarshalClass,
398 StdMarshalImpl_GetMarshalSizeMax,
399 StdMarshalImpl_MarshalInterface,
400 StdMarshalImpl_UnmarshalInterface,
401 StdMarshalImpl_ReleaseMarshalData,
402 StdMarshalImpl_DisconnectObject
405 /***********************************************************************
406 * CoGetStandardMarshal [OLE32.@]
408 * When the COM library in the client process receives a marshalled
409 * interface pointer, it looks for a CLSID to be used in creating a proxy
410 * for the purposes of unmarshalling the packet. If the packet does not
411 * contain a CLSID for the proxy, COM calls CoGetStandardMarshal, passing a
413 * This function creates a standard proxy in the client process and returns
414 * a pointer to that proxy's implementation of IMarshal.
415 * COM uses this pointer to call CoUnmarshalInterface to retrieve the pointer
416 * to the requested interface.
419 CoGetStandardMarshal(
420 REFIID riid,IUnknown *pUnk,DWORD dwDestContext,LPVOID pvDestContext,
421 DWORD mshlflags, LPMARSHAL *pMarshal
426 FIXME("(%s,NULL,%lx,%p,%lx,%p), unimplemented yet.\n",
427 debugstr_guid(riid),dwDestContext,pvDestContext,mshlflags,pMarshal
431 TRACE("(%s,%p,%lx,%p,%lx,%p)\n",
432 debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags,pMarshal
434 *pMarshal = HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl));
435 dm = (StdMarshalImpl*) *pMarshal;
436 if (!dm) return E_FAIL;
437 dm->lpvtbl = &stdmvtbl;
440 memcpy(&dm->iid,riid,sizeof(dm->iid));
441 dm->dwDestContext = dwDestContext;
442 dm->pvDestContext = pvDestContext;
443 dm->mshlflags = mshlflags;
447 /* Helper function for getting Marshaler */
448 static HRESULT WINAPI
449 _GetMarshaller(REFIID riid, IUnknown *pUnk,DWORD dwDestContext,
450 void *pvDestContext, DWORD mshlFlags, LPMARSHAL *pMarshal
456 hres = IUnknown_QueryInterface(pUnk,&IID_IMarshal,(LPVOID*)pMarshal);
458 hres = CoGetStandardMarshal(riid,pUnk,dwDestContext,pvDestContext,mshlFlags,pMarshal);
462 /***********************************************************************
463 * CoGetMarshalSizeMax [OLE32.@]
466 CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk,
467 DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags
472 hres = _GetMarshaller(riid,pUnk,dwDestContext,pvDestContext,mshlFlags,&pMarshal);
475 hres = IMarshal_GetMarshalSizeMax(pMarshal,riid,pUnk,dwDestContext,pvDestContext,mshlFlags,pulSize);
476 *pulSize += sizeof(wine_marshal_id)+sizeof(wine_marshal_data)+sizeof(CLSID);
477 IMarshal_Release(pMarshal);
482 /***********************************************************************
483 * CoMarshalInterface [OLE32.@]
486 CoMarshalInterface( IStream *pStm, REFIID riid, IUnknown *pUnk,
487 DWORD dwDestContext, void *pvDestContext, DWORD mshlflags
494 wine_marshal_data md;
498 TRACE("(%p, %s, %p, %lx, %p, %lx)\n",
499 pStm,debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags
505 start_listener_thread(); /* Just to be sure we have one running. */
507 mid.processid = GetCurrentProcessId();
508 IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)&pUnknown);
509 mid.objectid = (DWORD)pUnknown;
510 IUnknown_Release(pUnknown);
511 memcpy(&mid.iid,riid,sizeof(mid.iid));
512 md.dwDestContext = dwDestContext;
513 md.mshlflags = mshlflags;
514 hres = IStream_Write(pStm,&mid,sizeof(mid),&res);
515 if (hres) return hres;
516 hres = IStream_Write(pStm,&md,sizeof(md),&res);
517 if (hres) return hres;
518 hres = _GetMarshaller(riid,pUnk,dwDestContext,pvDestContext,mshlflags,&pMarshal);
520 FIXME("Failed to get marshaller, %lx?\n",hres);
523 hres = IMarshal_GetUnmarshalClass(pMarshal,riid,pUnk,dwDestContext,pvDestContext,mshlflags,&xclsid);
525 FIXME("IMarshal:GetUnmarshalClass failed, %lx\n",hres);
526 goto release_marshal;
528 hres = IStream_Write(pStm,&xclsid,sizeof(xclsid),&writeres);
530 FIXME("Stream write failed, %lx\n",hres);
531 goto release_marshal;
534 TRACE("Calling IMarshal::MarshalInterace\n");
535 hres = IMarshal_MarshalInterface(pMarshal,pStm,riid,pUnk,dwDestContext,pvDestContext,mshlflags);
538 if (IsEqualGUID(riid,&IID_IOleObject)) {
539 ERR("WINE currently cannot marshal IOleObject interfaces. This means you cannot embed/link OLE objects between applications.\n");
541 FIXME("Failed to marshal the interface %s, %lx?\n",debugstr_guid(riid),hres);
545 IMarshal_Release(pMarshal);
550 /***********************************************************************
551 * CoUnmarshalInterface [OLE32.@]
554 CoUnmarshalInterface(IStream *pStm, REFIID riid, LPVOID *ppv) {
557 wine_marshal_data md;
563 TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(riid),ppv);
565 hres = IStream_Read(pStm,&mid,sizeof(mid),&res);
567 FIXME("Stream read 1 failed, %lx, (%ld of %d)\n",hres,res,sizeof(mid));
570 hres = IStream_Read(pStm,&md,sizeof(md),&res);
572 FIXME("Stream read 2 failed, %lx, (%ld of %d)\n",hres,res,sizeof(md));
575 hres = IStream_Read(pStm,&xclsid,sizeof(xclsid),&res);
577 FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid));
580 hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)&pUnk);
582 FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid));
585 hres = _GetMarshaller(riid,pUnk,md.dwDestContext,NULL,md.mshlflags,&pMarshal);
587 FIXME("Failed to get unmarshaller, %lx?\n",hres);
590 hres = IMarshal_UnmarshalInterface(pMarshal,pStm,riid,ppv);
592 FIXME("Failed to Unmarshal the interface, %lx?\n",hres);
593 goto release_marshal;
596 IMarshal_Release(pMarshal);
600 /***********************************************************************
601 * CoReleaseMarshalData [OLE32.@]
604 CoReleaseMarshalData(IStream *pStm) {
607 wine_marshal_data md;
613 TRACE("(%p)\n",pStm);
615 hres = IStream_Read(pStm,&mid,sizeof(mid),&res);
617 FIXME("Stream read 1 failed, %lx, (%ld of %d)\n",hres,res,sizeof(mid));
620 hres = IStream_Read(pStm,&md,sizeof(md),&res);
622 FIXME("Stream read 2 failed, %lx, (%ld of %d)\n",hres,res,sizeof(md));
625 hres = IStream_Read(pStm,&xclsid,sizeof(xclsid),&res);
627 FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid));
630 hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)(char*)&pUnk);
632 FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid));
635 hres = IUnknown_QueryInterface(pUnk,&IID_IMarshal,(LPVOID*)(char*)&pMarshal);
637 FIXME("Failed to get IMarshal iface, %lx?\n",hres);
640 hres = IMarshal_ReleaseMarshalData(pMarshal,pStm);
642 FIXME("Failed to releasemarshaldata the interface, %lx?\n",hres);
644 IMarshal_Release(pMarshal);
645 IUnknown_Release(pUnk);
650 /***********************************************************************
651 * CoMarshalInterThreadInterfaceInStream [OLE32.@]
653 * Marshal an interface across threads in the same process.
656 * riid [I] Identifier of the interface to be marshalled.
657 * pUnk [I] Pointer to IUnknown-derived interface that will be marshalled.
658 * ppStm [O] Pointer to IStream object that is created and then used to store the marshalled inteface.
662 * Failure: E_OUTOFMEMORY and other COM error codes
665 * CoMarshalInterface(), CoUnmarshalInterface() and CoGetInterfaceAndReleaseStream()
668 CoMarshalInterThreadInterfaceInStream(
669 REFIID riid, LPUNKNOWN pUnk, LPSTREAM * ppStm)
672 LARGE_INTEGER seekto;
675 TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm);
677 hres = CreateStreamOnHGlobal(0, TRUE, ppStm);
678 if (FAILED(hres)) return hres;
679 hres = CoMarshalInterface(*ppStm, riid, pUnk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
681 /* FIXME: is this needed? */
682 memset(&seekto,0,sizeof(seekto));
683 IStream_Seek(*ppStm,seekto,SEEK_SET,&xpos);
688 /***********************************************************************
689 * CoGetInterfaceAndReleaseStream [OLE32.@]
691 * Unmarshalls an inteface from a stream and then releases the stream.
694 * pStm [I] Stream that contains the marshalled inteface.
695 * riid [I] Interface identifier of the object to unmarshall.
696 * ppv [O] Address of pointer where the requested interface object will be stored.
700 * Failure: A COM error code
703 * CoMarshalInterThreadInterfaceInStream() and CoUnmarshalInteface()
706 CoGetInterfaceAndReleaseStream(LPSTREAM pStm,REFIID riid, LPVOID *ppv)
710 TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv);
712 hres = CoUnmarshalInterface(pStm, riid, ppv);
713 IStream_Release(pStm);
717 static HRESULT WINAPI
718 SMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
720 if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IClassFactory)) {
721 *ppv = (LPVOID)iface;
724 return E_NOINTERFACE;
726 static ULONG WINAPI SMCF_AddRef(LPCLASSFACTORY iface) { return 2; }
727 static ULONG WINAPI SMCF_Release(LPCLASSFACTORY iface) { return 1; }
729 static HRESULT WINAPI
731 LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv
733 if (IsEqualIID(riid,&IID_IMarshal)) {
735 dm=(StdMarshalImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl));
738 dm->lpvtbl = &stdmvtbl;
743 FIXME("(%s), not supported.\n",debugstr_guid(riid));
744 return E_NOINTERFACE;
747 static HRESULT WINAPI
748 SMCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) {
749 FIXME("(%d), stub!\n",fLock);
753 static IClassFactoryVtbl dfmarshalcfvtbl = {
760 static IClassFactoryVtbl *pdfmarshalcfvtbl = &dfmarshalcfvtbl;
763 MARSHAL_GetStandardMarshalCF(LPVOID *ppv) {
764 *ppv = &pdfmarshalcfvtbl;
768 /***********************************************************************
769 * CoMarshalHresult [OLE32.@]
771 * Marshals an HRESULT value into a stream.
774 * pStm [I] Stream that hresult will be marshaled into.
775 * hresult [I] HRESULT to be marshaled.
779 * Failure: A COM error code
782 * CoUnmarshalHresult().
785 CoMarshalHresult(LPSTREAM pStm, HRESULT hresult)
787 return IStream_Write(pStm, &hresult, sizeof(hresult), NULL);
790 /***********************************************************************
791 * CoUnmarshalHresult [OLE32.@]
793 * Unmarshals an HRESULT value from a stream.
796 * pStm [I] Stream that hresult will be unmarshaled from.
797 * phresult [I] Pointer to HRESULT where the value will be unmarshaled to.
801 * Failure: A COM error code
804 * CoMarshalHresult().
807 CoUnmarshalHresult(LPSTREAM pStm, HRESULT * phresult)
809 return IStream_Read(pStm, phresult, sizeof(*phresult), NULL);