wine/dlls/msimtf/main.c

174 lines
4.5 KiB
C
Raw Normal View History

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>
#include <stdio.h>
2007-10-14 17:31:45 +00:00
#define COBJMACROS
2007-10-14 17:31:45 +00:00
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "dimm.h"
2007-10-14 17:31:45 +00:00
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
static HINSTANCE msimtf_instance;
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:
msimtf_instance = hInstDLL;
2007-10-14 17:31:45 +00:00
DisableThreadLibraryCalls(hInstDLL);
break;
}
return TRUE;
}
typedef struct {
IClassFactory IClassFactory_iface;
HRESULT (*cf)(IUnknown*,IUnknown**);
} ClassFactory;
static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
}
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)
{
ClassFactory *This = impl_from_IClassFactory(iface);
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;
}
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)
{
if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
static ClassFactory cf = {
{ &ClassFactoryVtbl },
ActiveIMMApp_Constructor,
};
return IClassFactory_QueryInterface(&cf.IClassFactory_iface, riid, ppv);
}
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)
{
return __wine_register_resources( msimtf_instance );
2007-10-14 17:31:45 +00:00
}
/***********************************************************************
* DllUnregisterServer (msimtf.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( msimtf_instance );
2007-10-14 17:31:45 +00:00
}