[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") set_target_properties(msctfime PROPERTIES SUFFIX ".ime")
target_link_libraries(msctfime wine uuid cicero) target_link_libraries(msctfime wine uuid cicero)
add_importlibs(msctfime user32 gdi32 advapi32 msvcrt kernel32 ntdll) 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) add_cd_file(TARGET msctfime DESTINATION reactos/system32 FOR all)

View file

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

View file

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

View file

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

View file

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