From d3a3878a26bd93344bada90086ae2df637a6f28f Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Mon, 2 Dec 2024 08:07:18 -0800 Subject: [PATCH] Make interfaces consistent --- BuildNo.rc | 2 +- IDirectInputDeviceX.cpp | 2 +- IDirectInputDeviceX.h | 4 ++-- IDirectInputEffect.cpp | 16 +++------------- IDirectInputX.cpp | 2 +- IDirectInputX.h | 4 ++-- 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/BuildNo.rc b/BuildNo.rc index 0d28316..d0f55d5 100644 --- a/BuildNo.rc +++ b/BuildNo.rc @@ -1 +1 @@ -#define BUILD_NUMBER 81 +#define BUILD_NUMBER 82 diff --git a/IDirectInputDeviceX.cpp b/IDirectInputDeviceX.cpp index 108f875..dbd1a76 100644 --- a/IDirectInputDeviceX.cpp +++ b/IDirectInputDeviceX.cpp @@ -936,7 +936,7 @@ HRESULT m_IDirectInputDeviceX::WriteEffectToFileX(V lpszFileName, DWORD dwEntrie return GetProxyInterface()->WriteEffectToFile(lpszFileName, dwEntries, rgDiFileEft, dwFlags); } -void m_IDirectInputDeviceX::ReleaseDirectInput() +void m_IDirectInputDeviceX::ReleaseInterface() { // Don't delete wrapper interface if (StringType == ANSI_CHARSET) diff --git a/IDirectInputDeviceX.h b/IDirectInputDeviceX.h index 52707e7..cbb3a6c 100644 --- a/IDirectInputDeviceX.h +++ b/IDirectInputDeviceX.h @@ -112,7 +112,7 @@ class m_IDirectInputDeviceX : public AddressLookupTableDinputObject template inline HRESULT WriteEffectToFileX(V lpszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags); - void ReleaseDirectInput(); + void ReleaseInterface(); public: m_IDirectInputDeviceX(IDirectInputDevice8W *aOriginal, REFIID riid) : ProxyInterface(aOriginal), WrapperID(riid), StringType(GetStringType(riid)) @@ -131,7 +131,7 @@ class m_IDirectInputDeviceX : public AddressLookupTableDinputObject // Delete Critical Section DeleteCriticalSection(&dics); - ReleaseDirectInput(); + ReleaseInterface(); } /*** IUnknown methods ***/ diff --git a/IDirectInputEffect.cpp b/IDirectInputEffect.cpp index 28812e5..5ff98a6 100644 --- a/IDirectInputEffect.cpp +++ b/IDirectInputEffect.cpp @@ -51,21 +51,11 @@ HRESULT m_IDirectInputEffect::QueryInterface(REFIID riid, LPVOID * ppvObj) if (!ProxyInterface) { - if (!ppvObj) + if (ppvObj) { - return E_POINTER; + *ppvObj = nullptr; } - *ppvObj = nullptr; - - if (riid == WrapperID || riid == IID_IUnknown) - { - *ppvObj = this; - - AddRef(); - - return DI_OK; - } - return E_POINTER; + return E_NOINTERFACE; } return ProxyQueryInterface(ProxyInterface, riid, ppvObj, WrapperID, WrapperInterface); diff --git a/IDirectInputX.cpp b/IDirectInputX.cpp index b6530d6..f716217 100644 --- a/IDirectInputX.cpp +++ b/IDirectInputX.cpp @@ -301,7 +301,7 @@ HRESULT m_IDirectInputX::CreateDeviceExX(REFGUID rguid, REFIID riid, V *ppvObj, return hr; } -void m_IDirectInputX::ReleaseDirectInput() +void m_IDirectInputX::ReleaseInterface() { // Don't delete wrapper interface if (StringType == ANSI_CHARSET) diff --git a/IDirectInputX.h b/IDirectInputX.h index a1b69fd..e9be819 100644 --- a/IDirectInputX.h +++ b/IDirectInputX.h @@ -48,7 +48,7 @@ class m_IDirectInputX : public AddressLookupTableDinputObject template inline HRESULT CreateDeviceExX(REFGUID rguid, REFIID riid, V *ppvObj, LPUNKNOWN pUnkOuter); - void ReleaseDirectInput(); + void ReleaseInterface(); public: m_IDirectInputX(IDirectInput8W *aOriginal, REFIID riid) : ProxyInterface(aOriginal), WrapperID(riid), StringType(GetStringType(riid)) @@ -59,7 +59,7 @@ class m_IDirectInputX : public AddressLookupTableDinputObject { LOG_LIMIT(3, __FUNCTION__ << " (" << this << ")" << " deleting interface!"); - ReleaseDirectInput(); + ReleaseInterface(); } /*** IUnknown methods ***/