msvcrt: ungetc must create a buffer, even if _IONBF has been set with setvbuf.
[wine/multimedia.git] / dlls / dmime / dmime_main.c
blobaba6f56f88f8d1d89c1ed2258a7dbef4132b24db
1 /* DirectMusicInteractiveEngine Main
3 * Copyright (C) 2003-2004 Rok Mandeljc
4 * Copyright (C) 2003-2004 Raphael Junqueira
6 * This program 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 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 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 program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "dmime_private.h"
22 #include "rpcproxy.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
26 static HINSTANCE instance;
27 LONG DMIME_refCount = 0;
29 typedef struct {
30 const IClassFactoryVtbl *lpVtbl;
31 } IClassFactoryImpl;
33 /******************************************************************
34 * DirectMusicPerformance ClassFactory
36 static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
37 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
39 if (ppobj == NULL) return E_POINTER;
41 return E_NOINTERFACE;
44 static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) {
45 DMIME_LockModule();
47 return 2; /* non-heap based object */
50 static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) {
51 DMIME_UnlockModule();
53 return 1; /* non-heap based object */
56 static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
57 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
59 return DMUSIC_CreateDirectMusicPerformanceImpl (riid, ppobj, pOuter);
62 static HRESULT WINAPI PerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
63 TRACE("(%d)\n", dolock);
65 if (dolock)
66 DMIME_LockModule();
67 else
68 DMIME_UnlockModule();
70 return S_OK;
73 static const IClassFactoryVtbl PerformanceCF_Vtbl = {
74 PerformanceCF_QueryInterface,
75 PerformanceCF_AddRef,
76 PerformanceCF_Release,
77 PerformanceCF_CreateInstance,
78 PerformanceCF_LockServer
81 static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl};
83 /******************************************************************
84 * DirectMusicSegment ClassFactory
86 static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
87 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
89 if (ppobj == NULL) return E_POINTER;
91 return E_NOINTERFACE;
94 static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) {
95 DMIME_LockModule();
97 return 2; /* non-heap based object */
100 static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) {
101 DMIME_UnlockModule();
103 return 1; /* non-heap based object */
106 static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
107 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
109 return DMUSIC_CreateDirectMusicSegmentImpl (riid, ppobj, pOuter);
112 static HRESULT WINAPI SegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
113 TRACE("(%d)\n", dolock);
115 if (dolock)
116 DMIME_LockModule();
117 else
118 DMIME_UnlockModule();
120 return S_OK;
123 static const IClassFactoryVtbl SegmentCF_Vtbl = {
124 SegmentCF_QueryInterface,
125 SegmentCF_AddRef,
126 SegmentCF_Release,
127 SegmentCF_CreateInstance,
128 SegmentCF_LockServer
131 static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl};
133 /******************************************************************
134 * DirectMusicSegmentState ClassFactory
136 static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
137 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
139 if (ppobj == NULL) return E_POINTER;
141 return E_NOINTERFACE;
144 static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) {
145 DMIME_LockModule();
147 return 2; /* non-heap based objects */
150 static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) {
151 DMIME_UnlockModule();
153 return 1; /* non-heap based object */
156 static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
157 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
159 return DMUSIC_CreateDirectMusicSegmentStateImpl (riid, ppobj, pOuter);
162 static HRESULT WINAPI SegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
163 TRACE("(%d)\n", dolock);
165 if (dolock)
166 DMIME_LockModule();
167 else
168 DMIME_UnlockModule();
170 return S_OK;
173 static const IClassFactoryVtbl SegmentStateCF_Vtbl = {
174 SegmentStateCF_QueryInterface,
175 SegmentStateCF_AddRef,
176 SegmentStateCF_Release,
177 SegmentStateCF_CreateInstance,
178 SegmentStateCF_LockServer
181 static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl};
183 /******************************************************************
184 * DirectMusicGraph ClassFactory
186 static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
187 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
189 if (ppobj == NULL) return E_POINTER;
191 return E_NOINTERFACE;
194 static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) {
195 DMIME_LockModule();
197 return 2; /* non-heap based object */
200 static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) {
201 DMIME_UnlockModule();
203 return 1; /* non-heap based object */
206 static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
207 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
209 return DMUSIC_CreateDirectMusicGraphImpl (riid, ppobj, pOuter);
212 static HRESULT WINAPI GraphCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
213 TRACE("(%d)\n", dolock);
215 if (dolock)
216 DMIME_LockModule();
217 else
218 DMIME_UnlockModule();
220 return S_OK;
223 static const IClassFactoryVtbl GraphCF_Vtbl = {
224 GraphCF_QueryInterface,
225 GraphCF_AddRef,
226 GraphCF_Release,
227 GraphCF_CreateInstance,
228 GraphCF_LockServer
231 static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl};
233 /******************************************************************
234 * DirectMusicTempoTrack ClassFactory
236 static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
237 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
239 if (ppobj == NULL) return E_POINTER;
241 return E_NOINTERFACE;
244 static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) {
245 DMIME_LockModule();
247 return 2; /* non-heap based object */
250 static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) {
251 DMIME_UnlockModule();
253 return 1; /* non-heap based object */
256 static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
257 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
259 return DMUSIC_CreateDirectMusicTempoTrack (riid, ppobj, pOuter);
262 static HRESULT WINAPI TempoTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
263 TRACE("(%d)\n", dolock);
265 if (dolock)
266 DMIME_LockModule();
267 else
268 DMIME_UnlockModule();
270 return S_OK;
273 static const IClassFactoryVtbl TempoTrackCF_Vtbl = {
274 TempoTrackCF_QueryInterface,
275 TempoTrackCF_AddRef,
276 TempoTrackCF_Release,
277 TempoTrackCF_CreateInstance,
278 TempoTrackCF_LockServer
281 static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl};
283 /******************************************************************
284 * DirectMusicSeqTrack ClassFactory
286 static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
287 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
289 if (ppobj == NULL) return E_POINTER;
291 return E_NOINTERFACE;
294 static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) {
295 DMIME_LockModule();
297 return 2; /* non-heap based object */
300 static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) {
301 DMIME_UnlockModule();
303 return 1; /* non-heap based object */
306 static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
307 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
309 return DMUSIC_CreateDirectMusicSeqTrack (riid, ppobj, pOuter);
312 static HRESULT WINAPI SeqTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
313 TRACE("(%d)\n", dolock);
315 if (dolock)
316 DMIME_LockModule();
317 else
318 DMIME_UnlockModule();
320 return S_OK;
323 static const IClassFactoryVtbl SeqTrackCF_Vtbl = {
324 SeqTrackCF_QueryInterface,
325 SeqTrackCF_AddRef,
326 SeqTrackCF_Release,
327 SeqTrackCF_CreateInstance,
328 SeqTrackCF_LockServer
331 static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl};
333 /******************************************************************
334 * DirectMusicSysExTrack ClassFactory
336 static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
337 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
339 if (ppobj == NULL) return E_POINTER;
341 return E_NOINTERFACE;
344 static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) {
345 DMIME_LockModule();
347 return 2; /* non-heap based object */
350 static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) {
351 DMIME_UnlockModule();
353 return 1; /* non-heap based object */
356 static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
357 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
358 return DMUSIC_CreateDirectMusicSysExTrack (riid, ppobj, pOuter);
361 static HRESULT WINAPI SysExTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
362 TRACE("(%d)\n", dolock);
364 if (dolock)
365 DMIME_LockModule();
366 else
367 DMIME_UnlockModule();
369 return S_OK;
372 static const IClassFactoryVtbl SysExTrackCF_Vtbl = {
373 SysExTrackCF_QueryInterface,
374 SysExTrackCF_AddRef,
375 SysExTrackCF_Release,
376 SysExTrackCF_CreateInstance,
377 SysExTrackCF_LockServer
380 static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl};
382 /******************************************************************
383 * DirectMusicTimeSigTrack ClassFactory
385 static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
386 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
388 if (ppobj == NULL) return E_POINTER;
390 return E_NOINTERFACE;
393 static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) {
394 DMIME_LockModule();
396 return 2; /* non-heap based object */
399 static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) {
400 DMIME_UnlockModule();
402 return 1; /* non-heap based object */
405 static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
406 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
408 return DMUSIC_CreateDirectMusicTimeSigTrack (riid, ppobj, pOuter);
411 static HRESULT WINAPI TimeSigTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
412 TRACE("(%d)\n", dolock);
414 if (dolock)
415 DMIME_LockModule();
416 else
417 DMIME_UnlockModule();
419 return S_OK;
422 static const IClassFactoryVtbl TimeSigTrackCF_Vtbl = {
423 TimeSigTrackCF_QueryInterface,
424 TimeSigTrackCF_AddRef,
425 TimeSigTrackCF_Release,
426 TimeSigTrackCF_CreateInstance,
427 TimeSigTrackCF_LockServer
430 static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl};
432 /******************************************************************
433 * DirectMusicParamControlTrack ClassFactory
435 static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
436 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
438 if (ppobj == NULL) return E_POINTER;
440 return E_NOINTERFACE;
443 static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) {
444 DMIME_LockModule();
446 return 2; /* non-heap based object */
449 static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) {
450 DMIME_UnlockModule();
452 return 1; /* non-heap based object */
455 static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
456 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
458 return DMUSIC_CreateDirectMusicParamControlTrack (riid, ppobj, pOuter);
461 static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
462 TRACE("(%d)\n", dolock);
464 if (dolock)
465 DMIME_LockModule();
466 else
467 DMIME_UnlockModule();
469 return S_OK;
472 static const IClassFactoryVtbl ParamControlTrackCF_Vtbl = {
473 ParamControlTrackCF_QueryInterface,
474 ParamControlTrackCF_AddRef,
475 ParamControlTrackCF_Release,
476 ParamControlTrackCF_CreateInstance,
477 ParamControlTrackCF_LockServer
480 static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl};
482 /******************************************************************
483 * DirectMusicMarkerTrack ClassFactory
485 static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
486 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
488 if (ppobj == NULL) return E_POINTER;
490 return E_NOINTERFACE;
493 static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) {
494 DMIME_LockModule();
496 return 2; /* non-heap based object */
499 static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) {
500 DMIME_UnlockModule();
502 return 1; /* non-heap based object */
505 static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
506 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
508 return DMUSIC_CreateDirectMusicMarkerTrack (riid, ppobj, pOuter);
511 static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
512 TRACE("(%d)\n", dolock);
514 if (dolock)
515 DMIME_LockModule();
516 else
517 DMIME_UnlockModule();
519 return S_OK;
522 static const IClassFactoryVtbl MarkerTrackCF_Vtbl = {
523 MarkerTrackCF_QueryInterface,
524 MarkerTrackCF_AddRef,
525 MarkerTrackCF_Release,
526 MarkerTrackCF_CreateInstance,
527 MarkerTrackCF_LockServer
530 static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl};
532 /******************************************************************
533 * DirectMusicLyricsTrack ClassFactory
535 static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
536 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
538 if (ppobj == NULL) return E_POINTER;
540 return E_NOINTERFACE;
543 static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) {
544 DMIME_LockModule();
546 return 2; /* non-heap based object */
549 static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) {
550 DMIME_UnlockModule();
552 return 1; /* non-heap based object */
555 static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
556 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
558 return DMUSIC_CreateDirectMusicLyricsTrack (riid, ppobj, pOuter);
561 static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
562 TRACE("(%d)\n", dolock);
564 if (dolock)
565 DMIME_LockModule();
566 else
567 DMIME_UnlockModule();
569 return S_OK;
572 static const IClassFactoryVtbl LyricsTrackCF_Vtbl = {
573 LyricsTrackCF_QueryInterface,
574 LyricsTrackCF_AddRef,
575 LyricsTrackCF_Release,
576 LyricsTrackCF_CreateInstance,
577 LyricsTrackCF_LockServer
580 static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl};
583 /******************************************************************
584 * DirectMusicSegTriggerTrack ClassFactory
586 static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
587 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
589 if (ppobj == NULL) return E_POINTER;
591 return E_NOINTERFACE;
594 static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) {
595 DMIME_LockModule();
597 return 2; /* non-heap based object */
600 static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) {
601 DMIME_UnlockModule();
603 return 1; /* non-heap based object */
606 static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
607 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
609 return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, ppobj, pOuter);
612 static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
613 TRACE("(%d)\n", dolock);
615 if (dolock)
616 DMIME_LockModule();
617 else
618 DMIME_UnlockModule();
620 return S_OK;
623 static const IClassFactoryVtbl SegTriggerTrackCF_Vtbl = {
624 SegTriggerTrackCF_QueryInterface,
625 SegTriggerTrackCF_AddRef,
626 SegTriggerTrackCF_Release,
627 SegTriggerTrackCF_CreateInstance,
628 SegTriggerTrackCF_LockServer
631 static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl};
633 /******************************************************************
634 * DirectMusicAudioPath ClassFactory
636 static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
637 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
639 if (ppobj == NULL) return E_POINTER;
641 return E_NOINTERFACE;
644 static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) {
645 DMIME_LockModule();
647 return 2; /* non-heap based object */
650 static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) {
651 DMIME_UnlockModule();
653 return 1; /* non-heap based object */
656 static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
657 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
659 return DMUSIC_CreateDirectMusicAudioPathImpl (riid, ppobj, pOuter);
662 static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
663 TRACE("(%d)\n", dolock);
665 if (dolock)
666 DMIME_LockModule();
667 else
668 DMIME_UnlockModule();
670 return S_OK;
673 static const IClassFactoryVtbl AudioPathCF_Vtbl = {
674 AudioPathCF_QueryInterface,
675 AudioPathCF_AddRef,
676 AudioPathCF_Release,
677 AudioPathCF_CreateInstance,
678 AudioPathCF_LockServer
681 static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl};
683 /******************************************************************
684 * DirectMusicWaveTrack ClassFactory
686 static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
687 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
689 if (ppobj == NULL) return E_POINTER;
691 return E_NOINTERFACE;
694 static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) {
695 DMIME_LockModule();
697 return 2; /* non-heap based object */
700 static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) {
701 DMIME_UnlockModule();
703 return 1; /* non-heap based object */
706 static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
707 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
709 return DMUSIC_CreateDirectMusicWaveTrack (riid, ppobj, pOuter);
712 static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
713 TRACE("(%d)\n", dolock);
715 if (dolock)
716 DMIME_LockModule();
717 else
718 DMIME_UnlockModule();
720 return S_OK;
723 static const IClassFactoryVtbl WaveTrackCF_Vtbl = {
724 WaveTrackCF_QueryInterface,
725 WaveTrackCF_AddRef,
726 WaveTrackCF_Release,
727 WaveTrackCF_CreateInstance,
728 WaveTrackCF_LockServer
731 static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl};
733 /******************************************************************
734 * DllMain
738 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
739 if (fdwReason == DLL_PROCESS_ATTACH) {
740 instance = hinstDLL;
741 DisableThreadLibraryCalls(hinstDLL);
742 /* FIXME: Initialisation */
744 else if (fdwReason == DLL_PROCESS_DETACH) {
745 /* FIXME: Cleanup */
748 return TRUE;
752 /******************************************************************
753 * DllCanUnloadNow (DMIME.1)
757 HRESULT WINAPI DllCanUnloadNow(void)
759 return DMIME_refCount != 0 ? S_FALSE : S_OK;
763 /******************************************************************
764 * DllGetClassObject (DMIME.@)
768 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
770 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
771 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
772 *ppv = &Performance_CF;
773 IClassFactory_AddRef((IClassFactory*)*ppv);
774 return S_OK;
775 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
776 *ppv = &Segment_CF;
777 IClassFactory_AddRef((IClassFactory*)*ppv);
778 return S_OK;
779 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
780 *ppv = &SegmentState_CF;
781 IClassFactory_AddRef((IClassFactory*)*ppv);
782 return S_OK;
783 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicGraph) && IsEqualIID (riid, &IID_IClassFactory)) {
784 *ppv = &Graph_CF;
785 IClassFactory_AddRef((IClassFactory*)*ppv);
786 return S_OK;
787 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTempoTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
788 *ppv = &TempoTrack_CF;
789 IClassFactory_AddRef((IClassFactory*)*ppv);
790 return S_OK;
791 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSeqTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
792 *ppv = &SeqTrack_CF;
793 IClassFactory_AddRef((IClassFactory*)*ppv);
794 return S_OK;
795 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSysExTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
796 *ppv = &SysExTrack_CF;
797 IClassFactory_AddRef((IClassFactory*)*ppv);
798 return S_OK;
799 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTimeSigTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
800 *ppv = &TimeSigTrack_CF;
801 IClassFactory_AddRef((IClassFactory*)*ppv);
802 return S_OK;
803 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicParamControlTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
804 *ppv = &ParamControlTrack_CF;
805 IClassFactory_AddRef((IClassFactory*)*ppv);
806 return S_OK;
807 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMarkerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
808 *ppv = &MarkerTrack_CF;
809 IClassFactory_AddRef((IClassFactory*)*ppv);
810 return S_OK;
811 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLyricsTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
812 *ppv = &LyricsTrack_CF;
813 IClassFactory_AddRef((IClassFactory*)*ppv);
814 return S_OK;
815 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegTriggerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
816 *ppv = &SegTriggerTrack_CF;
817 IClassFactory_AddRef((IClassFactory*)*ppv);
818 return S_OK;
819 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
820 *ppv = &AudioPath_CF;
821 IClassFactory_AddRef((IClassFactory*)*ppv);
822 return S_OK;
823 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicWaveTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
824 *ppv = &WaveTrack_CF;
825 IClassFactory_AddRef((IClassFactory*)*ppv);
826 return S_OK;
829 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
830 return CLASS_E_CLASSNOTAVAILABLE;
833 /***********************************************************************
834 * DllRegisterServer (DMIME.@)
836 HRESULT WINAPI DllRegisterServer(void)
838 return __wine_register_resources( instance, NULL );
841 /***********************************************************************
842 * DllUnregisterServer (DMIME.@)
844 HRESULT WINAPI DllUnregisterServer(void)
846 return __wine_unregister_resources( instance, NULL );