mmdevapi: Be explicit about units in IAudioRenderClient::ReleaseBuffer.
[wine] / dlls / infosoft / infosoft_main.c
1 /*
2  *    Word splitter Implementation
3  *
4  * Copyright 2006 Mike McCormack
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #define COBJMACROS
22
23 #include "config.h"
24
25 #include <stdarg.h>
26 #include <stdio.h>
27
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"
36
37 #include "wine/debug.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
40
41 static HINSTANCE instance;
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         instance = hInstDLL;
51         DisableThreadLibraryCalls(hInstDLL);
52         break;
53     case DLL_PROCESS_DETACH:
54         break;
55     }
56     return TRUE;
57 }
58
59 extern HRESULT WINAPI wb_Constructor(IUnknown*, REFIID, LPVOID *);
60
61 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
62
63 typedef struct
64 {
65     IClassFactory      IClassFactory_iface;
66     LPFNCREATEINSTANCE lpfnCI;
67 } CFImpl;
68
69 static inline CFImpl *impl_from_IClassFactory(IClassFactory *iface)
70 {
71     return CONTAINING_RECORD(iface, CFImpl, IClassFactory_iface);
72 }
73
74 static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
75         REFIID riid, LPVOID *ppvObj)
76 {
77     CFImpl *This = impl_from_IClassFactory(iface);
78
79     TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
80
81     *ppvObj = NULL;
82
83     if (IsEqualIID(riid, &IID_IUnknown) ||
84         IsEqualIID(riid, &IID_IClassFactory))
85     {
86         *ppvObj = This;
87         return S_OK;
88     }
89
90     TRACE("-- E_NOINTERFACE\n");
91     return E_NOINTERFACE;
92 }
93
94 static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
95 {
96     return 2;
97 }
98
99 static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
100 {
101     return 1;
102 }
103
104 static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
105         LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
106 {
107     CFImpl *This = impl_from_IClassFactory(iface);
108
109     TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
110
111     *ppvObject = NULL;
112
113     return This->lpfnCI(pUnkOuter, riid, ppvObject);
114 }
115
116 static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
117 {
118     FIXME("%p %d\n", iface, fLock);
119     return E_NOTIMPL;
120 }
121
122 static const IClassFactoryVtbl infosoft_cfvt =
123 {
124     infosoftcf_fnQueryInterface,
125     infosoftcf_fnAddRef,
126     infosoftcf_fnRelease,
127     infosoftcf_fnCreateInstance,
128     infosoftcf_fnLockServer
129 };
130
131 static CFImpl wb_cf = { { &infosoft_cfvt }, wb_Constructor };
132
133 /***********************************************************************
134  *             DllGetClassObject (INFOSOFT.@)
135  */
136 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
137 {
138     IClassFactory   *pcf = NULL;
139
140     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
141
142     if (!ppv)
143         return E_INVALIDARG;
144     *ppv = NULL;
145
146     if (IsEqualIID(rclsid, &CLSID_wb_Neutral))
147         pcf = &wb_cf.IClassFactory_iface;
148     else
149         return CLASS_E_CLASSNOTAVAILABLE;
150
151     return IClassFactory_QueryInterface(pcf, iid, ppv);
152 }
153
154
155 HRESULT WINAPI DllCanUnloadNow(void)
156 {
157     return S_FALSE;
158 }
159
160 /***********************************************************************
161  *              DllRegisterServer (INFOSOFT.@)
162  */
163 HRESULT WINAPI DllRegisterServer(void)
164 {
165     return __wine_register_resources( instance, NULL );
166 }
167
168 /***********************************************************************
169  *              DllUnregisterServer (INFOSOFT.@)
170  */
171 HRESULT WINAPI DllUnregisterServer(void)
172 {
173     return __wine_unregister_resources( instance, NULL );
174 }