The presence of FGetComponentPath is used to check if mapi32.dll is
[wine] / dlls / dmband / band.c
1 /* IDirectMusicBand Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #include "dmband_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmband);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
24
25 const GUID IID_IDirectMusicBandPRIVATE = {0xda54db81,0x837d,0x11d1,{0x86,0xbc,0x00,0xc0,0x4f,0xbf,0x8f,0xef}};
26
27 /*****************************************************************************
28  * IDirectMusicBandImpl implementation
29  */
30 /* IDirectMusicBandImpl IUnknown part: */
31 HRESULT WINAPI IDirectMusicBandImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
32         ICOM_THIS_MULTI(IDirectMusicBandImpl, UnknownVtbl, iface);
33         
34         TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
35         if (IsEqualIID (riid, &IID_IUnknown)) {
36                 *ppobj = (LPVOID)&This->UnknownVtbl;
37                 IDirectMusicBandImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
38                 return S_OK;    
39         } else if (IsEqualIID (riid, &IID_IDirectMusicBand)) {
40                 *ppobj = (LPVOID)&This->BandVtbl;
41                 IDirectMusicBandImpl_IDirectMusicBand_AddRef ((LPDIRECTMUSICBAND)&This->BandVtbl);
42                 return S_OK;
43         } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
44                 *ppobj = (LPVOID)&This->ObjectVtbl;
45                 IDirectMusicBandImpl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl);                
46                 return S_OK;
47         } else if (IsEqualIID (riid, &IID_IPersistStream)) {
48                 *ppobj = (LPVOID)&This->PersistStreamVtbl;
49                 IDirectMusicBandImpl_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);         
50                 return S_OK;
51         }
52         
53         WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
54         return E_NOINTERFACE;
55 }
56
57 ULONG WINAPI IDirectMusicBandImpl_IUnknown_AddRef (LPUNKNOWN iface) {
58         ICOM_THIS_MULTI(IDirectMusicBandImpl, UnknownVtbl, iface);
59         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
60         return ++(This->ref);
61 }
62
63 ULONG WINAPI IDirectMusicBandImpl_IUnknown_Release (LPUNKNOWN iface) {
64         ICOM_THIS_MULTI(IDirectMusicBandImpl, UnknownVtbl, iface);
65         ULONG ref = --This->ref;
66         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
67         if (ref == 0) {
68                 HeapFree(GetProcessHeap(), 0, This);
69         }
70         return ref;
71 }
72
73 ICOM_VTABLE(IUnknown) DirectMusicBand_Unknown_Vtbl = {
74     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
75         IDirectMusicBandImpl_IUnknown_QueryInterface,
76         IDirectMusicBandImpl_IUnknown_AddRef,
77         IDirectMusicBandImpl_IUnknown_Release
78 };
79
80 /* IDirectMusicBandImpl IDirectMusicBand part: */
81 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicBand_QueryInterface (LPDIRECTMUSICBAND iface, REFIID riid, LPVOID *ppobj) {
82         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
83         return IDirectMusicBandImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
84 }
85
86 ULONG WINAPI IDirectMusicBandImpl_IDirectMusicBand_AddRef (LPDIRECTMUSICBAND iface) {
87         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
88         return IDirectMusicBandImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
89 }
90
91 ULONG WINAPI IDirectMusicBandImpl_IDirectMusicBand_Release (LPDIRECTMUSICBAND iface) {
92         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
93         return IDirectMusicBandImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
94 }
95
96 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicBand_CreateSegment (LPDIRECTMUSICBAND iface, IDirectMusicSegment** ppSegment) {
97         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
98         FIXME("(%p, %p): stub\n", This, ppSegment);
99         return S_OK;
100 }
101
102 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicBand_Download (LPDIRECTMUSICBAND iface, IDirectMusicPerformance* pPerformance) {
103         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
104         FIXME("(%p, %p): stub\n", This, pPerformance);
105         return S_OK;
106 }
107
108 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicBand_Unload (LPDIRECTMUSICBAND iface, IDirectMusicPerformance* pPerformance) {
109         ICOM_THIS_MULTI(IDirectMusicBandImpl, BandVtbl, iface);
110         FIXME("(%p, %p): stub\n", This, pPerformance);
111         return S_OK;
112 }
113
114 ICOM_VTABLE(IDirectMusicBand) DirectMusicBand_Band_Vtbl = {
115     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
116         IDirectMusicBandImpl_IDirectMusicBand_QueryInterface,
117         IDirectMusicBandImpl_IDirectMusicBand_AddRef,
118         IDirectMusicBandImpl_IDirectMusicBand_Release,
119         IDirectMusicBandImpl_IDirectMusicBand_CreateSegment,
120         IDirectMusicBandImpl_IDirectMusicBand_Download,
121         IDirectMusicBandImpl_IDirectMusicBand_Unload
122 };
123
124 /* IDirectMusicBandImpl IDirectMusicObject part: */
125 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
126         ICOM_THIS_MULTI(IDirectMusicBandImpl, ObjectVtbl, iface);
127         return IDirectMusicBandImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
128 }
129
130 ULONG WINAPI IDirectMusicBandImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
131         ICOM_THIS_MULTI(IDirectMusicBandImpl, ObjectVtbl, iface);
132         return IDirectMusicBandImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
133 }
134
135 ULONG WINAPI IDirectMusicBandImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
136         ICOM_THIS_MULTI(IDirectMusicBandImpl, ObjectVtbl, iface);
137         return IDirectMusicBandImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
138 }
139
140 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
141         ICOM_THIS_MULTI(IDirectMusicBandImpl, ObjectVtbl, iface);
142         TRACE("(%p, %p)\n", This, pDesc);
143         /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
144         memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
145         return S_OK;
146 }
147
148 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
149         ICOM_THIS_MULTI(IDirectMusicBandImpl, ObjectVtbl, iface);
150         TRACE("(%p, %p): setting descriptor:\n", This, pDesc);
151         if (TRACE_ON(dmband)) {
152                 DMUSIC_dump_DMUS_OBJECTDESC (pDesc);
153         }
154         
155         /* According to MSDN, we should copy only given values, not whole struct */     
156         if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
157                 memcpy (&This->pDesc->guidObject, &pDesc->guidObject, sizeof (pDesc->guidObject));
158         if (pDesc->dwValidData & DMUS_OBJ_CLASS)
159                 memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass));         
160         if (pDesc->dwValidData & DMUS_OBJ_NAME)
161                 strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
162         if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
163                 strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);             
164         if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
165                 strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);             
166         if (pDesc->dwValidData & DMUS_OBJ_VERSION)
167                 memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion));                            
168         if (pDesc->dwValidData & DMUS_OBJ_DATE)
169                 memcpy (&This->pDesc->ftDate, &pDesc->ftDate, sizeof (pDesc->ftDate));                          
170         if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
171                 memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));                           
172                 memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
173         }
174         if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
175                 /* according to MSDN, we copy the stream */
176                 IStream_Clone (pDesc->pStream, &This->pDesc->pStream);  
177         }
178         
179         /* add new flags */
180         This->pDesc->dwValidData |= pDesc->dwValidData;
181
182         return S_OK;
183 }
184
185 HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
186         DMUS_PRIVATE_CHUNK Chunk;
187         DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
188         LARGE_INTEGER liMove; /* used when skipping chunks */
189
190         TRACE("(%p, %p)\n", pStream, pDesc);
191         
192         /* FIXME: should this be determined from stream? */
193         pDesc->dwValidData |= DMUS_OBJ_CLASS;
194         memcpy (&pDesc->guidClass, &CLSID_DirectMusicBand, sizeof(CLSID));
195         
196         IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
197         TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
198         switch (Chunk.fccID) {  
199                 case FOURCC_RIFF: {
200                         IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);                             
201                         TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
202                         StreamSize = Chunk.dwSize - sizeof(FOURCC);
203                         StreamCount = 0;
204                         if (Chunk.fccID == DMUS_FOURCC_BAND_FORM) {
205                                 TRACE_(dmfile)(": band form\n");
206                                 do {
207                                         IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
208                                         StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
209                                         TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
210                                         switch (Chunk.fccID) {
211                                                 case DMUS_FOURCC_GUID_CHUNK: {
212                                                         TRACE_(dmfile)(": GUID chunk\n");
213                                                         pDesc->dwValidData |= DMUS_OBJ_OBJECT;
214                                                         IStream_Read (pStream, &pDesc->guidObject, Chunk.dwSize, NULL);
215                                                         break;
216                                                 }
217                                                 case DMUS_FOURCC_VERSION_CHUNK: {
218                                                         TRACE_(dmfile)(": version chunk\n");
219                                                         pDesc->dwValidData |= DMUS_OBJ_VERSION;
220                                                         IStream_Read (pStream, &pDesc->vVersion, Chunk.dwSize, NULL);
221                                                         break;
222                                                 }
223                                                 case DMUS_FOURCC_CATEGORY_CHUNK: {
224                                                         TRACE_(dmfile)(": category chunk\n");
225                                                         pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
226                                                         IStream_Read (pStream, pDesc->wszCategory, Chunk.dwSize, NULL);
227                                                         break;
228                                                 }
229                                                 case FOURCC_LIST: {
230                                                         IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);                             
231                                                         TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
232                                                         ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
233                                                         ListCount[0] = 0;
234                                                         switch (Chunk.fccID) {
235                                                                 /* evil M$ UNFO list, which can (!?) contain INFO elements */
236                                                                 case DMUS_FOURCC_UNFO_LIST: {
237                                                                         TRACE_(dmfile)(": UNFO list\n");
238                                                                         do {
239                                                                                 IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
240                                                                                 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
241                                                                                 TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
242                                                                                 switch (Chunk.fccID) {
243                                                                                         /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
244                                              (though strings seem to be valid unicode) */
245                                                                                         case mmioFOURCC('I','N','A','M'):
246                                                                                         case DMUS_FOURCC_UNAM_CHUNK: {
247                                                                                                 TRACE_(dmfile)(": name chunk\n");
248                                                                                                 pDesc->dwValidData |= DMUS_OBJ_NAME;
249                                                                                                 IStream_Read (pStream, pDesc->wszName, Chunk.dwSize, NULL);
250                                                                                                 break;
251                                                                                         }
252                                                                                         case mmioFOURCC('I','A','R','T'):
253                                                                                         case DMUS_FOURCC_UART_CHUNK: {
254                                                                                                 TRACE_(dmfile)(": artist chunk (ignored)\n");
255                                                                                                 liMove.QuadPart = Chunk.dwSize;
256                                                                                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
257                                                                                                 break;
258                                                                                         }
259                                                                                         case mmioFOURCC('I','C','O','P'):
260                                                                                         case DMUS_FOURCC_UCOP_CHUNK: {
261                                                                                                 TRACE_(dmfile)(": copyright chunk (ignored)\n");
262                                                                                                 liMove.QuadPart = Chunk.dwSize;
263                                                                                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
264                                                                                                 break;
265                                                                                         }
266                                                                                         case mmioFOURCC('I','S','B','J'):
267                                                                                         case DMUS_FOURCC_USBJ_CHUNK: {
268                                                                                                 TRACE_(dmfile)(": subject chunk (ignored)\n");
269                                                                                                 liMove.QuadPart = Chunk.dwSize;
270                                                                                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
271                                                                                                 break;
272                                                                                         }
273                                                                                         case mmioFOURCC('I','C','M','T'):
274                                                                                         case DMUS_FOURCC_UCMT_CHUNK: {
275                                                                                                 TRACE_(dmfile)(": comment chunk (ignored)\n");
276                                                                                                 liMove.QuadPart = Chunk.dwSize;
277                                                                                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
278                                                                                                 break;
279                                                                                         }
280                                                                                         default: {
281                                                                                                 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
282                                                                                                 liMove.QuadPart = Chunk.dwSize;
283                                                                                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
284                                                                                                 break;                                          
285                                                                                         }
286                                                                                 }
287                                                                                 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
288                                                                         } while (ListCount[0] < ListSize[0]);
289                                                                         break;
290                                                                 }
291                                                                 default: {
292                                                                         TRACE_(dmfile)(": unknown (skipping)\n");
293                                                                         liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
294                                                                         IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
295                                                                         break;                                          
296                                                                 }
297                                                         }
298                                                         break;
299                                                 }       
300                                                 default: {
301                                                         TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
302                                                         liMove.QuadPart = Chunk.dwSize;
303                                                         IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
304                                                         break;                                          
305                                                 }
306                                         }
307                                         TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
308                                 } while (StreamCount < StreamSize);
309                                 break;
310                         } else {
311                                 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
312                                 liMove.QuadPart = StreamSize;
313                                 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
314                                 return E_FAIL;
315                         }
316                 
317                         TRACE_(dmfile)(": reading finished\n");
318                         break;
319                 }
320                 default: {
321                         TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
322                         liMove.QuadPart = Chunk.dwSize;
323                         IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
324                         return DMUS_E_INVALIDFILE;
325                 }
326         }       
327         
328         TRACE(": returning descriptor:\n");
329         if (TRACE_ON(dmband)) {
330                 DMUSIC_dump_DMUS_OBJECTDESC (pDesc);
331         }
332         
333         return S_OK;
334 }
335
336 ICOM_VTABLE(IDirectMusicObject) DirectMusicBand_Object_Vtbl = {
337     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
338         IDirectMusicBandImpl_IDirectMusicObject_QueryInterface,
339         IDirectMusicBandImpl_IDirectMusicObject_AddRef,
340         IDirectMusicBandImpl_IDirectMusicObject_Release,
341         IDirectMusicBandImpl_IDirectMusicObject_GetDescriptor,
342         IDirectMusicBandImpl_IDirectMusicObject_SetDescriptor,
343         IDirectMusicBandImpl_IDirectMusicObject_ParseDescriptor
344 };
345
346 /* IDirectMusicBandImpl IPersistStream part: */
347 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
348         ICOM_THIS_MULTI(IDirectMusicBandImpl, PersistStreamVtbl, iface);
349         return IDirectMusicBandImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
350 }
351
352 ULONG WINAPI IDirectMusicBandImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
353         ICOM_THIS_MULTI(IDirectMusicBandImpl, PersistStreamVtbl, iface);
354         return IDirectMusicBandImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
355 }
356
357 ULONG WINAPI IDirectMusicBandImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
358         ICOM_THIS_MULTI(IDirectMusicBandImpl, PersistStreamVtbl, iface);
359         return IDirectMusicBandImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);   
360 }
361
362 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
363         return E_NOTIMPL;
364 }
365
366 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
367         return E_NOTIMPL;
368 }
369
370 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
371         ICOM_THIS_MULTI(IDirectMusicBandImpl, PersistStreamVtbl, iface);
372         FIXME("(%p,%p): loading not implemented yet\n", This, pStm);
373         return S_OK;
374 }
375
376 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
377         return E_NOTIMPL;
378 }
379
380 HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
381         return E_NOTIMPL;
382 }
383
384 ICOM_VTABLE(IPersistStream) DirectMusicBand_PersistStream_Vtbl = {
385     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
386         IDirectMusicBandImpl_IPersistStream_QueryInterface,
387         IDirectMusicBandImpl_IPersistStream_AddRef,
388         IDirectMusicBandImpl_IPersistStream_Release,
389         IDirectMusicBandImpl_IPersistStream_GetClassID,
390         IDirectMusicBandImpl_IPersistStream_IsDirty,
391         IDirectMusicBandImpl_IPersistStream_Load,
392         IDirectMusicBandImpl_IPersistStream_Save,
393         IDirectMusicBandImpl_IPersistStream_GetSizeMax
394 };
395
396 /* for ClassFactory */
397 HRESULT WINAPI DMUSIC_CreateDirectMusicBandImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
398         IDirectMusicBandImpl* obj;
399         
400         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandImpl));
401         if (NULL == obj) {
402                 *ppobj = (LPVOID) NULL;
403                 return E_OUTOFMEMORY;
404         }
405         obj->UnknownVtbl = &DirectMusicBand_Unknown_Vtbl;
406         obj->BandVtbl = &DirectMusicBand_Band_Vtbl;
407         obj->ObjectVtbl = &DirectMusicBand_Object_Vtbl;
408         obj->PersistStreamVtbl = &DirectMusicBand_PersistStream_Vtbl;
409         obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
410         DM_STRUCT_INIT(obj->pDesc);
411         obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
412         memcpy (&obj->pDesc->guidClass, &CLSID_DirectMusicBand, sizeof (CLSID));
413         obj->ref = 0; /* will be inited by QueryInterface */
414         list_init (&obj->Instruments);
415         
416         return IDirectMusicBandImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);
417 }