dmime_main.c 22.6 KB
Newer Older
1 2
/* DirectMusicInteractiveEngine Main
 *
3
 * Copyright (C) 2003-2004 Rok Mandeljc
4
 * Copyright (C) 2003-2004 Raphael Junqueira
5
 *
6 7 8 9
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
10 11 12
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
15
 *
16 17 18
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20 21 22
 */

#include "dmime_private.h"

23
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
24

25 26
LONG DMIME_refCount = 0;

27
typedef struct {
28
    const IClassFactoryVtbl *lpVtbl;
29 30
} IClassFactoryImpl;

31 32 33
/******************************************************************
 *		DirectMusicPerformance ClassFactory
 */
34
static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
35
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
36 37 38

	if (ppobj == NULL) return E_POINTER;

39 40 41
	return E_NOINTERFACE;
}

42
static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) {
43 44 45
	DMIME_LockModule();

	return 2; /* non-heap based object */
46 47
}

48
static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) {
49 50 51
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
52 53
}

54
static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
55 56
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
57
	return DMUSIC_CreateDirectMusicPerformanceImpl (riid, ppobj, pOuter);
58 59
}

60
static HRESULT WINAPI PerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
61 62 63 64 65 66 67
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
68 69 70
	return S_OK;
}

71
static const IClassFactoryVtbl PerformanceCF_Vtbl = {
72 73 74 75 76 77 78
	PerformanceCF_QueryInterface,
	PerformanceCF_AddRef,
	PerformanceCF_Release,
	PerformanceCF_CreateInstance,
	PerformanceCF_LockServer
};

79
static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl};
80 81 82 83

/******************************************************************
 *		DirectMusicSegment ClassFactory
 */
84
static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
85
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
86 87 88

	if (ppobj == NULL) return E_POINTER;
	
89 90 91
	return E_NOINTERFACE;
}

92
static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) {
93 94 95
	DMIME_LockModule();

	return 2; /* non-heap based object */
96 97
}

98
static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) {
99 100 101
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
102 103
}

104
static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
105 106
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
107
	return DMUSIC_CreateDirectMusicSegmentImpl (riid, ppobj, pOuter);
108 109
}

110
static HRESULT WINAPI SegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
111 112 113 114 115 116 117
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
118 119 120
	return S_OK;
}

121
static const IClassFactoryVtbl SegmentCF_Vtbl = {
122 123 124 125 126 127 128
	SegmentCF_QueryInterface,
	SegmentCF_AddRef,
	SegmentCF_Release,
	SegmentCF_CreateInstance,
	SegmentCF_LockServer
};

129
static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl};
130 131 132 133

/******************************************************************
 *		DirectMusicSegmentState ClassFactory
 */
134
static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
135
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
136 137 138

	if (ppobj == NULL) return E_POINTER;
	
139 140 141
	return E_NOINTERFACE;
}

142
static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) {
143 144 145
	DMIME_LockModule();

	return 2; /* non-heap based objects */
146 147
}

148
static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) {
149 150 151
	DMIME_UnlockModule();
	
	return 1; /* non-heap based object */
152 153
}

154
static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
155 156
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);

157
	return DMUSIC_CreateDirectMusicSegmentStateImpl (riid, ppobj, pOuter);
158 159
}

160
static HRESULT WINAPI SegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
161 162 163 164 165 166 167
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
168 169 170
	return S_OK;
}

171
static const IClassFactoryVtbl SegmentStateCF_Vtbl = {
172 173 174 175 176 177 178
	SegmentStateCF_QueryInterface,
	SegmentStateCF_AddRef,
	SegmentStateCF_Release,
	SegmentStateCF_CreateInstance,
	SegmentStateCF_LockServer
};

179
static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl};
180 181 182 183

/******************************************************************
 *		DirectMusicGraph ClassFactory
 */
184
static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
185
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
186 187 188

	if (ppobj == NULL) return E_POINTER;
	
189 190 191
	return E_NOINTERFACE;
}

192
static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) {
193 194 195
	DMIME_LockModule();

	return 2; /* non-heap based object */
196 197
}

198
static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) {
199 200 201
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
202 203
}

204
static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
205 206
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
207
	return DMUSIC_CreateDirectMusicGraphImpl (riid, ppobj, pOuter);
208 209
}

210
static HRESULT WINAPI GraphCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
211 212 213 214 215 216 217
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
218 219 220
	return S_OK;
}

