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);
59 DMCOMPOS_LockModule();
64 ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_Release (LPUNKNOWN iface) {
65 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface);
66 ULONG ref = --This->ref;
67 TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
70 HeapFree(GetProcessHeap(), 0, This);
73 DMCOMPOS_UnlockModule();
78 IUnknownVtbl DirectMusicChordMap_Unknown_Vtbl = {
79 IDirectMusicChordMapImpl_IUnknown_QueryInterface,
80 IDirectMusicChordMapImpl_IUnknown_AddRef,
81 IDirectMusicChordMapImpl_IUnknown_Release
84 /* IDirectMusicChordMapImpl IDirectMusicChordMap part: */
85 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface (LPDIRECTMUSICCHORDMAP iface, REFIID riid, LPVOID *ppobj) {
86 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface);
87 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
90 ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef (LPDIRECTMUSICCHORDMAP iface) {
91 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface);
92 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
95 ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_Release (LPDIRECTMUSICCHORDMAP iface) {
96 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface);
97 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
100 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale (LPDIRECTMUSICCHORDMAP iface, DWORD* pdwScale) {
101 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface);
102 FIXME("(%p, %p): stub\n", This, pdwScale);
106 IDirectMusicChordMapVtbl DirectMusicChordMap_ChordMap_Vtbl = {
107 IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface,
108 IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef,
109 IDirectMusicChordMapImpl_IDirectMusicChordMap_Release,
110 IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale
113 /* IDirectMusicChordMapImpl IDirectMusicObject part: */
114 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
115 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface);
116 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
119 ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
120 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface);
121 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
124 ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
125 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface);
126 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
129 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
130 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface);
131 TRACE("(%p, %p)\n", This, pDesc);
132 /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
133 memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
137 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
138 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface);
139 TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
141 /* According to MSDN, we should copy only given values, not whole struct */
142 if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
143 memcpy (&This->pDesc->guidObject, &pDesc->guidObject, sizeof (pDesc->guidObject));
144 if (pDesc->dwValidData & DMUS_OBJ_CLASS)
145 memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass));
146 if (pDesc->dwValidData & DMUS_OBJ_NAME)
147 strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
148 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
149 strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
150 if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
151 strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
152 if (pDesc->dwValidData & DMUS_OBJ_VERSION)
153 memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion));
154 if (pDesc->dwValidData & DMUS_OBJ_DATE)
155 memcpy (&This->pDesc->ftDate, &pDesc->ftDate, sizeof (pDesc->ftDate));
156 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
157 memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));
158 memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
160 if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
161 /* according to MSDN, we copy the stream */
162 IStream_Clone (pDesc->pStream, &This->pDesc->pStream);
166 This->pDesc->dwValidData |= pDesc->dwValidData;
171 HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
172 DMUS_PRIVATE_CHUNK Chunk;
173 DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
174 LARGE_INTEGER liMove; /* used when skipping chunks */
176 TRACE("(%p, %p)\n", pStream, pDesc);
178 /* FIXME: should this be determined from stream? */
179 pDesc->dwValidData |= DMUS_OBJ_CLASS;
180 memcpy (&pDesc->guidClass, &CLSID_DirectMusicChordMap, sizeof(CLSID));
182 IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
183 TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
184 switch (Chunk.fccID) {
186 IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
187 TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
188 StreamSize = Chunk.dwSize - sizeof(FOURCC);
190 if (Chunk.fccID == DMUS_FOURCC_CHORDMAP_FORM) {
191 TRACE_(dmfile)(": chord map form\n");
193 IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
194 StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
195 TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
196 switch (Chunk.fccID) {
197 case DMUS_FOURCC_GUID_CHUNK: {
198 TRACE_(dmfile)(": GUID chunk\n");
199 pDesc->dwValidData |= DMUS_OBJ_OBJECT;
200 IStream_Read (pStream, &pDesc->guidObject, Chunk.dwSize, NULL);
203 case DMUS_FOURCC_VERSION_CHUNK: {
204 TRACE_(dmfile)(": version chunk\n");
205 pDesc->dwValidData |= DMUS_OBJ_VERSION;
206 IStream_Read (pStream, &pDesc->vVersion, Chunk.dwSize, NULL);
209 case DMUS_FOURCC_CATEGORY_CHUNK: {
210 TRACE_(dmfile)(": category chunk\n");
211 pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
212 IStream_Read (pStream, pDesc->wszCategory, Chunk.dwSize, NULL);
216 IStream_Read (pStream, &Chunk.fccID, sizeof(FOURCC), NULL);
217 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
218 ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
220 switch (Chunk.fccID) {
221 /* evil M$ UNFO list, which can (!?) contain INFO elements */
222 case DMUS_FOURCC_UNFO_LIST: {
223 TRACE_(dmfile)(": UNFO list\n");
225 IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
226 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
227 TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
228 switch (Chunk.fccID) {
229 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
230 (though strings seem to be valid unicode) */
231 case mmioFOURCC('I','N','A','M'):
232 case DMUS_FOURCC_UNAM_CHUNK: {
233 TRACE_(dmfile)(": name chunk\n");
234 pDesc->dwValidData |= DMUS_OBJ_NAME;
235 IStream_Read (pStream, pDesc->wszName, Chunk.dwSize, NULL);
238 case mmioFOURCC('I','A','R','T'):
239 case DMUS_FOURCC_UART_CHUNK: {
240 TRACE_(dmfile)(": artist chunk (ignored)\n");
241 liMove.QuadPart = Chunk.dwSize;
242 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
245 case mmioFOURCC('I','C','O','P'):
246 case DMUS_FOURCC_UCOP_CHUNK: {
247 TRACE_(dmfile)(": copyright chunk (ignored)\n");
248 liMove.QuadPart = Chunk.dwSize;
249 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
252 case mmioFOURCC('I','S','B','J'):
253 case DMUS_FOURCC_USBJ_CHUNK: {
254 TRACE_(dmfile)(": subject chunk (ignored)\n");
255 liMove.QuadPart = Chunk.dwSize;
256 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
259 case mmioFOURCC('I','C','M','T'):
260 case DMUS_FOURCC_UCMT_CHUNK: {
261 TRACE_(dmfile)(": comment chunk (ignored)\n");
262 liMove.QuadPart = Chunk.dwSize;
263 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
267 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
268 liMove.QuadPart = Chunk.dwSize;
269 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
273 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
274 } while (ListCount[0] < ListSize[0]);
278 TRACE_(dmfile)(": unknown (skipping)\n");
279 liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
280 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
287 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
288 liMove.QuadPart = Chunk.dwSize;
289 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
293 TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
294 } while (StreamCount < StreamSize);
297 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
298 liMove.QuadPart = StreamSize;
299 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
303 TRACE_(dmfile)(": reading finished\n");
307 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
308 liMove.QuadPart = Chunk.dwSize;
309 IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
310 return DMUS_E_INVALIDFILE;
314 TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc));
319 IDirectMusicObjectVtbl DirectMusicChordMap_Object_Vtbl = {
320 IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface,
321 IDirectMusicChordMapImpl_IDirectMusicObject_AddRef,
322 IDirectMusicChordMapImpl_IDirectMusicObject_Release,
323 IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor,
324 IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor,
325 IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor
329 /* IDirectMusicChordMapImpl IPersistStream part: */
330 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
331 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface);
332 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
335 ULONG WINAPI IDirectMusicChordMapImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
336 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface);
337 return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
340 ULONG WINAPI IDirectMusicChordMapImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
341 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface);
342 return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
345 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
349 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
353 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
354 ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface);
357 DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3];
358 LARGE_INTEGER liMove; /* used when skipping chunks */
360 FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
361 IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
362 IStream_Read (pStm, &chunkSize, sizeof(DWORD), NULL);
363 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize);
366 IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
367 TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunkID));
368 StreamSize = chunkSize - sizeof(FOURCC);
371 case DMUS_FOURCC_CHORDMAP_FORM: {
372 TRACE_(dmfile)(": chordmap form\n");
374 IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
375 IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL);
376 StreamCount += sizeof(FOURCC) + sizeof(DWORD) + chunkSize;
377 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize);
379 case DMUS_FOURCC_GUID_CHUNK: {
380 TRACE_(dmfile)(": GUID chunk\n");
381 This->pDesc->dwValidData |= DMUS_OBJ_OBJECT;
382 IStream_Read (pStm, &This->pDesc->guidObject, chunkSize, NULL);
385 case DMUS_FOURCC_VERSION_CHUNK: {
386 TRACE_(dmfile)(": version chunk\n");
387 This->pDesc->dwValidData |= DMUS_OBJ_VERSION;
388 IStream_Read (pStm, &This->pDesc->vVersion, chunkSize, NULL);
391 case DMUS_FOURCC_CATEGORY_CHUNK: {
392 TRACE_(dmfile)(": category chunk\n");
393 This->pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
394 IStream_Read (pStm, This->pDesc->wszCategory, chunkSize, NULL);
398 IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
399 TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(chunkID));
400 ListSize[0] = chunkSize - sizeof(FOURCC);
403 case DMUS_FOURCC_UNFO_LIST: {
404 TRACE_(dmfile)(": UNFO list\n");
406 IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
407 IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL);
408 ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize;
409 TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize);
411 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
412 (though strings seem to be valid unicode) */
413 case mmioFOURCC('I','N','A','M'):
414 case DMUS_FOURCC_UNAM_CHUNK: {
415 TRACE_(dmfile)(": name chunk\n");
416 This->pDesc->dwValidData |= DMUS_OBJ_NAME;
417 IStream_Read (pStm, This->pDesc->wszName, chunkSize, NULL);
420 case mmioFOURCC('I','A','R','T'):
421 case DMUS_FOURCC_UART_CHUNK: {
422 TRACE_(dmfile)(": artist chunk (ignored)\n");
423 liMove.QuadPart = chunkSize;
424 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
427 case mmioFOURCC('I','C','O','P'):
428 case DMUS_FOURCC_UCOP_CHUNK: {
429 TRACE_(dmfile)(": copyright chunk (ignored)\n");
430 liMove.QuadPart = chunkSize;
431 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
434 case mmioFOURCC('I','S','B','J'):
435 case DMUS_FOURCC_USBJ_CHUNK: {
436 TRACE_(dmfile)(": subject chunk (ignored)\n");
437 liMove.QuadPart = chunkSize;
438 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
441 case mmioFOURCC('I','C','M','T'):
442 case DMUS_FOURCC_UCMT_CHUNK: {
443 TRACE_(dmfile)(": comment chunk (ignored)\n");
444 liMove.QuadPart = chunkSize;
445 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
449 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
450 liMove.QuadPart = chunkSize;
451 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
455 TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
456 } while (ListCount[0] < ListSize[0]);
460 TRACE_(dmfile)(": unknown (skipping)\n");
461 liMove.QuadPart = chunkSize - sizeof(FOURCC);
462 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
469 TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
470 liMove.QuadPart = chunkSize;
471 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
475 TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
476 } while (StreamCount < StreamSize);
480 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
481 liMove.QuadPart = StreamSize;
482 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
486 TRACE_(dmfile)(": reading finished\n");
490 TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
491 liMove.QuadPart = chunkSize;
492 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
500 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
504 HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
508 IPersistStreamVtbl DirectMusicChordMap_PersistStream_Vtbl = {
509 IDirectMusicChordMapImpl_IPersistStream_QueryInterface,
510 IDirectMusicChordMapImpl_IPersistStream_AddRef,
511 IDirectMusicChordMapImpl_IPersistStream_Release,
512 IDirectMusicChordMapImpl_IPersistStream_GetClassID,
513 IDirectMusicChordMapImpl_IPersistStream_IsDirty,
514 IDirectMusicChordMapImpl_IPersistStream_Load,
515 IDirectMusicChordMapImpl_IPersistStream_Save,
516 IDirectMusicChordMapImpl_IPersistStream_GetSizeMax
519 /* for ClassFactory */
520 HRESULT WINAPI DMUSIC_CreateDirectMusicChordMapImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
521 IDirectMusicChordMapImpl* obj;
523 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl));
526 return E_OUTOFMEMORY;
528 obj->UnknownVtbl = &DirectMusicChordMap_Unknown_Vtbl;
529 obj->ChordMapVtbl = &DirectMusicChordMap_ChordMap_Vtbl;
530 obj->ObjectVtbl = &DirectMusicChordMap_Object_Vtbl;
531 obj->PersistStreamVtbl = &DirectMusicChordMap_PersistStream_Vtbl;
532 obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
533 DM_STRUCT_INIT(obj->pDesc);
534 obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
535 memcpy (&obj->pDesc->guidClass, &CLSID_DirectMusicChordMap, sizeof (CLSID));
536 obj->ref = 0; /* will be inited by QueryInterface */
538 return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);