[PATCH 3/6] dmloader: Add and use a generic IPersistStream_GetClassID.
Michael Stefaniuc
mstefani at redhat.de
Mon Apr 27 17:13:38 CDT 2015
---
dlls/dmloader/container.c | 15 +--------------
dlls/dmloader/dmobject.c | 15 +++++++++++++++
dlls/dmloader/dmobject.h | 2 ++
dlls/dmloader/tests/loader.c | 2 ++
dlls/dmusic/dmobject.c | 15 +++++++++++++++
dlls/dmusic/dmobject.h | 2 ++
6 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/dlls/dmloader/container.c b/dlls/dmloader/container.c
index 7356bc8..2e15a71 100644
--- a/dlls/dmloader/container.c
+++ b/dlls/dmloader/container.c
@@ -368,19 +368,6 @@ static inline IDirectMusicContainerImpl *impl_from_IPersistStream(IPersistStream
return CONTAINING_RECORD(iface, IDirectMusicContainerImpl, dmobj.IPersistStream_iface);
}
-static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
- IDirectMusicContainerImpl *This = impl_from_IPersistStream(iface);
-
- TRACE("(%p, %p)\n", This, pClassID);
- if (IsBadWritePtr (pClassID, sizeof(CLSID))) {
- ERR(": pClassID bad write pointer\n");
- return E_POINTER;
- }
-
- *pClassID = CLSID_DirectMusicContainer;
- return S_OK;
-}
-
static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
IDirectMusicContainerImpl *This = impl_from_IPersistStream(iface);
WINE_CHUNK Chunk;
@@ -803,7 +790,7 @@ static const IPersistStreamVtbl persiststream_vtbl = {
dmobj_IPersistStream_QueryInterface,
dmobj_IPersistStream_AddRef,
dmobj_IPersistStream_Release,
- IDirectMusicContainerImpl_IPersistStream_GetClassID,
+ dmobj_IPersistStream_GetClassID,
unimpl_IPersistStream_IsDirty,
IDirectMusicContainerImpl_IPersistStream_Load,
unimpl_IPersistStream_Save,
diff --git a/dlls/dmloader/dmobject.c b/dlls/dmloader/dmobject.c
index 4afd5b9..cabb6f7 100644
--- a/dlls/dmloader/dmobject.c
+++ b/dlls/dmloader/dmobject.c
@@ -1,5 +1,6 @@
/*
* 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
@@ -134,6 +135,20 @@ ULONG WINAPI dmobj_IPersistStream_Release(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)
{
diff --git a/dlls/dmloader/dmobject.h b/dlls/dmloader/dmobject.h
index 3574939..ad6bf6d 100644
--- a/dlls/dmloader/dmobject.h
+++ b/dlls/dmloader/dmobject.h
@@ -1,5 +1,6 @@
/*
* Base IDirectMusicObject Implementation
+ * Keep in sync with the master in dlls/dmusic/dmobject.h
*
* Copyright (C) 2014 Michael Stefaniuc
*
@@ -42,6 +43,7 @@ HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID
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,
diff --git a/dlls/dmloader/tests/loader.c b/dlls/dmloader/tests/loader.c
index b2ba8fe..4b141f3 100644
--- a/dlls/dmloader/tests/loader.c
+++ b/dlls/dmloader/tests/loader.c
@@ -267,6 +267,8 @@ static void test_container(void)
/* IPersistStream */
hr = IDirectMusicContainer_QueryInterface(dmc, &IID_IPersistStream, (void**)&ps);
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
+ hr = IPersistStream_GetClassID(ps, NULL);
+ ok(hr == E_POINTER, "IPersistStream_GetClassID failed: %08x\n", hr);
hr = IPersistStream_GetClassID(ps, &class);
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
ok(IsEqualGUID(&class, &CLSID_DirectMusicContainer),
diff --git a/dlls/dmusic/dmobject.c b/dlls/dmusic/dmobject.c
index 4afd5b9..cabb6f7 100644
--- a/dlls/dmusic/dmobject.c
+++ b/dlls/dmusic/dmobject.c
@@ -1,5 +1,6 @@
/*
* 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
@@ -134,6 +135,20 @@ ULONG WINAPI dmobj_IPersistStream_Release(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)
{
diff --git a/dlls/dmusic/dmobject.h b/dlls/dmusic/dmobject.h
index 3574939..ad6bf6d 100644
--- a/dlls/dmusic/dmobject.h
+++ b/dlls/dmusic/dmobject.h
@@ -1,5 +1,6 @@
/*
* Base IDirectMusicObject Implementation
+ * Keep in sync with the master in dlls/dmusic/dmobject.h
*
* Copyright (C) 2014 Michael Stefaniuc
*
@@ -42,6 +43,7 @@ HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID
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,
--
2.1.0
More information about the wine-patches
mailing list