Commit daf7fb1f authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmscript: COM cleanup for IPersistStream from DirectMusicScriptTrack.

parent a0c0e367
...@@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmscript); ...@@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmscript);
typedef struct DirectMusicScriptTrack { typedef struct DirectMusicScriptTrack {
const IUnknownVtbl *UnknownVtbl; const IUnknownVtbl *UnknownVtbl;
IDirectMusicTrack8 IDirectMusicTrack8_iface; IDirectMusicTrack8 IDirectMusicTrack8_iface;
const IPersistStreamVtbl *PersistStreamVtbl; IPersistStream IPersistStream_iface;
LONG ref; LONG ref;
LPDMUS_OBJECTDESC pDesc; LPDMUS_OBJECTDESC pDesc;
} DirectMusicScriptTrack; } DirectMusicScriptTrack;
...@@ -40,6 +40,11 @@ static inline DirectMusicScriptTrack *impl_from_IDirectMusicTrack8(IDirectMusicT ...@@ -40,6 +40,11 @@ static inline DirectMusicScriptTrack *impl_from_IDirectMusicTrack8(IDirectMusicT
return CONTAINING_RECORD(iface, DirectMusicScriptTrack, IDirectMusicTrack8_iface); return CONTAINING_RECORD(iface, DirectMusicScriptTrack, IDirectMusicTrack8_iface);
} }
static inline DirectMusicScriptTrack *impl_from_IPersistStream(IPersistStream *iface)
{
return CONTAINING_RECORD(iface, DirectMusicScriptTrack, IPersistStream_iface);
}
/* IDirectMusicScriptTrack IUnknown part: */ /* IDirectMusicScriptTrack IUnknown part: */
static HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicScriptTrack, UnknownVtbl, iface); ICOM_THIS_MULTI(IDirectMusicScriptTrack, UnknownVtbl, iface);
...@@ -55,8 +60,8 @@ static HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN ...@@ -55,8 +60,8 @@ static HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN
IDirectMusicTrack_AddRef(&This->IDirectMusicTrack8_iface); IDirectMusicTrack_AddRef(&This->IDirectMusicTrack8_iface);
return S_OK; return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) { } else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = &This->PersistStreamVtbl; *ppobj = &This->IPersistStream_iface;
IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl); IPersistStream_AddRef(&This->IPersistStream_iface);
return S_OK; return S_OK;
} }
...@@ -271,19 +276,19 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { ...@@ -271,19 +276,19 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
static HRESULT WINAPI IPersistStreamImpl_QueryInterface(IPersistStream *iface, REFIID riid, static HRESULT WINAPI IPersistStreamImpl_QueryInterface(IPersistStream *iface, REFIID riid,
void **ppobj) void **ppobj)
{ {
ICOM_THIS_MULTI(IDirectMusicScriptTrack, PersistStreamVtbl, iface); DirectMusicScriptTrack *This = impl_from_IPersistStream(iface);
return IDirectMusicScriptTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); return IDirectMusicScriptTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
} }
static ULONG WINAPI IPersistStreamImpl_AddRef(IPersistStream *iface) static ULONG WINAPI IPersistStreamImpl_AddRef(IPersistStream *iface)
{ {
ICOM_THIS_MULTI(IDirectMusicScriptTrack, PersistStreamVtbl, iface); DirectMusicScriptTrack *This = impl_from_IPersistStream(iface);
return IDirectMusicScriptTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); return IDirectMusicScriptTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
} }
static ULONG WINAPI IPersistStreamImpl_Release(IPersistStream *iface) static ULONG WINAPI IPersistStreamImpl_Release(IPersistStream *iface)
{ {
ICOM_THIS_MULTI(IDirectMusicScriptTrack, PersistStreamVtbl, iface); DirectMusicScriptTrack *This = impl_from_IPersistStream(iface);
return IDirectMusicScriptTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); return IDirectMusicScriptTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
} }
...@@ -314,7 +319,7 @@ static HRESULT WINAPI IPersistStreamImpl_GetSizeMax(IPersistStream *iface, ULARG ...@@ -314,7 +319,7 @@ static HRESULT WINAPI IPersistStreamImpl_GetSizeMax(IPersistStream *iface, ULARG
return E_NOTIMPL; return E_NOTIMPL;
} }
static const IPersistStreamVtbl DirectMusicScriptTrack_PersistStream_Vtbl = { static const IPersistStreamVtbl persist_vtbl = {
IPersistStreamImpl_QueryInterface, IPersistStreamImpl_QueryInterface,
IPersistStreamImpl_AddRef, IPersistStreamImpl_AddRef,
IPersistStreamImpl_Release, IPersistStreamImpl_Release,
...@@ -342,7 +347,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack(LPCGUID lpcGUID, void **ppobj ...@@ -342,7 +347,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack(LPCGUID lpcGUID, void **ppobj
track->UnknownVtbl = &DirectMusicScriptTrack_Unknown_Vtbl; track->UnknownVtbl = &DirectMusicScriptTrack_Unknown_Vtbl;
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
track->PersistStreamVtbl = &DirectMusicScriptTrack_PersistStream_Vtbl; track->IPersistStream_iface.lpVtbl = &persist_vtbl;
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(track->pDesc); DM_STRUCT_INIT(track->pDesc);
track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment