There is no point making '--register' functions stdcall so just
[wine] / dlls / dmstyle / dmstyle_main.c
1 /* DirectMusicStyle Main
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmstyle_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
23
24 typedef struct {
25     /* IUnknown fields */
26     IClassFactoryVtbl          *lpVtbl;
27     DWORD                       ref;
28 } IClassFactoryImpl;
29
30 /******************************************************************
31  *              DirectMusicSection ClassFactory
32  */
33 static HRESULT WINAPI SectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
34         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
35         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
36         return E_NOINTERFACE;
37 }
38
39 static ULONG WINAPI SectionCF_AddRef(LPCLASSFACTORY iface) {
40         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
41         return ++(This->ref);
42 }
43
44 static ULONG WINAPI SectionCF_Release(LPCLASSFACTORY iface) {
45         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
46         /* static class, won't be  freed */
47         return --(This->ref);
48 }
49
50 static HRESULT WINAPI SectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
51         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
52         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
53         /* nothing here yet */
54         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
55         return E_NOINTERFACE;
56 }
57
58 static HRESULT WINAPI SectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
59         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
60         FIXME("(%p, %d): stub\n", This, dolock);
61         return S_OK;
62 }
63
64 static IClassFactoryVtbl SectionCF_Vtbl = {
65         SectionCF_QueryInterface,
66         SectionCF_AddRef,
67         SectionCF_Release,
68         SectionCF_CreateInstance,
69         SectionCF_LockServer
70 };
71
72 static IClassFactoryImpl Section_CF = {&SectionCF_Vtbl, 1 };
73
74 /******************************************************************
75  *              DirectMusicStyle ClassFactory
76  */
77 static HRESULT WINAPI StyleCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
78         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
79         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
80         return E_NOINTERFACE;
81 }
82
83 static ULONG WINAPI StyleCF_AddRef(LPCLASSFACTORY iface) {
84         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
85         return ++(This->ref);
86 }
87
88 static ULONG WINAPI StyleCF_Release(LPCLASSFACTORY iface) {
89         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
90         /* static class, won't be  freed */
91         return --(This->ref);
92 }
93
94 static HRESULT WINAPI StyleCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
95         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
96         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
97         return DMUSIC_CreateDirectMusicStyleImpl (riid, ppobj, pOuter);
98 }
99
100 static HRESULT WINAPI StyleCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
101         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
102         FIXME("(%p, %d): stub\n", This, dolock);
103         return S_OK;
104 }
105
106 static IClassFactoryVtbl StyleCF_Vtbl = {
107         StyleCF_QueryInterface,
108         StyleCF_AddRef,
109         StyleCF_Release,
110         StyleCF_CreateInstance,
111         StyleCF_LockServer
112 };
113
114 static IClassFactoryImpl Style_CF = {&StyleCF_Vtbl, 1 };
115
116 /******************************************************************
117  *              DirectMusicChordTrack ClassFactory
118  */
119 static HRESULT WINAPI ChordTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
120         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
121         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
122         return E_NOINTERFACE;
123 }
124
125 static ULONG WINAPI ChordTrackCF_AddRef(LPCLASSFACTORY iface) {
126         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
127         return ++(This->ref);
128 }
129
130 static ULONG WINAPI ChordTrackCF_Release(LPCLASSFACTORY iface) {
131         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
132         /* static class, won't be  freed */
133         return --(This->ref);
134 }
135
136 static HRESULT WINAPI ChordTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
137         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
138         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
139         return DMUSIC_CreateDirectMusicChordTrack (riid, ppobj, pOuter);
140 }
141
142 static HRESULT WINAPI ChordTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
143         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
144         FIXME("(%p, %d): stub\n", This, dolock);
145         return S_OK;
146 }
147
148 static IClassFactoryVtbl ChordTrackCF_Vtbl = {
149         ChordTrackCF_QueryInterface,
150         ChordTrackCF_AddRef,
151         ChordTrackCF_Release,
152         ChordTrackCF_CreateInstance,
153         ChordTrackCF_LockServer
154 };
155
156 static IClassFactoryImpl ChordTrack_CF = {&ChordTrackCF_Vtbl, 1 };
157
158 /******************************************************************
159  *              DirectMusicCommandTrack ClassFactory
160  */
161 static HRESULT WINAPI CommandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
162         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
163         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
164         return E_NOINTERFACE;
165 }
166
167 static ULONG WINAPI CommandTrackCF_AddRef(LPCLASSFACTORY iface) {
168         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
169         return ++(This->ref);
170 }
171
172 static ULONG WINAPI CommandTrackCF_Release(LPCLASSFACTORY iface) {
173         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
174         /* static class, won't be  freed */
175         return --(This->ref);
176 }
177
178 static HRESULT WINAPI CommandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
179         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
180         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
181         return DMUSIC_CreateDirectMusicCommandTrack (riid, ppobj, pOuter);
182 }
183
184 static HRESULT WINAPI CommandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
185         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
186         FIXME("(%p, %d): stub\n", This, dolock);
187         return S_OK;
188 }
189
190 static IClassFactoryVtbl CommandTrackCF_Vtbl = {
191         CommandTrackCF_QueryInterface,
192         CommandTrackCF_AddRef,
193         CommandTrackCF_Release,
194         CommandTrackCF_CreateInstance,
195         CommandTrackCF_LockServer
196 };
197
198 static IClassFactoryImpl CommandTrack_CF = {&CommandTrackCF_Vtbl, 1 };
199
200 /******************************************************************
201  *              DirectMusicStyleTrack ClassFactory
202  */
203 static HRESULT WINAPI StyleTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
204         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
205         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
206         return E_NOINTERFACE;
207 }
208
209 static ULONG WINAPI StyleTrackCF_AddRef(LPCLASSFACTORY iface) {
210         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
211         return ++(This->ref);
212 }
213
214 static ULONG WINAPI StyleTrackCF_Release(LPCLASSFACTORY iface) {
215         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
216         /* static class, won't be  freed */
217         return --(This->ref);
218 }
219
220 static HRESULT WINAPI StyleTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
221         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
222         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
223         return DMUSIC_CreateDirectMusicStyleTrack (riid, ppobj, pOuter);
224 }
225
226 static HRESULT WINAPI StyleTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
227         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
228         FIXME("(%p, %d): stub\n", This, dolock);
229         return S_OK;
230 }
231
232 static IClassFactoryVtbl StyleTrackCF_Vtbl = {
233         StyleTrackCF_QueryInterface,
234         StyleTrackCF_AddRef,
235         StyleTrackCF_Release,
236         StyleTrackCF_CreateInstance,
237         StyleTrackCF_LockServer
238 };
239
240 static IClassFactoryImpl StyleTrack_CF = {&StyleTrackCF_Vtbl, 1 };
241
242 /******************************************************************
243  *              DirectMusicMotifTrack ClassFactory
244  */
245 static HRESULT WINAPI MotifTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
246         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
247         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
248         return E_NOINTERFACE;
249 }
250
251 static ULONG WINAPI MotifTrackCF_AddRef(LPCLASSFACTORY iface) {
252         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
253         return ++(This->ref);
254 }
255
256 static ULONG WINAPI MotifTrackCF_Release(LPCLASSFACTORY iface) {
257         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
258         /* static class, won't be  freed */
259         return --(This->ref);
260 }
261
262 static HRESULT WINAPI MotifTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
263         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
264         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
265         return DMUSIC_CreateDirectMusicMotifTrack (riid, ppobj, pOuter);
266 }
267
268 static HRESULT WINAPI MotifTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
269         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
270         FIXME("(%p, %d): stub\n", This, dolock);
271         return S_OK;
272 }
273
274 static IClassFactoryVtbl MotifTrackCF_Vtbl = {
275         MotifTrackCF_QueryInterface,
276         MotifTrackCF_AddRef,
277         MotifTrackCF_Release,
278         MotifTrackCF_CreateInstance,
279         MotifTrackCF_LockServer
280 };
281
282 static IClassFactoryImpl MotifTrack_CF = {&MotifTrackCF_Vtbl, 1 };
283
284 /******************************************************************
285  *              DirectMusicAuditionTrack ClassFactory
286  */
287 static HRESULT WINAPI AuditionTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
288         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
289         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
290         return E_NOINTERFACE;
291 }
292
293 static ULONG WINAPI AuditionTrackCF_AddRef(LPCLASSFACTORY iface) {
294         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
295         return ++(This->ref);
296 }
297
298 static ULONG WINAPI AuditionTrackCF_Release(LPCLASSFACTORY iface) {
299         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
300         /* static class, won't be  freed */
301         return --(This->ref);
302 }
303
304 static HRESULT WINAPI AuditionTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
305         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
306         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
307         return DMUSIC_CreateDirectMusicAuditionTrack (riid, ppobj, pOuter);
308 }
309
310 static HRESULT WINAPI AuditionTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
311         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
312         FIXME("(%p, %d): stub\n", This, dolock);
313         return S_OK;
314 }
315
316 static IClassFactoryVtbl AuditionTrackCF_Vtbl = {
317         AuditionTrackCF_QueryInterface,
318         AuditionTrackCF_AddRef,
319         AuditionTrackCF_Release,
320         AuditionTrackCF_CreateInstance,
321         AuditionTrackCF_LockServer
322 };
323
324 static IClassFactoryImpl AuditionTrack_CF = {&AuditionTrackCF_Vtbl, 1 };
325
326 /******************************************************************
327  *              DirectMusicMuteTrack ClassFactory
328  */
329 static HRESULT WINAPI MuteTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
330         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
331         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
332         return E_NOINTERFACE;
333 }
334
335 static ULONG WINAPI MuteTrackCF_AddRef(LPCLASSFACTORY iface) {
336         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
337         return ++(This->ref);
338 }
339
340 static ULONG WINAPI MuteTrackCF_Release(LPCLASSFACTORY iface) {
341         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
342         /* static class, won't be  freed */
343         return --(This->ref);
344 }
345
346 static HRESULT WINAPI MuteTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
347         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
348         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
349         return DMUSIC_CreateDirectMusicMuteTrack (riid, ppobj, pOuter);
350 }
351
352 static HRESULT WINAPI MuteTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
353         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
354         FIXME("(%p, %d): stub\n", This, dolock);
355         return S_OK;
356 }
357
358 static IClassFactoryVtbl MuteTrackCF_Vtbl = {
359         MuteTrackCF_QueryInterface,
360         MuteTrackCF_AddRef,
361         MuteTrackCF_Release,
362         MuteTrackCF_CreateInstance,
363         MuteTrackCF_LockServer
364 };
365
366 static IClassFactoryImpl MuteTrack_CF = {&MuteTrackCF_Vtbl, 1 };
367
368 /******************************************************************
369  *              DllMain
370  *
371  *
372  */
373 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
374         if (fdwReason == DLL_PROCESS_ATTACH) {
375             DisableThreadLibraryCalls(hinstDLL);
376                 /* FIXME: Initialisation */
377         } else if (fdwReason == DLL_PROCESS_DETACH) {
378                 /* FIXME: Cleanup */
379         }
380
381         return TRUE;
382 }
383
384
385 /******************************************************************
386  *              DllCanUnloadNow (DMSTYLE.1)
387  *
388  *
389  */
390 HRESULT WINAPI DMSTYLE_DllCanUnloadNow(void) {
391     FIXME("(void): stub\n");
392     return S_FALSE;
393 }
394
395
396 /******************************************************************
397  *              DllGetClassObject (DMSTYLE.2)
398  *
399  *
400  */
401 HRESULT WINAPI DMSTYLE_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
402     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
403     
404         if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSection) && IsEqualIID (riid, &IID_IClassFactory)) {
405                 *ppv = (LPVOID) &Section_CF;
406                 IClassFactory_AddRef((IClassFactory*)*ppv);
407                 return S_OK;
408         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyle) && IsEqualIID (riid, &IID_IClassFactory)) {
409                 *ppv = (LPVOID) &Style_CF;
410                 IClassFactory_AddRef((IClassFactory*)*ppv);
411                 return S_OK;            
412         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
413                 *ppv = (LPVOID) &ChordTrack_CF;
414                 IClassFactory_AddRef((IClassFactory*)*ppv);
415                 return S_OK;    
416         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCommandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
417                 *ppv = (LPVOID) &CommandTrack_CF;
418                 IClassFactory_AddRef((IClassFactory*)*ppv);
419                 return S_OK;            
420         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyleTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
421                 *ppv = (LPVOID) &StyleTrack_CF;
422                 IClassFactory_AddRef((IClassFactory*)*ppv);
423                 return S_OK;            
424         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMotifTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
425                 *ppv = (LPVOID) &MotifTrack_CF;
426                 IClassFactory_AddRef((IClassFactory*)*ppv);
427                 return S_OK;            
428         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAuditionTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
429                 *ppv = (LPVOID) &AuditionTrack_CF;
430                 IClassFactory_AddRef((IClassFactory*)*ppv);
431                 return S_OK;            
432         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMuteTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
433                 *ppv = (LPVOID) &MuteTrack_CF;
434                 IClassFactory_AddRef((IClassFactory*)*ppv);
435                 return S_OK;            
436         }
437
438     WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
439     return CLASS_E_CLASSNOTAVAILABLE;
440 }