ole32: Use generic class factory for StdComponentCategoriesMgr object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-02-21 13:20:18 +01:00 committed by Alexandre Julliard
parent 076c78220d
commit fd09c37b49
3 changed files with 14 additions and 79 deletions

View File

@ -700,53 +700,7 @@ static const ICatInformationVtbl COMCAT_ICatInformation_Vtbl =
COMCAT_ICatInformation_EnumReqCategoriesOfClass COMCAT_ICatInformation_EnumReqCategoriesOfClass
}; };
/********************************************************************** HRESULT WINAPI ComCat_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
* COMCAT_IClassFactory_QueryInterface (also IUnknown)
*/
static HRESULT WINAPI COMCAT_IClassFactory_QueryInterface(
LPCLASSFACTORY iface,
REFIID riid,
LPVOID *ppvObj)
{
TRACE("%s\n",debugstr_guid(riid));
if (ppvObj == NULL) return E_POINTER;
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IClassFactory))
{
*ppvObj = iface;
IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
}
/**********************************************************************
* COMCAT_IClassFactory_AddRef (also IUnknown)
*/
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface)
{
return 2; /* non-heap based object */
}
/**********************************************************************
* COMCAT_IClassFactory_Release (also IUnknown)
*/
static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface)
{
return 1; /* non-heap based object */
}
/**********************************************************************
* COMCAT_IClassFactory_CreateInstance
*/
static HRESULT WINAPI COMCAT_IClassFactory_CreateInstance(
LPCLASSFACTORY iface,
LPUNKNOWN pUnkOuter,
REFIID riid,
LPVOID *ppvObj)
{ {
HRESULT res; HRESULT res;
TRACE("%s\n",debugstr_guid(riid)); TRACE("%s\n",debugstr_guid(riid));
@ -764,36 +718,6 @@ static HRESULT WINAPI COMCAT_IClassFactory_CreateInstance(
return CLASS_E_CLASSNOTAVAILABLE; return CLASS_E_CLASSNOTAVAILABLE;
} }
/**********************************************************************
* COMCAT_IClassFactory_LockServer
*/
static HRESULT WINAPI COMCAT_IClassFactory_LockServer(
LPCLASSFACTORY iface,
BOOL fLock)
{
FIXME("(%d), stub!\n",fLock);
return S_OK;
}
/**********************************************************************
* static ClassFactory instance
*/
static const IClassFactoryVtbl ComCatCFVtbl =
{
COMCAT_IClassFactory_QueryInterface,
COMCAT_IClassFactory_AddRef,
COMCAT_IClassFactory_Release,
COMCAT_IClassFactory_CreateInstance,
COMCAT_IClassFactory_LockServer
};
static const IClassFactoryVtbl *ComCatCF = &ComCatCFVtbl;
HRESULT ComCatCF_Create(REFIID riid, LPVOID *ppv)
{
return IClassFactory_QueryInterface((IClassFactory *)&ComCatCF, riid, ppv);
}
/********************************************************************** /**********************************************************************
* IEnumCATEGORYINFO implementation * IEnumCATEGORYINFO implementation
* *

View File

@ -36,7 +36,7 @@ HRESULT WINAPI AntiMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk,
HRESULT WINAPI CompositeMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv); HRESULT WINAPI CompositeMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
HRESULT WINAPI ClassMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv); HRESULT WINAPI ClassMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
HRESULT WINAPI PointerMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv); HRESULT WINAPI PointerMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
HRESULT ComCatCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT WINAPI ComCat_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) DECLSPEC_HIDDEN; int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) DECLSPEC_HIDDEN;

View File

@ -139,6 +139,17 @@ static const IClassFactoryVtbl PointerMonikerCFVtbl =
static IClassFactory PointerMonikerCF = { &PointerMonikerCFVtbl }; static IClassFactory PointerMonikerCF = { &PointerMonikerCFVtbl };
static const IClassFactoryVtbl ComCatCFVtbl =
{
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
ComCat_CreateInstance,
ClassFactory_LockServer
};
static IClassFactory ComCatCF = { &ComCatCFVtbl };
/*********************************************************************** /***********************************************************************
* DllGetClassObject [OLE32.@] * DllGetClassObject [OLE32.@]
*/ */
@ -168,7 +179,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker)) if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv); return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv);
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr)) if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
return ComCatCF_Create(iid, ppv); return IClassFactory_QueryInterface(&ComCatCF, iid, ppv);
hr = OLE32_DllGetClassObject(rclsid, iid, ppv); hr = OLE32_DllGetClassObject(rclsid, iid, ppv);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))