mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / msimtf / main.c
blobc5d3e8b9f3216e41891fc2b90947cdd525c0a5e0
1 /*
2 * Copyright 2007 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "rpcproxy.h"
30 #include "dimm.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
36 extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
38 static HINSTANCE msimtf_instance;
40 /******************************************************************
41 * DllMain (msimtf.@)
43 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
45 switch(fdwReason)
47 case DLL_PROCESS_ATTACH:
48 msimtf_instance = hInstDLL;
49 DisableThreadLibraryCalls(hInstDLL);
50 break;
52 return TRUE;
55 typedef struct {
56 IClassFactory IClassFactory_iface;
58 HRESULT (*cf)(IUnknown*,IUnknown**);
59 } ClassFactory;
61 static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
63 return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
66 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface,
67 REFIID riid, void **ppv)
69 *ppv = NULL;
71 if(IsEqualGUID(&IID_IUnknown, riid)) {
72 TRACE("(IID_IUnknown %p)\n", ppv);
73 *ppv = iface;
74 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
75 TRACE("IID_IClassFactory %p)\n", ppv);
76 *ppv = iface;
79 if(*ppv) {
80 IUnknown_AddRef((IUnknown*)*ppv);
81 return S_OK;
84 FIXME("(%s %p)\n", debugstr_guid(riid), ppv);
85 return E_NOINTERFACE;
88 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
90 return 2;
93 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
95 return 1;
98 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
99 IUnknown *pOuter, REFIID riid, void **ppv)
101 ClassFactory *This = impl_from_IClassFactory(iface);
102 HRESULT ret;
103 IUnknown *obj;
104 TRACE("(%p, %p, %s, %p)\n", iface, pOuter, debugstr_guid(riid), ppv);
106 ret = This->cf(pOuter, &obj);
107 if (FAILED(ret))
108 return ret;
110 ret = IUnknown_QueryInterface(obj,riid,ppv);
111 IUnknown_Release(obj);
112 return ret;
115 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
117 FIXME("(%d)\n", dolock);
118 return S_OK;
121 static const IClassFactoryVtbl ClassFactoryVtbl = {
122 ClassFactory_QueryInterface,
123 ClassFactory_AddRef,
124 ClassFactory_Release,
125 ClassFactory_CreateInstance,
126 ClassFactory_LockServer
129 /******************************************************************
130 * DllGetClassObject (msimtf.@)
132 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
134 if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
135 static ClassFactory cf = {
136 { &ClassFactoryVtbl },
137 ActiveIMMApp_Constructor,
140 return IClassFactory_QueryInterface(&cf.IClassFactory_iface, riid, ppv);
143 FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
144 return CLASS_E_CLASSNOTAVAILABLE;
147 /******************************************************************
148 * DllCanUnloadNow (msimtf.@)
150 HRESULT WINAPI DllCanUnloadNow(void)
152 return S_FALSE;
155 /***********************************************************************
156 * DllRegisterServer (msimtf.@)
158 HRESULT WINAPI DllRegisterServer(void)
160 return __wine_register_resources( msimtf_instance );
163 /***********************************************************************
164 * DllUnregisterServer (msimtf.@)
166 HRESULT WINAPI DllUnregisterServer(void)
168 return __wine_unregister_resources( msimtf_instance );