ole32: Reduce duplication for global interface table factory.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7f50f877ee
commit
b59b5da856
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
|
||||
{
|
||||
*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)
|
||||
{
|
||||
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 */
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue