Commit 834a92cc authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dswave: Use the generic DirectMusicObject implementation for DSWave.

parent 5843a1a0
...@@ -2,6 +2,7 @@ MODULE = dswave.dll ...@@ -2,6 +2,7 @@ MODULE = dswave.dll
IMPORTS = dxguid uuid ole32 advapi32 IMPORTS = dxguid uuid ole32 advapi32
C_SRCS = \ C_SRCS = \
dmobject.c \
dswave.c \ dswave.c \
dswave_main.c dswave_main.c
......
/*
* Base IDirectMusicObject Implementation
* Keep in sync with the master in dlls/dmusic/dmobject.c
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2014 Michael Stefaniuc
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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
*/
#define COBJMACROS
#include "objbase.h"
#include "dmusici.h"
#include "dmobject.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmobj);
/* Generic IDirectMusicObject methods */
static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
{
return CONTAINING_RECORD(iface, struct dmobject, IDirectMusicObject_iface);
}
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid,
void **ret_iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
}
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_AddRef(This->outer_unk);
}
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_Release(This->outer_unk);
}
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, desc);
if (!desc)
return E_POINTER;
memcpy(desc, &This->desc, This->desc.dwSize);
return S_OK;
}
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
HRESULT ret = S_OK;
TRACE("(%p, %p)\n", iface, desc);
if (!desc)
return E_POINTER;
/* Immutable property */
if (desc->dwValidData & DMUS_OBJ_CLASS)
{
desc->dwValidData &= ~DMUS_OBJ_CLASS;
ret = S_FALSE;
}
/* Set only valid fields */
if (desc->dwValidData & DMUS_OBJ_OBJECT)
This->desc.guidObject = desc->guidObject;
if (desc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW(This->desc.wszName, desc->wszName, DMUS_MAX_NAME);
if (desc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW(This->desc.wszCategory, desc->wszCategory, DMUS_MAX_CATEGORY);
if (desc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW(This->desc.wszFileName, desc->wszFileName, DMUS_MAX_FILENAME);
if (desc->dwValidData & DMUS_OBJ_VERSION)
This->desc.vVersion = desc->vVersion;
if (desc->dwValidData & DMUS_OBJ_DATE)
This->desc.ftDate = desc->ftDate;
if (desc->dwValidData & DMUS_OBJ_MEMORY) {
This->desc.llMemLength = desc->llMemLength;
memcpy(This->desc.pbMemData, desc->pbMemData, desc->llMemLength);
}
if (desc->dwValidData & DMUS_OBJ_STREAM)
IStream_Clone(desc->pStream, &This->desc.pStream);
This->desc.dwValidData |= desc->dwValidData;
return ret;
}
/* Generic IPersistStream methods */
static inline struct dmobject *impl_from_IPersistStream(IPersistStream *iface)
{
return CONTAINING_RECORD(iface, struct dmobject, IPersistStream_iface);
}
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid,
void **ret_iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
}
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_AddRef(This->outer_unk);
}
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_Release(This->outer_unk);
}
HRESULT WINAPI dmobj_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class)
{
struct dmobject *This = impl_from_IPersistStream(iface);
TRACE("(%p, %p)\n", This, class);
if (!class)
return E_POINTER;
*class = This->desc.guidClass;
return S_OK;
}
/* IPersistStream methods not implemented in native */
HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class)
{
TRACE("(%p, %p): method not implemented\n", iface, class);
return E_NOTIMPL;
}
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface)
{
TRACE("(%p): method not implemented, always returning S_FALSE\n", iface);
return S_FALSE;
}
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream,
BOOL clear_dirty)
{
TRACE("(%p, %p, %d): method not implemented\n", iface, stream, clear_dirty);
return E_NOTIMPL;
}
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size)
{
TRACE("(%p, %p): method not implemented\n", iface, size);
return E_NOTIMPL;
}
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
{
dmobj->outer_unk = outer_unk;
dmobj->desc.dwSize = sizeof(dmobj->desc);
dmobj->desc.dwValidData = DMUS_OBJ_CLASS;
dmobj->desc.guidClass = *class;
}
/*
* Base IDirectMusicObject Implementation
* Keep in sync with the master in dlls/dmusic/dmobject.h
*
* Copyright (C) 2014 Michael Stefaniuc
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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
*/
struct dmobject {
IDirectMusicObject IDirectMusicObject_iface;
IPersistStream IPersistStream_iface;
IUnknown *outer_unk;
DMUS_OBJECTDESC desc;
};
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) DECLSPEC_HIDDEN;
/* Generic IDirectMusicObject methods */
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid,
void **ret_iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
/* Generic IPersistStream methods */
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid,
void **ret_iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class) DECLSPEC_HIDDEN;
/* IPersistStream methods not implemented in native */
HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface,
CLSID *class) DECLSPEC_HIDDEN;
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream,
BOOL clear_dirty) DECLSPEC_HIDDEN;
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface,
ULARGE_INTEGER *size) DECLSPEC_HIDDEN;
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "dswave_private.h" #include "dswave_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dswave); WINE_DEFAULT_DEBUG_CHANNEL(dswave);
WINE_DECLARE_DEBUG_CHANNEL(dmfile); WINE_DECLARE_DEBUG_CHANNEL(dmfile);
...@@ -31,8 +32,7 @@ static const GUID IID_IDirectMusicWavePRIVATE = {0x69e934e4,0x97f1,0x4f1d,{0x88, ...@@ -31,8 +32,7 @@ static const GUID IID_IDirectMusicWavePRIVATE = {0x69e934e4,0x97f1,0x4f1d,{0x88,
*/ */
typedef struct IDirectMusicWaveImpl { typedef struct IDirectMusicWaveImpl {
IUnknown IUnknown_iface; IUnknown IUnknown_iface;
const IDirectMusicObjectVtbl *ObjectVtbl; struct dmobject dmobj;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref; LONG ref;
LPDMUS_OBJECTDESC pDesc; LPDMUS_OBJECTDESC pDesc;
} IDirectMusicWaveImpl; } IDirectMusicWaveImpl;
...@@ -54,9 +54,9 @@ static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, ...@@ -54,9 +54,9 @@ static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid,
if (IsEqualIID(riid, &IID_IUnknown)) if (IsEqualIID(riid, &IID_IUnknown))
*ret_iface = iface; *ret_iface = iface;
else if (IsEqualIID(riid, &IID_IDirectMusicObject)) else if (IsEqualIID(riid, &IID_IDirectMusicObject))
*ret_iface = &This->ObjectVtbl; *ret_iface = &This->dmobj.IDirectMusicObject_iface;
else if (IsEqualIID(riid, &IID_IPersistStream)) else if (IsEqualIID(riid, &IID_IPersistStream))
*ret_iface = &This->PersistStreamVtbl; *ret_iface = &This->dmobj.IPersistStream_iface;
else if (IsEqualIID(riid, &IID_IDirectMusicWavePRIVATE)) { else if (IsEqualIID(riid, &IID_IDirectMusicWavePRIVATE)) {
FIXME("(%p, %s, %p): Unsupported private interface\n", This, debugstr_guid(riid), ret_iface); FIXME("(%p, %s, %p): Unsupported private interface\n", This, debugstr_guid(riid), ret_iface);
return E_NOINTERFACE; return E_NOINTERFACE;
...@@ -87,7 +87,6 @@ static ULONG WINAPI IUnknownImpl_Release(IUnknown *iface) ...@@ -87,7 +87,6 @@ static ULONG WINAPI IUnknownImpl_Release(IUnknown *iface)
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
if (!ref) { if (!ref) {
HeapFree(GetProcessHeap(), 0, This->pDesc);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
DSWAVE_UnlockModule(); DSWAVE_UnlockModule();
} }
...@@ -102,64 +101,9 @@ static const IUnknownVtbl unknown_vtbl = { ...@@ -102,64 +101,9 @@ static const IUnknownVtbl unknown_vtbl = {
}; };
/* IDirectMusicWaveImpl IDirectMusicObject part: */ /* IDirectMusicWaveImpl IDirectMusicObject part: */
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IDirectMusicObjectImpl_ParseDescriptor(IDirectMusicObject *iface,
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface); IStream *pStream, DMUS_OBJECTDESC *pDesc)
return IUnknown_QueryInterface(&This->IUnknown_iface, riid, ppobj); {
}
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
return IUnknown_AddRef(&This->IUnknown_iface);
}
static ULONG WINAPI IDirectMusicWaveImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
return IUnknown_Release(&This->IUnknown_iface);
}
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, 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 IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, ObjectVtbl, iface);
TRACE("(%p, %p, %s): setting descriptor:\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;
return S_OK;
}
static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) {
DMUS_PRIVATE_CHUNK Chunk; DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */ LARGE_INTEGER liMove; /* used when skipping chunks */
...@@ -306,42 +250,24 @@ static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor (L ...@@ -306,42 +250,24 @@ static HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor (L
return S_OK; return S_OK;
} }
static const IDirectMusicObjectVtbl DirectMusicWave_Object_Vtbl = { static const IDirectMusicObjectVtbl dmobject_vtbl = {
IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface, dmobj_IDirectMusicObject_QueryInterface,
IDirectMusicWaveImpl_IDirectMusicObject_AddRef, dmobj_IDirectMusicObject_AddRef,
IDirectMusicWaveImpl_IDirectMusicObject_Release, dmobj_IDirectMusicObject_Release,
IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor, dmobj_IDirectMusicObject_GetDescriptor,
IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor, dmobj_IDirectMusicObject_SetDescriptor,
IDirectMusicWaveImpl_IDirectMusicObject_ParseDescriptor IDirectMusicObjectImpl_ParseDescriptor
}; };
/* IDirectMusicWaveImpl IPersistStream part: */ /* IDirectMusicWaveImpl IPersistStream part: */
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { static inline IDirectMusicWaveImpl *impl_from_IPersistStream(IPersistStream *iface)
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface); {
return IUnknown_QueryInterface(&This->IUnknown_iface, riid, ppobj); return CONTAINING_RECORD(iface, IDirectMusicWaveImpl, dmobj.IPersistStream_iface);
}
static ULONG WINAPI IDirectMusicWaveImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
return IUnknown_AddRef(&This->IUnknown_iface);
}
static ULONG WINAPI IDirectMusicWaveImpl_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface);
return IUnknown_Release(&This->IUnknown_iface);
}
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
} }
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
ICOM_THIS_MULTI(IDirectMusicWaveImpl, PersistStreamVtbl, iface); {
IDirectMusicWaveImpl *This = impl_from_IPersistStream(iface);
DMUS_PRIVATE_CHUNK Chunk; DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */ LARGE_INTEGER liMove; /* used when skipping chunks */
...@@ -486,26 +412,17 @@ static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Load (LPPERSISTSTREAM ...@@ -486,26 +412,17 @@ static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Load (LPPERSISTSTREAM
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { static const IPersistStreamVtbl persiststream_vtbl = {
return E_NOTIMPL; dmobj_IPersistStream_QueryInterface,
} dmobj_IPersistStream_AddRef,
dmobj_IPersistStream_Release,
static HRESULT WINAPI IDirectMusicWaveImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { dmobj_IPersistStream_GetClassID,
return E_NOTIMPL; unimpl_IPersistStream_IsDirty,
} IPersistStreamImpl_Load,
unimpl_IPersistStream_Save,
static const IPersistStreamVtbl DirectMusicWave_PersistStream_Vtbl = { unimpl_IPersistStream_GetSizeMax
IDirectMusicWaveImpl_IPersistStream_QueryInterface,
IDirectMusicWaveImpl_IPersistStream_AddRef,
IDirectMusicWaveImpl_IPersistStream_Release,
IDirectMusicWaveImpl_IPersistStream_GetClassID,
IDirectMusicWaveImpl_IPersistStream_IsDirty,
IDirectMusicWaveImpl_IPersistStream_Load,
IDirectMusicWaveImpl_IPersistStream_Save,
IDirectMusicWaveImpl_IPersistStream_GetSizeMax
}; };
/* for ClassFactory */ /* for ClassFactory */
HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ppobj) HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ppobj)
{ {
...@@ -518,13 +435,11 @@ HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ppobj) ...@@ -518,13 +435,11 @@ HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
obj->IUnknown_iface.lpVtbl = &unknown_vtbl; obj->IUnknown_iface.lpVtbl = &unknown_vtbl;
obj->ObjectVtbl = &DirectMusicWave_Object_Vtbl;
obj->PersistStreamVtbl = &DirectMusicWave_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_DirectMusicSegment; /* shown by tests */
obj->ref = 1; obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectSoundWave, &obj->IUnknown_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
obj->pDesc = &obj->dmobj.desc;
DSWAVE_LockModule(); DSWAVE_LockModule();
hr = IUnknown_QueryInterface(&obj->IUnknown_iface, lpcGUID, ppobj); hr = IUnknown_QueryInterface(&obj->IUnknown_iface, lpcGUID, ppobj);
......
...@@ -72,18 +72,9 @@ typedef struct { ...@@ -72,18 +72,9 @@ typedef struct {
const char* name; const char* name;
} guid_info; } guid_info;
/* used for initialising structs (primarily for DMUS_OBJECTDESC) */
#define DM_STRUCT_INIT(x) \
do { \
memset((x), 0, sizeof(*(x))); \
(x)->dwSize = sizeof(*x); \
} while (0)
#define FE(x) { x, #x } #define FE(x) { x, #x }
#define GE(x) { &x, #x } #define GE(x) { &x, #x }
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
/* FOURCC to string conversion for debug messages */ /* FOURCC to string conversion for debug messages */
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN; extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
/* returns name of given GUID */ /* returns name of given GUID */
......
...@@ -113,13 +113,13 @@ static void test_dswave(void) ...@@ -113,13 +113,13 @@ static void test_dswave(void)
hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps); hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps);
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
hr = IPersistStream_GetClassID(ps, &class); hr = IPersistStream_GetClassID(ps, &class);
todo_wine ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
todo_wine ok(IsEqualGUID(&class, &CLSID_DirectSoundWave), ok(IsEqualGUID(&class, &CLSID_DirectSoundWave),
"Expected class CLSID_DirectSoundWave got %s\n", wine_dbgstr_guid(&class)); "Expected class CLSID_DirectSoundWave got %s\n", wine_dbgstr_guid(&class));
/* Unimplemented IPersistStream methods */ /* Unimplemented IPersistStream methods */
hr = IPersistStream_IsDirty(ps); hr = IPersistStream_IsDirty(ps);
todo_wine ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
hr = IPersistStream_GetSizeMax(ps, &size); hr = IPersistStream_GetSizeMax(ps, &size);
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr); ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
hr = IPersistStream_Save(ps, NULL, TRUE); hr = IPersistStream_Save(ps, NULL, TRUE);
......
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