cmd: DIR command outputs free space for the path.
[wine.git] / dlls / dmime / dmobject.h
blob772be015c80a22d943d2b3507df7323d3f125069
1 /*
2 * Base IDirectMusicObject Implementation
3 * Keep in sync with the master in dlls/dmusic/dmobject.h
5 * Copyright (C) 2014 Michael Stefaniuc
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 /* RIFF stream parsing */
25 struct chunk_entry;
26 struct chunk_entry {
27 FOURCC id;
28 DWORD size;
29 FOURCC type; /* valid only for LIST and RIFF chunks */
30 ULARGE_INTEGER offset; /* chunk offset from start of stream */
31 const struct chunk_entry *parent; /* enclosing RIFF or LIST chunk */
34 HRESULT stream_get_chunk(IStream *stream, struct chunk_entry *chunk);
35 HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk);
36 HRESULT stream_skip_chunk(IStream *stream, const struct chunk_entry *chunk);
38 HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk, void **array,
39 unsigned int *count, DWORD elem_size);
40 HRESULT stream_chunk_get_data(IStream *stream, const struct chunk_entry *chunk, void *data,
41 ULONG size);
42 HRESULT stream_chunk_get_wstr(IStream *stream, const struct chunk_entry *chunk, WCHAR *str,
43 ULONG size);
45 static inline HRESULT stream_reset_chunk_data(IStream *stream, const struct chunk_entry *chunk)
47 LARGE_INTEGER offset;
49 offset.QuadPart = chunk->offset.QuadPart + sizeof(FOURCC) + sizeof(DWORD);
50 if (chunk->id == FOURCC_RIFF || chunk->id == FOURCC_LIST)
51 offset.QuadPart += sizeof(FOURCC);
53 return IStream_Seek(stream, offset, STREAM_SEEK_SET, NULL);
56 static inline HRESULT stream_reset_chunk_start(IStream *stream, const struct chunk_entry *chunk)
58 LARGE_INTEGER offset;
60 offset.QuadPart = chunk->offset.QuadPart;
62 return IStream_Seek(stream, offset, STREAM_SEEK_SET, NULL);
66 /* IDirectMusicObject base object */
67 struct dmobject {
68 IDirectMusicObject IDirectMusicObject_iface;
69 IPersistStream IPersistStream_iface;
70 IUnknown *outer_unk;
71 DMUS_OBJECTDESC desc;
74 void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk);
76 /* Generic IDirectMusicObject methods */
77 HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid,
78 void **ret_iface);
79 ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface);
80 ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface);
81 HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
82 DMUS_OBJECTDESC *desc);
83 HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
84 DMUS_OBJECTDESC *desc);
86 /* Helper for IDirectMusicObject::ParseDescriptor */
87 HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff,
88 DMUS_OBJECTDESC *desc, DWORD supported);
89 /* Additional supported flags for dmobj_parsedescriptor.
90 DMUS_OBJ_NAME is 'UNAM' chunk in UNFO list */
91 #define DMUS_OBJ_NAME_INAM 0x1000 /* 'INAM' chunk in UNFO list */
92 #define DMUS_OBJ_NAME_INFO 0x2000 /* 'INAM' chunk in INFO list */
94 /* 'DMRF' (reference list) helper */
95 HRESULT dmobj_parsereference(IStream *stream, const struct chunk_entry *list,
96 IDirectMusicObject **dmobj);
98 /* Generic IPersistStream methods */
99 HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid,
100 void **ret_iface);
101 ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface);
102 ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface);
103 HRESULT WINAPI dmobj_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class);
105 /* IPersistStream methods not implemented in native */
106 HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface,
107 CLSID *class);
108 HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface);
109 HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream,
110 BOOL clear_dirty);
111 HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface,
112 ULARGE_INTEGER *size);
114 /* Debugging helpers */
115 const char *debugstr_chunk(const struct chunk_entry *chunk);
116 const char *debugstr_dmguid(const GUID *id);
117 void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc);
119 static inline const char *debugstr_fourcc(DWORD fourcc)
121 if (!fourcc) return "''";
122 return wine_dbg_sprintf("'%c%c%c%c'", (char)(fourcc), (char)(fourcc >> 8),
123 (char)(fourcc >> 16), (char)(fourcc >> 24));