2002-02-05 19:11:17 +01:00
|
|
|
/*
|
|
|
|
* OLE32 proxy/stub handler
|
|
|
|
*
|
|
|
|
* Copyright 2002 Marcus Meissner
|
2008-10-18 19:20:29 +02:00
|
|
|
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-02-05 19:11:17 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-02-05 19:11:17 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2002-02-05 19:11:17 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2003-09-09 21:39:31 +02:00
|
|
|
#include "winuser.h"
|
2002-02-05 19:11:17 +01:00
|
|
|
#include "objbase.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "rpc.h"
|
|
|
|
|
|
|
|
#include "compobj_private.h"
|
2005-05-19 16:22:14 +02:00
|
|
|
#include "moniker.h"
|
2008-10-11 13:30:08 +02:00
|
|
|
#include "comcat.h"
|
2002-02-05 19:11:17 +01:00
|
|
|
|
2017-02-21 13:19:12 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
*ppv = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
|
|
|
|
{
|
|
|
|
TRACE("(%x)\n", fLock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IClassFactoryVtbl FileMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
FileMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory FileMonikerCF = { &FileMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:19:24 +01:00
|
|
|
static const IClassFactoryVtbl ItemMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
ItemMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory ItemMonikerCF = { &ItemMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:19:32 +01:00
|
|
|
static const IClassFactoryVtbl AntiMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
AntiMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory AntiMonikerCF = { &AntiMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:19:39 +01:00
|
|
|
static const IClassFactoryVtbl CompositeMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
CompositeMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory CompositeMonikerCF = { &CompositeMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:19:47 +01:00
|
|
|
static const IClassFactoryVtbl ClassMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
ClassMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory ClassMonikerCF = { &ClassMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:20:09 +01:00
|
|
|
static const IClassFactoryVtbl PointerMonikerCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
PointerMoniker_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory PointerMonikerCF = { &PointerMonikerCFVtbl };
|
|
|
|
|
2017-02-21 13:20:18 +01:00
|
|
|
static const IClassFactoryVtbl ComCatCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
ComCat_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactory ComCatCF = { &ComCatCFVtbl };
|
|
|
|
|
2017-02-22 12:28:57 +01:00
|
|
|
static const IClassFactoryVtbl GlobalOptionsCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
GlobalOptions_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
IClassFactory GlobalOptionsCF = { &GlobalOptionsCFVtbl };
|
|
|
|
|
2020-08-12 10:12:31 +02:00
|
|
|
static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
GlobalInterfaceTable_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl };
|
|
|
|
|
2020-08-12 10:12:32 +02:00
|
|
|
static const IClassFactoryVtbl ManualResetEventCFVtbl =
|
|
|
|
{
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
ManualResetEvent_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
IClassFactory ManualResetEventCF = { &ManualResetEventCFVtbl };
|
|
|
|
|
2002-02-05 19:11:17 +01:00
|
|
|
/***********************************************************************
|
2003-09-11 05:06:25 +02:00
|
|
|
* DllGetClassObject [OLE32.@]
|
2002-02-05 19:11:17 +01:00
|
|
|
*/
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
|
2002-02-05 19:11:17 +01:00
|
|
|
{
|
2009-11-23 16:07:49 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2002-02-05 19:11:17 +01:00
|
|
|
*ppv = NULL;
|
2002-06-05 00:14:06 +02:00
|
|
|
if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&(
|
|
|
|
IsEqualIID(iid,&IID_IClassFactory) ||
|
|
|
|
IsEqualIID(iid,&IID_IUnknown)
|
|
|
|
)
|
|
|
|
)
|
2002-02-05 19:11:17 +01:00
|
|
|
return MARSHAL_GetStandardMarshalCF(ppv);
|
2020-08-12 10:12:31 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
|
|
|
|
return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv);
|
2020-08-12 10:12:32 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
|
|
|
|
return IClassFactory_QueryInterface(&ManualResetEventCF, iid, ppv);
|
2005-05-19 16:22:14 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
|
2017-02-21 13:19:12 +01:00
|
|
|
return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
|
2005-05-19 16:22:14 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
|
2017-02-21 13:19:24 +01:00
|
|
|
return IClassFactory_QueryInterface(&ItemMonikerCF, iid, ppv);
|
2006-05-08 13:36:13 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
|
2017-02-21 13:19:32 +01:00
|
|
|
return IClassFactory_QueryInterface(&AntiMonikerCF, iid, ppv);
|
2006-05-08 13:41:06 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))
|
2017-02-21 13:19:39 +01:00
|
|
|
return IClassFactory_QueryInterface(&CompositeMonikerCF, iid, ppv);
|
2006-05-08 16:55:14 +02:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_ClassMoniker))
|
2017-02-21 13:19:47 +01:00
|
|
|
return IClassFactory_QueryInterface(&ClassMonikerCF, iid, ppv);
|
2008-01-31 15:45:10 +01:00
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
|
2017-02-21 13:20:09 +01:00
|
|
|
return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv);
|
2008-10-11 13:30:08 +02:00
|
|
|
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
|
2017-02-21 13:20:18 +01:00
|
|
|
return IClassFactory_QueryInterface(&ComCatCF, iid, ppv);
|
2003-06-17 05:57:18 +02:00
|
|
|
|
2009-11-23 16:07:49 +01:00
|
|
|
hr = OLE32_DllGetClassObject(rclsid, iid, ppv);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return Handler_DllGetClassObject(rclsid, iid, ppv);
|
2002-02-05 19:11:17 +01:00
|
|
|
}
|
2020-08-13 09:29:30 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Ole32DllGetClassObject [OLE32.@]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI Ole32DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
|
|
|
|
return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, riid, obj);
|
|
|
|
else if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
|
|
|
|
return IClassFactory_QueryInterface(&ManualResetEventCF, riid, obj);
|
|
|
|
else if (IsEqualCLSID(rclsid, &CLSID_GlobalOptions))
|
|
|
|
return IClassFactory_QueryInterface(&GlobalOptionsCF, riid, obj);
|
|
|
|
else if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler))
|
|
|
|
return FTMarshalCF_Create(riid, obj);
|
|
|
|
else
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|