https://git.reactos.org/?p=reactos.git;a=commitdiff;h=152af475b19eafce551f6…
commit 152af475b19eafce551f625d1ca38c78285432f5
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Feb 10 16:04:33 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Feb 10 16:04:33 2024 +0900
[MSUTB][SDK] Implement SetRegisterLangBand (#6471)
Supporting Language Bar...
JIRA issue: CORE-19363
- Add some helper functions.
- Implement SetRegisterLangBand
function.
---
dll/win32/msutb/msutb.cpp | 69 +++++++++++++++++++++++++++++++++++--
sdk/include/reactos/cicero/cicutb.h | 2 ++
2 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp
index bc9c2ff510d..be242369160 100644
--- a/dll/win32/msutb/msutb.cpp
+++ b/dll/win32/msutb/msutb.cpp
@@ -375,6 +375,7 @@ FindEAEnumFontProc(ENUMLOGFONT *pLF, NEWTEXTMETRIC *pTM, INT
nFontType, LPARAM l
return FALSE;
}
+/// Are there East-Asian vertical fonts?
BOOL CheckEAFonts(void)
{
BOOL bHasVertical = FALSE;
@@ -384,6 +385,55 @@ BOOL CheckEAFonts(void)
return bHasVertical;
}
+BOOL IsDeskBandFromReg()
+{
+ if (!(g_dwOSInfo & CIC_OSINFO_XPPLUS)) // Desk band is for XP+
+ return FALSE;
+
+ CicRegKey regKey;
+ if (regKey.Open(HKEY_CURRENT_USER,
TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")))
+ {
+ DWORD dwValue = 0;
+ regKey.QueryDword(TEXT("ShowDeskBand"), &dwValue);
+ return !!dwValue;
+ }
+
+ return FALSE;
+}
+
+void SetDeskBandToReg(BOOL bShow)
+{
+ CicRegKey regKey;
+ if (regKey.Open(HKEY_CURRENT_USER,
TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\"), KEY_ALL_ACCESS))
+ regKey.SetDword(TEXT("ShowDeskBand"), bShow);
+}
+
+BOOL RegisterComCat(REFCLSID rclsid, REFCATID rcatid, BOOL bRegister)
+{
+ if (FAILED(::CoInitialize(NULL)))
+ return FALSE;
+
+ ICatRegister *pCat;
+ HRESULT hr = ::CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL,
CLSCTX_INPROC_SERVER,
+ IID_ICatRegister, (void**)&pCat);
+ if (SUCCEEDED(hr))
+ {
+ if (bRegister)
+ hr = pCat->RegisterClassImplCategories(rclsid, 1,
const_cast<CATID*>(&rcatid));
+ else
+ hr = pCat->UnRegisterClassImplCategories(rclsid, 1,
const_cast<CATID*>(&rcatid));
+
+ pCat->Release();
+ }
+
+ ::CoUninitialize();
+
+ //if (IsIE5())
+ // ::RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Component
Categories\\{00021492-0000-0000-C000-000000000046}\\Enum"));
+
+ return SUCCEEDED(hr);
+}
+
BOOL InitFromReg(void)
{
DWORD dwValue;
@@ -4801,13 +4851,26 @@ GetPopupTipbar(HWND hWnd, BOOL fWinLogon)
/***********************************************************************
* SetRegisterLangBand (MSUTB.@)
*
- * @unimplemented
+ * @implemented
*/
EXTERN_C HRESULT WINAPI
SetRegisterLangBand(BOOL bRegister)
{
- FIXME("stub:(%d)\n", bRegister);
- return E_NOTIMPL;
+ TRACE("(%d)\n", bRegister);
+
+ if (!(g_dwOSInfo & CIC_OSINFO_XPPLUS)) // Desk band is for XP+
+ return E_FAIL;
+
+ BOOL bDeskBand = IsDeskBandFromReg();
+ if (bDeskBand == bRegister)
+ return S_OK;
+
+ SetDeskBandToReg(bRegister);
+
+ if (!RegisterComCat(CLSID_MSUTBDeskBand, CATID_DeskBand, bRegister))
+ return TF_E_NOLOCK;
+
+ return S_OK;
}
/***********************************************************************
diff --git a/sdk/include/reactos/cicero/cicutb.h b/sdk/include/reactos/cicero/cicutb.h
index e1f517d1915..774be036cb4 100644
--- a/sdk/include/reactos/cicero/cicutb.h
+++ b/sdk/include/reactos/cicero/cicutb.h
@@ -15,6 +15,8 @@ DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63, 0xB2F0,
0x4784, 0x8B,
DEFINE_GUID(CLSID_SYSTEMLANGBARITEM, 0xBEBACC94, 0x5CD3, 0x4662, 0xA1, 0xE0,
0xF3, 0x31, 0x99, 0x49, 0x36, 0x69);
DEFINE_GUID(IID_ITfLangBarMgr_P, 0xD72C0FA9, 0xADD5, 0x4AF0, 0x87, 0x06,
0x4F, 0xA9, 0xAE, 0x3E, 0x2E, 0xFF);
DEFINE_GUID(IID_ITfLangBarEventSink_P, 0x7A460360, 0xDA21, 0x4B09, 0xA8, 0xA0,
0x8A, 0x69, 0xE7, 0x28, 0xD8, 0x93);
+DEFINE_GUID(CLSID_MSUTBDeskBand, 0x540D8A8B, 0x1C3F, 0x4E32, 0x81, 0x32,
0x53, 0x0F, 0x6A, 0x50, 0x20, 0x90);
+DEFINE_GUID(CATID_DeskBand, 0x00021492, 0x0000, 0x0000, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
EXTERN_C LPVOID WINAPI GetLibTls(VOID);
EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);