1 /* IDirectMusicContainer
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.
26 #include "wine/debug.h"
28 #include "dmloader_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmloader
);
32 /* IDirectMusicContainer IUnknown parts follow: */
33 HRESULT WINAPI
IDirectMusicContainerImpl_QueryInterface (LPDIRECTMUSICCONTAINER iface
, REFIID riid
, LPVOID
*ppobj
)
35 ICOM_THIS(IDirectMusicContainerImpl
,iface
);
37 if (IsEqualIID (riid
, &IID_IUnknown
) ||
38 IsEqualIID (riid
, &IID_IDirectMusicContainer
)) {
39 IDirectMusicContainerImpl_AddRef(iface
);
43 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
47 ULONG WINAPI
IDirectMusicContainerImpl_AddRef (LPDIRECTMUSICCONTAINER iface
)
49 ICOM_THIS(IDirectMusicContainerImpl
,iface
);
50 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
54 ULONG WINAPI
IDirectMusicContainerImpl_Release (LPDIRECTMUSICCONTAINER iface
)
56 ICOM_THIS(IDirectMusicContainerImpl
,iface
);
57 ULONG ref
= --This
->ref
;
58 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
60 HeapFree(GetProcessHeap(), 0, This
);
65 /* IDirectMusicContainer Interface follow: */
66 HRESULT WINAPI
IDirectMusicContainerImpl_EnumObject (LPDIRECTMUSICCONTAINER iface
, REFGUID rguidClass
, DWORD dwIndex
, LPDMUS_OBJECTDESC pDesc
, WCHAR
* pwszAlias
)
68 ICOM_THIS(IDirectMusicContainerImpl
,iface
);
70 FIXME("(%p, %s, %ld, %p, %p): stub\n", This
, debugstr_guid(rguidClass
), dwIndex
, pDesc
, pwszAlias
);
75 ICOM_VTABLE(IDirectMusicContainer
) DirectMusicContainer_Vtbl
=
77 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
78 IDirectMusicContainerImpl_QueryInterface
,
79 IDirectMusicContainerImpl_AddRef
,
80 IDirectMusicContainerImpl_Release
,
81 IDirectMusicContainerImpl_EnumObject
84 /* for ClassFactory */
85 HRESULT WINAPI
DMUSIC_CreateDirectMusicContainer (LPCGUID lpcGUID
, LPDIRECTMUSICCONTAINER
*ppDMCon
, LPUNKNOWN pUnkOuter
)
87 IDirectMusicContainerImpl
* dmcon
;
89 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicContainer
)) {
90 dmcon
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicContainerImpl
));
92 *ppDMCon
= (LPDIRECTMUSICCONTAINER
) NULL
;
95 dmcon
->lpVtbl
= &DirectMusicContainer_Vtbl
;
97 *ppDMCon
= (LPDIRECTMUSICCONTAINER
) dmcon
;
100 WARN("No interface found\n");
102 return E_NOINTERFACE
;
105 /*****************************************************************************
106 * IDirectMusicContainerObject implementation
108 /* IDirectMusicContainerObject IUnknown part: */
109 HRESULT WINAPI
IDirectMusicContainerObject_QueryInterface (LPDIRECTMUSICOBJECT iface
, REFIID riid
, LPVOID
*ppobj
)
111 ICOM_THIS(IDirectMusicContainerObject
,iface
);
113 if (IsEqualIID (riid
, &IID_IUnknown
)
114 || IsEqualIID (riid
, &IID_IDirectMusicObject
)) {
115 IDirectMusicContainerObject_AddRef(iface
);
118 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
119 IPersistStream_AddRef ((LPPERSISTSTREAM
)This
->pStream
);
120 *ppobj
= (LPPERSISTSTREAM
)This
->pStream
;
122 } else if (IsEqualIID (riid
, &IID_IDirectMusicContainer
)) {
123 IDirectMusicContainer_AddRef ((LPDIRECTMUSICCONTAINER
)This
->pContainer
);
124 *ppobj
= (LPDIRECTMUSICCONTAINER
)This
->pContainer
;
127 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
128 return E_NOINTERFACE
;
131 ULONG WINAPI
IDirectMusicContainerObject_AddRef (LPDIRECTMUSICOBJECT iface
)
133 ICOM_THIS(IDirectMusicContainerObject
,iface
);
134 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
135 return ++(This
->ref
);
138 ULONG WINAPI
IDirectMusicContainerObject_Release (LPDIRECTMUSICOBJECT iface
)
140 ICOM_THIS(IDirectMusicContainerObject
,iface
);
141 ULONG ref
= --This
->ref
;
142 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
144 HeapFree(GetProcessHeap(), 0, This
);
149 /* IDirectMusicContainerObject IDirectMusicObject part: */
150 HRESULT WINAPI
IDirectMusicContainerObject_GetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
)
152 ICOM_THIS(IDirectMusicContainerObject
,iface
);
154 TRACE("(%p, %p)\n", This
, pDesc
);
160 HRESULT WINAPI
IDirectMusicContainerObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
)
162 ICOM_THIS(IDirectMusicContainerObject
,iface
);
164 TRACE("(%p, %p)\n", This
, pDesc
);
170 HRESULT WINAPI
IDirectMusicContainerObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface
, LPSTREAM pStream
, LPDMUS_OBJECTDESC pDesc
)
172 ICOM_THIS(IDirectMusicContainerObject
,iface
);
174 FIXME("(%p, %p, %p): stub\n", This
, pStream
, pDesc
);
179 ICOM_VTABLE(IDirectMusicObject
) DirectMusicContainerObject_Vtbl
=
181 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
182 IDirectMusicContainerObject_QueryInterface
,
183 IDirectMusicContainerObject_AddRef
,
184 IDirectMusicContainerObject_Release
,
185 IDirectMusicContainerObject_GetDescriptor
,
186 IDirectMusicContainerObject_SetDescriptor
,
187 IDirectMusicContainerObject_ParseDescriptor
190 /* for ClassFactory */
191 HRESULT WINAPI
DMUSIC_CreateDirectMusicContainerObject (LPCGUID lpcGUID
, LPDIRECTMUSICOBJECT
* ppObject
, LPUNKNOWN pUnkOuter
)
193 IDirectMusicContainerObject
*obj
;
195 TRACE("(%p,%p,%p)\n", lpcGUID
, ppObject
, pUnkOuter
);
196 if (IsEqualIID (lpcGUID
, &IID_IDirectMusicObject
)) {
197 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicContainerObject
));
199 *ppObject
= (LPDIRECTMUSICOBJECT
) NULL
;
200 return E_OUTOFMEMORY
;
202 obj
->lpVtbl
= &DirectMusicContainerObject_Vtbl
;
204 /* prepare IPersistStream */
205 obj
->pStream
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicContainerObjectStream
));
206 obj
->pStream
->lpVtbl
= &DirectMusicContainerObjectStream_Vtbl
;
207 obj
->pStream
->ref
= 1;
208 obj
->pStream
->pParentObject
= obj
;
209 /* prepare IDirectMusicContainer */
210 DMUSIC_CreateDirectMusicContainer (&IID_IDirectMusicContainer
, (LPDIRECTMUSICCONTAINER
*)&obj
->pContainer
, NULL
);
211 obj
->pContainer
->pObject
= obj
;
212 *ppObject
= (LPDIRECTMUSICOBJECT
) obj
;
215 WARN("No interface found\n");
217 return E_NOINTERFACE
;
220 /*****************************************************************************
221 * IDirectMusicContainerObjectStream implementation
223 /* IDirectMusicContainerObjectStream IUnknown part: */
224 HRESULT WINAPI
IDirectMusicContainerObjectStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
)
226 ICOM_THIS(IDirectMusicContainerObjectStream
,iface
);
228 if (IsEqualIID (riid
, &IID_IUnknown
)
229 || IsEqualIID (riid
, &IID_IPersistStream
)) {
230 IDirectMusicContainerObjectStream_AddRef(iface
);
235 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
236 return E_NOINTERFACE
;
239 ULONG WINAPI
IDirectMusicContainerObjectStream_AddRef (LPPERSISTSTREAM iface
)
241 ICOM_THIS(IDirectMusicContainerObjectStream
,iface
);
242 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
243 return ++(This
->ref
);
246 ULONG WINAPI
IDirectMusicContainerObjectStream_Release (LPPERSISTSTREAM iface
)
248 ICOM_THIS(IDirectMusicContainerObjectStream
,iface
);
249 ULONG ref
= --This
->ref
;
250 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
252 HeapFree(GetProcessHeap(), 0, This
);
257 /* IDirectMusicContainerObjectStream IPersist part: */
258 HRESULT WINAPI
IDirectMusicContainerObjectStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
)
263 /* IDirectMusicContainerObjectStream IPersistStream part: */
264 HRESULT WINAPI
IDirectMusicContainerObjectStream_IsDirty (LPPERSISTSTREAM iface
)
269 HRESULT WINAPI
IDirectMusicContainerObjectStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
)
271 FIXME(": Loading not implemented yet\n");
275 HRESULT WINAPI
IDirectMusicContainerObjectStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
)
280 HRESULT WINAPI
IDirectMusicContainerObjectStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
)
285 ICOM_VTABLE(IPersistStream
) DirectMusicContainerObjectStream_Vtbl
=
287 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
288 IDirectMusicContainerObjectStream_QueryInterface
,
289 IDirectMusicContainerObjectStream_AddRef
,
290 IDirectMusicContainerObjectStream_Release
,
291 IDirectMusicContainerObjectStream_GetClassID
,
292 IDirectMusicContainerObjectStream_IsDirty
,
293 IDirectMusicContainerObjectStream_Load
,
294 IDirectMusicContainerObjectStream_Save
,
295 IDirectMusicContainerObjectStream_GetSizeMax