Regression fixes for Nt{Read|Write}File:
[wine/multimedia.git] / dlls / dmime / dmime_main.c
blob896c8c10412fc5c86bca774ba5dce0bda73044a0
1 /* DirectMusicInteractiveEngine Main
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "dmime_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
25 /******************************************************************
26 * DirectMusicInteractiveEngine ClassFactory
31 typedef struct
33 /* IUnknown fields */
34 ICOM_VFIELD(IClassFactory);
35 DWORD ref;
36 } IClassFactoryImpl;
38 static HRESULT WINAPI DMIMECF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
40 ICOM_THIS(IClassFactoryImpl,iface);
42 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
43 return E_NOINTERFACE;
46 static ULONG WINAPI DMIMECF_AddRef(LPCLASSFACTORY iface)
48 ICOM_THIS(IClassFactoryImpl,iface);
49 return ++(This->ref);
52 static ULONG WINAPI DMIMECF_Release(LPCLASSFACTORY iface)
54 ICOM_THIS(IClassFactoryImpl,iface);
55 /* static class, won't be freed */
56 return --(This->ref);
59 static HRESULT WINAPI DMIMECF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
61 ICOM_THIS(IClassFactoryImpl,iface);
63 TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
64 if (IsEqualGUID (riid, &IID_IDirectMusicPerformance) ||
65 IsEqualGUID (riid, &IID_IDirectMusicPerformance8)) {
66 return DMUSIC_CreateDirectMusicPerformance (riid, (LPDIRECTMUSICPERFORMANCE8*) ppobj, pOuter);
67 } else if (IsEqualGUID (riid, &IID_IDirectMusicSegment) ||
68 IsEqualGUID (riid, &IID_IDirectMusicSegment8)) {
69 return DMUSIC_CreateDirectMusicSegment (riid, (LPDIRECTMUSICSEGMENT8*) ppobj, pOuter);
70 } else if (IsEqualGUID (riid, &IID_IDirectMusicSegmentState) ||
71 IsEqualGUID (riid, &IID_IDirectMusicSegmentState8)) {
72 return DMUSIC_CreateDirectMusicSegmentState (riid, (LPDIRECTMUSICSEGMENTSTATE8*) ppobj, pOuter);
73 } else if (IsEqualGUID (riid, &IID_IDirectMusicGraph)) {
74 return DMUSIC_CreateDirectMusicGraph (riid, (LPDIRECTMUSICGRAPH*) ppobj, pOuter);
75 } else if (IsEqualGUID (riid, &IID_IDirectMusicAudioPath)) {
76 return DMUSIC_CreateDirectMusicSong (riid, (LPDIRECTMUSICSONG*) ppobj, pOuter);
77 } else if (IsEqualGUID (riid, &IID_IDirectMusicAudioPath)) {
78 return DMUSIC_CreateDirectMusicAudioPath (riid, (LPDIRECTMUSICAUDIOPATH*) ppobj, pOuter);
79 } else if (IsEqualGUID (riid, &IID_IDirectMusicTool) ||
80 IsEqualGUID (riid, &IID_IDirectMusicTool8)) {
81 return DMUSIC_CreateDirectMusicTool (riid, (LPDIRECTMUSICTOOL8*) ppobj, pOuter);
82 } else if (IsEqualGUID (riid, &IID_IDirectMusicTrack) ||
83 IsEqualGUID (riid, &IID_IDirectMusicTrack8)) {
84 return DMUSIC_CreateDirectMusicTrack (riid, (LPDIRECTMUSICTRACK8*) ppobj, pOuter);
85 } else if (IsEqualGUID (riid, &IID_IDirectMusicPatternTrack)) {
86 return DMUSIC_CreateDirectMusicPatternTrack (riid, (LPDIRECTMUSICPATTERNTRACK*) ppobj, pOuter);
89 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
90 return E_NOINTERFACE;
93 static HRESULT WINAPI DMIMECF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
95 ICOM_THIS(IClassFactoryImpl,iface);
96 FIXME("(%p)->(%d),stub!\n", This, dolock);
97 return S_OK;
100 static ICOM_VTABLE(IClassFactory) DMIMECF_Vtbl = {
101 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
102 DMIMECF_QueryInterface,
103 DMIMECF_AddRef,
104 DMIMECF_Release,
105 DMIMECF_CreateInstance,
106 DMIMECF_LockServer
109 static IClassFactoryImpl DMIME_CF = {&DMIMECF_Vtbl, 1 };
111 /******************************************************************
112 * DllMain
116 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
118 if (fdwReason == DLL_PROCESS_ATTACH)
120 DisableThreadLibraryCalls(hinstDLL);
121 /* FIXME: Initialisation */
123 else if (fdwReason == DLL_PROCESS_DETACH)
125 /* FIXME: Cleanup */
128 return TRUE;
132 /******************************************************************
133 * DllCanUnloadNow (DMIME.1)
137 HRESULT WINAPI DMIME_DllCanUnloadNow(void)
139 FIXME("(void): stub\n");
141 return S_FALSE;
145 /******************************************************************
146 * DllGetClassObject (DMIME.2)
150 HRESULT WINAPI DMIME_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
152 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
153 if (IsEqualCLSID (&IID_IClassFactory, riid)) {
154 *ppv = (LPVOID) &DMIME_CF;
155 IClassFactory_AddRef((IClassFactory*)*ppv);
156 return S_OK;
158 WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
159 return CLASS_E_CLASSNOTAVAILABLE;