ole32: Implement table-strong marshaling and ReleaseMarshalData for the free-threaded marshaler.

This commit is contained in:
Robert Shearman 2006-05-24 23:02:14 +01:00 committed by Alexandre Julliard
parent f9b5280dd0
commit 2c57189a97
2 changed files with 43 additions and 7 deletions

View File

@ -262,7 +262,7 @@ FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid,
if (hres != S_OK) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
hres = IUnknown_QueryInterface(object, riid, ppv); hres = IUnknown_QueryInterface(object, riid, ppv);
if (!(mshlflags & MSHLFLAGS_TABLEWEAK)) if (!(mshlflags & (MSHLFLAGS_TABLEWEAK|MSHLFLAGS_TABLESTRONG)))
IUnknown_Release(object); IUnknown_Release(object);
return hres; return hres;
} }
@ -270,13 +270,49 @@ FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid,
static HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm) static HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm)
{ {
FIXME ("(), stub!\n"); DWORD mshlflags;
return S_OK; HRESULT hres;
TRACE ("(%p)\n", pStm);
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, &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;
IUnknown_Release(object);
return S_OK;
}
} }
static HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwReserved) static HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwReserved)
{ {
FIXME ("(), stub!\n"); TRACE ("()\n");
/* nothing to do */
return S_OK; return S_OK;
} }

View File

@ -1718,7 +1718,7 @@ static void test_freethreadedmarshaler(void)
IUnknown_Release(pProxy); IUnknown_Release(pProxy);
todo_wine ok_more_than_one_lock(); ok_more_than_one_lock();
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL); IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
hr = IMarshal_ReleaseMarshalData(pFTMarshal, pStream); hr = IMarshal_ReleaseMarshalData(pFTMarshal, pStream);
@ -1767,7 +1767,7 @@ static void test_freethreadedmarshaler(void)
hr = IMarshal_ReleaseMarshalData(pFTMarshal, pStream); hr = IMarshal_ReleaseMarshalData(pFTMarshal, pStream);
ok_ole_success(hr, IMarshal_ReleaseMarshalData); ok_ole_success(hr, IMarshal_ReleaseMarshalData);
todo_wine ok_no_locks(); ok_no_locks();
/* doesn't enforce marshaling rules here and allows us to unmarshal the /* doesn't enforce marshaling rules here and allows us to unmarshal the
* interface, even though it was freed above */ * interface, even though it was freed above */
@ -1775,7 +1775,7 @@ static void test_freethreadedmarshaler(void)
hr = IMarshal_UnmarshalInterface(pFTMarshal, pStream, &IID_IUnknown, (void **)&pProxy); hr = IMarshal_UnmarshalInterface(pFTMarshal, pStream, &IID_IUnknown, (void **)&pProxy);
ok_ole_success(hr, IMarshal_UnmarshalInterface); ok_ole_success(hr, IMarshal_UnmarshalInterface);
todo_wine ok_no_locks(); ok_no_locks();
IStream_Release(pStream); IStream_Release(pStream);
IMarshal_Release(pFTMarshal); IMarshal_Release(pFTMarshal);