ReactOS  0.4.15-dev-499-g1f31905
main.c
Go to the documentation of this file.
1 /*
2  * Copyright 2007 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include <stdarg.h>
20 #include <stdio.h>
21 
22 #define COBJMACROS
23 
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"
31 
32 #include "wine/debug.h"
33 
35 
36 extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
37 
39 
40 /******************************************************************
41  * DllMain (msimtf.@)
42  */
43 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
44 {
45  switch(fdwReason)
46  {
47  case DLL_WINE_PREATTACH:
48  return FALSE; /* prefer native version */
49  case DLL_PROCESS_ATTACH:
50  msimtf_instance = hInstDLL;
51  DisableThreadLibraryCalls(hInstDLL);
52  break;
53  }
54  return TRUE;
55 }
56 
57 typedef struct {
58  IClassFactory IClassFactory_iface;
59 
61 } ClassFactory;
62 
64 {
65  return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
66 }
67 
69  REFIID riid, void **ppv)
70 {
71  *ppv = NULL;
72 
74  TRACE("(IID_IUnknown %p)\n", ppv);
75  *ppv = iface;
76  }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
77  TRACE("IID_IClassFactory %p)\n", ppv);
78  *ppv = iface;
79  }
80 
81  if(*ppv) {
82  IUnknown_AddRef((IUnknown*)*ppv);
83  return S_OK;
84  }
85 
86  FIXME("(%s %p)\n", debugstr_guid(riid), ppv);
87  return E_NOINTERFACE;
88 }
89 
91 {
92  return 2;
93 }
94 
96 {
97  return 1;
98 }
99 
101  IUnknown *pOuter, REFIID riid, void **ppv)
102 {
104  HRESULT ret;
105  IUnknown *obj;
106  TRACE("(%p, %p, %s, %p)\n", iface, pOuter, debugstr_guid(riid), ppv);
107 
108  ret = This->cf(pOuter, &obj);
109  if (FAILED(ret))
110  return ret;
111 
112  ret = IUnknown_QueryInterface(obj,riid,ppv);
113  IUnknown_Release(obj);
114  return ret;
115 }
116 
118 {
119  FIXME("(%d)\n", dolock);
120  return S_OK;
121 }
122 
123 static const IClassFactoryVtbl ClassFactoryVtbl = {
129 };
130 
131 /******************************************************************
132  * DllGetClassObject (msimtf.@)
133  */
135 {
136  if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
137  static ClassFactory cf = {
138  { &ClassFactoryVtbl },
140  };
141 
142  return IClassFactory_QueryInterface(&cf.IClassFactory_iface, riid, ppv);
143  }
144 
145  FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
147 }
148 
149 /******************************************************************
150  * DllCanUnloadNow (msimtf.@)
151  */
153 {
154  return S_FALSE;
155 }
156 
157 /***********************************************************************
158  * DllRegisterServer (msimtf.@)
159  */
161 {
163 }
164 
165 /***********************************************************************
166  * DllUnregisterServer (msimtf.@)
167  */
169 {
171 }
#define HRESULT
Definition: msvc.h:7
static HINSTANCE msimtf_instance
Definition: main.c:38
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
IClassFactory IClassFactory_iface
Definition: inetcomm_main.c:74
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
WINE_DEFAULT_DEBUG_CHANNEL(wmic)
REFIID riid
Definition: precomp.h:44
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:117
#define REFCLSID
Definition: guiddef.h:117
REFIID LPVOID * ppv
Definition: atlbase.h:39
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut)
Definition: activeimmapp.c:892
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static ClassFactory * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: main.c:100
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: main.c:123
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: main.c:68
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: main.c:95
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: main.c:90
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
struct tagClassFactory ClassFactory
unsigned int ULONG
Definition: retypes.h:1
const GUID IID_IClassFactory
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26