Make more of the OLE interface vtables const.
[wine] / dlls / dmime / dmime_main.c
1 /* DirectMusicInteractiveEngine Main
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  * Copyright (C) 2003-2004 Raphael Junqueira
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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
14  * GNU Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #include "dmime_private.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
24 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
25
26 LONG DMIME_refCount = 0;
27
28 typedef struct {
29     const IClassFactoryVtbl *lpVtbl;
30 } IClassFactoryImpl;
31
32 /******************************************************************
33  *              DirectMusicPerformance ClassFactory
34  */
35 static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
36         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
37
38         if (ppobj == NULL) return E_POINTER;
39
40         return E_NOINTERFACE;
41 }
42
43 static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) {
44         DMIME_LockModule();
45
46         return 2; /* non-heap based object */
47 }
48
49 static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) {
50         DMIME_UnlockModule();
51
52         return 1; /* non-heap based object */
53 }
54
55 static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
56         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
57         
58         return DMUSIC_CreateDirectMusicPerformanceImpl (riid, ppobj, pOuter);
59 }
60
61 static HRESULT WINAPI PerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
62         TRACE("(%d)\n", dolock);
63
64         if (dolock)
65                 DMIME_LockModule();
66         else
67                 DMIME_UnlockModule();
68         
69         return S_OK;
70 }
71
72 static const IClassFactoryVtbl PerformanceCF_Vtbl = {
73         PerformanceCF_QueryInterface,
74         PerformanceCF_AddRef,
75         PerformanceCF_Release,
76         PerformanceCF_CreateInstance,
77         PerformanceCF_LockServer
78 };
79
80 static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl};
81
82 /******************************************************************
83  *              DirectMusicSegment ClassFactory
84  */
85 static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
86         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
87
88         if (ppobj == NULL) return E_POINTER;
89         
90         return E_NOINTERFACE;
91 }
92
93 static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) {
94         DMIME_LockModule();
95
96         return 2; /* non-heap based object */
97 }
98
99 static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) {
100         DMIME_UnlockModule();
101
102         return 1; /* non-heap based object */
103 }
104
105 static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
106         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
107         
108         return DMUSIC_CreateDirectMusicSegmentImpl (riid, ppobj, pOuter);
109 }
110
111 static HRESULT WINAPI SegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
112         TRACE("(%d)\n", dolock);
113
114         if (dolock)
115                 DMIME_LockModule();
116         else
117                 DMIME_UnlockModule();
118         
119         return S_OK;
120 }
121
122 static const IClassFactoryVtbl SegmentCF_Vtbl = {
123         SegmentCF_QueryInterface,
124         SegmentCF_AddRef,
125         SegmentCF_Release,
126         SegmentCF_CreateInstance,
127         SegmentCF_LockServer
128 };
129
130 static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl};
131
132 /******************************************************************
133  *              DirectMusicSegmentState ClassFactory
134  */
135 static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
136         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
137
138         if (ppobj == NULL) return E_POINTER;
139         
140         return E_NOINTERFACE;
141 }
142
143 static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) {
144         DMIME_LockModule();
145
146         return 2; /* non-heap based objects */
147 }
148
149 static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) {
150         DMIME_UnlockModule();
151         
152         return 1; /* non-heap based object */
153 }
154
155 static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
156         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
157
158         return DMUSIC_CreateDirectMusicSegmentStateImpl (riid, ppobj, pOuter);
159 }
160
161 static HRESULT WINAPI SegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
162         TRACE("(%d)\n", dolock);
163
164         if (dolock)
165                 DMIME_LockModule();
166         else
167                 DMIME_UnlockModule();
168         
169         return S_OK;
170 }
171
172 static const IClassFactoryVtbl SegmentStateCF_Vtbl = {
173         SegmentStateCF_QueryInterface,
174         SegmentStateCF_AddRef,
175         SegmentStateCF_Release,
176         SegmentStateCF_CreateInstance,
177         SegmentStateCF_LockServer
178 };
179
180 static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl};
181
182 /******************************************************************
183  *              DirectMusicGraph ClassFactory
184  */
185 static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
186         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
187
188         if (ppobj == NULL) return E_POINTER;
189         
190         return E_NOINTERFACE;
191 }
192
193 static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) {
194         DMIME_LockModule();
195
196         return 2; /* non-heap based object */
197 }
198
199 static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) {
200         DMIME_UnlockModule();
201
202         return 1; /* non-heap based object */
203 }
204
205 static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
206         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
207         
208         return DMUSIC_CreateDirectMusicGraphImpl (riid, ppobj, pOuter);
209 }
210
211 static HRESULT WINAPI GraphCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
212         TRACE("(%d)\n", dolock);
213
214         if (dolock)
215                 DMIME_LockModule();
216         else
217                 DMIME_UnlockModule();
218         
219         return S_OK;
220 }
221
222 static const IClassFactoryVtbl GraphCF_Vtbl = {
223         GraphCF_QueryInterface,
224         GraphCF_AddRef,
225         GraphCF_Release,
226         GraphCF_CreateInstance,
227         GraphCF_LockServer
228 };
229
230 static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl};
231
232 /******************************************************************
233  *              DirectMusicTempoTrack ClassFactory
234  */
235 static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
236         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
237
238         if (ppobj == NULL) return E_POINTER;
239         
240         return E_NOINTERFACE;
241 }
242
243 static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) {
244         DMIME_LockModule();
245
246         return 2; /* non-heap based object */
247 }
248
249 static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) {
250         DMIME_UnlockModule();
251
252         return 1; /* non-heap based object */
253 }
254
255 static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
256         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
257         
258         return DMUSIC_CreateDirectMusicTempoTrack (riid, ppobj, pOuter);
259 }
260
261 static HRESULT WINAPI TempoTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
262         TRACE("(%d)\n", dolock);
263
264         if (dolock)
265                 DMIME_LockModule();
266         else
267                 DMIME_UnlockModule();
268         
269         return S_OK;
270 }
271
272 static const IClassFactoryVtbl TempoTrackCF_Vtbl = {
273         TempoTrackCF_QueryInterface,
274         TempoTrackCF_AddRef,
275         TempoTrackCF_Release,
276         TempoTrackCF_CreateInstance,
277         TempoTrackCF_LockServer
278 };
279
280 static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl};
281
282 /******************************************************************
283  *              DirectMusicSeqTrack ClassFactory
284  */
285 static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
286         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
287
288         if (ppobj == NULL) return E_POINTER;
289         
290         return E_NOINTERFACE;
291 }
292
293 static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) {
294         DMIME_LockModule();
295         
296         return 2; /* non-heap based object */
297 }
298
299 static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) {
300         DMIME_UnlockModule();
301
302         return 1; /* non-heap based object */
303 }
304
305 static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
306         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
307         
308         return DMUSIC_CreateDirectMusicSeqTrack (riid, ppobj, pOuter);
309 }
310
311 static HRESULT WINAPI SeqTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
312         TRACE("(%d)\n", dolock);
313
314         if (dolock)
315                 DMIME_LockModule();
316         else
317                 DMIME_UnlockModule();
318         
319         return S_OK;
320 }
321
322 static const IClassFactoryVtbl SeqTrackCF_Vtbl = {
323         SeqTrackCF_QueryInterface,
324         SeqTrackCF_AddRef,
325         SeqTrackCF_Release,
326         SeqTrackCF_CreateInstance,
327         SeqTrackCF_LockServer
328 };
329
330 static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl};
331
332 /******************************************************************
333  *              DirectMusicSysExTrack ClassFactory
334  */
335 static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
336         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
337
338         if (ppobj == NULL) return E_POINTER;
339         
340         return E_NOINTERFACE;
341 }
342
343 static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) {
344         DMIME_LockModule();
345
346         return 2; /* non-heap based object */
347 }
348
349 static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) {
350         DMIME_UnlockModule();
351
352         return 1; /* non-heap based object */
353 }
354
355 static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
356         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
357         return DMUSIC_CreateDirectMusicSysExTrack (riid, ppobj, pOuter);
358 }
359
360 static HRESULT WINAPI SysExTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
361         TRACE("(%d)\n", dolock);
362
363         if (dolock)
364                 DMIME_LockModule();
365         else
366                 DMIME_UnlockModule();
367         
368         return S_OK;
369 }
370
371 static const IClassFactoryVtbl SysExTrackCF_Vtbl = {
372         SysExTrackCF_QueryInterface,
373         SysExTrackCF_AddRef,
374         SysExTrackCF_Release,
375         SysExTrackCF_CreateInstance,
376         SysExTrackCF_LockServer
377 };
378
379 static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl};
380
381 /******************************************************************
382  *              DirectMusicTimeSigTrack ClassFactory
383  */
384 static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
385         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
386
387         if (ppobj == NULL) return E_POINTER;
388         
389         return E_NOINTERFACE;
390 }
391
392 static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) {
393         DMIME_LockModule();
394
395         return 2; /* non-heap based object */
396 }
397
398 static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) {
399         DMIME_UnlockModule();
400
401         return 1; /* non-heap based object */
402 }
403
404 static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
405         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
406         
407         return DMUSIC_CreateDirectMusicTimeSigTrack (riid, ppobj, pOuter);
408 }
409
410 static HRESULT WINAPI TimeSigTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
411         TRACE("(%d)\n", dolock);
412
413         if (dolock)
414                 DMIME_LockModule();
415         else
416                 DMIME_UnlockModule();
417         
418         return S_OK;
419 }
420
421 static const IClassFactoryVtbl TimeSigTrackCF_Vtbl = {
422         TimeSigTrackCF_QueryInterface,
423         TimeSigTrackCF_AddRef,
424         TimeSigTrackCF_Release,
425         TimeSigTrackCF_CreateInstance,
426         TimeSigTrackCF_LockServer
427 };
428
429 static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl};
430
431 /******************************************************************
432  *              DirectMusicParamControlTrack ClassFactory
433  */
434 static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
435         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
436
437         if (ppobj == NULL) return E_POINTER;
438         
439         return E_NOINTERFACE;
440 }
441
442 static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) {
443         DMIME_LockModule();
444
445         return 2; /* non-heap based object */
446 }
447
448 static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) {
449         DMIME_UnlockModule();
450
451         return 1; /* non-heap based object */
452 }
453
454 static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
455         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
456         
457         return DMUSIC_CreateDirectMusicParamControlTrack (riid, ppobj, pOuter);
458 }
459
460 static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
461         TRACE("(%d)\n", dolock);
462
463         if (dolock)
464                 DMIME_LockModule();
465         else
466                 DMIME_UnlockModule();
467         
468         return S_OK;
469 }
470
471 static const IClassFactoryVtbl ParamControlTrackCF_Vtbl = {
472         ParamControlTrackCF_QueryInterface,
473         ParamControlTrackCF_AddRef,
474         ParamControlTrackCF_Release,
475         ParamControlTrackCF_CreateInstance,
476         ParamControlTrackCF_LockServer
477 };
478
479 static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl};
480
481 /******************************************************************
482  *              DirectMusicMarkerTrack ClassFactory
483  */
484 static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
485         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
486
487         if (ppobj == NULL) return E_POINTER;
488         
489         return E_NOINTERFACE;
490 }
491
492 static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) {
493         DMIME_LockModule();
494
495         return 2; /* non-heap based object */
496 }
497
498 static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) {
499         DMIME_UnlockModule();
500
501         return 1; /* non-heap based object */
502 }
503
504 static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
505         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
506
507         return DMUSIC_CreateDirectMusicMarkerTrack (riid, ppobj, pOuter);
508 }
509
510 static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
511         TRACE("(%d)\n", dolock);
512
513         if (dolock)
514                 DMIME_LockModule();
515         else
516                 DMIME_UnlockModule();
517         
518         return S_OK;
519 }
520
521 static const IClassFactoryVtbl MarkerTrackCF_Vtbl = {
522         MarkerTrackCF_QueryInterface,
523         MarkerTrackCF_AddRef,
524         MarkerTrackCF_Release,
525         MarkerTrackCF_CreateInstance,
526         MarkerTrackCF_LockServer
527 };
528
529 static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl};
530
531 /******************************************************************
532  *              DirectMusicLyricsTrack ClassFactory
533  */
534 static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
535         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
536
537         if (ppobj == NULL) return E_POINTER;
538         
539         return E_NOINTERFACE;
540 }
541
542 static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) {
543         DMIME_LockModule();
544
545         return 2; /* non-heap based object */
546 }
547
548 static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) {
549         DMIME_UnlockModule();
550
551         return 1; /* non-heap based object */
552 }
553
554 static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
555         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
556         
557         return DMUSIC_CreateDirectMusicLyricsTrack (riid, ppobj, pOuter);
558 }
559
560 static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
561         TRACE("(%d)\n", dolock);
562
563         if (dolock)
564                 DMIME_LockModule();
565         else
566                 DMIME_UnlockModule();
567         
568         return S_OK;
569 }
570
571 static const IClassFactoryVtbl LyricsTrackCF_Vtbl = {
572         LyricsTrackCF_QueryInterface,
573         LyricsTrackCF_AddRef,
574         LyricsTrackCF_Release,
575         LyricsTrackCF_CreateInstance,
576         LyricsTrackCF_LockServer
577 };
578
579 static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl};
580
581
582 /******************************************************************
583  *              DirectMusicSegTriggerTrack ClassFactory
584  */
585 static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
586         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
587
588         if (ppobj == NULL) return E_POINTER;
589         
590         return E_NOINTERFACE;
591 }
592
593 static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) {
594         DMIME_LockModule();
595
596         return 2; /* non-heap based object */
597 }
598
599 static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) {
600         DMIME_UnlockModule();
601         
602         return 1; /* non-heap based object */
603 }
604
605 static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
606         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
607         
608         return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, ppobj, pOuter);
609 }
610
611 static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
612         TRACE("(%d)\n", dolock);
613
614         if (dolock)
615                 DMIME_LockModule();
616         else
617                 DMIME_UnlockModule();
618         
619         return S_OK;
620 }
621
622 static const IClassFactoryVtbl SegTriggerTrackCF_Vtbl = {
623         SegTriggerTrackCF_QueryInterface,
624         SegTriggerTrackCF_AddRef,
625         SegTriggerTrackCF_Release,
626         SegTriggerTrackCF_CreateInstance,
627         SegTriggerTrackCF_LockServer
628 };
629
630 static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl};
631
632 /******************************************************************
633  *              DirectMusicAudioPath ClassFactory
634  */
635 static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
636         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
637
638         if (ppobj == NULL) return E_POINTER;
639         
640         return E_NOINTERFACE;
641 }
642
643 static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) {
644         DMIME_LockModule();
645
646         return 2; /* non-heap based object */
647 }
648
649 static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) {
650         DMIME_UnlockModule();
651
652         return 1; /* non-heap based object */
653 }
654
655 static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
656         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
657         
658         return DMUSIC_CreateDirectMusicAudioPathImpl (riid, ppobj, pOuter);
659 }
660
661 static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
662         TRACE("(%d)\n", dolock);
663
664         if (dolock)
665                 DMIME_LockModule();
666         else
667                 DMIME_UnlockModule();
668         
669         return S_OK;
670 }
671
672 static const IClassFactoryVtbl AudioPathCF_Vtbl = {
673         AudioPathCF_QueryInterface,
674         AudioPathCF_AddRef,
675         AudioPathCF_Release,
676         AudioPathCF_CreateInstance,
677         AudioPathCF_LockServer
678 };
679
680 static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl};
681
682 /******************************************************************
683  *              DirectMusicWaveTrack ClassFactory
684  */
685 static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
686         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
687
688         if (ppobj == NULL) return E_POINTER;
689         
690         return E_NOINTERFACE;
691 }
692
693 static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) {
694         DMIME_LockModule();
695
696         return 2; /* non-heap based object */
697 }
698
699 static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) {
700         DMIME_UnlockModule();
701
702         return 1; /* non-heap based object */
703 }
704
705 static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
706         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
707         
708         return DMUSIC_CreateDirectMusicWaveTrack (riid, ppobj, pOuter);
709 }
710
711 static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
712         TRACE("(%d)\n", dolock);
713
714         if (dolock)
715                 DMIME_LockModule();
716         else
717                 DMIME_UnlockModule();
718         
719         return S_OK;
720 }
721
722 static const IClassFactoryVtbl WaveTrackCF_Vtbl = {
723         WaveTrackCF_QueryInterface,
724         WaveTrackCF_AddRef,
725         WaveTrackCF_Release,
726         WaveTrackCF_CreateInstance,
727         WaveTrackCF_LockServer
728 };
729
730 static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl};
731
732 /******************************************************************
733  *              DllMain
734  *
735  *
736  */
737 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
738         if (fdwReason == DLL_PROCESS_ATTACH) {
739                 DisableThreadLibraryCalls(hinstDLL);
740                 /* FIXME: Initialisation */
741         }
742         else if (fdwReason == DLL_PROCESS_DETACH) {
743                 /* FIXME: Cleanup */
744         }
745
746         return TRUE;
747 }
748
749
750 /******************************************************************
751  *              DllCanUnloadNow (DMIME.1)
752  *
753  *
754  */
755 HRESULT WINAPI DllCanUnloadNow(void)
756 {
757         return DMIME_refCount != 0 ? S_FALSE : S_OK;
758 }
759
760
761 /******************************************************************
762  *              DllGetClassObject (DMIME.2)
763  *
764  *
765  */
766 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
767 {
768     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
769     if (IsEqualCLSID (rclsid, &CLSID_DirectMusicPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
770                 *ppv = (LPVOID) &Performance_CF;
771                 IClassFactory_AddRef((IClassFactory*)*ppv);
772                 return S_OK;
773         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
774                 *ppv = (LPVOID) &Segment_CF;
775                 IClassFactory_AddRef((IClassFactory*)*ppv);
776                 return S_OK;
777         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
778                 *ppv = (LPVOID) &SegmentState_CF;
779                 IClassFactory_AddRef((IClassFactory*)*ppv);
780                 return S_OK;
781         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicGraph) && IsEqualIID (riid, &IID_IClassFactory)) {
782                 *ppv = (LPVOID) &Graph_CF;
783                 IClassFactory_AddRef((IClassFactory*)*ppv);
784                 return S_OK;
785         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTempoTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
786                 *ppv = (LPVOID) &TempoTrack_CF;
787                 IClassFactory_AddRef((IClassFactory*)*ppv);
788                 return S_OK;
789         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSeqTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
790                 *ppv = (LPVOID) &SeqTrack_CF;
791                 IClassFactory_AddRef((IClassFactory*)*ppv);
792                 return S_OK;
793         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSysExTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
794                 *ppv = (LPVOID) &SysExTrack_CF;
795                 IClassFactory_AddRef((IClassFactory*)*ppv);
796                 return S_OK;
797         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTimeSigTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
798                 *ppv = (LPVOID) &TimeSigTrack_CF;
799                 IClassFactory_AddRef((IClassFactory*)*ppv);
800                 return S_OK;
801         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicParamControlTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
802                 *ppv = (LPVOID) &ParamControlTrack_CF;
803                 IClassFactory_AddRef((IClassFactory*)*ppv);
804                 return S_OK;
805         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMarkerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
806                 *ppv = (LPVOID) &MarkerTrack_CF;
807                 IClassFactory_AddRef((IClassFactory*)*ppv);
808                 return S_OK;
809         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLyricsTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
810                 *ppv = (LPVOID) &LyricsTrack_CF;
811                 IClassFactory_AddRef((IClassFactory*)*ppv);
812                 return S_OK;
813         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegTriggerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
814                 *ppv = (LPVOID) &SegTriggerTrack_CF;
815                 IClassFactory_AddRef((IClassFactory*)*ppv);
816                 return S_OK;
817         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
818                 *ppv = (LPVOID) &AudioPath_CF;
819                 IClassFactory_AddRef((IClassFactory*)*ppv);
820                 return S_OK;
821         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicWaveTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
822                 *ppv = (LPVOID) &WaveTrack_CF;
823                 IClassFactory_AddRef((IClassFactory*)*ppv);
824                 return S_OK;
825         } 
826         
827     WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
828     return CLASS_E_CLASSNOTAVAILABLE;
829 }