221
static const IClassFactoryVtbl GraphCF_Vtbl = {
222 223 224 225 226 227 228
	GraphCF_QueryInterface,
	GraphCF_AddRef,
	GraphCF_Release,
	GraphCF_CreateInstance,
	GraphCF_LockServer
};

229
static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl};
230 231 232 233

/******************************************************************
 *		DirectMusicTempoTrack ClassFactory
 */
234
static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
235
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
236 237 238

	if (ppobj == NULL) return E_POINTER;
	
239 240 241
	return E_NOINTERFACE;
}

242
static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) {
243 244 245
	DMIME_LockModule();

	return 2; /* non-heap based object */
246 247
}

248
static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) {
249 250 251
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
252 253
}

254
static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
255 256
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
257
	return DMUSIC_CreateDirectMusicTempoTrack (riid, ppobj, pOuter);
258 259
}

260
static HRESULT WINAPI TempoTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
261 262 263 264 265 266 267
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
268 269 270
	return S_OK;
}

271
static const IClassFactoryVtbl TempoTrackCF_Vtbl = {
272 273 274 275 276 277 278
	TempoTrackCF_QueryInterface,
	TempoTrackCF_AddRef,
	TempoTrackCF_Release,
	TempoTrackCF_CreateInstance,
	TempoTrackCF_LockServer
};

279
static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl};
280 281 282 283

/******************************************************************
 *		DirectMusicSeqTrack ClassFactory
 */
284
static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
285
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
286 287 288

	if (ppobj == NULL) return E_POINTER;
	
289 290 291
	return E_NOINTERFACE;
}

292
static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) {
293 294 295
	DMIME_LockModule();
	
	return 2; /* non-heap based object */
296 297
}

298
static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) {
299 300 301
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
302 303
}

304
static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
305 306
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
307
	return DMUSIC_CreateDirectMusicSeqTrack (riid, ppobj, pOuter);
308 309
}

310
static HRESULT WINAPI SeqTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
311 312 313 314 315 316 317
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
318 319 320
	return S_OK;
}

321
static const IClassFactoryVtbl SeqTrackCF_Vtbl = {
322 323 324 325 326 327 328
	SeqTrackCF_QueryInterface,
	SeqTrackCF_AddRef,
	SeqTrackCF_Release,
	SeqTrackCF_CreateInstance,
	SeqTrackCF_LockServer
};

329
static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl};
330 331 332 333

/******************************************************************
 *		DirectMusicSysExTrack ClassFactory
 */
334
static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
335
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
336 337 338

	if (ppobj == NULL) return E_POINTER;
	
339 340 341
	return E_NOINTERFACE;
}

342
static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) {
343 344 345
	DMIME_LockModule();

	return 2; /* non-heap based object */
346 347
}

348
static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) {
349 350 351
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
352 353
}

354
static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
355
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
356
	return DMUSIC_CreateDirectMusicSysExTrack (riid, ppobj, pOuter);
357 358
}

359
static HRESULT WINAPI SysExTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
360 361 362 363 364 365 366
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
367 368 369
	return S_OK;
}

370
static const IClassFactoryVtbl SysExTrackCF_Vtbl = {
371 372 373 374 375 376 377
	SysExTrackCF_QueryInterface,
	SysExTrackCF_AddRef,
	SysExTrackCF_Release,
	SysExTrackCF_CreateInstance,
	SysExTrackCF_LockServer
};

378
static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl};
379 380 381 382

/******************************************************************
 *		DirectMusicTimeSigTrack ClassFactory
 */
383
static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
384
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
385 386 387

	if (ppobj == NULL) return E_POINTER;
	
388 389 390
	return E_NOINTERFACE;
}

391
static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) {
392 393 394
	DMIME_LockModule();

	return 2; /* non-heap based object */
395 396
}

397
static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) {
398 399 400
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
401 402
}

403
static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
404 405
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
406
	return DMUSIC_CreateDirectMusicTimeSigTrack (riid, ppobj, pOuter);
407 408
}

409
static HRESULT WINAPI TimeSigTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
410 411 412 413 414 415 416
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
417 418 419
	return S_OK;
}

420
static const IClassFactoryVtbl TimeSigTrackCF_Vtbl = {
421 422 423 424 425 426 427
	TimeSigTrackCF_QueryInterface,
	TimeSigTrackCF_AddRef,
	TimeSigTrackCF_Release,
	TimeSigTrackCF_CreateInstance,
	TimeSigTrackCF_LockServer
};

