[NTUSER] Implement NtUserDisableThreadIme (#4216)

CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2021-12-31 10:20:53 +09:00 committed by GitHub
parent 10a5200e1f
commit fcc222c28a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 8 deletions

View file

@ -2038,10 +2038,10 @@ NTAPI
NtUserDestroyWindow(
HWND Wnd);
DWORD
BOOL
NTAPI
NtUserDisableThreadIme(
DWORD dwUnknown1);
DWORD dwThreadID);
LRESULT
NTAPI

View file

@ -10,6 +10,7 @@
#include <win32k.h>
DBG_DEFAULT_CHANNEL(UserMisc);
#define INVALID_THREAD_ID ((ULONG)-1)
UINT FASTCALL
IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
@ -80,14 +81,72 @@ NtUserCheckImeHotKey(
return 0;
}
DWORD
BOOL
APIENTRY
NtUserDisableThreadIme(
DWORD dwUnknown1)
DWORD dwThreadID)
{
STUB;
return 0;
PTHREADINFO pti, ptiCurrent;
PPROCESSINFO ppi;
BOOL ret = FALSE;
UserEnterExclusive();
if (!IS_IMM_MODE())
{
EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
goto Quit;
}
ptiCurrent = GetW32ThreadInfo();
if (dwThreadID == INVALID_THREAD_ID)
{
ppi = ptiCurrent->ppi;
ppi->W32PF_flags |= W32PF_DISABLEIME;
Retry:
for (pti = ppi->ptiList; pti; pti = pti->ptiSibling)
{
pti->TIF_flags |= TIF_DISABLEIME;
if (pti->spwndDefaultIme)
{
co_UserDestroyWindow(pti->spwndDefaultIme);
pti->spwndDefaultIme = NULL;
goto Retry; /* The contents of ppi->ptiList may be changed. */
}
}
}
else
{
if (dwThreadID == 0)
{
pti = ptiCurrent;
}
else
{
pti = IntTID2PTI(UlongToHandle(dwThreadID));
/* The thread needs to reside in the current process. */
if (!pti || pti->ppi != ptiCurrent->ppi)
goto Quit;
}
pti->TIF_flags |= TIF_DISABLEIME;
if (pti->spwndDefaultIme)
{
co_UserDestroyWindow(pti->spwndDefaultIme);
pti->spwndDefaultIme = NULL;
}
}
ret = TRUE;
Quit:
UserLeave();
return ret;
}
DWORD

View file

@ -4,7 +4,7 @@
#define RETURN(value) { _ret_ = value; goto _cleanup_; }
#define CLEANUP /*unreachable*/ ASSERT(FALSE); _cleanup_
#define END_CLEANUP return _ret_;
#define IS_IMM_MODE() (gpsi && (gpsi->dwSRVIFlags & SRVINFO_IMM32))
#define UserEnterCo UserEnterExclusive
#define UserLeaveCo UserLeave

View file

@ -25,6 +25,7 @@
#define W32PF_OLELOADED 0x00100000
#define W32PF_SCREENSAVER 0x00200000
#define W32PF_IDLESCREENSAVER 0x00400000
#define W32PF_DISABLEIME 0x00800000
#define W32PF_ICONTITLEREGISTERED 0x10000000
#define W32PF_DPIAWARE 0x20000000
// ReactOS