ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
274 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSCTFIME] Half-implement CicBridge::ActivateIMMX/DeactivateIMMX
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3401a99e0f2bedb195f69…
commit 3401a99e0f2bedb195f6978671063f9b2a3341e3 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Dec 21 12:02:21 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Dec 21 12:02:21 2023 +0900 [MSCTFIME] Half-implement CicBridge::ActivateIMMX/DeactivateIMMX CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 172 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 168 insertions(+), 4 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index c63aab280f3..047dbfe3ccd 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -15,6 +15,8 @@ DWORD g_dwOSInfo = 0; BOOL gfTFInitLib = FALSE; CRITICAL_SECTION g_csLock; +DEFINE_GUID(GUID_COMPARTMENT_CTFIME_DIMFLAGS, 0xA94C5FD2, 0xC471, 0x4031, 0x95, 0x46, 0x70, 0x9C, 0x17, 0x30, 0x0C, 0xB9); + UINT WM_MSIME_SERVICE = 0; UINT WM_MSIME_UIREADY = 0; UINT WM_MSIME_RECONVERTREQUEST = 0; @@ -944,13 +946,52 @@ HRESULT CThreadMgrEventSink::_Unadvise() return hr; } +/* FIXME */ +class CFunctionProvider : public IUnknown +{ +public: + CFunctionProvider(TfClientId clientId) + { + } + + // IUnknown interface + STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; +}; + +/** + * @unimplemented + */ +STDMETHODIMP CFunctionProvider::QueryInterface(REFIID riid, LPVOID* ppvObj) +{ + return E_NOTIMPL; +} + +/** + * @unimplemented + */ +STDMETHODIMP_(ULONG) CFunctionProvider::AddRef() +{ + return 1; +} + +/** + * @unimplemented + */ +STDMETHODIMP_(ULONG) CFunctionProvider::Release() +{ + return 0; +} + /* FIXME */ class CicBridge : public ITfSysHookSink { protected: LONG m_cRefs; DWORD m_dwImmxInit; - DWORD m_dw[3]; + DWORD m_dw[2]; + DWORD m_cActivateLocks; ITfKeystrokeMgr *m_pKeystrokeMgr; ITfDocumentMgr *m_pDocMgr; CThreadMgrEventSink *m_pThreadMgrEventSink; @@ -958,6 +999,9 @@ protected: LIBTHREAD m_LibThread; DWORD m_dw21; + static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam); + static BOOL CALLBACK EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam); + public: CicBridge(); virtual ~CicBridge(); @@ -976,6 +1020,8 @@ public: BOOL UnInitIMMX(TLS *pTLS); HRESULT ActivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr); HRESULT DeactivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr); + + HRESULT CreateInputContext(TLS *pTLS, HIMC hIMC); HRESULT DestroyInputContext(TLS *pTLS, HIMC hIMC); void PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs); @@ -1335,7 +1381,9 @@ public: CicBridge *m_pBridge; CicProfile *m_pProfile; ITfThreadMgr *m_pThreadMgr; - DWORD m_dwUnknown2[4]; + DWORD m_dwFlags1; + DWORD m_dwFlags2; + DWORD m_dwUnknown2[2]; DWORD m_dwNowOpening; DWORD m_NonEAComposition; DWORD m_cWnds; @@ -1532,6 +1580,14 @@ CicBridge::~CicBridge() UnInitIMMX(pTLS); } +/** + * @unimplemented + */ +HRESULT CicBridge::CreateInputContext(TLS *pTLS, HIMC hIMC) +{ + return E_NOTIMPL; +} + /** * @implemented */ @@ -1573,12 +1629,83 @@ HRESULT CicBridge::DestroyInputContext(TLS *pTLS, HIMC hIMC) return hr; } +typedef struct ENUM_CREATE_DESTROY_IC +{ + TLS *m_pTLS; + CicBridge *m_pBridge; +} ENUM_CREATE_DESTROY_IC, *PENUM_CREATE_DESTROY_IC; + +BOOL CALLBACK CicBridge::EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam) +{ + PENUM_CREATE_DESTROY_IC pData = (PENUM_CREATE_DESTROY_IC)lParam; + pData->m_pBridge->CreateInputContext(pData->m_pTLS, hIMC); + return TRUE; +} + +BOOL CALLBACK CicBridge::EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam) +{ + PENUM_CREATE_DESTROY_IC pData = (PENUM_CREATE_DESTROY_IC)lParam; + pData->m_pBridge->DestroyInputContext(pData->m_pTLS, hIMC); + return TRUE; +} + /** * @unimplemented */ HRESULT CicBridge::ActivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr) { - return E_NOTIMPL; + //FIXME + + if (m_cActivateLocks++ != 0) + return S_OK; + + ITfSourceSingle *pSource = NULL; + HRESULT hr = pThreadMgr->QueryInterface(IID_ITfSourceSingle, (void**)&pSource); + if (FAILED(hr)) + { + DeactivateIMMX(pTLS, pThreadMgr); + return hr; + } + + CFunctionProvider *pProvider = new CFunctionProvider(m_cliendId); + if (!pProvider) + { + hr = E_FAIL; + goto Finish; + } + + pSource->AdviseSingleSink(m_cliendId, IID_ITfFunctionProvider, pProvider); + pProvider->Release(); + + if (!m_pDocMgr) + { + hr = pThreadMgr->CreateDocumentMgr(&m_pDocMgr); + if (FAILED(hr)) + { + hr = E_FAIL; + goto Finish; + } + + SetCompartmentDWORD(m_cliendId, m_pDocMgr, GUID_COMPARTMENT_CTFIME_DIMFLAGS, TRUE, FALSE); + } + + //FIXME + + hr = S_OK; + if (pTLS->m_dwUnknown2[1] & 1) + { + ENUM_CREATE_DESTROY_IC Data = { pTLS, this }; + ImmEnumInputContext(0, CicBridge::EnumCreateInputContextCallback, (LPARAM)&Data); + } + +Finish: + if (FAILED(hr)) + DeactivateIMMX(pTLS, pThreadMgr); + + if (pSource) + pSource->Release(); + + return hr; } /** @@ -1586,7 +1713,44 @@ HRESULT CicBridge::ActivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr) */ HRESULT CicBridge::DeactivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr) { - return E_NOTIMPL; + if (m_dw[1] & 1) + return TRUE; + + m_dw[1] |= 1; + + if (m_cliendId) + { + ENUM_CREATE_DESTROY_IC Data = { pTLS, this }; + ImmEnumInputContext(0, CicBridge::EnumDestroyInputContextCallback, (LPARAM)&Data); + pTLS->m_dwUnknown2[1] |= 1u; + + ITfSourceSingle *pSource = NULL; + if (pThreadMgr->QueryInterface(IID_ITfSourceSingle, (void **)&pSource) == S_OK) + pSource->UnadviseSingleSink(m_cliendId, IID_ITfFunctionProvider); + + m_cliendId = 0; + + while (m_cActivateLocks > 0) + { + --m_cActivateLocks; + pThreadMgr->Deactivate(); + } + + if (pSource) + pSource->Release(); + } + + if (m_pDocMgr) + { + m_pDocMgr->Release(); + m_pDocMgr = NULL; + } + + //FIXME + + m_dw[1] &= ~1; + + return S_OK; } /**
1 year
1
0
0
0
[reactos] 01/01: [MSCTFIME] Implement CicInputContext::GetGuidAtom
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6cb6d257a6f6d9c4aa28…
commit e6cb6d257a6f6d9c4aa283419525ddc039edde96 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Dec 21 11:04:02 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Dec 21 11:04:02 2023 +0900 [MSCTFIME] Implement CicInputContext::GetGuidAtom CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index f5f2e592ea4..c63aab280f3 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -503,10 +503,32 @@ HRESULT CCompartmentEventSink::_Unadvise() * CicInputContext */ +class CInputContextOwnerCallBack; + /* FIXME */ class CicInputContext : public ITfContextOwnerCompositionSink { + DWORD m_dw[2]; LONG m_cRefs; + HIMC m_hIMC; + ITfDocumentMgr *m_pDocumentMgr; + ITfContext *m_pContext; + DWORD m_dw0_0[1]; + CInputContextOwnerCallBack *m_pICOwnerCallback; + DWORD m_dw0; + CCompartmentEventSink *m_pCompEventSink1; + CCompartmentEventSink *m_pCompEventSink2; + DWORD m_dw0_5[4]; + DWORD m_dw1[2]; + DWORD m_dwQueryPos; + DWORD m_dw1_5[1]; + GUID m_guid; + DWORD m_dw2[19]; + WORD m_cGuidAtoms; + WORD m_padding; + DWORD m_adwGuidAtoms[256]; + DWORD m_dw3[19]; + public: CicInputContext() { @@ -529,7 +551,7 @@ public: HRESULT GetGuidAtom( _Inout_ IMCLock& imcLock, - _In_ DWORD dwUnknown, + _In_ BYTE iAtom, _Out_opt_ LPDWORD pdwGuidAtom); HRESULT DestroyInputContext(); @@ -612,24 +634,28 @@ CicInputContext::OnEndComposition( } /** - * @unimplemented + * @implemented */ HRESULT CicInputContext::GetGuidAtom( _Inout_ IMCLock& imcLock, - _In_ DWORD dwUnknown, + _In_ BYTE iAtom, _Out_opt_ LPDWORD pdwGuidAtom) { IMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCompStr); - HRESULT hr = imeContext.m_hr; if (!imeContext) hr = E_FAIL; - if (FAILED(hr)) return hr; - // FIXME + hr = E_FAIL; + if (iAtom < m_cGuidAtoms) + { + *pdwGuidAtom = m_adwGuidAtoms[iAtom]; + hr = S_OK; + } + return hr; }
1 year
1
0
0
0
[reactos] 01/01: [MSCTFIME] Fix compartment code
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ee73267db86fec0dd6dd8…
commit ee73267db86fec0dd6dd85738d52b7db96f88e96 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Dec 21 10:42:06 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Dec 21 10:42:06 2023 +0900 [MSCTFIME] Fix compartment code Fix some mistakes. CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 94 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 14 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 5a3e8c94830..f5f2e592ea4 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -168,6 +168,9 @@ void TFUninitLib_Thread(PLIBTHREAD pLibThread) * Compartment */ +/** + * @implemented + */ HRESULT GetCompartment( IUnknown *pUnknown, @@ -175,10 +178,11 @@ GetCompartment( ITfCompartment **ppComp, BOOL bThread) { + *ppComp = NULL; + ITfThreadMgr *pThreadMgr = NULL; ITfCompartmentMgr *pCompMgr = NULL; - *ppComp = NULL; HRESULT hr; if (bThread) { @@ -195,10 +199,12 @@ GetCompartment( if (SUCCEEDED(hr)) { + hr = E_FAIL; if (pCompMgr) + { hr = pCompMgr->GetCompartment(rguid, ppComp); - else - hr = E_FAIL; + pCompMgr->Release(); + } } if (pThreadMgr) @@ -207,12 +213,15 @@ GetCompartment( return hr; } +/** + * @implemented + */ HRESULT SetCompartmentDWORD( TfEditCookie cookie, IUnknown *pUnknown, REFGUID rguid, - VARTYPE type, + DWORD dwValue, BOOL bThread) { ITfCompartment *pComp = NULL; @@ -221,38 +230,49 @@ SetCompartmentDWORD( return hr; VARIANT vari; - V_I4(&vari) = type; + V_I4(&vari) = dwValue; V_VT(&vari) = VT_I4; hr = pComp->SetValue(cookie, &vari); - pComp->Release(); + pComp->Release(); return hr; } +/** + * @implemented + */ HRESULT GetCompartmentDWORD( IUnknown *pUnknown, REFGUID rguid, - ITfCompartment *pComp, + LPDWORD pdwValue, BOOL bThread) { + *pdwValue = 0; + + ITfCompartment *pComp = NULL; HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread); if (FAILED(hr)) return hr; VARIANT vari; hr = pComp->GetValue(&vari); - pComp->Release(); + if (hr == S_OK) + *pdwValue = V_I4(&vari); + pComp->Release(); return hr; } +/** + * @implemented + */ HRESULT SetCompartmentUnknown( TfEditCookie cookie, IUnknown *pUnknown, REFGUID rguid, - IUnknown *pUnknown2) + IUnknown *punkValue) { ITfCompartment *pComp = NULL; HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, FALSE); @@ -260,14 +280,17 @@ SetCompartmentUnknown( return hr; VARIANT vari; - V_UNKNOWN(&vari) = pUnknown2; + V_UNKNOWN(&vari) = punkValue; V_VT(&vari) = VT_UNKNOWN; hr = pComp->SetValue(cookie, &vari); - pComp->Release(); + pComp->Release(); return hr; } +/** + * @implemented + */ HRESULT ClearCompartment( TfClientId tid, @@ -327,7 +350,7 @@ public: CCompartmentEventSink(FN_EVENTSINK fnEventSink, LPVOID pUserData); virtual ~CCompartmentEventSink(); - HRESULT _Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment *pComp); + HRESULT _Advise(IUnknown *pUnknown, REFGUID rguid, BOOL bThread); HRESULT _Unadvise(); // IUnknown interface @@ -339,6 +362,9 @@ public: STDMETHODIMP OnChange(REFGUID rguid) override; }; +/** + * @implemented + */ CCompartmentEventSink::CCompartmentEventSink(FN_EVENTSINK fnEventSink, LPVOID pUserData) : m_array(8) , m_cRefs(1) @@ -347,10 +373,16 @@ CCompartmentEventSink::CCompartmentEventSink(FN_EVENTSINK fnEventSink, LPVOID pU { } +/** + * @implemented + */ CCompartmentEventSink::~CCompartmentEventSink() { } +/** + * @implemented + */ STDMETHODIMP CCompartmentEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj) { if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCompartmentEventSink)) @@ -364,11 +396,17 @@ STDMETHODIMP CCompartmentEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj) return E_NOINTERFACE; } +/** + * @implemented + */ STDMETHODIMP_(ULONG) CCompartmentEventSink::AddRef() { return ::InterlockedIncrement(&m_cRefs); } +/** + * @implemented + */ STDMETHODIMP_(ULONG) CCompartmentEventSink::Release() { if (::InterlockedDecrement(&m_cRefs) == 0) @@ -379,13 +417,19 @@ STDMETHODIMP_(ULONG) CCompartmentEventSink::Release() return m_cRefs; } +/** + * @implemented + */ STDMETHODIMP CCompartmentEventSink::OnChange(REFGUID rguid) { return m_fnEventSink(m_pUserData, rguid); } +/** + * @implemented + */ HRESULT -CCompartmentEventSink::_Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment *pComp) +CCompartmentEventSink::_Advise(IUnknown *pUnknown, REFGUID rguid, BOOL bThread) { CESMAP *pCesMap = (CESMAP *)m_array.Append(1); if (!pCesMap) @@ -393,7 +437,7 @@ CCompartmentEventSink::_Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment ITfSource *pSource = NULL; - HRESULT hr = GetCompartment(pUnknown, rguid, &pCesMap->m_pComp, !!pComp); + HRESULT hr = GetCompartment(pUnknown, rguid, &pCesMap->m_pComp, bThread); if (FAILED(hr)) { hr = pCesMap->m_pComp->QueryInterface(IID_ITfSource, (void **)&pSource); @@ -422,6 +466,9 @@ CCompartmentEventSink::_Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment return hr; } +/** + * @implemented + */ HRESULT CCompartmentEventSink::_Unadvise() { CESMAP *pCesMap = (CESMAP *)m_array.m_pb; @@ -905,6 +952,8 @@ public: HRESULT DeactivateIMMX(TLS *pTLS, ITfThreadMgr *pThreadMgr); HRESULT DestroyInputContext(TLS *pTLS, HIMC hIMC); + void PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs); + HRESULT ConfigureGeneral(TLS* pTLS, ITfThreadMgr *pThreadMgr, HKL hKL, HWND hWnd); HRESULT ConfigureRegisterWord(TLS* pTLS, ITfThreadMgr *pThreadMgr, HKL hKL, HWND hWnd, LPVOID lpData); }; @@ -1644,6 +1693,20 @@ STDMETHODIMP CicBridge::OnSysShellProc(INT, UINT, LONG) return S_OK; } +/** + * @implemented + */ +void CicBridge::PostTransMsg(HWND hWnd, INT cTransMsgs, LPTRANSMSG pTransMsgs) +{ + for (INT i = 0; i < cTransMsgs; ++i, ++pTransMsgs) + { + ::PostMessageW(hWnd, pTransMsgs->message, pTransMsgs->wParam, pTransMsgs->lParam); + } +} + +/** + * @implemented + */ HRESULT CicBridge::ConfigureGeneral( TLS* pTLS, @@ -1680,6 +1743,9 @@ CicBridge::ConfigureGeneral( return hr; } +/** + * @implemented + */ HRESULT CicBridge::ConfigureRegisterWord( TLS* pTLS,
1 year
1
0
0
0
[reactos] 01/01: [SETUPAPI] CMP_RegisterNotification: Do not fail if we cannot retrieve a window title
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9277f5352a48f247a393d…
commit 9277f5352a48f247a393d02d50b1ecb713738dac Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed Dec 20 15:20:01 2023 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed Dec 20 15:20:01 2023 +0100 [SETUPAPI] CMP_RegisterNotification: Do not fail if we cannot retrieve a window title --- dll/win32/setupapi/cfgmgr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index b292a3c391d..ef29d045f8c 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -636,6 +636,8 @@ CMP_RegisterNotification( pNotifyData->ulMagic = NOTIFY_MAGIC; pNotifyData->hNotifyHandle = NULL; + ZeroMemory(szNameBuffer, sizeof(szNameBuffer)); + if ((ulFlags & DEVICE_NOTIFY_SERVICE_HANDLE) == DEVICE_NOTIFY_WINDOW_HANDLE) { FIXME("Register a window\n"); @@ -645,8 +647,12 @@ CMP_RegisterNotification( ARRAYSIZE(szNameBuffer)); if (nLength == 0) { - HeapFree(GetProcessHeap(), 0, pNotifyData); - return CR_INVALID_DATA; + + } + + if (nLength == 0) + { + szNameBuffer[0] = UNICODE_NULL; } FIXME("Register window: %S\n", szNameBuffer);
1 year
1
0
0
0
[reactos] 01/01: [IDL] Revert commit c03899fc
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92942fbbd8cd9c3eba288…
commit 92942fbbd8cd9c3eba288dce83071ff840b7429f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed Dec 20 15:13:40 2023 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed Dec 20 15:13:40 2023 +0100 [IDL] Revert commit c03899fc --- sdk/include/reactos/idl/pnp.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl index 52c47ab2ffc..efe320e3e63 100644 --- a/sdk/include/reactos/idl/pnp.idl +++ b/sdk/include/reactos/idl/pnp.idl @@ -53,7 +53,7 @@ typedef enum _PNP_VETO_TYPE { PNP_VetoNonDisableable = 10, PNP_VetoLegacyDriver = 11, PNP_VetoInsufficientRights = 12, -} *PPNP_VETO_TYPE; +} PNP_VETO_TYPE, *PPNP_VETO_TYPE; cpp_quote("#endif")
1 year
1
0
0
0
[reactos] 01/01: [IDL] Add missing PNP_VETO_TYPE
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c03899fc7f0b7d85af7ca…
commit c03899fc7f0b7d85af7ca4702d83d41bb0ac2e9c Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed Dec 20 15:09:03 2023 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed Dec 20 15:09:03 2023 +0100 [IDL] Add missing PNP_VETO_TYPE --- sdk/include/reactos/idl/pnp.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl index efe320e3e63..52c47ab2ffc 100644 --- a/sdk/include/reactos/idl/pnp.idl +++ b/sdk/include/reactos/idl/pnp.idl @@ -53,7 +53,7 @@ typedef enum _PNP_VETO_TYPE { PNP_VetoNonDisableable = 10, PNP_VetoLegacyDriver = 11, PNP_VetoInsufficientRights = 12, -} PNP_VETO_TYPE, *PPNP_VETO_TYPE; +} *PPNP_VETO_TYPE; cpp_quote("#endif")
1 year
1
0
0
0
[reactos] 01/01: [IDL][SETUPAPI][UMPNPMGR] Improve PNP_RegisterNotification
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=71df39b027f9d08276fd0…
commit 71df39b027f9d08276fd06f2dadfc9162abcf859 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed Dec 20 14:49:30 2023 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed Dec 20 14:49:30 2023 +0100 [IDL][SETUPAPI][UMPNPMGR] Improve PNP_RegisterNotification - The 2nd parameter is the handle to the recipient. - The 8th parameter is the callers process id. --- base/services/umpnpmgr/rpcserver.c | 8 ++++---- dll/win32/setupapi/cfgmgr.c | 2 +- sdk/include/reactos/idl/pnp.idl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 4e57e261e13..f493f181d5e 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -4689,13 +4689,13 @@ DWORD WINAPI PNP_RegisterNotification( handle_t hBinding, - DWORD ulUnknown2, + DWORD_PTR hRecipient, LPWSTR pszName, BYTE *pNotificationFilter, DWORD ulNotificationFilterSize, DWORD ulFlags, PNP_NOTIFY_HANDLE *pNotifyHandle, - DWORD ulUnknown8, + DWORD ulProcessId, DWORD *pulUnknown9) { PDEV_BROADCAST_DEVICEINTERFACE_W pBroadcastDeviceInterface; @@ -4703,8 +4703,8 @@ PNP_RegisterNotification( PNOTIFY_ENTRY pNotifyData = NULL; DPRINT1("PNP_RegisterNotification(%p %lx '%S' %p %lu 0x%lx %p %lx %p)\n", - hBinding, ulUnknown2, pszName, pNotificationFilter, - ulNotificationFilterSize, ulFlags, pNotifyHandle, ulUnknown8, pulUnknown9); + hBinding, hRecipient, pszName, pNotificationFilter, + ulNotificationFilterSize, ulFlags, pNotifyHandle, ulProcessId, pulUnknown9); if (pNotifyHandle == NULL) return CR_INVALID_POINTER; diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 7fd00b122e8..b292a3c391d 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -670,7 +670,7 @@ CMP_RegisterNotification( RpcTryExcept { ret = PNP_RegisterNotification(BindingHandle, - 0, /* ??? */ + (DWORD_PTR)hRecipient, szNameBuffer, (BYTE*)lpvNotificationFilter, ((DEV_BROADCAST_HDR*)lpvNotificationFilter)->dbch_size, diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl index 0a75c523f05..efe320e3e63 100644 --- a/sdk/include/reactos/idl/pnp.idl +++ b/sdk/include/reactos/idl/pnp.idl @@ -878,7 +878,7 @@ interface pnp __stdcall PNP_RegisterNotification( [in] handle_t hBinding, - [in] DWORD ulUnknown2, + [in] DWORD_PTR hRecipient, [in, string, ref] LPWSTR pszName, [in, size_is(ulNotificationFilterSize)] BYTE *pNotificationFilter, [in] DWORD ulNotificationFilterSize,
1 year
1
0
0
0
[reactos] 01/01: [MSCTFIME][SDK] Implement CCompartmentEventSink (#6205)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=954598037fc4ddd76078e…
commit 954598037fc4ddd76078e5159329a7594434d2c9 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Dec 20 22:01:39 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Dec 20 22:01:39 2023 +0900 [MSCTFIME][SDK] Implement CCompartmentEventSink (#6205) - Modify <cicero/cicbase.h> and <cicero/cicarray.h>. - Add CCompartmentEventSink class. CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 152 ++++++++++++++++++++++++++++++++++ dll/ime/msctfime/msctfime.h | 1 + sdk/include/reactos/cicero/cicarray.h | 20 +++-- sdk/include/reactos/cicero/cicbase.h | 14 ++++ 4 files changed, 178 insertions(+), 9 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 044a6bc8cb2..5a3e8c94830 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -164,6 +164,10 @@ void TFUninitLib_Thread(PLIBTHREAD pLibThread) } } +/*********************************************************************** + * Compartment + */ + HRESULT GetCompartment( IUnknown *pUnknown, @@ -304,6 +308,154 @@ ClearCompartment( return hr; } +typedef struct CESMAP +{ + ITfCompartment *m_pComp; + DWORD m_dwCookie; +} CESMAP, *PCESMAP; + +typedef INT (CALLBACK *FN_EVENTSINK)(LPVOID, REFGUID); + +class CCompartmentEventSink : public ITfCompartmentEventSink +{ + CicArray m_array; + LONG m_cRefs; + FN_EVENTSINK m_fnEventSink; + LPVOID m_pUserData; + +public: + CCompartmentEventSink(FN_EVENTSINK fnEventSink, LPVOID pUserData); + virtual ~CCompartmentEventSink(); + + HRESULT _Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment *pComp); + HRESULT _Unadvise(); + + // IUnknown interface + STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + + // ITfCompartmentEventSink interface + STDMETHODIMP OnChange(REFGUID rguid) override; +}; + +CCompartmentEventSink::CCompartmentEventSink(FN_EVENTSINK fnEventSink, LPVOID pUserData) + : m_array(8) + , m_cRefs(1) + , m_fnEventSink(fnEventSink) + , m_pUserData(pUserData) +{ +} + +CCompartmentEventSink::~CCompartmentEventSink() +{ +} + +STDMETHODIMP CCompartmentEventSink::QueryInterface(REFIID riid, LPVOID* ppvObj) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCompartmentEventSink)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + + *ppvObj = NULL; + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CCompartmentEventSink::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +STDMETHODIMP_(ULONG) CCompartmentEventSink::Release() +{ + if (::InterlockedDecrement(&m_cRefs) == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +STDMETHODIMP CCompartmentEventSink::OnChange(REFGUID rguid) +{ + return m_fnEventSink(m_pUserData, rguid); +} + +HRESULT +CCompartmentEventSink::_Advise(IUnknown *pUnknown, REFGUID rguid, ITfCompartment *pComp) +{ + CESMAP *pCesMap = (CESMAP *)m_array.Append(1); + if (!pCesMap) + return E_OUTOFMEMORY; + + ITfSource *pSource = NULL; + + HRESULT hr = GetCompartment(pUnknown, rguid, &pCesMap->m_pComp, !!pComp); + if (FAILED(hr)) + { + hr = pCesMap->m_pComp->QueryInterface(IID_ITfSource, (void **)&pSource); + if (FAILED(hr)) + { + hr = pSource->AdviseSink(IID_ITfCompartmentEventSink, this, &pCesMap->m_dwCookie); + if (FAILED(hr)) + { + if (pCesMap->m_pComp) + { + pCesMap->m_pComp->Release(); + pCesMap->m_pComp = NULL; + } + m_array.Remove(m_array.m_cItems - 1, 1); + } + else + { + hr = S_OK; + } + } + } + + if (pSource) + pSource->Release(); + + return hr; +} + +HRESULT CCompartmentEventSink::_Unadvise() +{ + CESMAP *pCesMap = (CESMAP *)m_array.m_pb; + if (!m_array.m_cItems) + return S_OK; + + INT cItems = m_array.m_cItems; + do + { + ITfSource *pSource = NULL; + HRESULT hr = pCesMap->m_pComp->QueryInterface(IID_ITfSource, (void **)&pSource); + if (SUCCEEDED(hr)) + pSource->UnadviseSink(pCesMap->m_dwCookie); + + if (pCesMap->m_pComp) + { + pCesMap->m_pComp->Release(); + pCesMap->m_pComp = NULL; + } + + if (pSource) + pSource->Release(); + + ++pCesMap; + --cItems; + } while (cItems); + + return S_OK; +} + +/*********************************************************************** + * CicInputContext + */ + /* FIXME */ class CicInputContext : public ITfContextOwnerCompositionSink { diff --git a/dll/ime/msctfime/msctfime.h b/dll/ime/msctfime/msctfime.h index 892bd76ef26..daa9f74c66f 100644 --- a/dll/ime/msctfime/msctfime.h +++ b/dll/ime/msctfime/msctfime.h @@ -23,6 +23,7 @@ #include <strsafe.h> #include <cicero/cicbase.h> +#include <cicero/cicarray.h> #include <cicero/osinfo.h> #include <cicero/CModulePath.h> #include <cicero/imclock.h> diff --git a/sdk/include/reactos/cicero/cicarray.h b/sdk/include/reactos/cicero/cicarray.h index 8767ac727f9..9ce7cfa6b76 100644 --- a/sdk/include/reactos/cicero/cicarray.h +++ b/sdk/include/reactos/cicero/cicarray.h @@ -11,18 +11,17 @@ class CicArray { - LPVOID lpVtbl; +public: LPBYTE m_pb; INT m_cItems; INT m_cbItem; INT m_cCapacity; -public: CicArray(INT cbItem); - virtual CicArray(); + virtual ~CicArray(); - void Insert(INT iItem, INT cGrow); - void Append(INT cGrow); + BOOL Insert(INT iItem, INT cGrow); + LPVOID Append(INT cGrow); void Remove(INT iItem, INT cRemove); }; @@ -40,12 +39,14 @@ inline CicArray::~CicArray() cicMemFree(m_pb); } -inline void CicArray::Append(INT cGrow) +inline LPVOID CicArray::Append(INT cGrow) { - Insert(m_cItems, cGrow); + if (!Insert(m_cItems, cGrow)) + return NULL; + return &m_pb[(m_cItems - cGrow) * m_cbItem]; } -inline void CicArray::Insert(INT iItem, INT cGrow) +inline BOOL CicArray::Insert(INT iItem, INT cGrow) { INT cNewCapacity = m_cItems + cGrow; if (m_cCapacity < cNewCapacity) @@ -60,7 +61,7 @@ inline void CicArray::Insert(INT iItem, INT cGrow) pbNew = (BYTE *)cicMemAlloc(cNewCapacity * m_cbItem); if (!pbNew) - return; + return FALSE; m_pb = pbNew; m_cCapacity = cNewCapacity; @@ -74,6 +75,7 @@ inline void CicArray::Insert(INT iItem, INT cGrow) } m_cItems += cGrow; + return TRUE; } inline void CicArray::Remove(INT iItem, INT cRemove) diff --git a/sdk/include/reactos/cicero/cicbase.h b/sdk/include/reactos/cicero/cicbase.h index 9048dcb865a..3e4184ac7fc 100644 --- a/sdk/include/reactos/cicero/cicbase.h +++ b/sdk/include/reactos/cicero/cicbase.h @@ -5,11 +5,25 @@ * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> */ +#pragma once + +static inline LPVOID cicMemAlloc(SIZE_T size) +{ + return LocalAlloc(0, size); +} + static inline LPVOID cicMemAllocClear(SIZE_T size) { return LocalAlloc(LMEM_ZEROINIT, size); } +static inline LPVOID cicMemReAlloc(LPVOID ptr, SIZE_T newSize) +{ + if (!ptr) + return LocalAlloc(LMEM_ZEROINIT, newSize); + return LocalReAlloc(ptr, newSize, LMEM_ZEROINIT); +} + static inline void cicMemFree(LPVOID ptr) { if (ptr)
1 year
1
0
0
0
[reactos] 01/01: [SDK] Add <cicero/cicarray.h> and <cicero/cicreg.h>
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=209e9a7c1daa6a5962022…
commit 209e9a7c1daa6a596202287a67799baefc73ff21 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Dec 20 20:49:06 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Dec 20 20:49:21 2023 +0900 [SDK] Add <cicero/cicarray.h> and <cicero/cicreg.h> CORE-19360 --- sdk/include/reactos/cicero/cicarray.h | 100 +++++++++++++++++++++++++++ sdk/include/reactos/cicero/cicreg.h | 126 ++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) diff --git a/sdk/include/reactos/cicero/cicarray.h b/sdk/include/reactos/cicero/cicarray.h new file mode 100644 index 00000000000..8767ac727f9 --- /dev/null +++ b/sdk/include/reactos/cicero/cicarray.h @@ -0,0 +1,100 @@ +/* + * PROJECT: ReactOS Cicero + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Cicero dynamic array + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#pragma once + +#include "cicbase.h" + +class CicArray +{ + LPVOID lpVtbl; + LPBYTE m_pb; + INT m_cItems; + INT m_cbItem; + INT m_cCapacity; + +public: + CicArray(INT cbItem); + virtual CicArray(); + + void Insert(INT iItem, INT cGrow); + void Append(INT cGrow); + void Remove(INT iItem, INT cRemove); +}; + +/******************************************************************************/ + +inline CicArray::CicArray(INT cbItem) +{ + m_cbItem = cbItem; + m_pb = NULL; + m_cItems = m_cCapacity = 0; +} + +inline CicArray::~CicArray() +{ + cicMemFree(m_pb); +} + +inline void CicArray::Append(INT cGrow) +{ + Insert(m_cItems, cGrow); +} + +inline void CicArray::Insert(INT iItem, INT cGrow) +{ + INT cNewCapacity = m_cItems + cGrow; + if (m_cCapacity < cNewCapacity) + { + if (cNewCapacity <= m_cItems + m_cItems / 2) + cNewCapacity = m_cItems + m_cItems / 2; + + BYTE *pbNew; + if (m_pb) + pbNew = (BYTE *)cicMemReAlloc(m_pb, cNewCapacity * m_cbItem); + else + pbNew = (BYTE *)cicMemAlloc(cNewCapacity * m_cbItem); + + if (!pbNew) + return; + + m_pb = pbNew; + m_cCapacity = cNewCapacity; + } + + if (iItem < m_cItems) + { + MoveMemory(&m_pb[(cGrow + iItem) * m_cbItem], + &m_pb[iItem * m_cbItem], + (m_cItems - iItem) * m_cbItem); + } + + m_cItems += cGrow; +} + +inline void CicArray::Remove(INT iItem, INT cRemove) +{ + if (iItem + cRemove < m_cItems) + { + MoveMemory(&m_pb[iItem * m_cbItem], + &m_pb[(iItem + cRemove) * m_cbItem], + (m_cItems - iItem - cRemove) * m_cbItem); + } + + m_cItems -= cRemove; + + INT cHalfCapacity = m_cCapacity / 2; + if (cHalfCapacity > m_cItems) + { + BYTE *pb = (BYTE *)cicMemReAlloc(m_pb, cHalfCapacity * m_cbItem); + if (pb) + { + m_pb = pb; + m_cCapacity = cHalfCapacity; + } + } +} diff --git a/sdk/include/reactos/cicero/cicreg.h b/sdk/include/reactos/cicero/cicreg.h new file mode 100644 index 00000000000..674d1d27ed2 --- /dev/null +++ b/sdk/include/reactos/cicero/cicreg.h @@ -0,0 +1,126 @@ +/* + * PROJECT: ReactOS Cicero + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Cicero registry handling + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#pragma once + +#include "cicbase.h" + +class CicRegKey +{ +public: + HKEY m_hKey; + + CicRegKey() : m_hKey(NULL) { } + ~CicRegKey() { Close(); } + + operator HKEY() { return m_hKey; } + + void Close(); + + LSTATUS Open( + HKEY hKey, + LPCWSTR lpSubKey, + REGSAM samDesired = KEY_READ); + + LSTATUS Create( + HKEY hKey, + LPCWSTR lpSubKey, + LPWSTR lpClass = NULL, + DWORD dwOptions = REG_OPTION_NON_VOLATILE, + REGSAM samDesired = KEY_ALL_ACCESS, + LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL, + LPDWORD pdwDisposition = NULL); + + LSTATUS QueryDword(LPCWSTR pszValueName, LPDWORD pdwValue) + { + DWORD cbData = sizeof(DWORD); + return ::RegQueryValueExW(m_hKey, pszValueName, 0, NULL, (LPBYTE)pdwValue, &cbData); + } + + LSTATUS SetDword(LPCWSTR pszValueName, DWORD dwValue) + { + return ::RegSetValueExW(m_hKey, pszValueName, 0, REG_DWORD, &dwValue, sizeof(dwValue)); + } + + LSTATUS QuerySz(LPCWSTR pszValueName, LPWSTR pszValue, DWORD cchValueMax); + + LSTATUS SetSz(LPCWSTR pszValueName, LPCWSTR pszValue) + { + DWORD cbValue = (lstrlenW(pszValue) + 1) * sizeof(WCHAR); + return ::RegSetValueExW(m_hKey, pszValueName, 0, REG_SZ, (LPBYTE)pszValue, cbValue); + } +}; + +/******************************************************************************/ + +inline void +CicRegKey::Close() +{ + if (!m_hKey) + return; + + ::RegCloseKey(m_hKey); + m_hKey = NULL; +} + +inline LSTATUS +CicRegKey::Open( + HKEY hKey, + LPCWSTR lpSubKey, + REGSAM samDesired) +{ + HKEY hNewKey = NULL; + LSTATUS error = ::RegOpenKeyExW(hKey, lpSubKey, 0, samDesired, &hNewKey); + if (error != ERROR_SUCCESS) + return error; + + Close(); + m_hKey = hNewKey; + return error; +} + +inline LSTATUS +CicRegKey::Create( + HKEY hKey, + LPCWSTR lpSubKey, + LPWSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + LPDWORD pdwDisposition) +{ + HKEY hNewKey = NULL; + LSTATUS error = ::RegCreateKeyExW(hKey, + lpSubKey, + 0, + lpClass, + dwOptions, + samDesired, + lpSecurityAttributes, + &hNewKey, + pdwDisposition); + if (error != ERROR_SUCCESS) + return error; + + Close(); + m_hKey = hNewKey; + return error; +} + +inline LSTATUS +CicRegKey::QuerySz(LPCWSTR pszValueName, LPWSTR pszValue, DWORD cchValueMax) +{ + DWORD cchSaveMax = cchValueMax; + + cchValueMax *= sizeof(WCHAR); + LSTATUS error = ::RegQueryValueExW(m_hKey, pszValueName, 0, NULL, + (LPBYTE)pszValue, &cchValueMax); + if (cchSaveMax > 0) + pszValue[(error == ERROR_SUCCESS) ? (cchSaveMax - 1) : 0] = UNICODE_NULL; + + return error; +}
1 year
1
0
0
0
[reactos] 01/01: [MSCTFIME][MSCTF][SDK] Add compartment helper functions (#6202)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d495475f027ad64a70d6…
commit 9d495475f027ad64a70d619284db31a7c6d242bc Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Dec 20 17:51:37 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Dec 20 17:51:37 2023 +0900 [MSCTFIME][MSCTF][SDK] Add compartment helper functions (#6202) - Implement GetCompartment, SetCompartmentDWORD, GetCompartmentDWORD, SetCompartmentUnknown, and ClearCompartment helper functions. - Add TF_DllDetachInOther prototype to "msctf.idl". CORE-19360 --- dll/ime/msctfime/msctfime.cpp | 144 +++++++++++++++++++++++++++++++++++++++++- dll/win32/msctf/msctf.spec | 2 +- sdk/include/psdk/msctf.idl | 1 + 3 files changed, 144 insertions(+), 3 deletions(-) diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index db9c0fe352b..044a6bc8cb2 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -164,6 +164,146 @@ void TFUninitLib_Thread(PLIBTHREAD pLibThread) } } +HRESULT +GetCompartment( + IUnknown *pUnknown, + REFGUID rguid, + ITfCompartment **ppComp, + BOOL bThread) +{ + ITfThreadMgr *pThreadMgr = NULL; + ITfCompartmentMgr *pCompMgr = NULL; + + *ppComp = NULL; + HRESULT hr; + if (bThread) + { + hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr); + if (FAILED(hr)) + return hr; + + hr = pThreadMgr->GetGlobalCompartment(&pCompMgr); + } + else + { + hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr); + } + + if (SUCCEEDED(hr)) + { + if (pCompMgr) + hr = pCompMgr->GetCompartment(rguid, ppComp); + else + hr = E_FAIL; + } + + if (pThreadMgr) + pThreadMgr->Release(); + + return hr; +} + +HRESULT +SetCompartmentDWORD( + TfEditCookie cookie, + IUnknown *pUnknown, + REFGUID rguid, + VARTYPE type, + BOOL bThread) +{ + ITfCompartment *pComp = NULL; + HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread); + if (FAILED(hr)) + return hr; + + VARIANT vari; + V_I4(&vari) = type; + V_VT(&vari) = VT_I4; + hr = pComp->SetValue(cookie, &vari); + pComp->Release(); + + return hr; +} + +HRESULT +GetCompartmentDWORD( + IUnknown *pUnknown, + REFGUID rguid, + ITfCompartment *pComp, + BOOL bThread) +{ + HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread); + if (FAILED(hr)) + return hr; + + VARIANT vari; + hr = pComp->GetValue(&vari); + pComp->Release(); + + return hr; +} + +HRESULT +SetCompartmentUnknown( + TfEditCookie cookie, + IUnknown *pUnknown, + REFGUID rguid, + IUnknown *pUnknown2) +{ + ITfCompartment *pComp = NULL; + HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, FALSE); + if (FAILED(hr)) + return hr; + + VARIANT vari; + V_UNKNOWN(&vari) = pUnknown2; + V_VT(&vari) = VT_UNKNOWN; + hr = pComp->SetValue(cookie, &vari); + pComp->Release(); + + return hr; +} + +HRESULT +ClearCompartment( + TfClientId tid, + IUnknown *pUnknown, + REFGUID rguid, + BOOL bThread) +{ + ITfCompartmentMgr *pCompMgr = NULL; + ITfThreadMgr *pThreadMgr = NULL; + + HRESULT hr; + if (bThread) + { + hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr); + if (FAILED(hr)) + return hr; + + hr = pThreadMgr->GetGlobalCompartment(&pCompMgr); + } + else + { + hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr); + } + + if (SUCCEEDED(hr)) + { + hr = E_FAIL; + if (pCompMgr) + { + hr = pCompMgr->ClearCompartment(tid, rguid); + pCompMgr->Release(); + } + } + + if (pThreadMgr) + pThreadMgr->Release(); + + return hr; +} + /* FIXME */ class CicInputContext : public ITfContextOwnerCompositionSink { @@ -2155,7 +2295,7 @@ VOID ProcessDetach(HINSTANCE hinstDLL) } /** - * @unimplemented + * @implemented */ EXTERN_C BOOL WINAPI DllMain( @@ -2182,7 +2322,7 @@ DllMain( } case DLL_THREAD_DETACH: { - // FIXME + TF_DllDetachInOther(); CtfImeThreadDetach(); TLS::InternalDestroyTLS(); break; diff --git a/dll/win32/msctf/msctf.spec b/dll/win32/msctf/msctf.spec index 779ef12c79f..a38e8d7da2b 100644 --- a/dll/win32/msctf/msctf.spec +++ b/dll/win32/msctf/msctf.spec @@ -15,7 +15,7 @@ @ stdcall TF_CreateLangBarItemMgr(ptr) @ stdcall TF_CreateLangBarMgr(ptr) @ stdcall TF_CreateThreadMgr(ptr) -@ stub TF_DllDetachInOther +@ stdcall -stub TF_DllDetachInOther() @ stdcall -stub TF_GetGlobalCompartment(ptr) @ stub TF_GetInputScope @ stub TF_GetLangIcon diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index ea487273a5b..4a4425f95fb 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -40,6 +40,7 @@ cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateLangBarItemMgr(_Out_ ITfLangBarItemM cpp_quote("EXTERN_C HANDLE WINAPI TF_CreateCicLoadMutex(_Out_ LPBOOL pfWinLogon);") cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCache(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(VOID);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;")
1 year
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200