Make RtlCreateUserThread fail if process handle is not for the current
[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 typedef struct {
27     /* IUnknown fields */
28     IClassFactoryVtbl          *lpVtbl;
29     DWORD                       ref;
30 } IClassFactoryImpl;
31
32 /******************************************************************
33  *              DirectMusicPerformance ClassFactory
34  */
35 static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
36         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
37         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
38         return E_NOINTERFACE;
39 }
40
41 static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) {
42         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
43         return ++(This->ref);
44 }
45
46 static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) {
47         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
48         /* static class, won't be  freed */
49         return --(This->ref);
50 }
51
52 static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
53         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
54         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
55         return DMUSIC_CreateDirectMusicPerformanceImpl (riid, ppobj, pOuter);
56 }
57
58 static HRESULT WINAPI PerformanceCF_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 PerformanceCF_Vtbl = {
65         PerformanceCF_QueryInterface,
66         PerformanceCF_AddRef,
67         PerformanceCF_Release,
68         PerformanceCF_CreateInstance,
69         PerformanceCF_LockServer
70 };
71
72 static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl, 1 };
73
74 /******************************************************************
75  *              DirectMusicSegment ClassFactory
76  */
77 static HRESULT WINAPI SegmentCF_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 SegmentCF_AddRef(LPCLASSFACTORY iface) {
84         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
85         return ++(This->ref);
86 }
87
88 static ULONG WINAPI SegmentCF_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 SegmentCF_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_CreateDirectMusicSegmentImpl (riid, ppobj, pOuter);
98 }
99
100 static HRESULT WINAPI SegmentCF_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 SegmentCF_Vtbl = {
107         SegmentCF_QueryInterface,
108         SegmentCF_AddRef,
109         SegmentCF_Release,
110         SegmentCF_CreateInstance,
111         SegmentCF_LockServer
112 };
113
114 static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl, 1 };
115
116 /******************************************************************
117  *              DirectMusicSegmentState ClassFactory
118  */
119 static HRESULT WINAPI SegmentStateCF_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 SegmentStateCF_AddRef(LPCLASSFACTORY iface) {
126         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
127         return ++(This->ref);
128 }
129
130 static ULONG WINAPI SegmentStateCF_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 SegmentStateCF_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_CreateDirectMusicSegmentStateImpl (riid, ppobj, pOuter);
140 }
141
142 static HRESULT WINAPI SegmentStateCF_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 SegmentStateCF_Vtbl = {
149         SegmentStateCF_QueryInterface,
150         SegmentStateCF_AddRef,
151         SegmentStateCF_Release,
152         SegmentStateCF_CreateInstance,
153         SegmentStateCF_LockServer
154 };
155
156 static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl, 1 };
157
158 /******************************************************************
159  *              DirectMusicGraph ClassFactory
160  */
161 static HRESULT WINAPI GraphCF_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 GraphCF_AddRef(LPCLASSFACTORY iface) {
168         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
169         return ++(This->ref);
170 }
171
172 static ULONG WINAPI GraphCF_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 GraphCF_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_CreateDirectMusicGraphImpl (riid, ppobj, pOuter);
182 }
183
184 static HRESULT WINAPI GraphCF_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 GraphCF_Vtbl = {
191         GraphCF_QueryInterface,
192         GraphCF_AddRef,
193         GraphCF_Release,
194         GraphCF_CreateInstance,
195         GraphCF_LockServer
196 };
197
198 static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl, 1 };
199
200 /******************************************************************
201  *              DirectMusicTempoTrack ClassFactory
202  */
203 static HRESULT WINAPI TempoTrackCF_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 TempoTrackCF_AddRef(LPCLASSFACTORY iface) {
210         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
211         return ++(This->ref);
212 }
213
214 static ULONG WINAPI TempoTrackCF_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 TempoTrackCF_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_CreateDirectMusicTempoTrack (riid, ppobj, pOuter);
224 }
225
226 static HRESULT WINAPI TempoTrackCF_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 TempoTrackCF_Vtbl = {
233         TempoTrackCF_QueryInterface,
234         TempoTrackCF_AddRef,
235         TempoTrackCF_Release,
236         TempoTrackCF_CreateInstance,
237         TempoTrackCF_LockServer
238 };
239
240 static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl, 1 };
241
242 /******************************************************************
243  *              DirectMusicSeqTrack ClassFactory
244  */
245 static HRESULT WINAPI SeqTrackCF_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 SeqTrackCF_AddRef(LPCLASSFACTORY iface) {
252         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
253         return ++(This->ref);
254 }
255
256 static ULONG WINAPI SeqTrackCF_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 SeqTrackCF_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_CreateDirectMusicSeqTrack (riid, ppobj, pOuter);
266 }
267
268 static HRESULT WINAPI SeqTrackCF_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 SeqTrackCF_Vtbl = {
275         SeqTrackCF_QueryInterface,
276         SeqTrackCF_AddRef,
277         SeqTrackCF_Release,
278         SeqTrackCF_CreateInstance,
279         SeqTrackCF_LockServer
280 };
281
282 static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl, 1 };
283
284 /******************************************************************
285  *              DirectMusicSysExTrack ClassFactory
286  */
287 static HRESULT WINAPI SysExTrackCF_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 SysExTrackCF_AddRef(LPCLASSFACTORY iface) {
294         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
295         return ++(This->ref);
296 }
297
298 static ULONG WINAPI SysExTrackCF_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 SysExTrackCF_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_CreateDirectMusicSysExTrack (riid, ppobj, pOuter);
308 }
309
310 static HRESULT WINAPI SysExTrackCF_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 SysExTrackCF_Vtbl = {
317         SysExTrackCF_QueryInterface,
318         SysExTrackCF_AddRef,
319         SysExTrackCF_Release,
320         SysExTrackCF_CreateInstance,
321         SysExTrackCF_LockServer
322 };
323
324 static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl, 1 };
325
326 /******************************************************************
327  *              DirectMusicTimeSigTrack ClassFactory
328  */
329 static HRESULT WINAPI TimeSigTrackCF_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 TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) {
336         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
337         return ++(This->ref);
338 }
339
340 static ULONG WINAPI TimeSigTrackCF_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 TimeSigTrackCF_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_CreateDirectMusicTimeSigTrack (riid, ppobj, pOuter);
350 }
351
352 static HRESULT WINAPI TimeSigTrackCF_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 TimeSigTrackCF_Vtbl = {
359         TimeSigTrackCF_QueryInterface,
360         TimeSigTrackCF_AddRef,
361         TimeSigTrackCF_Release,
362         TimeSigTrackCF_CreateInstance,
363         TimeSigTrackCF_LockServer
364 };
365
366 static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl, 1 };
367
368 /******************************************************************
369  *              DirectMusicParamControlTrack ClassFactory
370  */
371 static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
372         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
373         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
374         return E_NOINTERFACE;
375 }
376
377 static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) {
378         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
379         return ++(This->ref);
380 }
381
382 static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) {
383         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
384         /* static class, won't be  freed */
385         return --(This->ref);
386 }
387
388 static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
389         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
390         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
391         return DMUSIC_CreateDirectMusicParamControlTrack (riid, ppobj, pOuter);
392 }
393
394 static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
395         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
396         FIXME("(%p, %d): stub\n", This, dolock);
397         return S_OK;
398 }
399
400 static IClassFactoryVtbl ParamControlTrackCF_Vtbl = {
401         ParamControlTrackCF_QueryInterface,
402         ParamControlTrackCF_AddRef,
403         ParamControlTrackCF_Release,
404         ParamControlTrackCF_CreateInstance,
405         ParamControlTrackCF_LockServer
406 };
407
408 static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl, 1 };
409
410 /******************************************************************
411  *              DirectMusicMarkerTrack ClassFactory
412  */
413 static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
414         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
415         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
416         return E_NOINTERFACE;
417 }
418
419 static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) {
420         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
421         return ++(This->ref);
422 }
423
424 static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) {
425         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
426         /* static class, won't be  freed */
427         return --(This->ref);
428 }
429
430 static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
431         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
432         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
433         return DMUSIC_CreateDirectMusicMarkerTrack (riid, ppobj, pOuter);
434 }
435
436 static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
437         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
438         FIXME("(%p, %d): stub\n", This, dolock);
439         return S_OK;
440 }
441
442 static IClassFactoryVtbl MarkerTrackCF_Vtbl = {
443         MarkerTrackCF_QueryInterface,
444         MarkerTrackCF_AddRef,
445         MarkerTrackCF_Release,
446         MarkerTrackCF_CreateInstance,
447         MarkerTrackCF_LockServer
448 };
449
450 static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl, 1 };
451
452 /******************************************************************
453  *              DirectMusicLyricsTrack ClassFactory
454  */
455 static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
456         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
457         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
458         return E_NOINTERFACE;
459 }
460
461 static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) {
462         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
463         return ++(This->ref);
464 }
465
466 static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) {
467         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
468         /* static class, won't be  freed */
469         return --(This->ref);
470 }
471
472 static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
473         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
474         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
475         return DMUSIC_CreateDirectMusicLyricsTrack (riid, ppobj, pOuter);
476 }
477
478 static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
479         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
480         FIXME("(%p, %d): stub\n", This, dolock);
481         return S_OK;
482 }
483
484 static IClassFactoryVtbl LyricsTrackCF_Vtbl = {
485         LyricsTrackCF_QueryInterface,
486         LyricsTrackCF_AddRef,
487         LyricsTrackCF_Release,
488         LyricsTrackCF_CreateInstance,
489         LyricsTrackCF_LockServer
490 };
491
492 static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl, 1 };
493
494
495 /******************************************************************
496  *              DirectMusicSegTriggerTrack ClassFactory
497  */
498 static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
499         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
500         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
501         return E_NOINTERFACE;
502 }
503
504 static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) {
505         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
506         return ++(This->ref);
507 }
508
509 static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) {
510         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
511         /* static class, won't be  freed */
512         return --(This->ref);
513 }
514
515 static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
516         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
517         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
518         return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, ppobj, pOuter);
519 }
520
521 static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
522         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
523         FIXME("(%p, %d): stub\n", This, dolock);
524         return S_OK;
525 }
526
527 static IClassFactoryVtbl SegTriggerTrackCF_Vtbl = {
528         SegTriggerTrackCF_QueryInterface,
529         SegTriggerTrackCF_AddRef,
530         SegTriggerTrackCF_Release,
531         SegTriggerTrackCF_CreateInstance,
532         SegTriggerTrackCF_LockServer
533 };
534
535 static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl, 1 };
536
537 /******************************************************************
538  *              DirectMusicAudioPath ClassFactory
539  */
540 static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
541         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
542         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
543         return E_NOINTERFACE;
544 }
545
546 static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) {
547         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
548         return ++(This->ref);
549 }
550
551 static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) {
552         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
553         /* static class, won't be  freed */
554         return --(This->ref);
555 }
556
557 static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
558         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
559         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
560         return DMUSIC_CreateDirectMusicAudioPathImpl (riid, ppobj, pOuter);
561 }
562
563 static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
564         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
565         FIXME("(%p, %d): stub\n", This, dolock);
566         return S_OK;
567 }
568
569 static IClassFactoryVtbl AudioPathCF_Vtbl = {
570         AudioPathCF_QueryInterface,
571         AudioPathCF_AddRef,
572         AudioPathCF_Release,
573         AudioPathCF_CreateInstance,
574         AudioPathCF_LockServer
575 };
576
577 static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl, 1 };
578
579 /******************************************************************
580  *              DirectMusicWaveTrack ClassFactory
581  */
582 static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
583         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
584         FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
585         return E_NOINTERFACE;
586 }
587
588 static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) {
589         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
590         return ++(This->ref);
591 }
592
593 static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) {
594         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
595         /* static class, won't be  freed */
596         return --(This->ref);
597 }
598
599 static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
600         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
601         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
602         return DMUSIC_CreateDirectMusicWaveTrack (riid, ppobj, pOuter);
603 }
604
605 static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
606         IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
607         FIXME("(%p, %d): stub\n", This, dolock);
608         return S_OK;
609 }
610
611 static IClassFactoryVtbl WaveTrackCF_Vtbl = {
612         WaveTrackCF_QueryInterface,
613         WaveTrackCF_AddRef,
614         WaveTrackCF_Release,
615         WaveTrackCF_CreateInstance,
616         WaveTrackCF_LockServer
617 };
618
619 static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl, 1 };
620
621 /******************************************************************
622  *              DllMain
623  *
624  *
625  */
626 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
627         if (fdwReason == DLL_PROCESS_ATTACH) {
628                 DisableThreadLibraryCalls(hinstDLL);
629                 /* FIXME: Initialisation */
630         }
631         else if (fdwReason == DLL_PROCESS_DETACH) {
632                 /* FIXME: Cleanup */
633         }
634
635         return TRUE;
636 }
637
638
639 /******************************************************************
640  *              DllCanUnloadNow (DMIME.1)
641  *
642  *
643  */
644 HRESULT WINAPI DMIME_DllCanUnloadNow(void) {
645     FIXME("(void): stub\n");
646     return S_FALSE;
647 }
648
649
650 /******************************************************************
651  *              DllGetClassObject (DMIME.2)
652  *
653  *
654  */
655 HRESULT WINAPI DMIME_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
656 {
657     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
658     if (IsEqualCLSID (rclsid, &CLSID_DirectMusicPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
659                 *ppv = (LPVOID) &Performance_CF;
660                 IClassFactory_AddRef((IClassFactory*)*ppv);
661                 return S_OK;
662         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
663                 *ppv = (LPVOID) &Segment_CF;
664                 IClassFactory_AddRef((IClassFactory*)*ppv);
665                 return S_OK;
666         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
667                 *ppv = (LPVOID) &SegmentState_CF;
668                 IClassFactory_AddRef((IClassFactory*)*ppv);
669                 return S_OK;
670         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicGraph) && IsEqualIID (riid, &IID_IClassFactory)) {
671                 *ppv = (LPVOID) &Graph_CF;
672                 IClassFactory_AddRef((IClassFactory*)*ppv);
673                 return S_OK;
674         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTempoTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
675                 *ppv = (LPVOID) &TempoTrack_CF;
676                 IClassFactory_AddRef((IClassFactory*)*ppv);
677                 return S_OK;
678         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSeqTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
679                 *ppv = (LPVOID) &SeqTrack_CF;
680                 IClassFactory_AddRef((IClassFactory*)*ppv);
681                 return S_OK;
682         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSysExTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
683                 *ppv = (LPVOID) &SysExTrack_CF;
684                 IClassFactory_AddRef((IClassFactory*)*ppv);
685                 return S_OK;
686         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTimeSigTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
687                 *ppv = (LPVOID) &TimeSigTrack_CF;
688                 IClassFactory_AddRef((IClassFactory*)*ppv);
689                 return S_OK;
690         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicParamControlTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
691                 *ppv = (LPVOID) &ParamControlTrack_CF;
692                 IClassFactory_AddRef((IClassFactory*)*ppv);
693                 return S_OK;
694         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMarkerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
695                 *ppv = (LPVOID) &MarkerTrack_CF;
696                 IClassFactory_AddRef((IClassFactory*)*ppv);
697                 return S_OK;
698         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLyricsTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
699                 *ppv = (LPVOID) &LyricsTrack_CF;
700                 IClassFactory_AddRef((IClassFactory*)*ppv);
701                 return S_OK;
702         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegTriggerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
703                 *ppv = (LPVOID) &SegTriggerTrack_CF;
704                 IClassFactory_AddRef((IClassFactory*)*ppv);
705                 return S_OK;
706         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
707                 *ppv = (LPVOID) &AudioPath_CF;
708                 IClassFactory_AddRef((IClassFactory*)*ppv);
709                 return S_OK;
710         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicWaveTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
711                 *ppv = (LPVOID) &WaveTrack_CF;
712                 IClassFactory_AddRef((IClassFactory*)*ppv);
713                 return S_OK;
714         } 
715         
716     WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
717     return CLASS_E_CLASSNOTAVAILABLE;
718 }