mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[MSUTB][SDK] Use QISearch for QueryInterface (#6631)
Simplify code and reduce binary size. JIRA issue: CORE-19363 - Use shlwapi!QISearch for QueryInterface implementation. - Add delay link to shlwapi. - Define QITABENT macro in <shlwapi.h>.
This commit is contained in:
parent
1fbf09f531
commit
1af0dbe36e
3 changed files with 28 additions and 45 deletions
|
@ -15,5 +15,5 @@ set_module_type(msutb win32dll UNICODE)
|
|||
add_dependencies(msutb msctf psdk)
|
||||
target_link_libraries(msutb wine uuid atl_classes cicero)
|
||||
add_importlibs(msutb user32 gdi32 advapi32 msvcrt kernel32 ntdll)
|
||||
add_delay_importlibs(msutb uxtheme imm32 comctl32 msctf ole32 oleacc oleaut32 shell32)
|
||||
add_delay_importlibs(msutb uxtheme imm32 shlwapi comctl32 msctf ole32 oleacc oleaut32 shell32)
|
||||
add_cd_file(TARGET msutb DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -1887,13 +1887,12 @@ CCicLibMenu::~CCicLibMenu()
|
|||
|
||||
STDMETHODIMP CCicLibMenu::QueryInterface(REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfMenu))
|
||||
static const QITAB c_tab[] =
|
||||
{
|
||||
*ppvObj = this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
QITABENT(CCicLibMenu, ITfMenu),
|
||||
{ NULL }
|
||||
};
|
||||
return ::QISearch(this, c_tab, riid, ppvObj);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CCicLibMenu::AddRef()
|
||||
|
@ -2191,15 +2190,13 @@ STDMETHODIMP CTipbarAccessible::QueryInterface(
|
|||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) ||
|
||||
IsEqualIID(riid, IID_IDispatch) ||
|
||||
IsEqualIID(riid, IID_IAccessible))
|
||||
static const QITAB c_tab[] =
|
||||
{
|
||||
*ppvObject = this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
QITABENT(CTipbarAccessible, IDispatch),
|
||||
QITABENT(CTipbarAccessible, IAccessible),
|
||||
{ NULL }
|
||||
};
|
||||
return ::QISearch(this, c_tab, riid, ppvObject);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CTipbarAccessible::AddRef()
|
||||
|
@ -3667,25 +3664,14 @@ CLBarItemButtonBase::~CLBarItemButtonBase()
|
|||
|
||||
STDMETHODIMP CLBarItemButtonBase::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfLangBarItem))
|
||||
static const QITAB c_tab[] =
|
||||
{
|
||||
*ppvObject = static_cast<ITfLangBarItem*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
if (IsEqualIID(riid, IID_ITfLangBarItemButton))
|
||||
{
|
||||
*ppvObject = static_cast<ITfLangBarItemButton*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
if (IsEqualIID(riid, IID_ITfSource))
|
||||
{
|
||||
*ppvObject = static_cast<ITfSource*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
QITABENT(CLBarItemButtonBase, ITfLangBarItem),
|
||||
QITABENT(CLBarItemButtonBase, ITfLangBarItemButton),
|
||||
QITABENT(CLBarItemButtonBase, ITfSource),
|
||||
{ NULL }
|
||||
};
|
||||
return ::QISearch(this, c_tab, riid, ppvObject);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CLBarItemButtonBase::AddRef()
|
||||
|
@ -5148,19 +5134,13 @@ void CTipbarWnd::TerminateAllThreads(BOOL bFlag)
|
|||
|
||||
STDMETHODIMP CTipbarWnd::QueryInterface(REFIID riid, void **ppvObj)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfLangBarEventSink))
|
||||
static const QITAB c_tab[] =
|
||||
{
|
||||
*ppvObj = this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
if (IsEqualIID(riid, IID_ITfLangBarEventSink_P))
|
||||
{
|
||||
*ppvObj = static_cast<ITfLangBarEventSink_P*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
QITABENT(CTipbarWnd, ITfLangBarEventSink),
|
||||
QITABENT(CTipbarWnd, ITfLangBarEventSink_P),
|
||||
{ NULL }
|
||||
};
|
||||
return ::QISearch(this, c_tab, riid, ppvObj);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CTipbarWnd::AddRef()
|
||||
|
|
|
@ -2090,6 +2090,9 @@ QISearch(
|
|||
#define OFFSETOFCLASS(base, derived) \
|
||||
((DWORD)(DWORD_PTR)(static_cast<base*>((derived*)8))-8)
|
||||
|
||||
#define QITABENTMULTI(Cthis, Ifoo, Iimpl) { &IID_##Ifoo, OFFSETOFCLASS(Iimpl, Cthis) }
|
||||
#define QITABENT(Cthis, Ifoo) QITABENTMULTI(Cthis, Ifoo, Ifoo)
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in a new issue