include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / dlls / dmstyle / dmutils.c
blob4b9101e675abe203605de6ca47b18e3e64ff80fb
1 /* Debug and Helper Functions
3 * Copyright (C) 2004 Rok Mandeljc
4 * Copyright (C) 2004 Raphael Junqueira
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <string.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winnt.h"
30 #include "wingdi.h"
31 #include "winuser.h"
33 #include "wine/debug.h"
34 #include "objbase.h"
36 #include "dmusici.h"
37 #include "dmusicf.h"
38 #include "dmusics.h"
40 #include "dmutils.h"
41 #include "dmobject.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(dmfile);
45 HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
47 switch (pChunk->fccID) {
48 case DMUS_FOURCC_GUID_CHUNK: {
49 TRACE(": GUID chunk\n");
50 pDesc->dwValidData |= DMUS_OBJ_OBJECT;
51 IStream_Read (pStm, &pDesc->guidObject, pChunk->dwSize, NULL);
52 break;
54 case DMUS_FOURCC_DATE_CHUNK: {
55 TRACE(": file date chunk\n");
56 pDesc->dwValidData |= DMUS_OBJ_DATE;
57 IStream_Read (pStm, &pDesc->ftDate, pChunk->dwSize, NULL);
58 break;
60 case DMUS_FOURCC_NAME_CHUNK: {
61 TRACE(": name chunk\n");
62 pDesc->dwValidData |= DMUS_OBJ_NAME;
63 IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL);
64 break;
66 case DMUS_FOURCC_FILE_CHUNK: {
67 TRACE(": file name chunk\n");
68 pDesc->dwValidData |= DMUS_OBJ_FILENAME;
69 IStream_Read (pStm, pDesc->wszFileName, pChunk->dwSize, NULL);
70 break;
72 case DMUS_FOURCC_VERSION_CHUNK: {
73 TRACE(": version chunk\n");
74 pDesc->dwValidData |= DMUS_OBJ_VERSION;
75 IStream_Read (pStm, &pDesc->vVersion, pChunk->dwSize, NULL);
76 break;
78 case DMUS_FOURCC_CATEGORY_CHUNK: {
79 TRACE(": category chunk\n");
80 pDesc->dwValidData |= DMUS_OBJ_CATEGORY;
81 IStream_Read (pStm, pDesc->wszCategory, pChunk->dwSize, NULL);
82 break;
84 default:
85 /* not handled */
86 return S_FALSE;
89 return S_OK;
92 HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) {
94 LARGE_INTEGER liMove; /* used when skipping chunks */
96 /**
97 * don't ask me why, but M$ puts INFO elements in UNFO list sometimes
98 * (though strings seem to be valid unicode)
100 switch (pChunk->fccID) {
102 case mmioFOURCC('I','N','A','M'):
103 case DMUS_FOURCC_UNAM_CHUNK: {
104 TRACE(": name chunk\n");
105 pDesc->dwValidData |= DMUS_OBJ_NAME;
106 IStream_Read (pStm, pDesc->wszName, pChunk->dwSize, NULL);
107 TRACE(" - wszName: %s\n", debugstr_w(pDesc->wszName));
108 break;
111 case mmioFOURCC('I','A','R','T'):
112 case DMUS_FOURCC_UART_CHUNK: {
113 TRACE(": artist chunk (ignored)\n");
114 liMove.QuadPart = pChunk->dwSize;
115 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
116 break;
118 case mmioFOURCC('I','C','O','P'):
119 case DMUS_FOURCC_UCOP_CHUNK: {
120 TRACE(": copyright chunk (ignored)\n");
121 liMove.QuadPart = pChunk->dwSize;
122 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
123 break;
125 case mmioFOURCC('I','S','B','J'):
126 case DMUS_FOURCC_USBJ_CHUNK: {
127 TRACE(": subject chunk (ignored)\n");
128 liMove.QuadPart = pChunk->dwSize;
129 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
130 break;
132 case mmioFOURCC('I','C','M','T'):
133 case DMUS_FOURCC_UCMT_CHUNK: {
134 TRACE(": comment chunk (ignored)\n");
135 liMove.QuadPart = pChunk->dwSize;
136 IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
137 break;
139 default:
140 /* not handled */
141 return S_FALSE;
144 return S_OK;