[PATCH 15/15] dsound: Move the QI implementation from IDirectSoundFullDuplex to IUnknown
Michael Stefaniuc
mstefani at redhat.de
Wed Aug 15 18:52:16 CDT 2012
---
dlls/dsound/duplex.c | 63 ++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/dlls/dsound/duplex.c b/dlls/dsound/duplex.c
index 5e57bbd..a2bc726 100644
--- a/dlls/dsound/duplex.c
+++ b/dlls/dsound/duplex.c
@@ -79,8 +79,30 @@ static inline IDirectSoundFullDuplexImpl *impl_from_IUnknown(IUnknown *iface)
static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
IDirectSoundFullDuplexImpl *This = impl_from_IUnknown(iface);
+
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
- return IDirectSoundFullDuplex_QueryInterface(&This->IDirectSoundFullDuplex_iface, riid, ppv);
+
+ if (!ppv) {
+ WARN("invalid parameter\n");
+ return E_INVALIDARG;
+ }
+
+ if (IsEqualIID(riid, &IID_IUnknown)) {
+ IUnknown_AddRef(&This->IUnknown_iface);
+ *ppv = &This->IUnknown_iface;
+ return S_OK;
+ } else if (IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
+ IDirectSoundFullDuplex_AddRef(&This->IDirectSoundFullDuplex_iface);
+ *ppv = &This->IDirectSoundFullDuplex_iface;
+ return S_OK;
+ } else if (This->ds8_unk && (IsEqualIID(riid, &IID_IDirectSound) ||
+ IsEqualIID(riid, &IID_IDirectSound8)))
+ return IUnknown_QueryInterface(This->ds8_unk, riid, ppv);
+ else if (This->dsc8_unk && IsEqualIID(riid, &IID_IDirectSoundCapture))
+ return IUnknown_QueryInterface(This->dsc8_unk, riid, ppv);
+
+ *ppv = NULL;
+ return E_NOINTERFACE;
}
static ULONG WINAPI IUnknownImpl_AddRef(IUnknown *iface)
@@ -122,6 +144,14 @@ static inline IDirectSoundFullDuplexImpl *impl_from_IDirectSoundFullDuplex(IDire
return CONTAINING_RECORD(iface, IDirectSoundFullDuplexImpl, IDirectSoundFullDuplex_iface);
}
+static HRESULT WINAPI IDirectSoundFullDuplexImpl_QueryInterface(IDirectSoundFullDuplex *iface,
+ REFIID riid, void **ppv)
+{
+ IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
+ TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
+ return IUnknown_QueryInterface(&This->IUnknown_iface, riid, ppv);
+}
+
static ULONG WINAPI IDirectSoundFullDuplexImpl_AddRef(IDirectSoundFullDuplex *iface)
{
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
@@ -134,37 +164,6 @@ static ULONG WINAPI IDirectSoundFullDuplexImpl_AddRef(IDirectSoundFullDuplex *if
return ref;
}
-static HRESULT WINAPI IDirectSoundFullDuplexImpl_QueryInterface(IDirectSoundFullDuplex *iface,
- REFIID riid, void **ppv)
-{
- IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
- TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
-
- if (ppv == NULL) {
- WARN("invalid parameter\n");
- return E_INVALIDARG;
- }
-
- *ppv = NULL;
-
- if (IsEqualIID(riid, &IID_IUnknown)) {
- IUnknown_AddRef(&This->IUnknown_iface);
- *ppv = &This->IUnknown_iface;
- return S_OK;
- } else if (IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
- IDirectSoundFullDuplexImpl_AddRef(iface);
- *ppv = &This->IDirectSoundFullDuplex_iface;
- return S_OK;
- } else if (This->ds8_unk && (IsEqualIID(riid, &IID_IDirectSound) ||
- IsEqualIID(riid, &IID_IDirectSound8))) {
- return IUnknown_QueryInterface(This->ds8_unk, riid, ppv);
- } else if (This->dsc8_unk && IsEqualIID(riid, &IID_IDirectSoundCapture)) {
- return IUnknown_QueryInterface(This->dsc8_unk, riid, ppv);
- }
-
- return E_NOINTERFACE;
-}
-
static ULONG WINAPI IDirectSoundFullDuplexImpl_Release(IDirectSoundFullDuplex *iface)
{
IDirectSoundFullDuplexImpl *This = impl_from_IDirectSoundFullDuplex(iface);
--
1.7.6.5
More information about the wine-patches
mailing list