https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cfff2dbd12b208175eb56faf04e533c4dde82c9e

commit cfff2dbd12b208175eb56faf04e533c4dde82c9e
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Wed Dec 27 12:32:01 2023 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Wed Dec 27 12:32:01 2023 +0900

    [MSCTF] Implement InitCUASFlag (#6235)
    
    Implementing TIPs and Language Bar...
    JIRA issue: CORE-19361
    - Add InitCUASFlag function.
    - Use it in ProcessAttach function.
---
 dll/win32/msctf/utils.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/dll/win32/msctf/utils.cpp b/dll/win32/msctf/utils.cpp
index dfad480ea0b..8e798094af7 100644
--- a/dll/win32/msctf/utils.cpp
+++ b/dll/win32/msctf/utils.cpp
@@ -45,6 +45,8 @@ HKL g_hklDefault = NULL;
 DWORD g_dwTLSIndex = (DWORD)-1;
 BOOL gfSharedMemory = FALSE;
 LONG g_cRefDll = -1;
+BOOL g_fCUAS = FALSE;
+TCHAR g_szCUASImeFile[16] = { 0 };
 
 // Messages
 UINT g_msgPrivate = 0;
@@ -484,6 +486,40 @@ VOID CheckAnchorStores(VOID)
     //FIXME
 }
 
+VOID InitCUASFlag(VOID)
+{
+    CicRegKey regKey1;
+    LSTATUS error;
+
+    error = regKey1.Open(HKEY_LOCAL_MACHINE, 
TEXT("SOFTWARE\\Microsoft\\CTF\\SystemShared\\"));
+    if (error == ERROR_SUCCESS)
+    {
+        DWORD dwValue;
+        error = regKey1.QueryDword(TEXT("CUAS"), &dwValue);
+        if (error == ERROR_SUCCESS)
+            g_fCUAS = !!dwValue;
+    }
+
+    g_szCUASImeFile[0] = TEXT('\0');
+
+    if (!g_fCUAS)
+        return;
+
+    TCHAR szImeFile[16];
+    CicRegKey regKey2;
+    error = regKey2.Open(HKEY_LOCAL_MACHINE,
+                         TEXT("Software\\Microsoft\\Windows 
NT\\CurrentVersion\\IMM"));
+    if (error == ERROR_SUCCESS)
+    {
+        error = regKey2.QuerySz(TEXT("IME File"), szImeFile, 
_countof(szImeFile));
+        if (error == ERROR_SUCCESS)
+        {
+            g_szCUASImeFile[_countof(g_szCUASImeFile) - 1] = TEXT('\0'); // 
Avoid buffer overrun
+            StringCchCopy(g_szCUASImeFile, _countof(g_szCUASImeFile), 
szImeFile);
+        }
+    }
+}
+
 /**
  * @unimplemented
  */
@@ -541,6 +577,10 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) // FIXME: Call me 
from DllMain
 
     //FIXME
 
+    InitCUASFlag();
+
+    //FIXME
+
     GetDesktopUniqueName(TEXT("CTF.AsmListCache.FMP"), g_szAsmListCache, 
_countof(g_szAsmListCache));
     GetDesktopUniqueName(TEXT("CTF.TimListCache.FMP"), g_szTimListCache, 
_countof(g_szTimListCache));
     GetDesktopUniqueName(TEXT("CTF.LayoutsCache.FMP"), g_szLayoutsCache, 
_countof(g_szLayoutsCache));

Reply via email to