Added stubs for AccessCheckByType, AddAuditAccessAce,
[wine] / dlls / dmime / song.c
1 /* IDirectMusicSong Implementation
2  *
3  * Copyright (C) 2003 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 <stdarg.h>
21
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
27
28 #include "dmime_private.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
31
32 /* IDirectMusicSong IUnknown part: */
33 HRESULT WINAPI IDirectMusicSongImpl_QueryInterface (LPDIRECTMUSICSONG iface, REFIID riid, LPVOID *ppobj)
34 {
35         ICOM_THIS(IDirectMusicSongImpl,iface);
36
37         if (IsEqualIID (riid, &IID_IUnknown) || 
38             IsEqualIID (riid, &IID_IDirectMusicSong)) {
39                 IDirectMusicSongImpl_AddRef(iface);
40                 *ppobj = This;
41                 return S_OK;
42         }
43         
44         WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
45         return E_NOINTERFACE;
46 }
47
48 ULONG WINAPI IDirectMusicSongImpl_AddRef (LPDIRECTMUSICSONG iface)
49 {
50         ICOM_THIS(IDirectMusicSongImpl,iface);
51         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
52         return ++(This->ref);
53 }
54
55 ULONG WINAPI IDirectMusicSongImpl_Release (LPDIRECTMUSICSONG iface)
56 {
57         ICOM_THIS(IDirectMusicSongImpl,iface);
58         ULONG ref = --This->ref;
59         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
60         if (ref == 0) {
61                 HeapFree(GetProcessHeap(), 0, This);
62         }
63         return ref;
64 }
65
66 /* IDirectMusicSong IDirectMusicSong part: */
67 HRESULT WINAPI IDirectMusicSongImpl_Compose (LPDIRECTMUSICSONG iface)
68 {
69         ICOM_THIS(IDirectMusicSongImpl,iface);
70
71         FIXME("(%p): stub\n", This);
72         
73         return S_OK;
74 }
75
76 HRESULT WINAPI IDirectMusicSongImpl_GetParam (LPDIRECTMUSICSONG iface, REFGUID rguidType, DWORD dwGroupBits, DWORD dwIndex, MUSIC_TIME mtTime, MUSIC_TIME* pmtNext, void* pParam)
77 {
78         ICOM_THIS(IDirectMusicSongImpl,iface);
79
80         FIXME("(%p, %s, %ld, %ld, %ld, %p, %p): stub\n", This, debugstr_guid(rguidType), dwGroupBits, dwIndex, mtTime, pmtNext, pParam);
81
82         return S_OK;
83 }
84
85 HRESULT WINAPI IDirectMusicSongImpl_GetSegment (LPDIRECTMUSICSONG iface, WCHAR* pwzName, IDirectMusicSegment** ppSegment)
86 {
87         ICOM_THIS(IDirectMusicSongImpl,iface);
88
89         FIXME("(%p, %p, %p): stub\n", This, pwzName, ppSegment);
90
91         return S_OK;
92 }
93
94 HRESULT WINAPI IDirectMusicSongImpl_GetAudioPathConfig (LPDIRECTMUSICSONG iface, IUnknown** ppAudioPathConfig)
95 {
96         ICOM_THIS(IDirectMusicSongImpl,iface);
97
98         FIXME("(%p, %p): stub\n", This, ppAudioPathConfig);
99
100         return S_OK;
101 }
102
103 HRESULT WINAPI IDirectMusicSongImpl_Download (LPDIRECTMUSICSONG iface, IUnknown* pAudioPath)
104 {
105         ICOM_THIS(IDirectMusicSongImpl,iface);
106
107         FIXME("(%p, %p): stub\n", This, pAudioPath);
108
109         return S_OK;
110 }
111
112 HRESULT WINAPI IDirectMusicSongImpl_Unload (LPDIRECTMUSICSONG iface, IUnknown* pAudioPath)
113 {
114         ICOM_THIS(IDirectMusicSongImpl,iface);
115
116         FIXME("(%p, %p): stub\n", This, pAudioPath);
117
118         return S_OK;
119 }
120
121 HRESULT WINAPI IDirectMusicSongImpl_EnumSegment (LPDIRECTMUSICSONG iface, DWORD dwIndex, IDirectMusicSegment** ppSegment)
122 {
123         ICOM_THIS(IDirectMusicSongImpl,iface);
124
125         FIXME("(%p, %ld, %p): stub\n", This, dwIndex, ppSegment);
126
127         return S_OK;
128 }
129
130 ICOM_VTABLE(IDirectMusicSong) DirectMusicSong_Vtbl =
131 {
132     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
133         IDirectMusicSongImpl_QueryInterface,
134         IDirectMusicSongImpl_AddRef,
135         IDirectMusicSongImpl_Release,
136         IDirectMusicSongImpl_Compose,
137         IDirectMusicSongImpl_GetParam,
138         IDirectMusicSongImpl_GetSegment,
139         IDirectMusicSongImpl_GetAudioPathConfig,
140         IDirectMusicSongImpl_Download,
141         IDirectMusicSongImpl_Unload,
142         IDirectMusicSongImpl_EnumSegment
143 };
144
145 /* for ClassFactory */
146 HRESULT WINAPI DMUSIC_CreateDirectMusicSong (LPCGUID lpcGUID, LPDIRECTMUSICSONG *ppDMSng, LPUNKNOWN pUnkOuter)
147 {
148         IDirectMusicSongImpl* dmsong;
149         
150         if (IsEqualIID (lpcGUID, &IID_IDirectMusicSong)) {
151                 dmsong = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongImpl));
152                 if (NULL == dmsong) {
153                         *ppDMSng = (LPDIRECTMUSICSONG) NULL;
154                         return E_OUTOFMEMORY;
155                 }
156                 dmsong->lpVtbl = &DirectMusicSong_Vtbl;
157                 dmsong->ref = 1;
158                 *ppDMSng = (LPDIRECTMUSICSONG) dmsong;
159                 return S_OK;
160         }
161         WARN("No interface found\n");
162         
163         return E_NOINTERFACE;
164 }
165
166 /*****************************************************************************
167  * IDirectMusicSongObject implementation
168  */
169 /* IDirectMusicSongObject IUnknown part: */
170 HRESULT WINAPI IDirectMusicSongObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj)
171 {
172         ICOM_THIS(IDirectMusicSongObject,iface);
173
174         if (IsEqualIID (riid, &IID_IUnknown) 
175                 || IsEqualIID (riid, &IID_IDirectMusicObject)) {
176                 IDirectMusicSongObject_AddRef(iface);
177                 *ppobj = This;
178                 return S_OK;
179         } else if (IsEqualIID (riid, &IID_IPersistStream)) {
180                 IPersistStream_AddRef ((LPPERSISTSTREAM)This->pStream);
181                 *ppobj = (LPPERSISTSTREAM)This->pStream;
182                 return S_OK;
183         } else if (IsEqualIID (riid, &IID_IDirectMusicSong)) {
184                 IDirectMusicSong_AddRef ((LPDIRECTMUSICSONG)This->pSong);
185                 *ppobj = (LPDIRECTMUSICSONG)This->pSong;
186                 return S_OK;
187         }
188         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
189         return E_NOINTERFACE;
190 }
191
192 ULONG WINAPI IDirectMusicSongObject_AddRef (LPDIRECTMUSICOBJECT iface)
193 {
194         ICOM_THIS(IDirectMusicSongObject,iface);
195         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
196         return ++(This->ref);
197 }
198
199 ULONG WINAPI IDirectMusicSongObject_Release (LPDIRECTMUSICOBJECT iface)
200 {
201         ICOM_THIS(IDirectMusicSongObject,iface);
202         ULONG ref = --This->ref;
203         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
204         if (ref == 0) {
205                 HeapFree(GetProcessHeap(), 0, This);
206         }
207         return ref;
208 }
209
210 /* IDirectMusicSongObject IDirectMusicObject part: */
211 HRESULT WINAPI IDirectMusicSongObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
212 {
213         ICOM_THIS(IDirectMusicSongObject,iface);
214
215         TRACE("(%p, %p)\n", This, pDesc);
216         pDesc = This->pDesc;
217         
218         return S_OK;
219 }
220
221 HRESULT WINAPI IDirectMusicSongObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
222 {
223         ICOM_THIS(IDirectMusicSongObject,iface);
224
225         TRACE("(%p, %p)\n", This, pDesc);
226         This->pDesc = pDesc;
227
228         return S_OK;
229 }
230
231 HRESULT WINAPI IDirectMusicSongObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
232 {
233         ICOM_THIS(IDirectMusicSongObject,iface);
234
235         FIXME("(%p, %p, %p): stub\n", This, pStream, pDesc);
236
237         return S_OK;
238 }
239
240 ICOM_VTABLE(IDirectMusicObject) DirectMusicSongObject_Vtbl =
241 {
242     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
243         IDirectMusicSongObject_QueryInterface,
244         IDirectMusicSongObject_AddRef,
245         IDirectMusicSongObject_Release,
246         IDirectMusicSongObject_GetDescriptor,
247         IDirectMusicSongObject_SetDescriptor,
248         IDirectMusicSongObject_ParseDescriptor
249 };
250
251 /* for ClassFactory */
252 HRESULT WINAPI DMUSIC_CreateDirectMusicSongObject (LPCGUID lpcGUID, LPDIRECTMUSICOBJECT* ppObject, LPUNKNOWN pUnkOuter)
253 {
254         IDirectMusicSongObject *obj;
255         
256         TRACE("(%p,%p,%p)\n", lpcGUID, ppObject, pUnkOuter);
257         if (IsEqualIID (lpcGUID, &IID_IDirectMusicObject)) {
258                 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObject));
259                 if (NULL == obj) {
260                         *ppObject = (LPDIRECTMUSICOBJECT) NULL;
261                         return E_OUTOFMEMORY;
262                 }
263                 obj->lpVtbl = &DirectMusicSongObject_Vtbl;
264                 obj->ref = 1;
265                 /* prepare IPersistStream */
266                 obj->pStream = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSongObjectStream));
267                 obj->pStream->lpVtbl = &DirectMusicSongObjectStream_Vtbl;
268                 obj->pStream->ref = 1;  
269                 obj->pStream->pParentObject = obj;
270                 /* prepare IDirectMusicSong */
271                 DMUSIC_CreateDirectMusicSong (&IID_IDirectMusicSong, (LPDIRECTMUSICSONG*)&obj->pSong, NULL);
272                 obj->pSong->pObject = obj;
273                 *ppObject = (LPDIRECTMUSICOBJECT) obj;
274                 return S_OK;
275         }
276         WARN("No interface found\n");
277         
278         return E_NOINTERFACE;
279 }
280         
281 /*****************************************************************************
282  * IDirectMusicSongObjectStream implementation
283  */
284 /* IDirectMusicSongObjectStream IUnknown part: */
285 HRESULT WINAPI IDirectMusicSongObjectStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj)
286 {
287         ICOM_THIS(IDirectMusicSongObjectStream,iface);
288
289         if (IsEqualIID (riid, &IID_IUnknown)
290                 || IsEqualIID (riid, &IID_IPersistStream)) {
291                 IDirectMusicSongObjectStream_AddRef(iface);
292                 *ppobj = This;
293                 return S_OK;
294         }
295         WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
296         return E_NOINTERFACE;
297 }
298
299 ULONG WINAPI IDirectMusicSongObjectStream_AddRef (LPPERSISTSTREAM iface)
300 {
301         ICOM_THIS(IDirectMusicSongObjectStream,iface);
302         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
303         return ++(This->ref);
304 }
305
306 ULONG WINAPI IDirectMusicSongObjectStream_Release (LPPERSISTSTREAM iface)
307 {
308         ICOM_THIS(IDirectMusicSongObjectStream,iface);
309         ULONG ref = --This->ref;
310         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
311         if (ref == 0) {
312                 HeapFree(GetProcessHeap(), 0, This);
313         }
314         return ref;
315 }
316
317 /* IDirectMusicSongObjectStream IPersist part: */
318 HRESULT WINAPI IDirectMusicSongObjectStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID)
319 {
320         return E_NOTIMPL;
321 }
322
323 /* IDirectMusicSongObjectStream IPersistStream part: */
324 HRESULT WINAPI IDirectMusicSongObjectStream_IsDirty (LPPERSISTSTREAM iface)
325 {
326         return E_NOTIMPL;
327 }
328
329 HRESULT WINAPI IDirectMusicSongObjectStream_Load (LPPERSISTSTREAM iface, IStream* pStm)
330 {
331         FIXME(": Loading not implemented yet\n");
332         return S_OK;
333 }
334
335 HRESULT WINAPI IDirectMusicSongObjectStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty)
336 {
337         return E_NOTIMPL;
338 }
339
340 HRESULT WINAPI IDirectMusicSongObjectStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize)
341 {
342         return E_NOTIMPL;
343 }
344
345 ICOM_VTABLE(IPersistStream) DirectMusicSongObjectStream_Vtbl =
346 {
347     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
348         IDirectMusicSongObjectStream_QueryInterface,
349         IDirectMusicSongObjectStream_AddRef,
350         IDirectMusicSongObjectStream_Release,
351         IDirectMusicSongObjectStream_GetClassID,
352         IDirectMusicSongObjectStream_IsDirty,
353         IDirectMusicSongObjectStream_Load,
354         IDirectMusicSongObjectStream_Save,
355         IDirectMusicSongObjectStream_GetSizeMax
356 };