[NTUSER] Implement NtUserGetAppImeLevel and NtUserSetAppImeLevel (#4313)

- Add AtomImeLevel atom.
- Modify NtUserSetAppImeLevel prototype.
- Implement NtUserGetAppImeLevel and NtUserSetAppImeLevel functions.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-01-27 07:29:19 +09:00 committed by GitHub
parent 963e76fd60
commit 9c8167e90a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 11 deletions

View file

@ -3084,11 +3084,11 @@ NTAPI
NtUserSetActiveWindow(
HWND Wnd);
DWORD
BOOL
NTAPI
NtUserSetAppImeLevel(
DWORD dwUnknown1,
DWORD dwUnknown2);
HWND hWnd,
DWORD dwLevel);
HWND
NTAPI

View file

@ -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)

View file

@ -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

View file

@ -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);