Module: wine Branch: refs/heads/master Commit: 386fcbb5f789be359e983097f86d571df28669ea URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=386fcbb5f789be359e983097...
Author: Robert Shearman rob@codeweavers.com Date: Wed May 24 23:02:26 2006 +0100
ole32: Implement GetUnmarshalClass for the free-threaded marshaler and remove unnecessary unmarshaling code for the standard-marshal case - this is handled by CoUnmarshalInterface and CoReleaseMarshalData.
---
dlls/ole32/ftmarshal.c | 99 +++++++++++++++++------------------------------- 1 files changed, 36 insertions(+), 63 deletions(-)
diff --git a/dlls/ole32/ftmarshal.c b/dlls/ole32/ftmarshal.c index 5255f60..a0befee 100644 --- a/dlls/ole32/ftmarshal.c +++ b/dlls/ole32/ftmarshal.c @@ -38,6 +38,8 @@ #include "compobj_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
+const CLSID CLSID_InProcFreeMarshaler = { 0x33A, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46} }; + typedef struct _FTMarshalImpl { const IUnknownVtbl *lpVtbl; LONG ref; @@ -138,7 +140,12 @@ static HRESULT WINAPI FTMarshalImpl_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID * pCid) { - FIXME ("(), stub!\n"); + TRACE("(%s, %p, 0x%lx, %p, 0x%lx, %p)\n", debugstr_guid(riid), pv, + dwDestContext, pvDestContext, mshlflags, pCid); + if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) + memcpy(pCid, &CLSID_InProcFreeMarshaler, sizeof(CLSID_InProcFreeMarshaler)); + else + memcpy(pCid, &CLSID_DfMarshal, sizeof(CLSID_InProcFreeMarshaler)); return S_OK; }
@@ -175,7 +182,6 @@ FTMarshalImpl_MarshalInterface (LPMARSHA
IMarshal *pMarshal = NULL; HRESULT hres; - DWORD magic = 0x57dfd54d /* MEOW */;
TRACE("(%p, %s, %p, 0x%lx, %p, 0x%lx)\n", pStm, debugstr_guid(riid), pv, dwDestContext, pvDestContext, mshlflags); @@ -210,13 +216,6 @@ FTMarshalImpl_MarshalInterface (LPMARSHA return S_OK; }
- /* FIXME: this isn't exactly corret. it looks like the standard marshaler - * for native writes all of the OBJREF data into the stream, so we should - * really rely on it to write this constant for us. however, we need a - * constant to differentiate the outofproc data from the inproc data */ - hres = IStream_Write (pStm, &magic, sizeof (magic), NULL); - if (hres != S_OK) return STG_E_MEDIUMFULL; - /* use the standard marshaler to handle all other cases */ CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal); hres = IMarshal_MarshalInterface (pMarshal, pStm, riid, pv, dwDestContext, pvDestContext, mshlflags); @@ -228,6 +227,9 @@ static HRESULT WINAPI FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void **ppv) { DWORD mshlflags; + IUnknown *object; + DWORD constant; + GUID unknown_guid; HRESULT hres;
TRACE ("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv); @@ -235,42 +237,29 @@ FTMarshalImpl_UnmarshalInterface (LPMARS hres = IStream_Read (pStm, &mshlflags, sizeof (mshlflags), NULL); if (hres != S_OK) return STG_E_READFAULT;
- if (mshlflags == 0x57dfd54d /* MEOW */) { - IMarshal *pMarshal; - - hres = CoCreateInstance (&CLSID_DfMarshal, NULL, CLSCTX_INPROC, &IID_IMarshal, (void **)&pMarshal); - if (FAILED(hres)) return hres; - - hres = IMarshal_UnmarshalInterface (pMarshal, pStm, riid, ppv); - IMarshal_Release (pMarshal); - return hres; - } - else { - IUnknown *object; - DWORD constant; - GUID unknown_guid; - - hres = IStream_Read (pStm, &object, sizeof (object), NULL); - if (hres != S_OK) return STG_E_READFAULT; + hres = IStream_Read (pStm, &object, sizeof (object), NULL); + if (hres != S_OK) return STG_E_READFAULT;
- hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); - if (hres != S_OK) return STG_E_READFAULT; - if (constant != 0) - FIXME("constant is 0x%lx instead of 0\n", constant); + hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); + if (hres != S_OK) return STG_E_READFAULT; + if (constant != 0) + FIXME("constant is 0x%lx instead of 0\n", constant);
- hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); - if (hres != S_OK) return STG_E_READFAULT; + hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); + if (hres != S_OK) return STG_E_READFAULT;
- hres = IUnknown_QueryInterface(object, riid, ppv); - if (!(mshlflags & (MSHLFLAGS_TABLEWEAK|MSHLFLAGS_TABLESTRONG))) - IUnknown_Release(object); - return hres; - } + hres = IUnknown_QueryInterface(object, riid, ppv); + if (!(mshlflags & (MSHLFLAGS_TABLEWEAK|MSHLFLAGS_TABLESTRONG))) + IUnknown_Release(object); + return hres; }
static HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm) { DWORD mshlflags; + IUnknown *object; + DWORD constant; + GUID unknown_guid; HRESULT hres;
TRACE ("(%p)\n", pStm); @@ -278,35 +267,19 @@ static HRESULT WINAPI FTMarshalImpl_Rele hres = IStream_Read (pStm, &mshlflags, sizeof (mshlflags), NULL); if (hres != S_OK) return STG_E_READFAULT;
- if (mshlflags == 0x57dfd54d /* MEOW */) { - IMarshal *pMarshal; - - hres = CoCreateInstance (&CLSID_DfMarshal, NULL, CLSCTX_INPROC, &IID_IMarshal, (void **)&pMarshal); - if (FAILED(hres)) return hres; - - hres = IMarshal_ReleaseMarshalData (pMarshal, pStm); - IMarshal_Release (pMarshal); - return hres; - } - else { - IUnknown *object; - DWORD constant; - GUID unknown_guid; - - hres = IStream_Read (pStm, &object, sizeof (object), NULL); - if (hres != S_OK) return STG_E_READFAULT; + hres = IStream_Read (pStm, &object, sizeof (object), NULL); + if (hres != S_OK) return STG_E_READFAULT;
- hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); - if (hres != S_OK) return STG_E_READFAULT; - if (constant != 0) - FIXME("constant is 0x%lx instead of 0\n", constant); + hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); + if (hres != S_OK) return STG_E_READFAULT; + if (constant != 0) + FIXME("constant is 0x%lx instead of 0\n", constant);
- hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); - if (hres != S_OK) return STG_E_READFAULT; + hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); + if (hres != S_OK) return STG_E_READFAULT;
- IUnknown_Release(object); - return S_OK; - } + IUnknown_Release(object); + return S_OK; }
static HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwReserved)