https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9c8167e90ab856627bda19...
commit 9c8167e90ab856627bda1940be7a76790a7b0441 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Thu Jan 27 07:29:19 2022 +0900 Commit: GitHub noreply@github.com CommitDate: Thu Jan 27 07:29:19 2022 +0900
[NTUSER] Implement NtUserGetAppImeLevel and NtUserSetAppImeLevel (#4313)
- Add AtomImeLevel atom. - Modify NtUserSetAppImeLevel prototype. - Implement NtUserGetAppImeLevel and NtUserSetAppImeLevel functions. CORE-11700 --- win32ss/include/ntuser.h | 6 ++--- win32ss/user/ntuser/ime.c | 56 +++++++++++++++++++++++++++++++++++++------- win32ss/user/ntuser/ntuser.c | 2 ++ win32ss/user/ntuser/ntuser.h | 1 + 4 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h index dab6b267781..400830ab3e5 100644 --- a/win32ss/include/ntuser.h +++ b/win32ss/include/ntuser.h @@ -3084,11 +3084,11 @@ NTAPI NtUserSetActiveWindow( HWND Wnd);
-DWORD +BOOL NTAPI NtUserSetAppImeLevel( - DWORD dwUnknown1, - DWORD dwUnknown2); + HWND hWnd, + DWORD dwLevel);
HWND NTAPI diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c index 3a8af9d46a9..18806d68a8d 100644 --- a/win32ss/user/ntuser/ime.c +++ b/win32ss/user/ntuser/ime.c @@ -238,8 +238,29 @@ DWORD APIENTRY NtUserGetAppImeLevel(HWND hWnd) { - STUB; - return 0; + DWORD ret = 0; + PWND pWnd; + PTHREADINFO pti; + + UserEnterShared(); + + pWnd = ValidateHwndNoErr(hWnd); + if (!pWnd) + goto Quit; + + if (!IS_IMM_MODE()) + { + EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED); + goto Quit; + } + + pti = PsGetCurrentThreadWin32Thread(); + if (pWnd->head.pti->ppi == pti->ppi) + ret = (DWORD)(ULONG_PTR)UserGetProp(pWnd, AtomImeLevel, TRUE); + +Quit: + UserLeave(); + return ret; }
BOOL FASTCALL UserGetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pInfoEx, IMEINFOEXCLASS SearchType) @@ -335,14 +356,33 @@ Quit: return ret; }
-DWORD +BOOL APIENTRY -NtUserSetAppImeLevel( - DWORD dwUnknown1, - DWORD dwUnknown2) +NtUserSetAppImeLevel(HWND hWnd, DWORD dwLevel) { - STUB; - return 0; + BOOL ret = FALSE; + PWND pWnd; + PTHREADINFO pti; + + UserEnterExclusive(); + + pWnd = ValidateHwndNoErr(hWnd); + if (!pWnd) + goto Quit; + + if (!IS_IMM_MODE()) + { + EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED); + goto Quit; + } + + pti = PsGetCurrentThreadWin32Thread(); + if (pWnd->head.pti->ppi == pti->ppi) + ret = UserSetProp(pWnd, AtomImeLevel, (HANDLE)(ULONG_PTR)dwLevel, TRUE); + +Quit: + UserLeave(); + return ret; }
BOOL FASTCALL UserSetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pImeInfoEx) diff --git a/win32ss/user/ntuser/ntuser.c b/win32ss/user/ntuser/ntuser.c index 32805901b33..220ed8db6af 100644 --- a/win32ss/user/ntuser/ntuser.c +++ b/win32ss/user/ntuser/ntuser.c @@ -25,6 +25,7 @@ ATOM AtomQOS; // Window DDE Quality of Service atom. HINSTANCE hModClient = NULL; BOOL ClientPfnInit = FALSE; ATOM gaGuiConsoleWndClass; +ATOM AtomImeLevel;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -55,6 +56,7 @@ InitUserAtoms(VOID)
AtomDDETrack = IntAddGlobalAtom(L"SysDT", TRUE); AtomQOS = IntAddGlobalAtom(L"SysQOS", TRUE); + AtomImeLevel = IntAddGlobalAtom(L"SysIMEL", TRUE);
/* * FIXME: AddPropW uses the global kernel atom table, thus leading to conflicts if we use diff --git a/win32ss/user/ntuser/ntuser.h b/win32ss/user/ntuser/ntuser.h index 29ee2fae600..090a7973690 100644 --- a/win32ss/user/ntuser/ntuser.h +++ b/win32ss/user/ntuser/ntuser.h @@ -18,6 +18,7 @@ extern BOOL g_AlwaysDisplayVersion; extern ATOM gaGuiConsoleWndClass; extern ATOM AtomDDETrack; extern ATOM AtomQOS; +extern ATOM AtomImeLevel; extern ERESOURCE UserLock;
CODE_SEG("INIT") NTSTATUS NTAPI InitUserImpl(VOID);