[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( NtUserSetActiveWindow(
HWND Wnd); HWND Wnd);
DWORD BOOL
NTAPI NTAPI
NtUserSetAppImeLevel( NtUserSetAppImeLevel(
DWORD dwUnknown1, HWND hWnd,
DWORD dwUnknown2); DWORD dwLevel);
HWND HWND
NTAPI NTAPI

View file

@ -238,8 +238,29 @@ DWORD
APIENTRY APIENTRY
NtUserGetAppImeLevel(HWND hWnd) NtUserGetAppImeLevel(HWND hWnd)
{ {
STUB; DWORD ret = 0;
return 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) BOOL FASTCALL UserGetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pInfoEx, IMEINFOEXCLASS SearchType)
@ -335,14 +356,33 @@ Quit:
return ret; return ret;
} }
DWORD BOOL
APIENTRY APIENTRY
NtUserSetAppImeLevel( NtUserSetAppImeLevel(HWND hWnd, DWORD dwLevel)
DWORD dwUnknown1,
DWORD dwUnknown2)
{ {
STUB; BOOL ret = FALSE;
return 0; 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) BOOL FASTCALL UserSetImeInfoEx(LPVOID pUnknown, PIMEINFOEX pImeInfoEx)

View file

@ -25,6 +25,7 @@ ATOM AtomQOS; // Window DDE Quality of Service atom.
HINSTANCE hModClient = NULL; HINSTANCE hModClient = NULL;
BOOL ClientPfnInit = FALSE; BOOL ClientPfnInit = FALSE;
ATOM gaGuiConsoleWndClass; ATOM gaGuiConsoleWndClass;
ATOM AtomImeLevel;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
@ -55,6 +56,7 @@ InitUserAtoms(VOID)
AtomDDETrack = IntAddGlobalAtom(L"SysDT", TRUE); AtomDDETrack = IntAddGlobalAtom(L"SysDT", TRUE);
AtomQOS = IntAddGlobalAtom(L"SysQOS", 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 * 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 gaGuiConsoleWndClass;
extern ATOM AtomDDETrack; extern ATOM AtomDDETrack;
extern ATOM AtomQOS; extern ATOM AtomQOS;
extern ATOM AtomImeLevel;
extern ERESOURCE UserLock; extern ERESOURCE UserLock;
CODE_SEG("INIT") NTSTATUS NTAPI InitUserImpl(VOID); CODE_SEG("INIT") NTSTATUS NTAPI InitUserImpl(VOID);