2013-01-09 10:22:55 +01:00
|
|
|
/*
|
|
|
|
* IDirectMusicDownload Implementation
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmusic_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicDownloadImpl IUnknown part: */
|
2013-01-09 10:22:55 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IDirectMusicDownload))
|
|
|
|
{
|
|
|
|
IDirectMusicDownload_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_iface = NULL;
|
|
|
|
WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
|
|
|
|
return E_NOINTERFACE;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
|
|
|
|
{
|
|
|
|
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
DMUSIC_LockModule();
|
2005-01-26 20:41:43 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
return ref;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
|
|
|
|
{
|
|
|
|
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
if (!ref)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
DMUSIC_UnlockModule();
|
2005-01-26 20:41:43 +01:00
|
|
|
|
2013-01-09 10:22:55 +01:00
|
|
|
return ref;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
|
2013-01-09 10:22:55 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
|
|
|
|
|
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
|
2013-01-09 10:22:55 +01:00
|
|
|
IDirectMusicDownloadImpl_QueryInterface,
|
|
|
|
IDirectMusicDownloadImpl_AddRef,
|
|
|
|
IDirectMusicDownloadImpl_Release,
|
|
|
|
IDirectMusicDownloadImpl_GetBuffer
|
2003-07-22 00:10:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* for ClassFactory */
|
2013-01-09 10:22:55 +01:00
|
|
|
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
|
|
|
|
{
|
|
|
|
IDirectMusicDownloadImpl *download;
|
|
|
|
|
|
|
|
download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
|
|
|
|
if (!download)
|
|
|
|
{
|
|
|
|
*ret_iface = NULL;
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
|
|
|
|
download->ref = 1;
|
2013-01-20 13:09:41 +01:00
|
|
|
*ret_iface = download;
|
2013-01-09 10:22:55 +01:00
|
|
|
return S_OK;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|