Add support for REG_EXPAND_SZ in set_registry_variables().
[wine] / dlls / dmstyle / mutetrack.c
1 /* IDirectMusicMuteTrack Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #include "dmstyle_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
23 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
24
25 /*****************************************************************************
26  * IDirectMusicMuteTrack implementation
27  */
28 /* IDirectMusicMuteTrack IUnknown part: */
29 HRESULT WINAPI IDirectMusicMuteTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
30         ICOM_THIS_MULTI(IDirectMusicMuteTrack, UnknownVtbl, iface);
31         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
32
33         if (IsEqualIID (riid, &IID_IUnknown)) {
34                 *ppobj = (LPUNKNOWN)&This->UnknownVtbl;
35                 IDirectMusicMuteTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
36                 return S_OK;
37         } else if (IsEqualIID (riid, &IID_IDirectMusicTrack)
38           || IsEqualIID (riid, &IID_IDirectMusicTrack8)) {
39                 *ppobj = (LPDIRECTMUSICTRACK8)&This->TrackVtbl;
40                 IDirectMusicMuteTrack_IDirectMusicTrack_AddRef ((LPDIRECTMUSICTRACK8)&This->TrackVtbl);
41                 return S_OK;
42         } else if (IsEqualIID (riid, &IID_IPersistStream)) {
43                 *ppobj = (LPPERSISTSTREAM)&This->PersistStreamVtbl;
44                 IDirectMusicMuteTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl);
45                 return S_OK;
46         }
47         
48         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
49         return E_NOINTERFACE;
50 }
51
52 ULONG WINAPI IDirectMusicMuteTrack_IUnknown_AddRef (LPUNKNOWN iface) {
53         ICOM_THIS_MULTI(IDirectMusicMuteTrack, UnknownVtbl, iface);
54         TRACE("(%p): AddRef from %ld\n", This, This->ref);
55         return ++(This->ref);
56 }
57
58 ULONG WINAPI IDirectMusicMuteTrack_IUnknown_Release (LPUNKNOWN iface) {
59         ICOM_THIS_MULTI(IDirectMusicMuteTrack, UnknownVtbl, iface);
60         ULONG ref = --This->ref;
61         TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
62         if (ref == 0) {
63                 HeapFree(GetProcessHeap(), 0, This);
64         }
65         return ref;
66 }
67
68 IUnknownVtbl DirectMusicMuteTrack_Unknown_Vtbl = {
69         IDirectMusicMuteTrack_IUnknown_QueryInterface,
70         IDirectMusicMuteTrack_IUnknown_AddRef,
71         IDirectMusicMuteTrack_IUnknown_Release
72 };
73
74 /* IDirectMusicMuteTrack IDirectMusicTrack8 part: */
75 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_QueryInterface (LPDIRECTMUSICTRACK8 iface, REFIID riid, LPVOID *ppobj) {
76         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
77         return IDirectMusicMuteTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
78 }
79
80 ULONG WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface) {
81         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
82         return IDirectMusicMuteTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
83 }
84
85 ULONG WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Release (LPDIRECTMUSICTRACK8 iface) {
86         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
87         return IDirectMusicMuteTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
88 }
89
90 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Init (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegment* pSegment)
91 {
92         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
93         FIXME("(%p, %p): stub\n", This, pSegment);
94         return S_OK;
95 }
96
97 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_InitPlay (LPDIRECTMUSICTRACK8 iface, IDirectMusicSegmentState* pSegmentState, IDirectMusicPerformance* pPerformance, void** ppStateData, DWORD dwVirtualTrack8ID, DWORD dwFlags)
98 {
99         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
100         FIXME("(%p, %p, %p, %p, %ld, %ld): stub\n", This, pSegmentState, pPerformance, ppStateData, dwVirtualTrack8ID, dwFlags);
101         return S_OK;
102 }
103
104 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_EndPlay (LPDIRECTMUSICTRACK8 iface, void* pStateData)
105 {
106         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
107         FIXME("(%p, %p): stub\n", This, pStateData);
108         return S_OK;
109 }
110
111 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Play (LPDIRECTMUSICTRACK8 iface, void* pStateData, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, MUSIC_TIME mtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID)
112 {
113         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
114         FIXME("(%p, %p, %ld, %ld, %ld, %ld, %p, %p, %ld): stub\n", This, pStateData, mtStart, mtEnd, mtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
115         return S_OK;
116 }
117
118 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_GetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam) {
119         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
120         FIXME("(%p, %s, %ld, %p, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pmtNext, pParam);
121         return S_OK;
122 }
123
124 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_SetParam (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, MUSIC_TIME mtTime, void* pParam) {
125         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
126         FIXME("(%p, %s, %ld, %p): stub\n", This, debugstr_dmguid(rguidType), mtTime, pParam);
127         return S_OK;
128 }
129
130 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_IsParamSupported (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType) {
131         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
132
133         TRACE("(%p, %s): ", This, debugstr_dmguid(rguidType));
134         if (IsEqualGUID (rguidType, &GUID_MuteParam)) {
135                 TRACE("param supported\n");
136                 return S_OK;
137         }
138         TRACE("param unsupported\n");
139         return DMUS_E_TYPE_UNSUPPORTED;
140 }
141
142 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_AddNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
143         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
144         FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
145         return S_OK;
146 }
147
148 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_RemoveNotificationType (LPDIRECTMUSICTRACK8 iface, REFGUID rguidNotificationType) {
149         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
150         FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidNotificationType));
151         return S_OK;
152 }
153
154 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Clone (LPDIRECTMUSICTRACK8 iface, MUSIC_TIME mtStart, MUSIC_TIME mtEnd, IDirectMusicTrack** ppTrack) {
155         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
156         FIXME("(%p, %ld, %ld, %p): stub\n", This, mtStart, mtEnd, ppTrack);
157         return S_OK;
158 }
159
160 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_PlayEx (LPDIRECTMUSICTRACK8 iface, void* pStateData, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, REFERENCE_TIME rtOffset, DWORD dwFlags, IDirectMusicPerformance* pPerf, IDirectMusicSegmentState* pSegSt, DWORD dwVirtualID) {
161         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
162         FIXME("(%p, %p, %lli, %lli, %lli, %ld, %p, %p, %ld): stub\n", This, pStateData, rtStart, rtEnd, rtOffset, dwFlags, pPerf, pSegSt, dwVirtualID);
163         return S_OK;
164 }
165
166 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_GetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, REFERENCE_TIME* prtNext, void* pParam, void* pStateData, DWORD dwFlags) {
167         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
168         FIXME("(%p, %s, %lli, %p, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, prtNext, pParam, pStateData, dwFlags);
169         return S_OK;
170 }
171
172 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_SetParamEx (LPDIRECTMUSICTRACK8 iface, REFGUID rguidType, REFERENCE_TIME rtTime, void* pParam, void* pStateData, DWORD dwFlags) {
173         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
174         FIXME("(%p, %s, %lli, %p, %p, %ld): stub\n", This, debugstr_dmguid(rguidType), rtTime, pParam, pStateData, dwFlags);
175         return S_OK;
176 }
177
178 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Compose (LPDIRECTMUSICTRACK8 iface, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
179         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
180         FIXME("(%p, %p, %ld, %p): stub\n", This, pContext, dwTrackGroup, ppResultTrack);
181         return S_OK;
182 }
183
184 HRESULT WINAPI IDirectMusicMuteTrack_IDirectMusicTrack_Join (LPDIRECTMUSICTRACK8 iface, IDirectMusicTrack* pNewTrack, MUSIC_TIME mtJoin, IUnknown* pContext, DWORD dwTrackGroup, IDirectMusicTrack** ppResultTrack) {
185         ICOM_THIS_MULTI(IDirectMusicMuteTrack, TrackVtbl, iface);
186         FIXME("(%p, %p, %ld, %p, %ld, %p): stub\n", This, pNewTrack, mtJoin, pContext, dwTrackGroup, ppResultTrack);
187         return S_OK;
188 }
189
190 IDirectMusicTrack8Vtbl DirectMusicMuteTrack_Track_Vtbl = {
191         IDirectMusicMuteTrack_IDirectMusicTrack_QueryInterface,
192         IDirectMusicMuteTrack_IDirectMusicTrack_AddRef,
193         IDirectMusicMuteTrack_IDirectMusicTrack_Release,
194         IDirectMusicMuteTrack_IDirectMusicTrack_Init,
195         IDirectMusicMuteTrack_IDirectMusicTrack_InitPlay,
196         IDirectMusicMuteTrack_IDirectMusicTrack_EndPlay,
197         IDirectMusicMuteTrack_IDirectMusicTrack_Play,
198         IDirectMusicMuteTrack_IDirectMusicTrack_GetParam,
199         IDirectMusicMuteTrack_IDirectMusicTrack_SetParam,
200         IDirectMusicMuteTrack_IDirectMusicTrack_IsParamSupported,
201         IDirectMusicMuteTrack_IDirectMusicTrack_AddNotificationType,
202         IDirectMusicMuteTrack_IDirectMusicTrack_RemoveNotificationType,
203         IDirectMusicMuteTrack_IDirectMusicTrack_Clone,
204         IDirectMusicMuteTrack_IDirectMusicTrack_PlayEx,
205         IDirectMusicMuteTrack_IDirectMusicTrack_GetParamEx,
206         IDirectMusicMuteTrack_IDirectMusicTrack_SetParamEx,
207         IDirectMusicMuteTrack_IDirectMusicTrack_Compose,
208         IDirectMusicMuteTrack_IDirectMusicTrack_Join
209 };
210
211 /* IDirectMusicMuteTrack IPersistStream part: */
212 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
213         ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
214         return IDirectMusicMuteTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
215 }
216
217 ULONG WINAPI IDirectMusicMuteTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
218         ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
219         return IDirectMusicMuteTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
220 }
221
222 ULONG WINAPI IDirectMusicMuteTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
223         ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
224         return IDirectMusicMuteTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
225 }
226
227 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
228         return E_NOTIMPL;
229 }
230
231 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
232         return E_NOTIMPL;
233 }
234
235 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
236         FIXME(": Loading not implemented yet\n");
237         return S_OK;
238 }
239
240 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
241         return E_NOTIMPL;
242 }
243
244 HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
245         return E_NOTIMPL;
246 }
247
248 IPersistStreamVtbl DirectMusicMuteTrack_PersistStream_Vtbl = {
249         IDirectMusicMuteTrack_IPersistStream_QueryInterface,
250         IDirectMusicMuteTrack_IPersistStream_AddRef,
251         IDirectMusicMuteTrack_IPersistStream_Release,
252         IDirectMusicMuteTrack_IPersistStream_GetClassID,
253         IDirectMusicMuteTrack_IPersistStream_IsDirty,
254         IDirectMusicMuteTrack_IPersistStream_Load,
255         IDirectMusicMuteTrack_IPersistStream_Save,
256         IDirectMusicMuteTrack_IPersistStream_GetSizeMax
257 };
258
259 /* for ClassFactory */
260 HRESULT WINAPI DMUSIC_CreateDirectMusicMuteTrack (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
261         IDirectMusicMuteTrack* track;
262         
263         track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMuteTrack));
264         if (NULL == track) {
265                 *ppobj = (LPVOID) NULL;
266                 return E_OUTOFMEMORY;
267         }
268         track->UnknownVtbl = &DirectMusicMuteTrack_Unknown_Vtbl;
269         track->TrackVtbl = &DirectMusicMuteTrack_Track_Vtbl;
270         track->PersistStreamVtbl = &DirectMusicMuteTrack_PersistStream_Vtbl;
271         track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
272         DM_STRUCT_INIT(track->pDesc);
273         track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
274         memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicMuteTrack, sizeof (CLSID));
275         track->ref = 0; /* will be inited by QueryInterface */
276         
277         return IDirectMusicMuteTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);
278 }