Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- dlls/combase/marshal.c | 19 +++++++++++++++++++ dlls/ole32/marshal.c | 30 ------------------------------ dlls/ole32/ole32.spec | 2 +- 4 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 56dc63c4f72..8c471f5ef69 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -109,7 +109,7 @@ @ stub CoGetErrorInfo @ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) -@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) ole32.CoGetInterfaceAndReleaseStream +@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) @ stdcall CoGetMalloc(long ptr) @ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) ole32.CoGetMarshalSizeMax @ stub CoGetModuleType diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c index dfe6426db9a..54151e21c8e 100644 --- a/dlls/combase/marshal.c +++ b/dlls/combase/marshal.c @@ -21,6 +21,10 @@ #define COBJMACROS #include "objbase.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + /*********************************************************************** * CoMarshalHresult (combase.@) */ @@ -36,3 +40,18 @@ HRESULT WINAPI CoUnmarshalHresult(IStream *stream, HRESULT *phresult) { return IStream_Read(stream, phresult, sizeof(*phresult), NULL); } + +/*********************************************************************** + * CoGetInterfaceAndReleaseStream (combase.@) + */ +HRESULT WINAPI CoGetInterfaceAndReleaseStream(IStream *stream, REFIID riid, void **obj) +{ + HRESULT hr; + + TRACE("%p, %s, %p\n", stream, debugstr_guid(riid), obj); + + if (!stream) return E_INVALIDARG; + hr = CoUnmarshalInterface(stream, riid, obj); + IStream_Release(stream); + return hr; +} diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index 90d24805952..51db5a7e699 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -2124,36 +2124,6 @@ HRESULT WINAPI CoMarshalInterThreadInterfaceInStream( return hres; }
-/*********************************************************************** - * CoGetInterfaceAndReleaseStream [OLE32.@] - * - * Unmarshalls an interface from a stream and then releases the stream. - * - * PARAMS - * pStm [I] Stream that contains the marshalled interface. - * riid [I] Interface identifier of the object to unmarshall. - * ppv [O] Address of pointer where the requested interface object will be stored. - * - * RETURNS - * Success: S_OK - * Failure: A COM error code - * - * SEE ALSO - * CoMarshalInterThreadInterfaceInStream() and CoUnmarshalInterface() - */ -HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, - LPVOID *ppv) -{ - HRESULT hres; - - TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv); - - if(!pStm) return E_INVALIDARG; - hres = CoUnmarshalInterface(pStm, riid, ppv); - IStream_Release(pStm); - return hres; -} - static HRESULT WINAPI StdMarshalCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv) { diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 001e7b7ad2b..d5e5607e036 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -37,7 +37,7 @@ @ stdcall CoGetDefaultContext(long ptr ptr) combase.CoGetDefaultContext @ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) combase.CoGetInstanceFromFile @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) combase.CoGetInstanceFromIStorage -@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) +@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) combase.CoGetInterfaceAndReleaseStream @ stdcall CoGetMalloc(long ptr) combase.CoGetMalloc @ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) @ stdcall CoGetObject(wstr ptr ptr ptr)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- dlls/combase/marshal.c | 29 +++++++++++++++++++++++++ dlls/ole32/marshal.c | 45 --------------------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 31 insertions(+), 47 deletions(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 8c471f5ef69..5ee52d950ee 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -129,7 +129,7 @@ @ stdcall CoIsHandlerConnected(ptr) ole32.CoIsHandlerConnected @ stdcall CoLockObjectExternal(ptr long long) ole32.CoLockObjectExternal @ stdcall CoMarshalHresult(ptr long) -@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr) ole32.CoMarshalInterThreadInterfaceInStream +@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr) @ stdcall CoMarshalInterface(ptr ptr ptr long ptr long) ole32.CoMarshalInterface @ stub CoPopServiceDomain @ stub CoPushServiceDomain diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c index 54151e21c8e..fe4c2f3adf8 100644 --- a/dlls/combase/marshal.c +++ b/dlls/combase/marshal.c @@ -55,3 +55,32 @@ HRESULT WINAPI CoGetInterfaceAndReleaseStream(IStream *stream, REFIID riid, void IStream_Release(stream); return hr; } + +/*********************************************************************** + * CoMarshalInterThreadInterfaceInStream (combase.@) + */ +HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, IUnknown *unk, IStream **stream) +{ + ULARGE_INTEGER xpos; + LARGE_INTEGER seekto; + HRESULT hr; + + TRACE("%s, %p, %p\n", debugstr_guid(riid), unk, stream); + + hr = CreateStreamOnHGlobal(NULL, TRUE, stream); + if (FAILED(hr)) return hr; + hr = CoMarshalInterface(*stream, riid, unk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL); + + if (SUCCEEDED(hr)) + { + memset(&seekto, 0, sizeof(seekto)); + IStream_Seek(*stream, seekto, STREAM_SEEK_SET, &xpos); + } + else + { + IStream_Release(*stream); + *stream = NULL; + } + + return hr; +} diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index 51db5a7e699..cf1e55babed 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -2079,51 +2079,6 @@ HRESULT WINAPI CoReleaseMarshalData(IStream *pStream) return hr; }
- -/*********************************************************************** - * CoMarshalInterThreadInterfaceInStream [OLE32.@] - * - * Marshal an interface across threads in the same process. - * - * PARAMS - * riid [I] Identifier of the interface to be marshalled. - * pUnk [I] Pointer to IUnknown-derived interface that will be marshalled. - * ppStm [O] Pointer to IStream object that is created and then used to store the marshalled interface. - * - * RETURNS - * Success: S_OK - * Failure: E_OUTOFMEMORY and other COM error codes - * - * SEE ALSO - * CoMarshalInterface(), CoUnmarshalInterface() and CoGetInterfaceAndReleaseStream() - */ -HRESULT WINAPI CoMarshalInterThreadInterfaceInStream( - REFIID riid, LPUNKNOWN pUnk, LPSTREAM * ppStm) -{ - ULARGE_INTEGER xpos; - LARGE_INTEGER seekto; - HRESULT hres; - - TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm); - - hres = CreateStreamOnHGlobal(NULL, TRUE, ppStm); - if (FAILED(hres)) return hres; - hres = CoMarshalInterface(*ppStm, riid, pUnk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL); - - if (SUCCEEDED(hres)) - { - memset(&seekto, 0, sizeof(seekto)); - IStream_Seek(*ppStm, seekto, STREAM_SEEK_SET, &xpos); - } - else - { - IStream_Release(*ppStm); - *ppStm = NULL; - } - - return hres; -} - static HRESULT WINAPI StdMarshalCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv) { diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index d5e5607e036..1587f926381 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -58,7 +58,7 @@ @ stdcall CoLoadLibrary(wstr long) @ stdcall CoLockObjectExternal(ptr long long) @ stdcall CoMarshalHresult(ptr long) combase.CoMarshalHresult -@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr) +@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr) combase.CoMarshalInterThreadInterfaceInStream @ stdcall CoMarshalInterface(ptr ptr ptr long ptr long) @ stub CoQueryAuthenticationServices @ stdcall CoQueryClientBlanket(ptr ptr ptr ptr ptr ptr ptr) combase.CoQueryClientBlanket
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- dlls/combase/marshal.c | 295 +++++++++++++++++++++++++++++++++++ dlls/ole32/ftmarshal.c | 312 -------------------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 297 insertions(+), 314 deletions(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 5ee52d950ee..79410be8be0 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -77,7 +77,7 @@ @ stub CoCancelCall @ stdcall CoCopyProxy(ptr ptr) @ stdcall CoCreateErrorInfo(ptr) CreateErrorInfo -@ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) ole32.CoCreateFreeThreadedMarshaler +@ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) @ stdcall CoCreateGuid(ptr) @ stdcall CoCreateInstance(ptr ptr long ptr ptr) @ stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr) ole32.CoCreateInstanceEx diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c index fe4c2f3adf8..2b0c0058125 100644 --- a/dlls/combase/marshal.c +++ b/dlls/combase/marshal.c @@ -1,4 +1,5 @@ /* + * Copyright 2002 Juergen Schmied * Copyright 2002 Marcus Meissner * Copyright 2004 Mike Hearn, for CodeWeavers * Copyright 2004 Rob Shearman, for CodeWeavers @@ -22,9 +23,28 @@ #include "objbase.h"
#include "wine/debug.h" +#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
+struct ftmarshaler +{ + IUnknown IUnknown_inner; + IMarshal IMarshal_iface; + IUnknown *outer_unk; + LONG refcount; +}; + +static struct ftmarshaler *impl_ft_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct ftmarshaler, IUnknown_inner); +} + +static struct ftmarshaler *impl_ft_from_IMarshal(IMarshal *iface) +{ + return CONTAINING_RECORD(iface, struct ftmarshaler, IMarshal_iface); +} + /*********************************************************************** * CoMarshalHresult (combase.@) */ @@ -84,3 +104,278 @@ HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, IUnknown *unk,
return hr; } + +static HRESULT WINAPI ftmarshaler_inner_QueryInterface(IUnknown *iface, REFIID riid, void **obj) +{ + struct ftmarshaler *marshaler = impl_ft_from_IUnknown(iface); + + TRACE("%p, %s, %p\n", iface, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID(&IID_IUnknown, riid)) + *obj = &marshaler->IUnknown_inner; + else if (IsEqualIID(&IID_IMarshal, riid)) + *obj = &marshaler->IMarshal_iface; + else + { + FIXME("No interface for %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*obj); + + return S_OK; +} + +static ULONG WINAPI ftmarshaler_inner_AddRef(IUnknown *iface) +{ + struct ftmarshaler *marshaler = impl_ft_from_IUnknown(iface); + ULONG refcount = InterlockedIncrement(&marshaler->refcount); + + TRACE("%p, refcount %u\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI ftmarshaler_inner_Release(IUnknown *iface) +{ + struct ftmarshaler *marshaler = impl_ft_from_IUnknown(iface); + ULONG refcount = InterlockedDecrement(&marshaler->refcount); + + TRACE("%p, refcount %u\n", iface, refcount); + + if (!refcount) + heap_free(marshaler); + + return refcount; +} + +static const IUnknownVtbl ftmarshaler_inner_vtbl = +{ + ftmarshaler_inner_QueryInterface, + ftmarshaler_inner_AddRef, + ftmarshaler_inner_Release +}; + +static HRESULT WINAPI ftmarshaler_QueryInterface(IMarshal *iface, REFIID riid, void **obj) +{ + struct ftmarshaler *marshaler = impl_ft_from_IMarshal(iface); + + TRACE("%p, %s, %p\n", iface, debugstr_guid(riid), obj); + + return IUnknown_QueryInterface(marshaler->outer_unk, riid, obj); +} + +static ULONG WINAPI ftmarshaler_AddRef(IMarshal *iface) +{ + struct ftmarshaler *marshaler = impl_ft_from_IMarshal(iface); + + TRACE("%p\n", iface); + + return IUnknown_AddRef(marshaler->outer_unk); +} + +static ULONG WINAPI ftmarshaler_Release(IMarshal *iface) +{ + struct ftmarshaler *marshaler = impl_ft_from_IMarshal(iface); + + TRACE("%p\n", iface); + + return IUnknown_Release(marshaler->outer_unk); +} + +static HRESULT WINAPI ftmarshaler_GetUnmarshalClass(IMarshal *iface, REFIID riid, void *pv, + DWORD dest_context, void *pvDestContext, DWORD mshlflags, CLSID *clsid) +{ + TRACE("%s, %p, %#x, %p, %#x, %p\n", debugstr_guid(riid), pv, dest_context, pvDestContext, mshlflags, clsid); + + if (dest_context == MSHCTX_INPROC || dest_context == MSHCTX_CROSSCTX) + *clsid = CLSID_InProcFreeMarshaler; + else + *clsid = CLSID_StdMarshal; + + return S_OK; +} + +static HRESULT WINAPI ftmarshaler_GetMarshalSizeMax(IMarshal *iface, REFIID riid, void *pv, + DWORD dest_context, void *pvDestContext, DWORD mshlflags, DWORD *size) +{ + IMarshal *marshal = NULL; + HRESULT hr; + + TRACE("%s, %p, %#x, %p, %#x, %p\n", debugstr_guid(riid), pv, dest_context, pvDestContext, mshlflags, size); + + /* If the marshalling happens inside the same process the interface pointer is + copied between the apartments */ + if (dest_context == MSHCTX_INPROC || dest_context == MSHCTX_CROSSCTX) + { + *size = sizeof(mshlflags) + sizeof(pv) + sizeof(DWORD) + sizeof(GUID); + return S_OK; + } + + /* Use the standard marshaller to handle all other cases */ + CoGetStandardMarshal(riid, pv, dest_context, pvDestContext, mshlflags, &marshal); + hr = IMarshal_GetMarshalSizeMax(marshal, riid, pv, dest_context, pvDestContext, mshlflags, size); + IMarshal_Release(marshal); + return hr; +} + +static HRESULT WINAPI ftmarshaler_MarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, + void *pv, DWORD dest_context, void *pvDestContext, DWORD mshlflags) +{ + IMarshal *marshal = NULL; + HRESULT hr; + + TRACE("%p, %s, %p, %#x, %p, %#x\n", stream, debugstr_guid(riid), pv, + dest_context, pvDestContext, mshlflags); + + /* If the marshalling happens inside the same process the interface pointer is + copied between the apartments */ + if (dest_context == MSHCTX_INPROC || dest_context == MSHCTX_CROSSCTX) + { + void *object; + DWORD constant = 0; + GUID unknown_guid = { 0 }; + + hr = IUnknown_QueryInterface((IUnknown *)pv, riid, &object); + if (FAILED(hr)) + return hr; + + /* don't hold a reference to table-weak marshaled interfaces */ + if (mshlflags & MSHLFLAGS_TABLEWEAK) + IUnknown_Release((IUnknown *)object); + + hr = IStream_Write(stream, &mshlflags, sizeof(mshlflags), NULL); + if (hr != S_OK) return STG_E_MEDIUMFULL; + + hr = IStream_Write(stream, &object, sizeof(object), NULL); + if (hr != S_OK) return STG_E_MEDIUMFULL; + + if (sizeof(object) == sizeof(DWORD)) + { + hr = IStream_Write(stream, &constant, sizeof(constant), NULL); + if (hr != S_OK) return STG_E_MEDIUMFULL; + } + + hr = IStream_Write(stream, &unknown_guid, sizeof(unknown_guid), NULL); + if (hr != S_OK) return STG_E_MEDIUMFULL; + + return S_OK; + } + + /* Use the standard marshaler to handle all other cases */ + CoGetStandardMarshal(riid, pv, dest_context, pvDestContext, mshlflags, &marshal); + hr = IMarshal_MarshalInterface(marshal, stream, riid, pv, dest_context, pvDestContext, mshlflags); + IMarshal_Release(marshal); + return hr; +} + +static HRESULT WINAPI ftmarshaler_UnmarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, void **ppv) +{ + DWORD mshlflags; + IUnknown *object; + DWORD constant; + GUID unknown_guid; + HRESULT hr; + + TRACE("%p, %s, %p\n", stream, debugstr_guid(riid), ppv); + + hr = IStream_Read(stream, &mshlflags, sizeof(mshlflags), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + hr = IStream_Read(stream, &object, sizeof(object), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + if (sizeof(object) == sizeof(DWORD)) + { + hr = IStream_Read(stream, &constant, sizeof(constant), NULL); + if (hr != S_OK) return STG_E_READFAULT; + if (constant != 0) + FIXME("constant is 0x%x instead of 0\n", constant); + } + + hr = IStream_Read(stream, &unknown_guid, sizeof(unknown_guid), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + hr = IUnknown_QueryInterface(object, riid, ppv); + if (!(mshlflags & (MSHLFLAGS_TABLEWEAK | MSHLFLAGS_TABLESTRONG))) + IUnknown_Release(object); + + return hr; +} + +static HRESULT WINAPI ftmarshaler_ReleaseMarshalData(IMarshal *iface, IStream *stream) +{ + DWORD mshlflags; + IUnknown *object; + DWORD constant; + GUID unknown_guid; + HRESULT hr; + + TRACE("%p\n", stream); + + hr = IStream_Read(stream, &mshlflags, sizeof(mshlflags), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + hr = IStream_Read(stream, &object, sizeof(object), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + if (sizeof(object) == sizeof(DWORD)) + { + hr = IStream_Read(stream, &constant, sizeof(constant), NULL); + if (hr != S_OK) return STG_E_READFAULT; + if (constant != 0) + FIXME("constant is 0x%x instead of 0\n", constant); + } + + hr = IStream_Read(stream, &unknown_guid, sizeof(unknown_guid), NULL); + if (hr != S_OK) return STG_E_READFAULT; + + IUnknown_Release(object); + return S_OK; +} + +static HRESULT WINAPI ftmarshaler_DisconnectObject(IMarshal *iface, DWORD reserved) +{ + TRACE("\n"); + + /* nothing to do */ + return S_OK; +} + +static const IMarshalVtbl ftmarshaler_vtbl = +{ + ftmarshaler_QueryInterface, + ftmarshaler_AddRef, + ftmarshaler_Release, + ftmarshaler_GetUnmarshalClass, + ftmarshaler_GetMarshalSizeMax, + ftmarshaler_MarshalInterface, + ftmarshaler_UnmarshalInterface, + ftmarshaler_ReleaseMarshalData, + ftmarshaler_DisconnectObject +}; + +/*********************************************************************** + * CoCreateFreeThreadedMarshaler (combase.@) + */ +HRESULT WINAPI CoCreateFreeThreadedMarshaler(IUnknown *outer, IUnknown **marshaler) +{ + struct ftmarshaler *object; + + TRACE("%p, %p\n", outer, marshaler); + + object = heap_alloc(sizeof(*object)); + if (!object) + return E_OUTOFMEMORY; + + object->IUnknown_inner.lpVtbl = &ftmarshaler_inner_vtbl; + object->IMarshal_iface.lpVtbl = &ftmarshaler_vtbl; + object->refcount = 1; + object->outer_unk = outer ? outer : &object->IUnknown_inner; + + *marshaler = &object->IUnknown_inner; + + return S_OK; +} diff --git a/dlls/ole32/ftmarshal.c b/dlls/ole32/ftmarshal.c index 851810df42a..8777b553618 100644 --- a/dlls/ole32/ftmarshal.c +++ b/dlls/ole32/ftmarshal.c @@ -36,318 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
-typedef struct _FTMarshalImpl { - IUnknown IUnknown_inner; - IMarshal IMarshal_iface; - IUnknown *outer_unk; - LONG ref; -} FTMarshalImpl; - -static inline FTMarshalImpl *impl_from_IUnknown(IUnknown *iface) -{ - return CONTAINING_RECORD(iface, FTMarshalImpl, IUnknown_inner); -} - -static inline FTMarshalImpl *impl_from_IMarshal( IMarshal *iface ) -{ - return CONTAINING_RECORD(iface, FTMarshalImpl, IMarshal_iface); -} - -/* inner IUnknown to handle aggregation */ -static HRESULT WINAPI -IiFTMUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppv) -{ - - FTMarshalImpl *This = impl_from_IUnknown(iface); - - TRACE ("\n"); - *ppv = NULL; - - if (IsEqualIID (&IID_IUnknown, riid)) - *ppv = &This->IUnknown_inner; - else if (IsEqualIID (&IID_IMarshal, riid)) - *ppv = &This->IMarshal_iface; - else { - FIXME ("No interface for %s.\n", debugstr_guid (riid)); - return E_NOINTERFACE; - } - IUnknown_AddRef ((IUnknown *) * ppv); - return S_OK; -} - -static ULONG WINAPI IiFTMUnknown_fnAddRef (IUnknown * iface) -{ - - FTMarshalImpl *This = impl_from_IUnknown(iface); - - TRACE ("\n"); - return InterlockedIncrement (&This->ref); -} - -static ULONG WINAPI IiFTMUnknown_fnRelease (IUnknown * iface) -{ - - FTMarshalImpl *This = impl_from_IUnknown(iface); - - TRACE ("\n"); - if (InterlockedDecrement (&This->ref)) - return This->ref; - HeapFree (GetProcessHeap (), 0, This); - return 0; -} - -static const IUnknownVtbl iunkvt = -{ - IiFTMUnknown_fnQueryInterface, - IiFTMUnknown_fnAddRef, - IiFTMUnknown_fnRelease -}; - -static HRESULT WINAPI -FTMarshalImpl_QueryInterface (LPMARSHAL iface, REFIID riid, LPVOID * ppv) -{ - - FTMarshalImpl *This = impl_from_IMarshal(iface); - - TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppv); - return IUnknown_QueryInterface(This->outer_unk, riid, ppv); -} - -static ULONG WINAPI -FTMarshalImpl_AddRef (LPMARSHAL iface) -{ - - FTMarshalImpl *This = impl_from_IMarshal(iface); - - TRACE ("\n"); - return IUnknown_AddRef(This->outer_unk); -} - -static ULONG WINAPI -FTMarshalImpl_Release (LPMARSHAL iface) -{ - - FTMarshalImpl *This = impl_from_IMarshal(iface); - - TRACE ("\n"); - return IUnknown_Release(This->outer_unk); -} - -static HRESULT WINAPI -FTMarshalImpl_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, - void *pvDestContext, DWORD mshlflags, CLSID * pCid) -{ - TRACE("(%s, %p, 0x%x, %p, 0x%x, %p)\n", debugstr_guid(riid), pv, - dwDestContext, pvDestContext, mshlflags, pCid); - if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) - *pCid = CLSID_InProcFreeMarshaler; - else - *pCid = CLSID_StdMarshal; - return S_OK; -} - -static HRESULT WINAPI -FTMarshalImpl_GetMarshalSizeMax (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, - void *pvDestContext, DWORD mshlflags, DWORD * pSize) -{ - - IMarshal *pMarshal = NULL; - HRESULT hres; - - TRACE("(%s, %p, 0x%x, %p, 0x%x, %p)\n", debugstr_guid(riid), pv, - dwDestContext, pvDestContext, mshlflags, pSize); - - /* if the marshalling happens inside the same process the interface pointer is - copied between the apartments */ - if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) { - *pSize = sizeof (mshlflags) + sizeof (pv) + sizeof (DWORD) + sizeof (GUID); - return S_OK; - } - - /* use the standard marshaller to handle all other cases */ - CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal); - hres = IMarshal_GetMarshalSizeMax (pMarshal, riid, pv, dwDestContext, pvDestContext, mshlflags, pSize); - IMarshal_Release (pMarshal); - return hres; -} - -static HRESULT WINAPI -FTMarshalImpl_MarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void *pv, - DWORD dwDestContext, void *pvDestContext, DWORD mshlflags) -{ - - IMarshal *pMarshal = NULL; - HRESULT hres; - - TRACE("(%p, %s, %p, 0x%x, %p, 0x%x)\n", pStm, debugstr_guid(riid), pv, - dwDestContext, pvDestContext, mshlflags); - - /* if the marshalling happens inside the same process the interface pointer is - copied between the apartments */ - if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) { - void *object; - DWORD constant = 0; - GUID unknown_guid = { 0 }; - - hres = IUnknown_QueryInterface((IUnknown *)pv, riid, &object); - if (FAILED(hres)) - return hres; - - /* don't hold a reference to table-weak marshaled interfaces */ - if (mshlflags & MSHLFLAGS_TABLEWEAK) - IUnknown_Release((IUnknown *)object); - - hres = IStream_Write (pStm, &mshlflags, sizeof (mshlflags), NULL); - if (hres != S_OK) return STG_E_MEDIUMFULL; - - hres = IStream_Write (pStm, &object, sizeof (object), NULL); - if (hres != S_OK) return STG_E_MEDIUMFULL; - - if (sizeof(object) == sizeof(DWORD)) - { - hres = IStream_Write (pStm, &constant, sizeof (constant), NULL); - if (hres != S_OK) return STG_E_MEDIUMFULL; - } - - hres = IStream_Write (pStm, &unknown_guid, sizeof (unknown_guid), NULL); - if (hres != S_OK) return STG_E_MEDIUMFULL; - - return S_OK; - } - - /* 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); - IMarshal_Release (pMarshal); - return hres; -} - -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); - - hres = IStream_Read (pStm, &mshlflags, sizeof (mshlflags), 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; - - if (sizeof(object) == sizeof(DWORD)) - { - hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); - if (hres != S_OK) return STG_E_READFAULT; - if (constant != 0) - FIXME("constant is 0x%x instead of 0\n", constant); - } - - 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; -} - -static HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm) -{ - DWORD mshlflags; - IUnknown *object; - DWORD constant; - GUID unknown_guid; - HRESULT hres; - - TRACE ("(%p)\n", pStm); - - hres = IStream_Read (pStm, &mshlflags, sizeof (mshlflags), 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; - - if (sizeof(object) == sizeof(DWORD)) - { - hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); - if (hres != S_OK) return STG_E_READFAULT; - if (constant != 0) - FIXME("constant is 0x%x 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) -{ - TRACE ("()\n"); - /* nothing to do */ - return S_OK; -} - -static const IMarshalVtbl ftmvtbl = -{ - FTMarshalImpl_QueryInterface, - FTMarshalImpl_AddRef, - FTMarshalImpl_Release, - FTMarshalImpl_GetUnmarshalClass, - FTMarshalImpl_GetMarshalSizeMax, - FTMarshalImpl_MarshalInterface, - FTMarshalImpl_UnmarshalInterface, - FTMarshalImpl_ReleaseMarshalData, - FTMarshalImpl_DisconnectObject -}; - -/*********************************************************************** - * CoCreateFreeThreadedMarshaler [OLE32.@] - * - * Creates a free-threaded marshaler. - * - * PARAMS - * punkOuter [I] Optional. Outer unknown. - * ppunkMarshal [O] On return, the inner unknown of the created free-threaded marshaler. - * - * RETURNS - * Success: S_OK - * Failure: E_OUTOFMEMORY if no memory available to create object. - * - * NOTES - * Objects that ensure their state is maintained consistent when used by - * multiple threads and reference no single-threaded objects are known as - * free-threaded. The free-threaded marshaler enables these objects to be - * efficiently marshaled within the same process, by not creating proxies - * (as they aren't needed for the object to be safely used), whilst still - * allowing the object to be used in inter-process and inter-machine contexts. - */ -HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN * ppunkMarshal) -{ - - FTMarshalImpl *ftm; - - TRACE ("(%p %p)\n", punkOuter, ppunkMarshal); - - ftm = HeapAlloc (GetProcessHeap (), 0, sizeof (FTMarshalImpl)); - if (!ftm) - return E_OUTOFMEMORY; - - ftm->IUnknown_inner.lpVtbl = &iunkvt; - ftm->IMarshal_iface.lpVtbl = &ftmvtbl; - ftm->ref = 1; - ftm->outer_unk = punkOuter ? punkOuter : &ftm->IUnknown_inner; - - *ppunkMarshal = &ftm->IUnknown_inner; - return S_OK; -} - static HRESULT WINAPI FTMarshalCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv) { diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 1587f926381..d1dedd39c3f 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -10,7 +10,7 @@ @ stdcall CoAllowSetForegroundWindow(ptr ptr) @ stdcall CoBuildVersion() @ stdcall CoCopyProxy(ptr ptr) combase.CoCopyProxy -@ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) +@ stdcall CoCreateFreeThreadedMarshaler(ptr ptr) combase.CoCreateFreeThreadedMarshaler @ stdcall CoCreateGuid(ptr) combase.CoCreateGuid @ stdcall CoCreateInstance(ptr ptr long ptr ptr) combase.CoCreateInstance @ stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr)
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.c | 10 ++++++++++ dlls/combase/combase.spec | 1 + dlls/ole32/compobj.c | 10 ---------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index f7c70e1232d..edd6ac0b285 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -1063,6 +1063,16 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid) return clsid_from_string_reg(progid, clsid); }
+/****************************************************************************** + * CLSIDFromProgIDEx (combase.@) + */ +HRESULT WINAPI CLSIDFromProgIDEx(LPCOLESTR progid, CLSID *clsid) +{ + FIXME("%s, %p: semi-stub\n", debugstr_w(progid), clsid); + + return CLSIDFromProgID(progid, clsid); +} + /****************************************************************************** * CLSIDFromString (combase.@) */ diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 79410be8be0..6698c23c76d 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -68,6 +68,7 @@ @ stdcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr) @ stub CLSIDFromOle1Class @ stdcall CLSIDFromProgID(wstr ptr) +@ stdcall CLSIDFromProgIDEx(wstr ptr) @ stdcall CLSIDFromString(wstr ptr) @ stub CleanupOleStateInAllTls @ stdcall CleanupTlsOleState(ptr) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 33e617cca0e..32283e6d958 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -2255,16 +2255,6 @@ HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey return S_OK; }
-/****************************************************************************** - * CLSIDFromProgIDEx [OLE32.@] - */ -HRESULT WINAPI CLSIDFromProgIDEx(LPCOLESTR progid, LPCLSID clsid) -{ - FIXME("%s,%p: semi-stub\n", debugstr_w(progid), clsid); - - return CLSIDFromProgID(progid, clsid); -} - static HRESULT get_ps_clsid_from_registry(const WCHAR* path, REGSAM access, CLSID *pclsid) { HKEY hkey; diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index d1dedd39c3f..c83f0b27166 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -4,7 +4,7 @@ @ stdcall CLIPFORMAT_UserSize(ptr long ptr) combase.CLIPFORMAT_UserSize @ stdcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr) combase.CLIPFORMAT_UserUnmarshal @ stdcall CLSIDFromProgID(wstr ptr) combase.CLSIDFromProgID -@ stdcall CLSIDFromProgIDEx(wstr ptr) +@ stdcall CLSIDFromProgIDEx(wstr ptr) combase.CLSIDFromProgIDEx @ stdcall CLSIDFromString(wstr ptr) combase.CLSIDFromString @ stdcall CoAddRefServerProcess() @ stdcall CoAllowSetForegroundWindow(ptr ptr)
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compobj_private.h | 3 ++ dlls/ole32/git.c | 60 +++--------------------------------- dlls/ole32/oleproxy.c | 15 +++++++-- 3 files changed, 21 insertions(+), 57 deletions(-)
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index e151241673c..3156f86f898 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -319,6 +319,9 @@ extern HRESULT HandlerCF_Create(REFCLSID rclsid, REFIID riid, LPVOID *ppv) DECLS extern HRESULT WINAPI GlobalOptions_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv) DECLSPEC_HIDDEN; extern IClassFactory GlobalOptionsCF DECLSPEC_HIDDEN; +extern HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, + void **obj) DECLSPEC_HIDDEN; +extern IClassFactory GlobalInterfaceTableCF DECLSPEC_HIDDEN;
/* Exported non-interface Data Advise Holder functions */ HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN; diff --git a/dlls/ole32/git.c b/dlls/ole32/git.c index 8683f3592ac..e761c99b77c 100644 --- a/dlls/ole32/git.c +++ b/dlls/ole32/git.c @@ -290,62 +290,12 @@ StdGlobalInterfaceTable_GetInterfaceFromGlobal( return S_OK; }
-/* Classfactory definition - despite what MSDN says, some programs need this */ - -static HRESULT WINAPI -GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) -{ - *ppv = NULL; - if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IClassFactory)) - { - *ppv = iface; - return S_OK; - } - return E_NOINTERFACE; -} - -static ULONG WINAPI GITCF_AddRef(LPCLASSFACTORY iface) -{ - return 2; -} - -static ULONG WINAPI GITCF_Release(LPCLASSFACTORY iface) -{ - return 1; -} - -static HRESULT WINAPI -GITCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, - REFIID riid, LPVOID *ppv) +HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) { - IGlobalInterfaceTable *git = get_std_git(); - HRESULT hr = IGlobalInterfaceTable_QueryInterface(git, riid, ppv); - IGlobalInterfaceTable_Release(git); - return hr; -} - -static HRESULT WINAPI GITCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) -{ - FIXME("(%d), stub!\n",fLock); - return S_OK; -} - -static const IClassFactoryVtbl GITClassFactoryVtbl = { - GITCF_QueryInterface, - GITCF_AddRef, - GITCF_Release, - GITCF_CreateInstance, - GITCF_LockServer -}; - -static IClassFactory git_classfactory = { &GITClassFactoryVtbl }; - -HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) -{ - *ppv = &git_classfactory; - TRACE("Returning GIT classfactory\n"); - return S_OK; + IGlobalInterfaceTable *git = get_std_git(); + HRESULT hr = IGlobalInterfaceTable_QueryInterface(git, riid, obj); + IGlobalInterfaceTable_Release(git); + return hr; }
/* Virtual function table */ diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c index b5c08ff1c5b..93ff5b0da84 100644 --- a/dlls/ole32/oleproxy.c +++ b/dlls/ole32/oleproxy.c @@ -159,6 +159,17 @@ static const IClassFactoryVtbl GlobalOptionsCFVtbl =
IClassFactory GlobalOptionsCF = { &GlobalOptionsCFVtbl };
+static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl = +{ + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + GlobalInterfaceTable_CreateInstance, + ClassFactory_LockServer +}; + +IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl }; + /*********************************************************************** * DllGetClassObject [OLE32.@] */ @@ -173,8 +184,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) ) ) return MARSHAL_GetStandardMarshalCF(ppv); - if (IsEqualIID(rclsid,&CLSID_StdGlobalInterfaceTable) && (IsEqualIID(iid,&IID_IClassFactory) || IsEqualIID(iid,&IID_IUnknown))) - return StdGlobalInterfaceTable_GetFactory(ppv); + if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable)) + return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv); if (IsEqualCLSID(rclsid, &CLSID_FileMoniker)) return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv); if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compobj.c | 6 +++--- dlls/ole32/compobj_private.h | 3 +++ dlls/ole32/oleproxy.c | 13 +++++++++++++ dlls/ole32/tests/marshal.c | 5 +++++ 4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 32283e6d958..8e78519dc80 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -922,12 +922,12 @@ static const ISynchronizeHandleVtbl SynchronizeHandleVtbl = { SynchronizeHandle_GetHandle };
-static HRESULT ManualResetEvent_Construct(IUnknown *punkouter, REFIID iid, void **ppv) +HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **ppv) { MREImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MREImpl)); HRESULT hr;
- if(punkouter) + if (outer) FIXME("Aggregation not implemented.\n");
This->ref = 1; @@ -3004,7 +3004,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx( }
if (IsEqualCLSID(&clsid, &CLSID_ManualResetEvent)) { - hres = ManualResetEvent_Construct(pUnkOuter, pResults[0].pIID, (void**)&unk); + hres = ManualResetEvent_CreateInstance(&ManualResetEventCF, pUnkOuter, pResults[0].pIID, (void**)&unk); if (FAILED(hres)) return hres; return return_multi_qi(unk, cmq, pResults, TRUE); diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index 3156f86f898..974c230ddce 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -322,6 +322,9 @@ extern IClassFactory GlobalOptionsCF DECLSPEC_HIDDEN; extern HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) DECLSPEC_HIDDEN; extern IClassFactory GlobalInterfaceTableCF DECLSPEC_HIDDEN; +extern HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, + void **obj) DECLSPEC_HIDDEN; +extern IClassFactory ManualResetEventCF DECLSPEC_HIDDEN;
/* Exported non-interface Data Advise Holder functions */ HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN; diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c index 93ff5b0da84..29cd391e127 100644 --- a/dlls/ole32/oleproxy.c +++ b/dlls/ole32/oleproxy.c @@ -170,6 +170,17 @@ static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl =
IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl };
+static const IClassFactoryVtbl ManualResetEventCFVtbl = +{ + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ManualResetEvent_CreateInstance, + ClassFactory_LockServer +}; + +IClassFactory ManualResetEventCF = { &ManualResetEventCFVtbl }; + /*********************************************************************** * DllGetClassObject [OLE32.@] */ @@ -186,6 +197,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) return MARSHAL_GetStandardMarshalCF(ppv); if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable)) return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv); + if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent)) + return IClassFactory_QueryInterface(&ManualResetEventCF, iid, ppv); if (IsEqualCLSID(rclsid, &CLSID_FileMoniker)) return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv); if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker)) diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index e2608ecb768..ef608e66d01 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -4006,11 +4006,16 @@ static void test_manualresetevent(void) { ISynchronizeHandle *sync_handle; ISynchronize *psync1, *psync2; + IClassFactory *factory; IUnknown *punk; HANDLE handle; LONG ref; HRESULT hr;
+ hr = pDllGetClassObject(&CLSID_ManualResetEvent, &IID_IClassFactory, (void **)&factory); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IClassFactory_Release(factory); + hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk); ok(hr == S_OK, "Got 0x%08x\n", hr); ok(!!punk, "Got NULL.\n");
Signed-off-by: Huw Davies huw@codeweavers.com