[MSCTFIME] Use QISearch for QueryInterface (#6630)

Simplify code and reduce binary size.
JIRA issue: CORE-19360
- Use shlwapi!QISearch for QueryInterface
  implementation.
- Add delay link to shlwapi.
This commit is contained in:
Katayama Hirofumi MZ 2024-03-17 12:44:03 +09:00 committed by GitHub
parent 1af0dbe36e
commit c5e6456377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 50 additions and 87 deletions

View File

@ -22,5 +22,5 @@ set_module_type(msctfime win32dll UNICODE)
set_target_properties(msctfime PROPERTIES SUFFIX ".ime")
target_link_libraries(msctfime wine uuid cicero)
add_importlibs(msctfime user32 gdi32 advapi32 msvcrt kernel32 ntdll)
add_delay_importlibs(msctfime uxtheme comctl32 msctf oleaut32 imm32)
add_delay_importlibs(msctfime uxtheme shlwapi comctl32 msctf oleaut32 imm32)
add_cd_file(TARGET msctfime DESTINATION reactos/system32 FOR all)

View File

@ -26,15 +26,12 @@ CicBridge::CicBridge()
/// @implemented
STDMETHODIMP CicBridge::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
*ppvObj = NULL;
if (!IsEqualIID(riid, IID_ITfSysHookSink))
return E_NOINTERFACE;
*ppvObj = this;
AddRef();
return S_OK;
static const QITAB c_tab[] =
{
QITABENT(CicBridge, ITfSysHookSink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented

View File

@ -80,23 +80,13 @@ HRESULT CInputContextOwner::_Unadvise()
/// @implemented
STDMETHODIMP CInputContextOwner::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
*ppvObj = NULL;
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfContextOwner))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
if (IsEqualIID(riid, IID_ITfMouseTrackerACP))
{
*ppvObj = static_cast<ITfMouseTrackerACP*>(this);
AddRef();
return S_OK;
}
return E_NOINTERFACE;
QITABENT(CInputContextOwner, ITfContextOwner),
QITABENT(CInputContextOwner, ITfMouseTrackerACP),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented
@ -202,22 +192,13 @@ CicInputContext::CicInputContext(
/// @implemented
STDMETHODIMP CicInputContext::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
*ppvObj = NULL;
if (IsEqualIID(riid, IID_ITfContextOwnerCompositionSink))
static const QITAB c_tab[] =
{
*ppvObj = static_cast<ITfContextOwnerCompositionSink*>(this);
AddRef();
return S_OK;
}
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCleanupContextSink))
{
*ppvObj = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
QITABENT(CicInputContext, ITfCleanupContextSink),
QITABENT(CicInputContext, ITfContextOwnerCompositionSink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented

View File

@ -452,13 +452,12 @@ CFunctionProviderBase::QueryInterface(
_In_ REFIID riid,
_Out_ LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfFunctionProvider))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
QITABENT(CFunctionProviderBase, ITfFunctionProvider),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented
@ -534,13 +533,12 @@ CFnDocFeed::~CFnDocFeed()
/// @implemented
STDMETHODIMP CFnDocFeed::QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IAImmFnDocFeed))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
QITABENT(CFnDocFeed, IAImmFnDocFeed),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented

View File

@ -26,15 +26,12 @@ CCompartmentEventSink::~CCompartmentEventSink()
/// @implemented
STDMETHODIMP CCompartmentEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCompartmentEventSink))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
QITABENT(CCompartmentEventSink, ITfCompartmentEventSink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented
@ -152,19 +149,13 @@ CTextEventSink::~CTextEventSink()
/// @implemented
STDMETHODIMP CTextEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfTextEditSink))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
if (IsEqualIID(riid, IID_ITfTextLayoutSink))
{
*ppvObj = static_cast<ITfTextLayoutSink*>(this);
AddRef();
return S_OK;
}
return E_NOINTERFACE;
QITABENT(CTextEventSink, ITfTextEditSink),
QITABENT(CTextEventSink, ITfTextLayoutSink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented
@ -294,14 +285,12 @@ CThreadMgrEventSink::CThreadMgrEventSink(
/// @implemented
STDMETHODIMP CThreadMgrEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfThreadMgrEventSink))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
QITABENT(CThreadMgrEventSink, ITfThreadMgrEventSink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented
@ -440,14 +429,12 @@ CActiveLanguageProfileNotifySink::~CActiveLanguageProfileNotifySink()
/// @implemented
STDMETHODIMP CActiveLanguageProfileNotifySink::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfActiveLanguageProfileNotifySink))
static const QITAB c_tab[] =
{
*ppvObj = this;
AddRef();
return S_OK;
}
*ppvObj = NULL;
return E_NOINTERFACE;
QITABENT(CActiveLanguageProfileNotifySink, ITfActiveLanguageProfileNotifySink),
{ NULL }
};
return ::QISearch(this, c_tab, riid, ppvObj);
}
/// @implemented