dwrite: Fix reference equality condition.
[wine.git] / dlls / infosoft / infosoft_main.c
blob032316b0f282f4c3c772f89f40c204ff61299064
1 /*
2 * Word splitter Implementation
4 * Copyright 2006 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include <stdio.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "ole2.h"
32 #include "rpcproxy.h"
33 #include "indexsrv.h"
34 #include "initguid.h"
35 #include "infosoft.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
41 static HINSTANCE instance;
43 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
45 switch(fdwReason)
47 case DLL_WINE_PREATTACH:
48 return FALSE; /* prefer native version */
49 case DLL_PROCESS_ATTACH:
50 instance = hInstDLL;
51 DisableThreadLibraryCalls(hInstDLL);
52 break;
54 return TRUE;
57 DECLSPEC_HIDDEN extern HRESULT WINAPI wb_Constructor(IUnknown*, REFIID, LPVOID *);
59 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
61 typedef struct
63 IClassFactory IClassFactory_iface;
64 LPFNCREATEINSTANCE lpfnCI;
65 } CFImpl;
67 static inline CFImpl *impl_from_IClassFactory(IClassFactory *iface)
69 return CONTAINING_RECORD(iface, CFImpl, IClassFactory_iface);
72 static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
73 REFIID riid, LPVOID *ppvObj)
75 CFImpl *This = impl_from_IClassFactory(iface);
77 TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
79 *ppvObj = NULL;
81 if (IsEqualIID(riid, &IID_IUnknown) ||
82 IsEqualIID(riid, &IID_IClassFactory))
84 *ppvObj = This;
85 return S_OK;
88 TRACE("-- E_NOINTERFACE\n");
89 return E_NOINTERFACE;
92 static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
94 return 2;
97 static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
99 return 1;
102 static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
103 LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
105 CFImpl *This = impl_from_IClassFactory(iface);
107 TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
109 *ppvObject = NULL;
111 return This->lpfnCI(pUnkOuter, riid, ppvObject);
114 static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
116 FIXME("%p %d\n", iface, fLock);
117 return E_NOTIMPL;
120 static const IClassFactoryVtbl infosoft_cfvt =
122 infosoftcf_fnQueryInterface,
123 infosoftcf_fnAddRef,
124 infosoftcf_fnRelease,
125 infosoftcf_fnCreateInstance,
126 infosoftcf_fnLockServer
129 static CFImpl wb_cf = { { &infosoft_cfvt }, wb_Constructor };
131 /***********************************************************************
132 * DllGetClassObject (INFOSOFT.@)
134 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
136 IClassFactory *pcf = NULL;
138 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
140 if (!ppv)
141 return E_INVALIDARG;
142 *ppv = NULL;
144 if (IsEqualIID(rclsid, &CLSID_wb_Neutral))
145 pcf = &wb_cf.IClassFactory_iface;
146 else
147 return CLASS_E_CLASSNOTAVAILABLE;
149 return IClassFactory_QueryInterface(pcf, iid, ppv);
153 HRESULT WINAPI DllCanUnloadNow(void)
155 return S_FALSE;
158 /***********************************************************************
159 * DllRegisterServer (INFOSOFT.@)
161 HRESULT WINAPI DllRegisterServer(void)
163 return __wine_register_resources( instance );
166 /***********************************************************************
167 * DllUnregisterServer (INFOSOFT.@)
169 HRESULT WINAPI DllUnregisterServer(void)
171 return __wine_unregister_resources( instance );