https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9e7c2ba4608f320a04571…
commit 9e7c2ba4608f320a04571c8c545c4b2aa3c6569d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Aug 25 10:20:42 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Thu Aug 25 10:20:42 2022 +0900
[NTUSER] Improve NtUserGetImeInfoEx / NtUserSetImeInfoEx
CORE-11700
---
win32ss/user/ntuser/ime.c | 44 +++++++++++++++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c
index 1cdabee6638..424c18c44fe 100644
--- a/win32ss/user/ntuser/ime.c
+++ b/win32ss/user/ntuser/ime.c
@@ -954,11 +954,15 @@ Quit:
}
// Win: GetImeInfoEx
-BOOL FASTCALL UserGetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pInfoEx, IMEINFOEXCLASS
SearchType)
+BOOL FASTCALL
+UserGetImeInfoEx(
+ _Inout_ PWINSTATION_OBJECT pWinSta,
+ _Inout_ PIMEINFOEX pInfoEx,
+ _In_ IMEINFOEXCLASS SearchType)
{
PKL pkl, pklHead;
- if (!gspklBaseLayout)
+ if (!pWinSta || !gspklBaseLayout)
return FALSE;
pkl = pklHead = gspklBaseLayout;
@@ -971,7 +975,10 @@ BOOL FASTCALL UserGetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pInfoEx,
IMEINFOEXCLA
if (pInfoEx->hkl == pkl->hkl)
{
if (!pkl->piiex)
+ {
+ ERR("!pkl->piiex at %p\n", pkl->hkl);
break;
+ }
*pInfoEx = *pkl->piiex;
return TRUE;
@@ -984,12 +991,18 @@ BOOL FASTCALL UserGetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pInfoEx,
IMEINFOEXCLA
{
do
{
- if (pkl->piiex &&
- _wcsnicmp(pkl->piiex->wszImeFile, pInfoEx->wszImeFile,
+ if (_wcsnicmp(pkl->piiex->wszImeFile, pInfoEx->wszImeFile,
RTL_NUMBER_OF(pkl->piiex->wszImeFile)) == 0)
{
- *pInfoEx = *pkl->piiex;
- return TRUE;
+ if (pkl->piiex)
+ {
+ *pInfoEx = *pkl->piiex;
+ return TRUE;
+ }
+ else
+ {
+ ERR("!pkl->piiex at %p\n", pkl->hkl);
+ }
}
pkl = pkl->pklNext;
@@ -1011,6 +1024,7 @@ NtUserGetImeInfoEx(
{
IMEINFOEX ImeInfoEx;
BOOL ret = FALSE;
+ PWINSTATION_OBJECT pWinSta;
UserEnterShared();
@@ -1031,7 +1045,8 @@ NtUserGetImeInfoEx(
}
_SEH2_END;
- ret = UserGetImeInfoEx(NULL, &ImeInfoEx, SearchType);
+ pWinSta = IntGetProcessWindowStation(NULL);
+ ret = UserGetImeInfoEx(pWinSta, &ImeInfoEx, SearchType);
if (!ret)
goto Quit;
@@ -1081,10 +1096,16 @@ Quit:
}
// Win: SetImeInfoEx
-BOOL FASTCALL UserSetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pImeInfoEx)
+BOOL FASTCALL
+UserSetImeInfoEx(
+ _Inout_ PWINSTATION_OBJECT pWinSta,
+ _Inout_ PIMEINFOEX pImeInfoEx)
{
PKL pklHead, pkl;
+ if (!pWinSta || !gspklBaseLayout)
+ return FALSE;
+
pkl = pklHead = gspklBaseLayout;
do
@@ -1096,7 +1117,10 @@ BOOL FASTCALL UserSetImeInfoEx(LPVOID pUnknown, PIMEINFOEX
pImeInfoEx)
}
if (!pkl->piiex)
+ {
+ ERR("!pkl->piiex at %p\n", pkl->hkl);
return FALSE;
+ }
if (!pkl->piiex->fLoadFlag)
*pkl->piiex = *pImeInfoEx;
@@ -1113,6 +1137,7 @@ NtUserSetImeInfoEx(PIMEINFOEX pImeInfoEx)
{
BOOL ret = FALSE;
IMEINFOEX ImeInfoEx;
+ PWINSTATION_OBJECT pWinSta;
UserEnterExclusive();
@@ -1133,7 +1158,8 @@ NtUserSetImeInfoEx(PIMEINFOEX pImeInfoEx)
}
_SEH2_END;
- ret = UserSetImeInfoEx(NULL, &ImeInfoEx);
+ pWinSta = IntGetProcessWindowStation(NULL);
+ ret = UserSetImeInfoEx(pWinSta, &ImeInfoEx);
Quit:
UserLeave();