1 /* IDirectMusicChordMap Implementation
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (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 GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmcompos_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos
);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile
);
25 /*****************************************************************************
26 * IDirectMusicChordMapImpl implementation
28 typedef struct IDirectMusicChordMapImpl
{
29 IDirectMusicChordMap IDirectMusicChordMap_iface
;
30 const IDirectMusicObjectVtbl
*ObjectVtbl
;
31 const IPersistStreamVtbl
*PersistStreamVtbl
;
33 DMUS_OBJECTDESC
*pDesc
;
34 } IDirectMusicChordMapImpl
;
36 /* IDirectMusicChordMapImpl IDirectMusicChordMap part: */
37 static inline IDirectMusicChordMapImpl
*impl_from_IDirectMusicChordMap(IDirectMusicChordMap
*iface
)
39 return CONTAINING_RECORD(iface
, IDirectMusicChordMapImpl
, IDirectMusicChordMap_iface
);
42 static HRESULT WINAPI
IDirectMusicChordMapImpl_QueryInterface(IDirectMusicChordMap
*iface
,
43 REFIID riid
, void **ret_iface
)
45 IDirectMusicChordMapImpl
*This
= impl_from_IDirectMusicChordMap(iface
);
47 TRACE("(%p, %s, %p)\n", This
, debugstr_dmguid(riid
), ret_iface
);
51 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicChordMap
))
53 else if (IsEqualIID(riid
, &IID_IDirectMusicObject
))
54 *ret_iface
= &This
->ObjectVtbl
;
55 else if (IsEqualIID(riid
, &IID_IPersistStream
))
56 *ret_iface
= &This
->PersistStreamVtbl
;
58 WARN("(%p, %s, %p): not found\n", This
, debugstr_dmguid(riid
), ret_iface
);
62 IUnknown_AddRef((IUnknown
*)*ret_iface
);
66 static ULONG WINAPI
IDirectMusicChordMapImpl_AddRef(IDirectMusicChordMap
*iface
)
68 IDirectMusicChordMapImpl
*This
= impl_from_IDirectMusicChordMap(iface
);
69 LONG ref
= InterlockedIncrement(&This
->ref
);
71 TRACE("(%p) ref=%d\n", This
, ref
);
76 static ULONG WINAPI
IDirectMusicChordMapImpl_Release(IDirectMusicChordMap
*iface
)
78 IDirectMusicChordMapImpl
*This
= impl_from_IDirectMusicChordMap(iface
);
79 LONG ref
= InterlockedDecrement(&This
->ref
);
81 TRACE("(%p) ref=%d\n", This
, ref
);
84 HeapFree(GetProcessHeap(), 0, This
->pDesc
);
85 HeapFree(GetProcessHeap(), 0, This
);
86 DMCOMPOS_UnlockModule();
92 static HRESULT WINAPI
IDirectMusicChordMapImpl_GetScale(IDirectMusicChordMap
*iface
,
95 IDirectMusicChordMapImpl
*This
= impl_from_IDirectMusicChordMap(iface
);
96 FIXME("(%p, %p): stub\n", This
, pdwScale
);
100 static const IDirectMusicChordMapVtbl dmchordmap_vtbl
= {
101 IDirectMusicChordMapImpl_QueryInterface
,
102 IDirectMusicChordMapImpl_AddRef
,
103 IDirectMusicChordMapImpl_Release
,
104 IDirectMusicChordMapImpl_GetScale
107 /* IDirectMusicChordMapImpl IDirectMusicObject part: */
108 static HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface
, REFIID riid
, LPVOID
*ppobj
) {
109 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
110 return IDirectMusicChordMap_QueryInterface(&This
->IDirectMusicChordMap_iface
, riid
, ppobj
);
113 static ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface
) {
114 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
115 return IDirectMusicChordMap_AddRef(&This
->IDirectMusicChordMap_iface
);
118 static ULONG WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface
) {
119 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
120 return IDirectMusicChordMap_Release(&This
->IDirectMusicChordMap_iface
);
123 static HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
) {
124 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
125 TRACE("(%p, %p)\n", This
, pDesc
);
126 /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
127 memcpy (pDesc
, This
->pDesc
, This
->pDesc
->dwSize
);
131 static HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface
, LPDMUS_OBJECTDESC pDesc
) {
132 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, ObjectVtbl
, iface
);
133 TRACE("(%p, %p): setting descriptor:\n%s\n", This
, pDesc
, debugstr_DMUS_OBJECTDESC (pDesc
));
135 /* According to MSDN, we should copy only given values, not whole struct */
136 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
)
137 This
->pDesc
->guidObject
= pDesc
->guidObject
;
138 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
)
139 This
->pDesc
->guidClass
= pDesc
->guidClass
;
140 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
)
141 lstrcpynW (This
->pDesc
->wszName
, pDesc
->wszName
, DMUS_MAX_NAME
);
142 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
)
143 lstrcpynW (This
->pDesc
->wszCategory
, pDesc
->wszCategory
, DMUS_MAX_CATEGORY
);
144 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
)
145 lstrcpynW (This
->pDesc
->wszFileName
, pDesc
->wszFileName
, DMUS_MAX_FILENAME
);
146 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
)
147 This
->pDesc
->vVersion
= pDesc
->vVersion
;
148 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
)
149 This
->pDesc
->ftDate
= pDesc
->ftDate
;
150 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) {
151 This
->pDesc
->llMemLength
= pDesc
->llMemLength
;
152 memcpy (This
->pDesc
->pbMemData
, pDesc
->pbMemData
, pDesc
->llMemLength
);
154 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) {
155 /* according to MSDN, we copy the stream */
156 IStream_Clone (pDesc
->pStream
, &This
->pDesc
->pStream
);
160 This
->pDesc
->dwValidData
|= pDesc
->dwValidData
;
165 static HRESULT WINAPI
IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface
, LPSTREAM pStream
, LPDMUS_OBJECTDESC pDesc
) {
166 DMUS_PRIVATE_CHUNK Chunk
;
167 DWORD StreamSize
, StreamCount
, ListSize
[1], ListCount
[1];
168 LARGE_INTEGER liMove
; /* used when skipping chunks */
170 TRACE("(%p, %p)\n", pStream
, pDesc
);
172 /* FIXME: should this be determined from stream? */
173 pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
174 pDesc
->guidClass
= CLSID_DirectMusicChordMap
;
176 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
177 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
178 switch (Chunk
.fccID
) {
180 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
181 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
182 StreamSize
= Chunk
.dwSize
- sizeof(FOURCC
);
184 if (Chunk
.fccID
== DMUS_FOURCC_CHORDMAP_FORM
) {
185 TRACE_(dmfile
)(": chord map form\n");
187 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
188 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
189 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
190 switch (Chunk
.fccID
) {
191 case DMUS_FOURCC_GUID_CHUNK
: {
192 TRACE_(dmfile
)(": GUID chunk\n");
193 pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
194 IStream_Read (pStream
, &pDesc
->guidObject
, Chunk
.dwSize
, NULL
);
197 case DMUS_FOURCC_VERSION_CHUNK
: {
198 TRACE_(dmfile
)(": version chunk\n");
199 pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
200 IStream_Read (pStream
, &pDesc
->vVersion
, Chunk
.dwSize
, NULL
);
203 case DMUS_FOURCC_CATEGORY_CHUNK
: {
204 TRACE_(dmfile
)(": category chunk\n");
205 pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
206 IStream_Read (pStream
, pDesc
->wszCategory
, Chunk
.dwSize
, NULL
);
210 IStream_Read (pStream
, &Chunk
.fccID
, sizeof(FOURCC
), NULL
);
211 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(Chunk
.fccID
));
212 ListSize
[0] = Chunk
.dwSize
- sizeof(FOURCC
);
214 switch (Chunk
.fccID
) {
215 /* evil M$ UNFO list, which can (!?) contain INFO elements */
216 case DMUS_FOURCC_UNFO_LIST
: {
217 TRACE_(dmfile
)(": UNFO list\n");
219 IStream_Read (pStream
, &Chunk
, sizeof(FOURCC
)+sizeof(DWORD
), NULL
);
220 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + Chunk
.dwSize
;
221 TRACE_(dmfile
)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk
.fccID
), Chunk
.dwSize
);
222 switch (Chunk
.fccID
) {
223 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
224 (though strings seem to be valid unicode) */
225 case mmioFOURCC('I','N','A','M'):
226 case DMUS_FOURCC_UNAM_CHUNK
: {
227 TRACE_(dmfile
)(": name chunk\n");
228 pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
229 IStream_Read (pStream
, pDesc
->wszName
, Chunk
.dwSize
, NULL
);
232 case mmioFOURCC('I','A','R','T'):
233 case DMUS_FOURCC_UART_CHUNK
: {
234 TRACE_(dmfile
)(": artist chunk (ignored)\n");
235 liMove
.QuadPart
= Chunk
.dwSize
;
236 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
239 case mmioFOURCC('I','C','O','P'):
240 case DMUS_FOURCC_UCOP_CHUNK
: {
241 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
242 liMove
.QuadPart
= Chunk
.dwSize
;
243 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
246 case mmioFOURCC('I','S','B','J'):
247 case DMUS_FOURCC_USBJ_CHUNK
: {
248 TRACE_(dmfile
)(": subject chunk (ignored)\n");
249 liMove
.QuadPart
= Chunk
.dwSize
;
250 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
253 case mmioFOURCC('I','C','M','T'):
254 case DMUS_FOURCC_UCMT_CHUNK
: {
255 TRACE_(dmfile
)(": comment chunk (ignored)\n");
256 liMove
.QuadPart
= Chunk
.dwSize
;
257 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
261 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
262 liMove
.QuadPart
= Chunk
.dwSize
;
263 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
267 TRACE_(dmfile
)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount
[0], ListSize
[0]);
268 } while (ListCount
[0] < ListSize
[0]);
272 TRACE_(dmfile
)(": unknown (skipping)\n");
273 liMove
.QuadPart
= Chunk
.dwSize
- sizeof(FOURCC
);
274 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
281 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
282 liMove
.QuadPart
= Chunk
.dwSize
;
283 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
);
287 TRACE_(dmfile
)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount
, StreamSize
);
288 } while (StreamCount
< StreamSize
);
290 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
291 liMove
.QuadPart
= StreamSize
;
292 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
296 TRACE_(dmfile
)(": reading finished\n");
300 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
301 liMove
.QuadPart
= Chunk
.dwSize
;
302 IStream_Seek (pStream
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
303 return DMUS_E_INVALIDFILE
;
307 TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc
));
312 static const IDirectMusicObjectVtbl DirectMusicChordMap_Object_Vtbl
= {
313 IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface
,
314 IDirectMusicChordMapImpl_IDirectMusicObject_AddRef
,
315 IDirectMusicChordMapImpl_IDirectMusicObject_Release
,
316 IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor
,
317 IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor
,
318 IDirectMusicChordMapImpl_IDirectMusicObject_ParseDescriptor
322 /* IDirectMusicChordMapImpl IPersistStream part: */
323 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface
, REFIID riid
, LPVOID
*ppobj
) {
324 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
325 return IDirectMusicChordMap_QueryInterface(&This
->IDirectMusicChordMap_iface
, riid
, ppobj
);
328 static ULONG WINAPI
IDirectMusicChordMapImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface
) {
329 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
330 return IDirectMusicChordMap_AddRef(&This
->IDirectMusicChordMap_iface
);
333 static ULONG WINAPI
IDirectMusicChordMapImpl_IPersistStream_Release (LPPERSISTSTREAM iface
) {
334 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
335 return IDirectMusicChordMap_Release(&This
->IDirectMusicChordMap_iface
);
338 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface
, CLSID
* pClassID
) {
342 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface
) {
346 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_Load (LPPERSISTSTREAM iface
, IStream
* pStm
) {
347 ICOM_THIS_MULTI(IDirectMusicChordMapImpl
, PersistStreamVtbl
, iface
);
350 DWORD chunkSize
, StreamSize
, StreamCount
, ListSize
[3], ListCount
[3];
351 LARGE_INTEGER liMove
; /* used when skipping chunks */
353 FIXME("(%p, %p): Loading not implemented yet\n", This
, pStm
);
354 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
355 IStream_Read (pStm
, &chunkSize
, sizeof(DWORD
), NULL
);
356 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
359 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
360 TRACE_(dmfile
)(": RIFF chunk of type %s", debugstr_fourcc(chunkID
));
361 StreamSize
= chunkSize
- sizeof(FOURCC
);
364 case DMUS_FOURCC_CHORDMAP_FORM
: {
365 TRACE_(dmfile
)(": chordmap form\n");
367 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
368 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
369 StreamCount
+= sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
370 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
372 case DMUS_FOURCC_GUID_CHUNK
: {
373 TRACE_(dmfile
)(": GUID chunk\n");
374 This
->pDesc
->dwValidData
|= DMUS_OBJ_OBJECT
;
375 IStream_Read (pStm
, &This
->pDesc
->guidObject
, chunkSize
, NULL
);
378 case DMUS_FOURCC_VERSION_CHUNK
: {
379 TRACE_(dmfile
)(": version chunk\n");
380 This
->pDesc
->dwValidData
|= DMUS_OBJ_VERSION
;
381 IStream_Read (pStm
, &This
->pDesc
->vVersion
, chunkSize
, NULL
);
384 case DMUS_FOURCC_CATEGORY_CHUNK
: {
385 TRACE_(dmfile
)(": category chunk\n");
386 This
->pDesc
->dwValidData
|= DMUS_OBJ_CATEGORY
;
387 IStream_Read (pStm
, This
->pDesc
->wszCategory
, chunkSize
, NULL
);
391 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
392 TRACE_(dmfile
)(": LIST chunk of type %s", debugstr_fourcc(chunkID
));
393 ListSize
[0] = chunkSize
- sizeof(FOURCC
);
396 case DMUS_FOURCC_UNFO_LIST
: {
397 TRACE_(dmfile
)(": UNFO list\n");
399 IStream_Read (pStm
, &chunkID
, sizeof(FOURCC
), NULL
);
400 IStream_Read (pStm
, &chunkSize
, sizeof(FOURCC
), NULL
);
401 ListCount
[0] += sizeof(FOURCC
) + sizeof(DWORD
) + chunkSize
;
402 TRACE_(dmfile
)(": %s chunk (size = %d)", debugstr_fourcc (chunkID
), chunkSize
);
404 /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
405 (though strings seem to be valid unicode) */
406 case mmioFOURCC('I','N','A','M'):
407 case DMUS_FOURCC_UNAM_CHUNK
: {
408 TRACE_(dmfile
)(": name chunk\n");
409 This
->pDesc
->dwValidData
|= DMUS_OBJ_NAME
;
410 IStream_Read (pStm
, This
->pDesc
->wszName
, chunkSize
, NULL
);
413 case mmioFOURCC('I','A','R','T'):
414 case DMUS_FOURCC_UART_CHUNK
: {
415 TRACE_(dmfile
)(": artist chunk (ignored)\n");
416 liMove
.QuadPart
= chunkSize
;
417 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
420 case mmioFOURCC('I','C','O','P'):
421 case DMUS_FOURCC_UCOP_CHUNK
: {
422 TRACE_(dmfile
)(": copyright chunk (ignored)\n");
423 liMove
.QuadPart
= chunkSize
;
424 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
427 case mmioFOURCC('I','S','B','J'):
428 case DMUS_FOURCC_USBJ_CHUNK
: {
429 TRACE_(dmfile
)(": subject chunk (ignored)\n");
430 liMove
.QuadPart
= chunkSize
;
431 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
434 case mmioFOURCC('I','C','M','T'):
435 case DMUS_FOURCC_UCMT_CHUNK
: {
436 TRACE_(dmfile
)(": comment chunk (ignored)\n");
437 liMove
.QuadPart
= chunkSize
;
438 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
442 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
443 liMove
.QuadPart
= chunkSize
;
444 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
448 TRACE_(dmfile
)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount
[0], ListSize
[0]);
449 } while (ListCount
[0] < ListSize
[0]);
453 TRACE_(dmfile
)(": unknown (skipping)\n");
454 liMove
.QuadPart
= chunkSize
- sizeof(FOURCC
);
455 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
462 TRACE_(dmfile
)(": unknown chunk (irrelevant & skipping)\n");
463 liMove
.QuadPart
= chunkSize
;
464 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
);
468 TRACE_(dmfile
)(": StreamCount[0] = %d < StreamSize[0] = %d\n", StreamCount
, StreamSize
);
469 } while (StreamCount
< StreamSize
);
473 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
474 liMove
.QuadPart
= StreamSize
;
475 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
479 TRACE_(dmfile
)(": reading finished\n");
483 TRACE_(dmfile
)(": unexpected chunk; loading failed)\n");
484 liMove
.QuadPart
= chunkSize
;
485 IStream_Seek (pStm
, liMove
, STREAM_SEEK_CUR
, NULL
); /* skip the rest of the chunk */
493 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_Save (LPPERSISTSTREAM iface
, IStream
* pStm
, BOOL fClearDirty
) {
497 static HRESULT WINAPI
IDirectMusicChordMapImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface
, ULARGE_INTEGER
* pcbSize
) {
501 static const IPersistStreamVtbl DirectMusicChordMap_PersistStream_Vtbl
= {
502 IDirectMusicChordMapImpl_IPersistStream_QueryInterface
,
503 IDirectMusicChordMapImpl_IPersistStream_AddRef
,
504 IDirectMusicChordMapImpl_IPersistStream_Release
,
505 IDirectMusicChordMapImpl_IPersistStream_GetClassID
,
506 IDirectMusicChordMapImpl_IPersistStream_IsDirty
,
507 IDirectMusicChordMapImpl_IPersistStream_Load
,
508 IDirectMusicChordMapImpl_IPersistStream_Save
,
509 IDirectMusicChordMapImpl_IPersistStream_GetSizeMax
512 /* for ClassFactory */
513 HRESULT WINAPI
create_dmchordmap(REFIID lpcGUID
, void **ppobj
)
515 IDirectMusicChordMapImpl
* obj
;
518 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicChordMapImpl
));
521 return E_OUTOFMEMORY
;
523 obj
->IDirectMusicChordMap_iface
.lpVtbl
= &dmchordmap_vtbl
;
524 obj
->ObjectVtbl
= &DirectMusicChordMap_Object_Vtbl
;
525 obj
->PersistStreamVtbl
= &DirectMusicChordMap_PersistStream_Vtbl
;
526 obj
->pDesc
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DMUS_OBJECTDESC
));
527 DM_STRUCT_INIT(obj
->pDesc
);
528 obj
->pDesc
->dwValidData
|= DMUS_OBJ_CLASS
;
529 obj
->pDesc
->guidClass
= CLSID_DirectMusicChordMap
;
532 DMCOMPOS_LockModule();
533 hr
= IDirectMusicChordMap_QueryInterface(&obj
->IDirectMusicChordMap_iface
, lpcGUID
, ppobj
);
534 IDirectMusicChordMap_Release(&obj
->IDirectMusicChordMap_iface
);