From f2bd261f120c9bfbb42930a19192e134a306e8f3 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 24 May 2006 23:02:35 +0100 Subject: [PATCH] ole32: Add a class factory for CLSID_InProcFreeMarshaler. --- dlls/ole32/compobj.c | 3 ++ dlls/ole32/compobj_private.h | 1 + dlls/ole32/ftmarshal.c | 65 ++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index f2a587ff667..d241bfb5c5a 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1642,6 +1642,9 @@ HRESULT WINAPI CoGetClassObject( static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0}; HKEY hkey; + if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler)) + return FTMarshalCF_Create(iid, ppv); + hres = COM_OpenKeyForCLSID(rclsid, wszInprocServer32, KEY_READ, &hkey); if (FAILED(hres)) { diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index 2237469d359..f9fac80d984 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -178,6 +178,7 @@ extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr); HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *key); HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv); +HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv); /* Stub Manager */ diff --git a/dlls/ole32/ftmarshal.c b/dlls/ole32/ftmarshal.c index a0befeed0b8..9f41f65e03a 100644 --- a/dlls/ole32/ftmarshal.c +++ b/dlls/ole32/ftmarshal.c @@ -325,3 +325,68 @@ HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN * p *ppunkMarshal = _IFTMUnknown_ (ftm); return S_OK; } + +static HRESULT WINAPI FTMarshalCF_QueryInterface(LPCLASSFACTORY iface, + REFIID riid, LPVOID *ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) + { + *ppv = iface; + IUnknown_AddRef(iface); + return S_OK; + } + return E_NOINTERFACE; +} + +static ULONG WINAPI FTMarshalCF_AddRef(LPCLASSFACTORY iface) +{ + return 2; /* non-heap based object */ +} + +static ULONG WINAPI FTMarshalCF_Release(LPCLASSFACTORY iface) +{ + return 1; /* non-heap based object */ +} + +static HRESULT WINAPI FTMarshalCF_CreateInstance(LPCLASSFACTORY iface, + LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv) +{ + IUnknown *pUnknown; + HRESULT hr; + + TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv); + + *ppv = NULL; + + hr = CoCreateFreeThreadedMarshaler(pUnk, &pUnknown); + + if (SUCCEEDED(hr)) + { + hr = IUnknown_QueryInterface(pUnknown, riid, ppv); + IUnknown_Release(pUnknown); + } + + return hr; +} + +static HRESULT WINAPI FTMarshalCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) +{ + FIXME("(%d), stub!\n",fLock); + return S_OK; +} + +static const IClassFactoryVtbl FTMarshalCFVtbl = +{ + FTMarshalCF_QueryInterface, + FTMarshalCF_AddRef, + FTMarshalCF_Release, + FTMarshalCF_CreateInstance, + FTMarshalCF_LockServer +}; +static const IClassFactoryVtbl *FTMarshalCF = &FTMarshalCFVtbl; + +HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv) +{ + return IClassFactory_QueryInterface((IClassFactory *)&FTMarshalCF, riid, ppv); +}