ole32: Use generic class factory for item moniker.

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:19:24 +01:00 committed by Alexandre Julliard
parent cf7883f396
commit dee64631ff
3 changed files with 16 additions and 49 deletions

View File

@ -948,39 +948,16 @@ HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, IMoni
hr = ItemMonikerImpl_Construct(newItemMoniker,lpszDelim,lpszItem);
if (FAILED(hr)){
HeapFree(GetProcessHeap(),0,newItemMoniker);
return hr;
return hr;
}
return ItemMonikerImpl_QueryInterface(&newItemMoniker->IMoniker_iface,&IID_IMoniker,
(void**)ppmk);
}
static HRESULT WINAPI ItemMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI ItemMonikerCF_AddRef(LPCLASSFACTORY iface)
{
return 2; /* non-heap based object */
}
static ULONG WINAPI ItemMonikerCF_Release(LPCLASSFACTORY iface)
{
return 1; /* non-heap based object */
}
static HRESULT WINAPI ItemMonikerCF_CreateInstance(LPCLASSFACTORY iface,
LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
HRESULT WINAPI ItemMoniker_CreateInstance(IClassFactory *iface,
IUnknown *pUnk, REFIID riid, void **ppv)
{
ItemMonikerImpl* newItemMoniker;
HRESULT hr;
@ -1006,24 +983,3 @@ static HRESULT WINAPI ItemMonikerCF_CreateInstance(LPCLASSFACTORY iface,
return hr;
}
static HRESULT WINAPI ItemMonikerCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
{
FIXME("(%d), stub!\n",fLock);
return S_OK;
}
static const IClassFactoryVtbl ItemMonikerCFVtbl =
{
ItemMonikerCF_QueryInterface,
ItemMonikerCF_AddRef,
ItemMonikerCF_Release,
ItemMonikerCF_CreateInstance,
ItemMonikerCF_LockServer
};
static const IClassFactoryVtbl *ItemMonikerCF = &ItemMonikerCFVtbl;
HRESULT ItemMonikerCF_Create(REFIID riid, LPVOID *ppv)
{
return IClassFactory_QueryInterface((IClassFactory *)&ItemMonikerCF, riid, ppv);
}

View File

@ -31,7 +31,7 @@ DEFINE_OLEGUID( CLSID_ClassMoniker, 0x31a, 0, 0 );
DEFINE_OLEGUID( CLSID_PointerMoniker, 0x306, 0, 0 );
HRESULT WINAPI FileMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
HRESULT ItemMonikerCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT WINAPI ItemMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv);
HRESULT AntiMonikerCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT CompositeMonikerCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT ClassMonikerCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN;

View File

@ -84,6 +84,17 @@ static const IClassFactoryVtbl FileMonikerCFVtbl =
static IClassFactory FileMonikerCF = { &FileMonikerCFVtbl };
static const IClassFactoryVtbl ItemMonikerCFVtbl =
{
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
ItemMoniker_CreateInstance,
ClassFactory_LockServer
};
static IClassFactory ItemMonikerCF = { &ItemMonikerCFVtbl };
/***********************************************************************
* DllGetClassObject [OLE32.@]
*/
@ -103,7 +114,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
return ItemMonikerCF_Create(iid, ppv);
return IClassFactory_QueryInterface(&ItemMonikerCF, iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
return AntiMonikerCF_Create(iid, ppv);
if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))