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 "dmusic_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
27 ICOM_VFIELD(IClassFactory
);
31 /******************************************************************
32 * DirectMusic ClassFactory
34 static HRESULT WINAPI
DirectMusicCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
36 ICOM_THIS(IClassFactoryImpl
,iface
);
38 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
42 static ULONG WINAPI
DirectMusicCF_AddRef(LPCLASSFACTORY iface
)
44 ICOM_THIS(IClassFactoryImpl
,iface
);
48 static ULONG WINAPI
DirectMusicCF_Release(LPCLASSFACTORY iface
)
50 ICOM_THIS(IClassFactoryImpl
,iface
);
51 /* static class, won't be freed */
55 static HRESULT WINAPI
DirectMusicCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
57 ICOM_THIS(IClassFactoryImpl
,iface
);
59 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
60 if (IsEqualIID (riid
, &IID_IDirectMusic
) ||
61 IsEqualIID (riid
, &IID_IDirectMusic2
) ||
62 IsEqualIID (riid
, &IID_IDirectMusic8
)) {
63 return DMUSIC_CreateDirectMusic (riid
, (LPDIRECTMUSIC8
*) ppobj
, pOuter
);
66 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
70 static HRESULT WINAPI
DirectMusicCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
72 ICOM_THIS(IClassFactoryImpl
,iface
);
73 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
77 static ICOM_VTABLE(IClassFactory
) DirectMusicCF_Vtbl
= {
78 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
79 DirectMusicCF_QueryInterface
,
81 DirectMusicCF_Release
,
82 DirectMusicCF_CreateInstance
,
83 DirectMusicCF_LockServer
86 static IClassFactoryImpl DirectMusic_CF
= {&DirectMusicCF_Vtbl
, 1 };
88 /******************************************************************
89 * DirectMusicCollection ClassFactory
91 static HRESULT WINAPI
CollectionCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
93 ICOM_THIS(IClassFactoryImpl
,iface
);
95 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
99 static ULONG WINAPI
CollectionCF_AddRef(LPCLASSFACTORY iface
)
101 ICOM_THIS(IClassFactoryImpl
,iface
);
102 return ++(This
->ref
);
105 static ULONG WINAPI
CollectionCF_Release(LPCLASSFACTORY iface
)
107 ICOM_THIS(IClassFactoryImpl
,iface
);
108 /* static class, won't be freed */
109 return --(This
->ref
);
112 static HRESULT WINAPI
CollectionCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
114 ICOM_THIS(IClassFactoryImpl
,iface
);
116 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
117 if (IsEqualIID (riid
, &IID_IDirectMusicCollection
)) {
118 return DMUSIC_CreateDirectMusicCollection (riid
, (LPDIRECTMUSICCOLLECTION
*)ppobj
, pOuter
);
119 } else if (IsEqualIID (riid
, &IID_IDirectMusicObject
)) {
120 return DMUSIC_CreateDirectMusicCollectionObject (riid
, (LPDIRECTMUSICOBJECT
*)ppobj
, pOuter
);
123 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
124 return E_NOINTERFACE
;
127 static HRESULT WINAPI
CollectionCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
129 ICOM_THIS(IClassFactoryImpl
,iface
);
130 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
134 static ICOM_VTABLE(IClassFactory
) CollectionCF_Vtbl
= {
135 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
136 CollectionCF_QueryInterface
,
138 CollectionCF_Release
,
139 CollectionCF_CreateInstance
,
140 CollectionCF_LockServer
143 static IClassFactoryImpl Collection_CF
= {&CollectionCF_Vtbl
, 1 };
145 /******************************************************************
150 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
152 if (fdwReason
== DLL_PROCESS_ATTACH
)
154 DisableThreadLibraryCalls(hinstDLL
);
155 /* FIXME: Initialisation */
157 else if (fdwReason
== DLL_PROCESS_DETACH
)
166 /******************************************************************
167 * DllCanUnloadNow (DMUSIC.1)
171 HRESULT WINAPI
DMUSIC_DllCanUnloadNow(void)
173 FIXME("(void): stub\n");
179 /******************************************************************
180 * DllGetClassObject (DMUSIC.2)
184 HRESULT WINAPI
DMUSIC_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
186 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
187 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusic
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
188 *ppv
= (LPVOID
) &DirectMusic_CF
;
189 IClassFactory_AddRef((IClassFactory
*)*ppv
);
191 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicCollection
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
192 *ppv
= (LPVOID
) &Collection_CF
;
193 IClassFactory_AddRef((IClassFactory
*)*ppv
);
197 WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
198 return CLASS_E_CLASSNOTAVAILABLE
;