dmusic: COM cleanup of IDirectMusicDownload.
This commit is contained in:
parent
ba6932459a
commit
1c77528a89
|
@ -149,7 +149,7 @@ struct IDirectMusicDownloadedInstrumentImpl {
|
||||||
*/
|
*/
|
||||||
struct IDirectMusicDownloadImpl {
|
struct IDirectMusicDownloadImpl {
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
const IDirectMusicDownloadVtbl *lpVtbl;
|
IDirectMusicDownload IDirectMusicDownload_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* IDirectMusicDownloadImpl fields */
|
/* IDirectMusicDownloadImpl fields */
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* IDirectMusicDownload Implementation
|
/*
|
||||||
|
* IDirectMusicDownload Implementation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2003-2004 Rok Mandeljc
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
||||||
*
|
*
|
||||||
|
@ -21,51 +22,61 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||||
|
|
||||||
/* IDirectMusicDownloadImpl IUnknown part: */
|
static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
|
||||||
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
|
{
|
||||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
|
||||||
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
}
|
||||||
|
|
||||||
if (IsEqualIID (riid, &IID_IUnknown)
|
/* IDirectMusicDownloadImpl IUnknown part: */
|
||||||
|| IsEqualIID (riid, &IID_IDirectMusicDownload)) {
|
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
|
||||||
IUnknown_AddRef(iface);
|
{
|
||||||
*ppobj = This;
|
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;
|
return S_OK;
|
||||||
}
|
}
|
||||||
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
|
||||||
|
*ret_iface = NULL;
|
||||||
|
WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
|
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
|
||||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
{
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||||
|
|
||||||
DMUSIC_LockModule();
|
DMUSIC_LockModule();
|
||||||
|
|
||||||
return refCount;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
|
static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
|
||||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
{
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||||
|
|
||||||
if (!refCount) {
|
if (!ref)
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
|
||||||
|
|
||||||
DMUSIC_UnlockModule();
|
DMUSIC_UnlockModule();
|
||||||
|
|
||||||
return refCount;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
|
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
|
||||||
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) {
|
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
|
||||||
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
|
{
|
||||||
FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize);
|
FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,16 +88,19 @@ static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for ClassFactory */
|
/* for ClassFactory */
|
||||||
HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
|
||||||
IDirectMusicDownloadImpl* dmdl;
|
{
|
||||||
|
IDirectMusicDownloadImpl *download;
|
||||||
|
|
||||||
dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
|
download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
|
||||||
if (NULL == dmdl) {
|
if (!download)
|
||||||
*ppobj = NULL;
|
{
|
||||||
|
*ret_iface = NULL;
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
dmdl->lpVtbl = &DirectMusicDownload_Vtbl;
|
|
||||||
dmdl->ref = 0; /* will be inited by QueryInterface */
|
|
||||||
|
|
||||||
return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj);
|
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
|
||||||
|
download->ref = 1;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue