Commit 91ee5676 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dmime: COM cleanup of IDirectMusicGraph interface.

parent 0eb62658
......@@ -138,23 +138,6 @@ struct IDirectMusicSegment8Impl {
};
/*****************************************************************************
* IDirectMusicGraphImpl implementation structure
*/
struct IDirectMusicGraphImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicGraphVtbl *GraphVtbl;
const IDirectMusicObjectVtbl *ObjectVtbl;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref;
/* IDirectMusicGraphImpl fields */
LPDMUS_OBJECTDESC pDesc;
WORD num_tools;
struct list Tools;
};
/*****************************************************************************
* IDirectMusicAudioPathImpl implementation structure
*/
struct IDirectMusicAudioPathImpl {
......
......@@ -22,242 +22,251 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
/*****************************************************************************
* IDirectMusicGraphImpl implementation
*/
/* IDirectMusicGraphImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicGraphImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = &This->UnknownVtbl;
IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicGraph)) {
*ppobj = &This->GraphVtbl;
IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
*ppobj = &This->ObjectVtbl;
IUnknown_AddRef (iface);
return S_OK;
} else if (IsEqualIID (riid, &IID_IPersistStream)) {
*ppobj = &This->PersistStreamVtbl;
IUnknown_AddRef (iface);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
struct IDirectMusicGraphImpl {
IDirectMusicGraph IDirectMusicGraph_iface;
IDirectMusicObject IDirectMusicObject_iface;
IPersistStream IPersistStream_iface;
LONG ref;
/* IDirectMusicGraphImpl fields */
LPDMUS_OBJECTDESC pDesc;
WORD num_tools;
struct list Tools;
};
static inline IDirectMusicGraphImpl *impl_from_IDirectMusicGraph(IDirectMusicGraph *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IDirectMusicGraph_iface);
}
static ULONG WINAPI IDirectMusicGraphImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface);
ULONG ref = InterlockedIncrement(&This->ref);
static inline IDirectMusicGraphImpl *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IDirectMusicObject_iface);
}
TRACE("(%p): AddRef from %d\n", This, ref - 1);
static inline IDirectMusicGraphImpl *impl_from_IPersistStream(IPersistStream *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IPersistStream_iface);
}
DMIME_LockModule();
static HRESULT WINAPI DirectMusicGraph_QueryInterface(IDirectMusicGraph *iface, REFIID riid, void **ret_iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
return ref;
}
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ret_iface);
static ULONG WINAPI IDirectMusicGraphImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %d\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
*ret_iface = NULL;
DMIME_UnlockModule();
return ref;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDirectMusicGraph))
{
*ret_iface = &This->IDirectMusicGraph_iface;
}
else if (IsEqualIID(riid, &IID_IDirectMusicObject))
*ret_iface = &This->IDirectMusicObject_iface;
else if (IsEqualIID(riid, &IID_IPersistStream))
*ret_iface = &This->IPersistStream_iface;
if (*ret_iface)
{
IDirectMusicGraph_AddRef(iface);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ret_iface);
return E_NOINTERFACE;
}
static const IUnknownVtbl DirectMusicGraph_Unknown_Vtbl = {
IDirectMusicGraphImpl_IUnknown_QueryInterface,
IDirectMusicGraphImpl_IUnknown_AddRef,
IDirectMusicGraphImpl_IUnknown_Release
};
static ULONG WINAPI DirectMusicGraph_AddRef(IDirectMusicGraph *iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
ULONG ref = InterlockedIncrement(&This->ref);
/* IDirectMusicGraphImpl IDirectMusicGraph part: */
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_QueryInterface (LPDIRECTMUSICGRAPH iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
}
TRACE("(%p): %d\n", This, ref);
static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_AddRef (LPDIRECTMUSICGRAPH iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
DMIME_LockModule();
return ref;
}
static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_Release (LPDIRECTMUSICGRAPH iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
static ULONG WINAPI DirectMusicGraph_Release(IDirectMusicGraph *iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
ULONG ref = InterlockedDecrement(&This->ref);
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_StampPMsg (LPDIRECTMUSICGRAPH iface, DMUS_PMSG* pPMSG) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
FIXME("(%p, %p): stub\n", This, pPMSG);
return S_OK;
TRACE("(%p): %d\n", This, ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
DMIME_UnlockModule();
return ref;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_InsertTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool, DWORD* pdwPChannels, DWORD cPChannels, LONG lIndex) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
static HRESULT WINAPI DirectMusicGraph_StampPMsg(IDirectMusicGraph *iface, DMUS_PMSG *msg)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
FIXME("(%p, %p): stub\n", This, msg);
return S_OK;
}
struct list* pEntry = NULL;
struct list* pPrevEntry = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pNewTool = NULL;
static HRESULT WINAPI DirectMusicGraph_InsertTool(IDirectMusicGraph *iface, IDirectMusicTool* pTool, DWORD* pdwPChannels, DWORD cPChannels, LONG lIndex)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
struct list* pEntry = NULL;
struct list* pPrevEntry = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pNewTool = NULL;
FIXME("(%p, %p, %p, %d, %i): use of pdwPChannels\n", This, pTool, pdwPChannels, cPChannels, lIndex);
FIXME("(%p, %p, %p, %d, %i): use of pdwPChannels\n", This, pTool, pdwPChannels, cPChannels, lIndex);
if (NULL == pTool) {
return E_POINTER;
}
if (0 > lIndex) {
lIndex = This->num_tools + lIndex;
}
pPrevEntry = &This->Tools;
LIST_FOR_EACH (pEntry, &This->Tools) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry);
if (pIt->dwIndex == lIndex) {
return DMUS_E_ALREADY_EXISTS;
if (!pTool)
return E_POINTER;
if (lIndex < 0)
lIndex = This->num_tools + lIndex;
pPrevEntry = &This->Tools;
LIST_FOR_EACH(pEntry, &This->Tools)
{
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry);
if (pIt->dwIndex == lIndex)
return DMUS_E_ALREADY_EXISTS;
if (pIt->dwIndex > lIndex)
break ;
pPrevEntry = pEntry;
}
if (pIt->dwIndex > lIndex) {
break ;
}
pPrevEntry = pEntry;
}
++This->num_tools;
pNewTool = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_GRAPH_TOOL));
pNewTool->pTool = pTool;
pNewTool->dwIndex = lIndex;
IDirectMusicTool8_AddRef(pTool);
IDirectMusicTool8_Init(pTool, iface);
list_add_tail (pPrevEntry->next, &pNewTool->entry);
++This->num_tools;
pNewTool = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_GRAPH_TOOL));
pNewTool->pTool = pTool;
pNewTool->dwIndex = lIndex;
IDirectMusicTool8_AddRef(pTool);
IDirectMusicTool8_Init(pTool, iface);
list_add_tail (pPrevEntry->next, &pNewTool->entry);
#if 0
DWORD dwNum = 0;
IDirectMusicTool8_GetMediaTypes(pTool, &dwNum);
#endif
return DS_OK;
return DS_OK;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_GetTool (LPDIRECTMUSICGRAPH iface, DWORD dwIndex, IDirectMusicTool** ppTool) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
struct list* pEntry = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL;
static HRESULT WINAPI DirectMusicGraph_GetTool(IDirectMusicGraph *iface, DWORD dwIndex, IDirectMusicTool** ppTool)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
struct list* pEntry = NULL;
LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL;
FIXME("(%p, %d, %p): stub\n", This, dwIndex, ppTool);
LIST_FOR_EACH (pEntry, &This->Tools) {
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry);
if (pIt->dwIndex == dwIndex) {
*ppTool = pIt->pTool;
if (NULL != *ppTool) {
IDirectMusicTool8_AddRef((LPDIRECTMUSICTOOL8) *ppTool);
}
return S_OK;
FIXME("(%p, %d, %p): stub\n", This, dwIndex, ppTool);
LIST_FOR_EACH (pEntry, &This->Tools)
{
pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry);
if (pIt->dwIndex == dwIndex)
{
*ppTool = pIt->pTool;
if (*ppTool)
IDirectMusicTool_AddRef(*ppTool);
return S_OK;
}
if (pIt->dwIndex > dwIndex)
break ;
}
if (pIt->dwIndex > dwIndex) {
break ;
}
}
return DMUS_E_NOT_FOUND;
return DMUS_E_NOT_FOUND;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_RemoveTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface);
FIXME("(%p, %p): stub\n", This, pTool);
return S_OK;
static HRESULT WINAPI DirectMusicGraph_RemoveTool(IDirectMusicGraph *iface, IDirectMusicTool* pTool)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface);
FIXME("(%p, %p): stub\n", This, pTool);
return S_OK;
}
static const IDirectMusicGraphVtbl DirectMusicGraph_Graph_Vtbl = {
IDirectMusicGraphImpl_IDirectMusicGraph_QueryInterface,
IDirectMusicGraphImpl_IDirectMusicGraph_AddRef,
IDirectMusicGraphImpl_IDirectMusicGraph_Release,
IDirectMusicGraphImpl_IDirectMusicGraph_StampPMsg,
IDirectMusicGraphImpl_IDirectMusicGraph_InsertTool,
IDirectMusicGraphImpl_IDirectMusicGraph_GetTool,
IDirectMusicGraphImpl_IDirectMusicGraph_RemoveTool
static const IDirectMusicGraphVtbl DirectMusicGraphVtbl =
{
DirectMusicGraph_QueryInterface,
DirectMusicGraph_AddRef,
DirectMusicGraph_Release,
DirectMusicGraph_StampPMsg,
DirectMusicGraph_InsertTool,
DirectMusicGraph_GetTool,
DirectMusicGraph_RemoveTool
};
/* IDirectMusicGraphImpl IDirectMusicObject part: */
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
static HRESULT WINAPI DirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicGraph_QueryInterface(&This->IDirectMusicGraph_iface, riid, ret_iface);
}
static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
static ULONG WINAPI DirectMusicObject_AddRef(IDirectMusicObject *iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicGraph_AddRef(&This->IDirectMusicGraph_iface);
}
static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
static ULONG WINAPI DirectMusicObject_Release(IDirectMusicObject *iface)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicGraph_Release(&This->IDirectMusicGraph_iface);
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
TRACE("(%p, %p)\n", This, pDesc);
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
return S_OK;
static HRESULT WINAPI DirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
TRACE("(%p, %p)\n", This, desc);
/* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */
memcpy(desc, This->pDesc, This->pDesc->dwSize);
return S_OK;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
/* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
This->pDesc->guidClass = pDesc->guidClass;
if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE)
This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
This->pDesc->llMemLength = pDesc->llMemLength;
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength);
}
if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
/* according to MSDN, we copy the stream */
IStream_Clone (pDesc->pStream, &This->pDesc->pStream);
}
/* add new flags */
This->pDesc->dwValidData |= pDesc->dwValidData;
static HRESULT WINAPI DirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *pDesc)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
TRACE("(%p, %p): %s\n", This, pDesc, debugstr_DMUS_OBJECTDESC(pDesc));
/* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
This->pDesc->guidClass = pDesc->guidClass;
if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE)
This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY)
{
This->pDesc->llMemLength = pDesc->llMemLength;
memcpy(This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength);
}
return S_OK;
/* according to MSDN, we copy the stream */
if (pDesc->dwValidData & DMUS_OBJ_STREAM)
IStream_Clone(pDesc->pStream, &This->pDesc->pStream);
/* add new flags */
This->pDesc->dwValidData |= pDesc->dwValidData;
return S_OK;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */
static HRESULT WINAPI DirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, IStream *pStream, DMUS_OBJECTDESC *pDesc)
{
IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */
TRACE("(%p, %p, %p)\n", This, pStream, pDesc);
TRACE("(%p, %p, %p)\n", This, pStream, pDesc);
/* FIXME: should this be determined from stream? */
pDesc->dwValidData |= DMUS_OBJ_CLASS;
......@@ -399,41 +408,51 @@ static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor (
return S_OK;
}
static const IDirectMusicObjectVtbl DirectMusicGraph_Object_Vtbl = {
IDirectMusicGraphImpl_IDirectMusicObject_QueryInterface,
IDirectMusicGraphImpl_IDirectMusicObject_AddRef,
IDirectMusicGraphImpl_IDirectMusicObject_Release,
IDirectMusicGraphImpl_IDirectMusicObject_GetDescriptor,
IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor,
IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor
static const IDirectMusicObjectVtbl DirectMusicObjectVtbl =
{
DirectMusicObject_QueryInterface,
DirectMusicObject_AddRef,
DirectMusicObject_Release,
DirectMusicObject_GetDescriptor,
DirectMusicObject_SetDescriptor,
DirectMusicObject_ParseDescriptor
};
/* IDirectMusicGraphImpl IPersistStream part: */
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface);
return IDirectMusicGraphImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
static HRESULT WINAPI PersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicGraph_QueryInterface(&This->IDirectMusicGraph_iface, riid, ret_iface);
}
static ULONG WINAPI IDirectMusicGraphImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface);
return IDirectMusicGraphImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
static ULONG WINAPI PersistStream_AddRef(IPersistStream *iface)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicGraph_AddRef(&This->IDirectMusicGraph_iface);
}
static ULONG WINAPI IDirectMusicGraphImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface);
return IDirectMusicGraphImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
static ULONG WINAPI PersistStream_Release(IPersistStream *iface)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicGraph_Release(&This->IDirectMusicGraph_iface);
}
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
static HRESULT WINAPI PersistStream_GetClassID(IPersistStream *iface, CLSID *clsid)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p) %p: stub\n", This, clsid);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
static HRESULT WINAPI PersistStream_IsDirty(IPersistStream *iface)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface);
static HRESULT WINAPI PersistStream_Load(IPersistStream *iface, IStream* pStm)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
FOURCC chunkID;
DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3];
LARGE_INTEGER liMove; /* used when skipping chunks */
......@@ -578,45 +597,56 @@ static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_Load (LPPERSISTSTREAM
return S_OK;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
return E_NOTIMPL;
static HRESULT WINAPI PersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p) %p %d\n", This, stream, clear_dirty);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
return E_NOTIMPL;
static HRESULT WINAPI PersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size)
{
IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p) %p\n", This, size);
return E_NOTIMPL;
}
static const IPersistStreamVtbl DirectMusicGraph_PersistStream_Vtbl = {
IDirectMusicGraphImpl_IPersistStream_QueryInterface,
IDirectMusicGraphImpl_IPersistStream_AddRef,
IDirectMusicGraphImpl_IPersistStream_Release,
IDirectMusicGraphImpl_IPersistStream_GetClassID,
IDirectMusicGraphImpl_IPersistStream_IsDirty,
IDirectMusicGraphImpl_IPersistStream_Load,
IDirectMusicGraphImpl_IPersistStream_Save,
IDirectMusicGraphImpl_IPersistStream_GetSizeMax
static const IPersistStreamVtbl PersistStreamVtbl =
{
PersistStream_QueryInterface,
PersistStream_AddRef,
PersistStream_Release,
PersistStream_GetClassID,
PersistStream_IsDirty,
PersistStream_Load,
PersistStream_Save,
PersistStream_GetSizeMax
};
/* for ClassFactory */
HRESULT WINAPI create_dmgraph(REFIID lpcGUID, void **ppobj)
HRESULT WINAPI create_dmgraph(REFIID riid, void **ret_iface)
{
IDirectMusicGraphImpl* obj;
IDirectMusicGraphImpl* obj;
HRESULT hr;
*ret_iface = NULL;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
if (NULL == obj) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->UnknownVtbl = &DirectMusicGraph_Unknown_Vtbl;
obj->GraphVtbl = &DirectMusicGraph_Graph_Vtbl;
obj->ObjectVtbl = &DirectMusicGraph_Object_Vtbl;
obj->PersistStreamVtbl = &DirectMusicGraph_PersistStream_Vtbl;
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
obj->pDesc->guidClass = CLSID_DirectMusicGraph;
obj->ref = 0; /* will be inited by QueryInterface */
list_init (&obj->Tools);
return IDirectMusicGraphImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl));
if (!obj)
return E_OUTOFMEMORY;
obj->IDirectMusicGraph_iface.lpVtbl = &DirectMusicGraphVtbl;
obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicObjectVtbl;
obj->IPersistStream_iface.lpVtbl = &PersistStreamVtbl;
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
obj->pDesc->guidClass = CLSID_DirectMusicGraph;
obj->ref = 1;
list_init(&obj->Tools);
hr = IDirectMusicGraph_QueryInterface(&obj->IDirectMusicGraph_iface, riid, ret_iface);
IDirectMusicGraph_Release(&obj->IDirectMusicGraph_iface);
return hr;
}
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