428
static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl};
429 430 431 432

/******************************************************************
 *		DirectMusicParamControlTrack ClassFactory
 */
433
static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
434
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
435 436 437

	if (ppobj == NULL) return E_POINTER;
	
438 439 440
	return E_NOINTERFACE;
}

441
static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) {
442 443 444
	DMIME_LockModule();

	return 2; /* non-heap based object */
445 446
}

447
static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) {
448 449 450
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
451 452
}

453
static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
454 455
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
456
	return DMUSIC_CreateDirectMusicParamControlTrack (riid, ppobj, pOuter);
457 458
}

459
static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
460 461 462 463 464 465 466
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
467 468 469
	return S_OK;
}

470
static const IClassFactoryVtbl ParamControlTrackCF_Vtbl = {
471 472 473 474 475 476 477
	ParamControlTrackCF_QueryInterface,
	ParamControlTrackCF_AddRef,
	ParamControlTrackCF_Release,
	ParamControlTrackCF_CreateInstance,
	ParamControlTrackCF_LockServer
};

478
static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl};
479 480 481 482

/******************************************************************
 *		DirectMusicMarkerTrack ClassFactory
 */
483
static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
484
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
485 486 487

	if (ppobj == NULL) return E_POINTER;
	
488 489 490
	return E_NOINTERFACE;
}

491
static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) {
492 493 494
	DMIME_LockModule();

	return 2; /* non-heap based object */
495 496
}

497
static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) {
498 499 500
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
501 502
}

503
static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
504 505
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);

506
	return DMUSIC_CreateDirectMusicMarkerTrack (riid, ppobj, pOuter);
507 508
}

509
static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
510 511 512 513 514 515 516
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
517 518 519
	return S_OK;
}

520
static const IClassFactoryVtbl MarkerTrackCF_Vtbl = {
521 522 523 524 525 526 527
	MarkerTrackCF_QueryInterface,
	MarkerTrackCF_AddRef,
	MarkerTrackCF_Release,
	MarkerTrackCF_CreateInstance,
	MarkerTrackCF_LockServer
};

528
static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl};
529 530 531 532

/******************************************************************
 *		DirectMusicLyricsTrack ClassFactory
 */
533
static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
534
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
535 536 537

	if (ppobj == NULL) return E_POINTER;
	
538 539 540
	return E_NOINTERFACE;
}

541
static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) {
542 543 544
	DMIME_LockModule();

	return 2; /* non-heap based object */
545 546
}

547
static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) {
548 549 550
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
551 552
}

553
static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
554 555
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
556
	return DMUSIC_CreateDirectMusicLyricsTrack (riid, ppobj, pOuter);
557 558
}

559
static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
560 561 562 563 564 565 566
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
567 568 569
	return S_OK;
}

570
static const IClassFactoryVtbl LyricsTrackCF_Vtbl = {
571 572 573 574 575 576 577
	LyricsTrackCF_QueryInterface,
	LyricsTrackCF_AddRef,
	LyricsTrackCF_Release,
	LyricsTrackCF_CreateInstance,
	LyricsTrackCF_LockServer
};

578
static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl};
579 580 581 582 583


/******************************************************************
 *		DirectMusicSegTriggerTrack ClassFactory
 */
584
static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
585
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
586 587 588

	if (ppobj == NULL) return E_POINTER;
	
589 590 591
	return E_NOINTERFACE;
}

592
static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) {
593 594 595
	DMIME_LockModule();

	return 2; /* non-heap based object */
596 597
}

598
static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) {
599 600 601
	DMIME_UnlockModule();
	
	return 1; /* non-heap based object */
602 603
}

604
static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
605 606
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
607
	return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, ppobj, pOuter);
608 609
}

610
static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
611 612 613 614 615 616 617
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
618 619 620
	return S_OK;
}

621
static const IClassFactoryVtbl SegTriggerTrackCF_Vtbl = {
622 623 624 625 626 627 628
	SegTriggerTrackCF_QueryInterface,
	SegTriggerTrackCF_AddRef,
	SegTriggerTrackCF_Release,
	SegTriggerTrackCF_CreateInstance,
	SegTriggerTrackCF_LockServer
};

629
static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl};
630 631 632 633

/******************************************************************
 *		DirectMusicAudioPath ClassFactory
 */
634
static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
635
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
636 637 638

	if (ppobj == NULL) return E_POINTER;
	
639 640 641
	return E_NOINTERFACE;
}

642
static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) {
643 644 645
	DMIME_LockModule();

	return 2; /* non-heap based object */
646 647
}

648
static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) {
649 650 651
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
652 653
}

654
static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
655 656
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
657
	return DMUSIC_CreateDirectMusicAudioPathImpl (riid, ppobj, pOuter);
658 659
}

660
static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
661 662 663 664 665 666 667
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
668 669 670
	return S_OK;
}

671
static const IClassFactoryVtbl AudioPathCF_Vtbl = {
672 673 674 675 676 677 678
	AudioPathCF_QueryInterface,
	AudioPathCF_AddRef,
	AudioPathCF_Release,
	AudioPathCF_CreateInstance,
	AudioPathCF_LockServer
};

679
static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl};
680 681 682 683

/******************************************************************
 *		DirectMusicWaveTrack ClassFactory
 */
684
static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
685
	FIXME("- no interface IID: %s\n", debugstr_guid(riid));
686 687 688

	if (ppobj == NULL) return E_POINTER;
	
689 690 691
	return E_NOINTERFACE;
}

692
static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) {
693 694 695
	DMIME_LockModule();

	return 2; /* non-heap based object */
696 697
}

698
static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) {
699 700 701
	DMIME_UnlockModule();

	return 1; /* non-heap based object */
702 703
}

704
static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
705 706
	TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
	
707
	return DMUSIC_CreateDirectMusicWaveTrack (riid, ppobj, pOuter);
708 709
}

710
static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
711 712 713 714 715 716 717
	TRACE("(%d)\n", dolock);

	if (dolock)
		DMIME_LockModule();
	else
		DMIME_UnlockModule();
	
718 719 720
	return S_OK;
}

721
static const IClassFactoryVtbl WaveTrackCF_Vtbl = {
722 723 724 725 726
	WaveTrackCF_QueryInterface,
	WaveTrackCF_AddRef,
	WaveTrackCF_Release,
	WaveTrackCF_CreateInstance,
	WaveTrackCF_LockServer
727 728
};

729
static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl};
730 731 732 733 734 735

/******************************************************************
 *		DllMain
 *
 *
 */
736 737
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
	if (fdwReason == DLL_PROCESS_ATTACH) {
738
		DisableThreadLibraryCalls(hinstDLL);
739 740
		/* FIXME: Initialisation */
	}
741
	else if (fdwReason == DLL_PROCESS_DETACH) {
742 743 744 745 746 747 748 749 750 751 752 753
		/* FIXME: Cleanup */
	}

	return TRUE;
}


/******************************************************************
 *		DllCanUnloadNow (DMIME.1)
 *
 *
 */
754 755
HRESULT WINAPI DllCanUnloadNow(void)
{
756
	return DMIME_refCount != 0 ? S_FALSE : S_OK;
757 758 759 760
}


/******************************************************************
761
 *		DllGetClassObject (DMIME.@)
762 763 764
 *
 *
 */
765
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
766
{
767
    TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
768
    if (IsEqualCLSID (rclsid, &CLSID_DirectMusicPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
769
                *ppv = &Performance_CF;
770 771 772
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
773
                *ppv = &Segment_CF;
774 775 776
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
777
                *ppv = &SegmentState_CF;
778 779 780
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicGraph) && IsEqualIID (riid, &IID_IClassFactory)) {
781
                *ppv = &Graph_CF;
782 783 784
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTempoTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
785
                *ppv = &TempoTrack_CF;
786 787 788
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSeqTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
789
                *ppv = &SeqTrack_CF;
790 791 792
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSysExTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
793
                *ppv = &SysExTrack_CF;
794 795 796
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicTimeSigTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
797
                *ppv = &TimeSigTrack_CF;
798 799 800
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicParamControlTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
801
                *ppv = &ParamControlTrack_CF;
802 803 804
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMarkerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
805
                *ppv = &MarkerTrack_CF;
806 807 808
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLyricsTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
809
                *ppv = &LyricsTrack_CF;
810 811 812
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSegTriggerTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
813
                *ppv = &SegTriggerTrack_CF;
814 815 816
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
817
                *ppv = &AudioPath_CF;
818 819 820
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicWaveTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
821
                *ppv = &WaveTrack_CF;
822 823 824 825
		IClassFactory_AddRef((IClassFactory*)*ppv);
		return S_OK;
	} 
	
826
    WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
827 828
    return CLASS_E_CLASSNOTAVAILABLE;
}