2007-10-14 17:31:45 +00: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 "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2007-10-16 18:50:20 +00:00
|
|
|
#include <stdio.h>
|
2007-10-14 17:31:45 +00:00
|
|
|
|
2007-10-16 18:50:49 +00:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2007-10-14 17:31:45 +00:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2007-10-16 18:50:20 +00:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2010-12-10 13:41:57 +00:00
|
|
|
#include "rpcproxy.h"
|
2007-10-16 18:50:20 +00:00
|
|
|
#include "dimm.h"
|
2007-10-14 17:31:45 +00:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
|
|
|
|
|
2008-11-03 16:14:43 +00:00
|
|
|
extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
|
2007-10-16 18:50:20 +00:00
|
|
|
|
2008-11-03 16:14:43 +00:00
|
|
|
static HINSTANCE msimtf_instance;
|
2007-10-16 18:50:49 +00:00
|
|
|
|
2007-10-14 17:31:45 +00:00
|
|
|
/******************************************************************
|
|
|
|
* DllMain (msimtf.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
|
|
|
{
|
|
|
|
switch(fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_WINE_PREATTACH:
|
|
|
|
return FALSE; /* prefer native version */
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2007-10-16 18:50:20 +00:00
|
|
|
msimtf_instance = hInstDLL;
|
2007-10-14 17:31:45 +00:00
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-10-16 18:50:49 +00:00
|
|
|
typedef struct {
|
2010-11-29 00:01:31 +00:00
|
|
|
IClassFactory IClassFactory_iface;
|
2007-10-16 18:50:49 +00:00
|
|
|
|
2008-11-03 16:14:43 +00:00
|
|
|
HRESULT (*cf)(IUnknown*,IUnknown**);
|
2007-10-16 18:50:49 +00:00
|
|
|
} ClassFactory;
|
|
|
|
|
2010-11-29 00:01:31 +00:00
|
|
|
static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
2007-10-16 18:50:49 +00: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 00:01:31 +00:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2008-11-03 16:14:43 +00: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 18:50:49 +00: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 17:31:45 +00:00
|
|
|
/******************************************************************
|
|
|
|
* DllGetClassObject (msimtf.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2007-10-16 18:50:49 +00:00
|
|
|
if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
|
|
|
|
static ClassFactory cf = {
|
2010-11-29 00:01:31 +00:00
|
|
|
{ &ClassFactoryVtbl },
|
2008-11-03 16:14:43 +00:00
|
|
|
ActiveIMMApp_Constructor,
|
2007-10-16 18:50:49 +00:00
|
|
|
};
|
|
|
|
|
2016-07-01 08:29:06 +00:00
|
|
|
return IClassFactory_QueryInterface(&cf.IClassFactory_iface, riid, ppv);
|
2007-10-16 18:50:49 +00:00
|
|
|
}
|
|
|
|
|
2007-10-14 17:31:45 +00:00
|
|
|
FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllCanUnloadNow (msimtf.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllRegisterServer (msimtf.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
|
|
|
{
|
2011-08-02 13:51:55 +00:00
|
|
|
return __wine_register_resources( msimtf_instance );
|
2007-10-14 17:31:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllUnregisterServer (msimtf.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
2011-08-02 13:51:55 +00:00
|
|
|
return __wine_unregister_resources( msimtf_instance );
|
2007-10-14 17:31:45 +00:00
|
|
|
}
|