https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a2c6af0da4acbba9c254d…
commit a2c6af0da4acbba9c254d003e9d9f4ea6e03ed63
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Nov 15 17:10:06 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Nov 15 17:10:06 2022 +0900
[BOOTDATA][NTUSER] Add UserIsIMMEnabled and use it (#4882)
This PR enables SRVINFO_IMM32 also for non-CJK. You can disable this flag by setting
zero to the LoadIMM registry value if you're non-CJK.
CORE-11700
---
boot/bootdata/hivesft.inf | 2 +-
win32ss/gdi/ntgdi/misc.h | 4 ++++
win32ss/user/ntuser/ime.c | 4 ++--
win32ss/user/ntuser/metric.c | 32 +++++++++++++++++++++++++++-----
win32ss/user/ntuser/misc/registry.c | 30 ++++++++++++++++++++++++++++++
win32ss/user/ntuser/simplecall.c | 9 ++-------
win32ss/user/ntuser/userfuncs.h | 3 +++
7 files changed, 69 insertions(+), 15 deletions(-)
diff --git a/boot/bootdata/hivesft.inf b/boot/bootdata/hivesft.inf
index 1804c2d9d72..3bf5db168d8 100644
--- a/boot/bootdata/hivesft.inf
+++ b/boot/bootdata/hivesft.inf
@@ -512,7 +512,7 @@ HKLM,"SOFTWARE\Microsoft\Windows
NT\CurrentVersion\FontMapper",,0x00000012
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix",,0x00000012
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\IME
Compatibility",,0x00000012
-HKLM,"SOFTWARE\Microsoft\Windows
NT\CurrentVersion\IMM","LoadIMM",0x00010003,0
+HKLM,"SOFTWARE\Microsoft\Windows
NT\CurrentVersion\IMM","LoadIMM",0x00010003,1
HKLM,"SOFTWARE\Microsoft\Windows
NT\CurrentVersion\IMM","LoadCTFIME",0x00010003,0
; DOS Device ports
diff --git a/win32ss/gdi/ntgdi/misc.h b/win32ss/gdi/ntgdi/misc.h
index eb25a53467e..6757acce4c0 100644
--- a/win32ss/gdi/ntgdi/misc.h
+++ b/win32ss/gdi/ntgdi/misc.h
@@ -54,6 +54,10 @@ BOOL
NTAPI
RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData);
+DWORD
+NTAPI
+RegGetSectionDWORD(LPCWSTR pszSection, LPWSTR pszValue, DWORD dwDefault);
+
VOID FASTCALL
SetLastNtError(
NTSTATUS Status);
diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c
index 62e71747f50..57d2e3f0839 100644
--- a/win32ss/user/ntuser/ime.c
+++ b/win32ss/user/ntuser/ime.c
@@ -562,7 +562,7 @@ DWORD FASTCALL UserBuildHimcList(PTHREADINFO pti, DWORD dwCount, HIMC
*phList)
}
else
{
- for (pti = GetW32ThreadInfo()->ppi->ptiList; pti; pti =
pti->ptiSibling)
+ for (pti = gptiCurrent->ppi->ptiList; pti; pti = pti->ptiSibling)
{
for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext)
{
@@ -716,7 +716,7 @@ NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList,
LPDWORD pdwCo
if (dwThreadId == 0)
{
- pti = GetW32ThreadInfo();
+ pti = gptiCurrent;
}
else if (dwThreadId == INVALID_THREAD_ID)
{
diff --git a/win32ss/user/ntuser/metric.c b/win32ss/user/ntuser/metric.c
index b9801486024..a72e1856edf 100644
--- a/win32ss/user/ntuser/metric.c
+++ b/win32ss/user/ntuser/metric.c
@@ -14,6 +14,26 @@ static BOOL Setup = FALSE;
/* FUNCTIONS *****************************************************************/
+BOOL FASTCALL UserIsDBCSEnabled(VOID)
+{
+ return NLS_MB_CODE_PAGE_TAG;
+}
+
+BOOL FASTCALL UserIsIMMEnabled(VOID)
+{
+ static WCHAR s_szLoadIMM[] = L"LoadIMM";
+
+ if (NLS_MB_CODE_PAGE_TAG)
+ return TRUE;
+
+ return !!RegGetSectionDWORD(L"IMM", s_szLoadIMM, TRUE);
+}
+
+BOOL FASTCALL UserIsCiceroEnabled(VOID)
+{
+ return FALSE; /* FIXME: Cicero is not supported yet */
+}
+
BOOL
NTAPI
InitMetrics(VOID)
@@ -169,12 +189,14 @@ InitMetrics(VOID)
piSysMet[90] = 0;
#endif
- /*gpsi->dwSRVIFlags |= SRVINFO_CICERO_ENABLED;*/ /* Cicero is not supported yet
*/
+ if (UserIsDBCSEnabled())
+ gpsi->dwSRVIFlags |= SRVINFO_DBCSENABLED; /* DBCS Support */
- if (NLS_MB_CODE_PAGE_TAG) /* Is the system multi-byte codepage? */
- {
- gpsi->dwSRVIFlags |= (SRVINFO_DBCSENABLED | SRVINFO_IMM32); /* DBCS+IME
Support */
- }
+ if (UserIsIMMEnabled())
+ gpsi->dwSRVIFlags |= SRVINFO_IMM32; /* IME Support */
+
+ if (UserIsCiceroEnabled())
+ gpsi->dwSRVIFlags |= SRVINFO_CICERO_ENABLED; /* Cicero support */
Setup = TRUE;
diff --git a/win32ss/user/ntuser/misc/registry.c b/win32ss/user/ntuser/misc/registry.c
index 0e03e791da4..2d7ca4a3d0b 100644
--- a/win32ss/user/ntuser/misc/registry.c
+++ b/win32ss/user/ntuser/misc/registry.c
@@ -155,6 +155,36 @@ RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
return NT_SUCCESS(Status);
}
+NTSTATUS
+NTAPI
+RegOpenSectionKey(
+ LPCWSTR pszSection,
+ PHKEY phkey)
+{
+ WCHAR szKey[MAX_PATH] =
+ L"\\Registry\\Machine\\Software\\Microsoft\\Windows
NT\\CurrentVersion\\";
+
+ RtlStringCchCatW(szKey, _countof(szKey), pszSection);
+ return RegOpenKey(szKey, phkey);
+}
+
+DWORD
+NTAPI
+RegGetSectionDWORD(LPCWSTR pszSection, LPWSTR pszValue, DWORD dwDefault)
+{
+ HKEY hKey;
+ DWORD dwValue;
+
+ if (NT_ERROR(RegOpenSectionKey(pszSection, &hKey)))
+ return dwDefault;
+
+ if (!RegReadDWORD(hKey, pszValue, &dwValue))
+ dwValue = dwDefault;
+
+ ZwClose(hKey);
+ return dwValue;
+}
+
_Success_(return!=FALSE)
BOOL
NTAPI
diff --git a/win32ss/user/ntuser/simplecall.c b/win32ss/user/ntuser/simplecall.c
index b0e1d86f1d0..a52d184fe20 100644
--- a/win32ss/user/ntuser/simplecall.c
+++ b/win32ss/user/ntuser/simplecall.c
@@ -124,16 +124,11 @@ NtUserCallNoParam(DWORD Routine)
break;
case NOPARAM_ROUTINE_UPDATEPERUSERIMMENABLING:
- // TODO: This should also check the registry!
- // see
https://www.pctipsbox.com/fix-available-for-ie7-memory-leaks-on-xp-sp3/ for more
information
- if (NLS_MB_CODE_PAGE_TAG)
- {
+ if (UserIsIMMEnabled())
gpsi->dwSRVIFlags |= SRVINFO_IMM32;
- }
else
- {
gpsi->dwSRVIFlags &= ~SRVINFO_IMM32;
- }
+
Result = TRUE; // Always return TRUE.
break;
diff --git a/win32ss/user/ntuser/userfuncs.h b/win32ss/user/ntuser/userfuncs.h
index f91058dd539..740607530a4 100644
--- a/win32ss/user/ntuser/userfuncs.h
+++ b/win32ss/user/ntuser/userfuncs.h
@@ -83,6 +83,9 @@ NTSTATUS FASTCALL InitSessionImpl(VOID);
BOOL NTAPI InitMetrics(VOID);
LONG NTAPI UserGetSystemMetrics(ULONG Index);
+BOOL FASTCALL UserIsDBCSEnabled(VOID);
+BOOL FASTCALL UserIsIMMEnabled(VOID);
+BOOL FASTCALL UserIsCiceroEnabled(VOID);
/*************** KEYBOARD.C ***************/