mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTUSER] Implement NtUserUpdateInputContext (#4228)
- Modify NtUserUpdateInputContext prototype. - Implement NtUserUpdateInputContext function. - Add enum UPDATE_INPUT_CONTEXT (UIC_*) to undocuser.h. CORE-11700
This commit is contained in:
parent
cdf3b5e85a
commit
ba3affe5f7
4 changed files with 60 additions and 9 deletions
|
@ -928,7 +928,7 @@ PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
|
||||||
// FIXME: NtUserGetThreadState and enum ThreadStateRoutines are broken.
|
// FIXME: NtUserGetThreadState and enum ThreadStateRoutines are broken.
|
||||||
pClientImc->unknown = NtUserGetThreadState(13);
|
pClientImc->unknown = NtUserGetThreadState(13);
|
||||||
|
|
||||||
if (!NtUserUpdateInputContext(hImc, 0, pClientImc))
|
if (!NtUserUpdateInputContext(hImc, UIC_CLIENTIMCDATA, (DWORD_PTR)pClientImc))
|
||||||
{
|
{
|
||||||
Imm32HeapFree(pClientImc);
|
Imm32HeapFree(pClientImc);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -296,6 +296,12 @@ MessageBoxTimeoutW(
|
||||||
|
|
||||||
LPCWSTR WINAPI MB_GetString(IN UINT wBtn);
|
LPCWSTR WINAPI MB_GetString(IN UINT wBtn);
|
||||||
|
|
||||||
|
/* dwType for NtUserUpdateInputContext */
|
||||||
|
typedef enum _UPDATE_INPUT_CONTEXT
|
||||||
|
{
|
||||||
|
UIC_CLIENTIMCDATA = 0,
|
||||||
|
UIC_IMEWINDOW
|
||||||
|
} UPDATE_INPUT_CONTEXT;
|
||||||
|
|
||||||
//
|
//
|
||||||
// User api hook
|
// User api hook
|
||||||
|
|
|
@ -3533,12 +3533,12 @@ BOOL
|
||||||
NTAPI
|
NTAPI
|
||||||
NtUserUnregisterUserApiHook(VOID);
|
NtUserUnregisterUserApiHook(VOID);
|
||||||
|
|
||||||
DWORD
|
BOOL
|
||||||
NTAPI
|
NTAPI
|
||||||
NtUserUpdateInputContext(
|
NtUserUpdateInputContext(
|
||||||
HIMC hIMC,
|
HIMC hIMC,
|
||||||
DWORD Unknown1,
|
DWORD dwType,
|
||||||
LPVOID pClientImc);
|
DWORD_PTR dwValue);
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -346,16 +346,61 @@ NtUserSetSysColors(
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
BOOL FASTCALL UserUpdateInputContext(PIMC pIMC, DWORD dwType, DWORD_PTR dwValue)
|
||||||
|
{
|
||||||
|
PTHREADINFO pti = GetW32ThreadInfo();
|
||||||
|
PTHREADINFO ptiIMC = pIMC->head.pti;
|
||||||
|
|
||||||
|
if (pti->ppi != ptiIMC->ppi) // Different process?
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
switch (dwType)
|
||||||
|
{
|
||||||
|
case UIC_CLIENTIMCDATA:
|
||||||
|
if (pIMC->dwClientImcData)
|
||||||
|
return FALSE; // Already set
|
||||||
|
|
||||||
|
pIMC->dwClientImcData = dwValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIC_IMEWINDOW:
|
||||||
|
if (!ValidateHwndNoErr((HWND)dwValue))
|
||||||
|
return FALSE; // Invalid HWND
|
||||||
|
|
||||||
|
pIMC->hImeWnd = (HWND)dwValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
APIENTRY
|
APIENTRY
|
||||||
NtUserUpdateInputContext(
|
NtUserUpdateInputContext(
|
||||||
HIMC hIMC,
|
HIMC hIMC,
|
||||||
DWORD Unknown1,
|
DWORD dwType,
|
||||||
LPVOID pClientImc)
|
DWORD_PTR dwValue)
|
||||||
{
|
{
|
||||||
STUB
|
PIMC pIMC;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
return 0;
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
if (!IS_IMM_MODE())
|
||||||
|
goto Quit;
|
||||||
|
|
||||||
|
pIMC = UserGetObject(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
|
||||||
|
if (!pIMC)
|
||||||
|
goto Quit;
|
||||||
|
|
||||||
|
ret = UserUpdateInputContext(pIMC, dwType, dwValue);
|
||||||
|
|
||||||
|
Quit:
|
||||||
|
UserLeave();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
|
|
Loading…
Reference in a new issue