1 /* IDirectMusicChordMap Implementation
3 * Copyright (C) 2003-2004 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 "dmcompos_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos
);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
25 /*****************************************************************************
26 * IDirectMusicChordMapImpl implementation
28 /* IDirectMusicChordMapImpl IUnknown part: */
29 HRESULT WINAPI
IDirectMusicChordMapImpl_IUnknown_QueryInterface (LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppobj
) {
30 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, UnknownVtbl
, iface
);
31 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ppobj
);
33 if (IsEqualIID (riid
, &IID_IUnknown
)) {
34 *ppobj
= (LPVOID
)&This
->UnknownVtbl
;
35 IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
37 } else if (IsEqualIID (riid
, &IID_IDirectMusicChordMap
)) {
38 *ppobj
= (LPVOID
)&This
->ChordMapVtbl
;
39 IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef ((LPDIRECTMUSICCHORDMAP
)&This
->ChordMapVtbl
);
41 } else if (IsEqualIID (riid
, &IID_IDirectMusicObject
)) {
42 *ppobj
= (LPVOID
)&This
->ObjectVtbl
;
43 IDirectMusicChordMapImpl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT
)&This
->ObjectVtbl
);
45 } else if (IsEqualIID (riid
, &IID_IPersistStream
)) {
46 *ppobj
= (LPVOID
)&This
->PersistStreamVtbl
;
47 IDirectMusicChordMapImpl_IPersistStream_AddRef ((LPPERSISTSTREAM
)&This
->PersistStreamVtbl
);
51 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ppobj
);
55 ULONG WINAPI
IDirectMusicChordMapImpl_IUnknown_AddRef (LPUNKNOWN iface
) {
56 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, UnknownVtbl
, iface
);
57 TRACE("(%p): AddRef from %ld\n", This
, This
->ref
);
61 ULONG WINAPI
IDirectMusicChordMapImpl_IUnknown_Release (LPUNKNOWN iface
) {
62 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, UnknownVtbl
, iface
);
63 ULONG ref
= --This
->ref
;
64 TRACE("(%p): ReleaseRef to %ld\n", This
, This
->ref
);
66 HeapFree(GetProcessHeap(), 0, This
);
71 ICOM_VTABLE(IUnknown
) DirectMusicChordMap_Unknown_Vtbl
= {
72 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
73 IDirectMusicChordMapImpl_IUnknown_QueryInterface
,
74 IDirectMusicChordMapImpl_IUnknown_AddRef
,
75 IDirectMusicChordMapImpl_IUnknown_Release
78 /* IDirectMusicChordMapImpl IDirectMusicChordMap part: */
79 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface (LPDIRECTMUSICCHORDMAP iface
, REFIID riid
, LPVOID
*ppobj
) {
80 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ChordMapVtbl
, iface
);
81 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
84 ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef (LPDIRECTMUSICCHORDMAP iface
) {
85 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ChordMapVtbl
, iface
);
86 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
89 ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicChordMap_Release (LPDIRECTMUSICCHORDMAP iface
) {
90 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ChordMapVtbl
, iface
);
91 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
94 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale (LPDIRECTMUSICCHORDMAP iface
, DWORD
* pdwScale
) {
95 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ChordMapVtbl
, iface
);
96 FIXME("(%p, %p): stub\n", This
, pdwScale
);
100 ICOM_VTABLE(IDirectMusicChordMap
) DirectMusicChordMap_ChordMap_Vtbl
= {
101 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
102 IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface
,
103 IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef
,
104 IDirectMusicChordMapImpl_IDirectMusicChordMap_Release
,
105 IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale
108 /* IDirectMusicChordMapImpl IDirectMusicObject part: */
109 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface
, REFIID riid
, LPVOID
*ppobj
) {
110 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
111 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
114 ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface
) {
115 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
116 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
119 ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface
) {
120 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
121 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
124 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
) {
125 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
126 TRACE("(%p, %p)\n", This
, pDesc
);
127 /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
128 memcpy (pDesc
, This
->pDesc
, This
->pDesc
->dwSize
);
132 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
) {
133 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
134 TRACE("(%p, %p): setting descriptor:\n%s\n", This
, pDesc
, debugstr_DMUS_OBJECTDESC (pDesc
));
136 /* According to MSDN, we should copy only given values, not whole struct */
137 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
)
138 memcpy (&This
->pDesc
->guidObject
, &pDesc
->guidObject
, sizeof (pDesc
->guidObject
));
139 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
)
140 memcpy (&This
->pDesc
->guidClass
, &pDesc
->guidClass
, sizeof (pDesc
->guidClass
));
141 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
)
142 strncpyW (This
->pDesc
->wszName
, pDesc
->wszName
, DMUS_MAX_NAME
);
143 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
)
144 strncpyW (This
->pDesc
->wszCategory
, pDesc
->wszCategory
, DMUS_MAX_CATEGORY
);
145 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
)
146 strncpyW (This
->pDesc
->wszFileName
, pDesc
->wszFileName
, DMUS_MAX_FILENAME
);
147 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
)
148 memcpy (&This
->pDesc
->vVersion
, &pDesc
->vVersion
, sizeof (pDesc
->vVersion
));
149 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
)
150 memcpy (&This
->pDesc
->ftDate
, &pDesc
->ftDate
, sizeof (pDesc
->ftDate
));
151 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) {
152 memcpy (&This
->pDesc
->llMemLength
, &pDesc
->llMemLength
, sizeof (pDesc
->llMemLength
));
153 memcpy (This
->pDesc
->pbMemData
, pDesc
->pbMemData
, sizeof (pDesc
->pbMemData
));
155 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) {
156 /* according to MSDN, we copy the stream */
157 IStream_Clone (pDesc
->pStream
, &This
->pDesc
->pStream
);
161 This
->pDesc
->dwValidData
|= pDesc
->dwValidData
;
166 HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface
, LPSTREAM pStream
, LPDMUS_OBJECTDESC pDesc
) {
167 DMUS_PRIVATE_CHUNK Chunk
;
168 DWORD StreamSize
, StreamCount
, ListSize
[1], ListCount
[1];
169 LARGE_INTEGER liMove
; /* used when skipping chunks */
171 TRACE("(%p, %p)\n", pStream
, pDesc
);
173 /* FIXME: should this be determined from stream? */
174 pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
175 memcpy (&pDesc
->guidClass
, &CLSID_DirectMusicChordMap
, sizeof(CLSID
));
177 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
178 TRACE_(dmfile
)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
179 switch (Chunk
.fccID
) {
181 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
182 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
183 StreamSize
= Chunk
.dwSize
- sizeof(FOURCC
);
185 if (Chunk
.fccID
== DMUS_FOURCC_CHORDMAP_FORM
) {
186 TRACE_(dmfile
)(": chord map form\n");
188 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
189 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
190 TRACE_(dmfile
)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
191 switch (Chunk
.fccID
) {
192 case DMUS_FOURCC_GUID_CHUNK
: {
193 TRACE_(dmfile
)(": GUID chunk\n");
194 pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
195 IStream_Read (pStream
, &pDesc
->guidObject
, Chunk
.dwSize
, NULL
);
198 case DMUS_FOURCC_VERSION_CHUNK
: {
199 TRACE_(dmfile
)(": version chunk\n");
200 pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
201 IStream_Read (pStream
, &pDesc
->vVersion
, Chunk
.dwSize
, NULL
);
204 case DMUS_FOURCC_CATEGORY_CHUNK
: {
205 TRACE_(dmfile
)(": category chunk\n");
206 pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
207 IStream_Read (pStream
, pDesc
->wszCategory
, Chunk
.dwSize
, NULL
);
211 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
212 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
213 ListSize
[0] = Chunk
.dwSize
- sizeof(FOURCC
);
215 switch (Chunk
.fccID
) {
216 /* evil M$ UNFO list, which can (!?) contain INFO elements */
217 case DMUS_FOURCC_UNFO_LIST
: {
218 TRACE_(dmfile
)(": UNFO list\n");
220 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
221 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
222 TRACE_(dmfile
)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
223 switch (Chunk
.fccID
) {
224 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
225 (though strings seem to be valid unicode) */
226 case mmioFOURCC('I','N','A','M'):
227 case DMUS_FOURCC_UNAM_CHUNK
: {
228 TRACE_(dmfile
)(": name chunk\n");
229 pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
230 IStream_Read (pStream
, pDesc
->wszName
, Chunk
.dwSize
, NULL
);
233 case mmioFOURCC('I','A','R','T'):
234 case DMUS_FOURCC_UART_CHUNK
: {
235 TRACE_(dmfile
)(": artist chunk (ignored)\n");
236 liMove
.QuadPart
= Chunk
.dwSize
;
237 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
240 case mmioFOURCC('I','C','O','P'):
241 case DMUS_FOURCC_UCOP_CHUNK
: {
242 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
243 liMove
.QuadPart
= Chunk
.dwSize
;
244 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
247 case mmioFOURCC('I','S','B','J'):
248 case DMUS_FOURCC_USBJ_CHUNK
: {
249 TRACE_(dmfile
)(": subject chunk (ignored)\n");
250 liMove
.QuadPart
= Chunk
.dwSize
;
251 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
254 case mmioFOURCC('I','C','M','T'):
255 case DMUS_FOURCC_UCMT_CHUNK
: {
256 TRACE_(dmfile
)(": comment chunk (ignored)\n");
257 liMove
.QuadPart
= Chunk
.dwSize
;
258 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
262 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
263 liMove
.QuadPart
= Chunk
.dwSize
;
264 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
268 TRACE_(dmfile
)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount
[0], ListSize
[0]);
269 } while (ListCount
[0] < ListSize
[0]);
273 TRACE_(dmfile
)(": unknown (skipping)\n");
274 liMove
.QuadPart
= Chunk
.dwSize
- sizeof(FOURCC
);
275 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
282 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
283 liMove
.QuadPart
= Chunk
.dwSize
;
284 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
288 TRACE_(dmfile
)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount
, StreamSize
);
289 } while (StreamCount
< StreamSize
);
292 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
293 liMove
.QuadPart
= StreamSize
;
294 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
298 TRACE_(dmfile
)(": reading finished\n");
302 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
303 liMove
.QuadPart
= Chunk
.dwSize
;
304 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
305 return DMUS_E_INVALIDFILE
;
309 TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc
));
314 ICOM_VTABLE(IDirectMusicObject
) DirectMusicChordMap_Object_Vtbl
= {
315 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
316 IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface
,
317 IDirectMusicChordMapImpl_IDirectMusicObject_AddRef
,
318 IDirectMusicChordMapImpl_IDirectMusicObject_Release
,
319 IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor
,
320 IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor
,
321 IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor
325 /* IDirectMusicChordMapImpl IPersistStream part: */
326 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
) {
327 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
328 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN
)&This
->UnknownVtbl
, riid
, ppobj
);
331 ULONG WINAPI
IDirectMusicChordMapImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface
) {
332 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
333 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN
)&This
->UnknownVtbl
);
336 ULONG WINAPI
IDirectMusicChordMapImpl_IPersistStream_Release (LPPERSISTSTREAM iface
) {
337 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
338 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN
)&This
->UnknownVtbl
);
341 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
) {
345 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface
) {
349 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
) {
350 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
353 DWORD chunkSize
, StreamSize
, StreamCount
, ListSize
[3], ListCount
[3];
354 LARGE_INTEGER liMove
; /* used when skipping chunks */
356 FIXME("(%p, %p): Loading not implemented yet\n", This
, pStm
);
357 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
358 IStream_Read (pStm
, &chunkSize
, sizeof(DWORD
), NULL
);
359 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID
), chunkSize
);
362 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
363 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(chunkID
));
364 StreamSize
= chunkSize
- sizeof(FOURCC
);
367 case DMUS_FOURCC_CHORDMAP_FORM
: {
368 TRACE_(dmfile
)(": chordmap form\n");
370 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
371 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
372 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
373 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID
), chunkSize
);
375 case DMUS_FOURCC_GUID_CHUNK
: {
376 TRACE_(dmfile
)(": GUID chunk\n");
377 This
->pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
378 IStream_Read (pStm
, &This
->pDesc
->guidObject
, chunkSize
, NULL
);
381 case DMUS_FOURCC_VERSION_CHUNK
: {
382 TRACE_(dmfile
)(": version chunk\n");
383 This
->pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
384 IStream_Read (pStm
, &This
->pDesc
->vVersion
, chunkSize
, NULL
);
387 case DMUS_FOURCC_CATEGORY_CHUNK
: {
388 TRACE_(dmfile
)(": category chunk\n");
389 This
->pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
390 IStream_Read (pStm
, This
->pDesc
->wszCategory
, chunkSize
, NULL
);
394 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
395 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(chunkID
));
396 ListSize
[0] = chunkSize
- sizeof(FOURCC
);
399 case DMUS_FOURCC_UNFO_LIST
: {
400 TRACE_(dmfile
)(": UNFO list\n");
402 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
403 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
404 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
405 TRACE_(dmfile
)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID
), chunkSize
);
407 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
408 (though strings seem to be valid unicode) */
409 case mmioFOURCC('I','N','A','M'):
410 case DMUS_FOURCC_UNAM_CHUNK
: {
411 TRACE_(dmfile
)(": name chunk\n");
412 This
->pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
413 IStream_Read (pStm
, This
->pDesc
->wszName
, chunkSize
, NULL
);
416 case mmioFOURCC('I','A','R','T'):
417 case DMUS_FOURCC_UART_CHUNK
: {
418 TRACE_(dmfile
)(": artist chunk (ignored)\n");
419 liMove
.QuadPart
= chunkSize
;
420 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
423 case mmioFOURCC('I','C','O','P'):
424 case DMUS_FOURCC_UCOP_CHUNK
: {
425 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
426 liMove
.QuadPart
= chunkSize
;
427 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
430 case mmioFOURCC('I','S','B','J'):
431 case DMUS_FOURCC_USBJ_CHUNK
: {
432 TRACE_(dmfile
)(": subject chunk (ignored)\n");
433 liMove
.QuadPart
= chunkSize
;
434 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
437 case mmioFOURCC('I','C','M','T'):
438 case DMUS_FOURCC_UCMT_CHUNK
: {
439 TRACE_(dmfile
)(": comment chunk (ignored)\n");
440 liMove
.QuadPart
= chunkSize
;
441 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
445 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
446 liMove
.QuadPart
= chunkSize
;
447 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
451 TRACE_(dmfile
)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount
[0], ListSize
[0]);
452 } while (ListCount
[0] < ListSize
[0]);
456 TRACE_(dmfile
)(": unknown (skipping)\n");
457 liMove
.QuadPart
= chunkSize
- sizeof(FOURCC
);
458 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
465 TRACE_(dmfile
)(": unknown chunk (irrevelant & skipping)\n");
466 liMove
.QuadPart
= chunkSize
;
467 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
471 TRACE_(dmfile
)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount
, StreamSize
);
472 } while (StreamCount
< StreamSize
);
476 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
477 liMove
.QuadPart
= StreamSize
;
478 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
482 TRACE_(dmfile
)(": reading finished\n");
486 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
487 liMove
.QuadPart
= chunkSize
;
488 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
496 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
) {
500 HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
) {
504 ICOM_VTABLE(IPersistStream
) DirectMusicChordMap_PersistStream_Vtbl
= {
505 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
506 IDirectMusicChordMapImpl_IPersistStream_QueryInterface
,
507 IDirectMusicChordMapImpl_IPersistStream_AddRef
,
508 IDirectMusicChordMapImpl_IPersistStream_Release
,
509 IDirectMusicChordMapImpl_IPersistStream_GetClassID
,
510 IDirectMusicChordMapImpl_IPersistStream_IsDirty
,
511 IDirectMusicChordMapImpl_IPersistStream_Load
,
512 IDirectMusicChordMapImpl_IPersistStream_Save
,
513 IDirectMusicChordMapImpl_IPersistStream_GetSizeMax
516 /* for ClassFactory */
517 HRESULT WINAPI
DMUSIC_CreateDirectMusicChordMapImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) {
518 IDirectMusicChordMapImpl
* obj
;
520 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicChordMapImpl
));
522 *ppobj
= (LPVOID
) NULL
;
523 return E_OUTOFMEMORY
;
525 obj
->UnknownVtbl
= &DirectMusicChordMap_Unknown_Vtbl
;
526 obj
->ChordMapVtbl
= &DirectMusicChordMap_ChordMap_Vtbl
;
527 obj
->ObjectVtbl
= &DirectMusicChordMap_Object_Vtbl
;
528 obj
->PersistStreamVtbl
= &DirectMusicChordMap_PersistStream_Vtbl
;
529 obj
->pDesc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DMUS_OBJECTDESC
));
530 DM_STRUCT_INIT(obj
->pDesc
);
531 obj
->pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
532 memcpy (&obj
->pDesc
->guidClass
, &CLSID_DirectMusicChordMap
, sizeof (CLSID
));
533 obj
->ref
= 0; /* will be inited by QueryInterface */
535 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN
)&obj
->UnknownVtbl
, lpcGUID
, ppobj
);