2007-10-14 19:31:45 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2007-10-16 20:50:20 +02:00
|
|
|
#include <stdio.h>
|
2007-10-14 19:31:45 +02:00
|
|
|
|
2007-10-16 20:50:49 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2007-10-14 19:31:45 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2007-10-16 20:50:20 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2010-12-10 14:41:57 +01:00
|
|
|
#include "rpcproxy.h"
|
2007-10-16 20:50:20 +02:00
|
|
|
#include "dimm.h"
|
2007-10-14 19:31:45 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
|
|
|
|
|
2008-11-03 17:14:43 +01:00
|
|
|
extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
|
2007-10-16 20:50:20 +02:00
|
|
|
|
2007-10-16 20:50:49 +02:00
|
|
|
typedef struct {
|
2010-11-29 01:01:31 +01:00
|
|
|
IClassFactory IClassFactory_iface;
|
2007-10-16 20:50:49 +02:00
|
|
|
|
2008-11-03 17:14:43 +01:00
|
|
|
HRESULT (*cf)(IUnknown*,IUnknown**);
|
2007-10-16 20:50:49 +02:00
|
|
|
} ClassFactory;
|
|
|
|
|
2010-11-29 01:01:31 +01:00
|
|
|
static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
2007-10-16 20:50:49 +02:00
|
|
|
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(IID_IUnknown %p)\n", ppv);
|
|
|
|
*ppv = iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IClassFactory, riid)) {
|
|
|
|
TRACE("IID_IClassFactory %p)\n", ppv);
|
|
|
|
*ppv = iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%s %p)\n", debugstr_guid(riid), ppv);
|
|
|
|
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_CreateInstance(IClassFactory *iface,
|
|
|
|
IUnknown *pOuter, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-29 01:01:31 +01:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2008-11-03 17:14:43 +01:00
|
|
|
HRESULT ret;
|
|
|
|
IUnknown *obj;
|
|
|
|
TRACE("(%p, %p, %s, %p)\n", iface, pOuter, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
ret = This->cf(pOuter, &obj);
|
|
|
|
if (FAILED(ret))
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = IUnknown_QueryInterface(obj,riid,ppv);
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
return ret;
|
2007-10-16 20:50:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
|
|
|
|
{
|
|
|
|
FIXME("(%d)\n", dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IClassFactoryVtbl ClassFactoryVtbl = {
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
ClassFactory_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
2007-10-14 19:31:45 +02:00
|
|
|
/******************************************************************
|
|
|
|
* DllGetClassObject (msimtf.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2007-10-16 20:50:49 +02:00
|
|
|
if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
|
|
|
|
static ClassFactory cf = {
|
2010-11-29 01:01:31 +01:00
|
|
|
{ &ClassFactoryVtbl },
|
2008-11-03 17:14:43 +01:00
|
|
|
ActiveIMMApp_Constructor,
|
2007-10-16 20:50:49 +02:00
|
|
|
};
|
|
|
|
|
2016-07-01 10:29:06 +02:00
|
|
|
return IClassFactory_QueryInterface(&cf.IClassFactory_iface, riid, ppv);
|
2007-10-16 20:50:49 +02:00
|
|
|
}
|
|
|
|
|
2007-10-14 19:31:45 +02:00
|
|
|
FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|