kernel32/tests/pipe: Enable compilation with long types.
[wine.git] / dlls / infosoft / infosoft_main.c
blob04f631d7efc9f5669518e3becaf676547c320d9a
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
24 #include <stdarg.h>
25 #include <stdio.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "rpcproxy.h"
32 #include "indexsrv.h"
33 #include "initguid.h"
34 #include "infosoft.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
40 DECLSPEC_HIDDEN extern HRESULT WINAPI wb_Constructor(IUnknown*, REFIID, LPVOID *);
42 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
44 typedef struct
46 IClassFactory IClassFactory_iface;
47 LPFNCREATEINSTANCE lpfnCI;
48 } CFImpl;
50 static inline CFImpl *impl_from_IClassFactory(IClassFactory *iface)
52 return CONTAINING_RECORD(iface, CFImpl, IClassFactory_iface);
55 static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
56 REFIID riid, LPVOID *ppvObj)
58 CFImpl *This = impl_from_IClassFactory(iface);
60 TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
62 *ppvObj = NULL;
64 if (IsEqualIID(riid, &IID_IUnknown) ||
65 IsEqualIID(riid, &IID_IClassFactory))
67 *ppvObj = &This->IClassFactory_iface;
68 return S_OK;
71 TRACE("-- E_NOINTERFACE\n");
72 return E_NOINTERFACE;
75 static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
77 return 2;
80 static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
82 return 1;
85 static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
86 LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
88 CFImpl *This = impl_from_IClassFactory(iface);
90 TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
92 *ppvObject = NULL;
94 return This->lpfnCI(pUnkOuter, riid, ppvObject);
97 static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
99 FIXME("%p %d\n", iface, fLock);
100 return E_NOTIMPL;
103 static const IClassFactoryVtbl infosoft_cfvt =
105 infosoftcf_fnQueryInterface,
106 infosoftcf_fnAddRef,
107 infosoftcf_fnRelease,
108 infosoftcf_fnCreateInstance,
109 infosoftcf_fnLockServer
112 static CFImpl wb_cf = { { &infosoft_cfvt }, wb_Constructor };
114 /***********************************************************************
115 * DllGetClassObject (INFOSOFT.@)
117 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
119 IClassFactory *pcf = NULL;
121 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
123 if (!ppv)
124 return E_INVALIDARG;
125 *ppv = NULL;
127 if (IsEqualIID(rclsid, &CLSID_wb_Neutral))
128 pcf = &wb_cf.IClassFactory_iface;
129 else
130 return CLASS_E_CLASSNOTAVAILABLE;
132 return IClassFactory_QueryInterface(pcf, iid, ppv);