mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +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.
|
||||
pClientImc->unknown = NtUserGetThreadState(13);
|
||||
|
||||
if (!NtUserUpdateInputContext(hImc, 0, pClientImc))
|
||||
if (!NtUserUpdateInputContext(hImc, UIC_CLIENTIMCDATA, (DWORD_PTR)pClientImc))
|
||||
{
|
||||
Imm32HeapFree(pClientImc);
|
||||
return NULL;
|
||||
|
|
|
@ -296,6 +296,12 @@ MessageBoxTimeoutW(
|
|||
|
||||
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
|
||||
|
|
|
@ -3533,12 +3533,12 @@ BOOL
|
|||
NTAPI
|
||||
NtUserUnregisterUserApiHook(VOID);
|
||||
|
||||
DWORD
|
||||
BOOL
|
||||
NTAPI
|
||||
NtUserUpdateInputContext(
|
||||
HIMC hIMC,
|
||||
DWORD Unknown1,
|
||||
LPVOID pClientImc);
|
||||
DWORD dwType,
|
||||
DWORD_PTR dwValue);
|
||||
|
||||
DWORD
|
||||
NTAPI
|
||||
|
|
|
@ -346,16 +346,61 @@ NtUserSetSysColors(
|
|||
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
|
||||
NtUserUpdateInputContext(
|
||||
HIMC hIMC,
|
||||
DWORD Unknown1,
|
||||
LPVOID pClientImc)
|
||||
DWORD dwType,
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue