From ba04e5cb30808f0763d8a4536b8f6539172b78b3 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Sat, 16 Sep 2023 12:41:50 -0700 Subject: [PATCH] Revert "[BOOTDATA][NTUSER] Add UserIsIMMEnabled and use it (#4882)" This reverts commit a2c6af0da4acbba9c254d003e9d9f4ea6e03ed63. --- 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, 15 insertions(+), 69 deletions(-) diff --git a/boot/bootdata/hivesft.inf b/boot/bootdata/hivesft.inf index e45880375defb..66ddaa64e4716 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,1 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\IMM","LoadIMM",0x00010003,0 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 06fa17b82550f..4747621f2f4f0 100644 --- a/win32ss/gdi/ntgdi/misc.h +++ b/win32ss/gdi/ntgdi/misc.h @@ -56,10 +56,6 @@ 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 5c21f2f9da91a..19bee2d549195 100644 --- a/win32ss/user/ntuser/ime.c +++ b/win32ss/user/ntuser/ime.c @@ -550,7 +550,7 @@ DWORD FASTCALL UserBuildHimcList(PTHREADINFO pti, DWORD dwCount, HIMC *phList) } else { - for (pti = gptiCurrent->ppi->ptiList; pti; pti = pti->ptiSibling) + for (pti = GetW32ThreadInfo()->ppi->ptiList; pti; pti = pti->ptiSibling) { for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext) { @@ -704,7 +704,7 @@ NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCo if (dwThreadId == 0) { - pti = gptiCurrent; + pti = GetW32ThreadInfo(); } else if (dwThreadId == INVALID_THREAD_ID) { diff --git a/win32ss/user/ntuser/metric.c b/win32ss/user/ntuser/metric.c index a72e1856edfbc..b980148602469 100644 --- a/win32ss/user/ntuser/metric.c +++ b/win32ss/user/ntuser/metric.c @@ -14,26 +14,6 @@ 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) @@ -189,14 +169,12 @@ InitMetrics(VOID) piSysMet[90] = 0; #endif - if (UserIsDBCSEnabled()) - gpsi->dwSRVIFlags |= SRVINFO_DBCSENABLED; /* DBCS Support */ + /*gpsi->dwSRVIFlags |= SRVINFO_CICERO_ENABLED;*/ /* Cicero is not supported yet */ - if (UserIsIMMEnabled()) - gpsi->dwSRVIFlags |= SRVINFO_IMM32; /* IME Support */ - - if (UserIsCiceroEnabled()) - gpsi->dwSRVIFlags |= SRVINFO_CICERO_ENABLED; /* Cicero support */ + if (NLS_MB_CODE_PAGE_TAG) /* Is the system multi-byte codepage? */ + { + gpsi->dwSRVIFlags |= (SRVINFO_DBCSENABLED | SRVINFO_IMM32); /* DBCS+IME Support */ + } Setup = TRUE; diff --git a/win32ss/user/ntuser/misc/registry.c b/win32ss/user/ntuser/misc/registry.c index 2d7ca4a3d0b32..0e03e791da442 100644 --- a/win32ss/user/ntuser/misc/registry.c +++ b/win32ss/user/ntuser/misc/registry.c @@ -155,36 +155,6 @@ 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 6cfcf8e9d4504..c7b48fc045a64 100644 --- a/win32ss/user/ntuser/simplecall.c +++ b/win32ss/user/ntuser/simplecall.c @@ -124,11 +124,16 @@ NtUserCallNoParam(DWORD Routine) break; case NOPARAM_ROUTINE_UPDATEPERUSERIMMENABLING: - if (UserIsIMMEnabled()) + // 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) + { 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 740607530a46a..f91058dd53950 100644 --- a/win32ss/user/ntuser/userfuncs.h +++ b/win32ss/user/ntuser/userfuncs.h @@ -83,9 +83,6 @@ 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 ***************/