[NTUSER] Implement NtUserBuildHimcList (#4286)

- Add UserBuildHimcList helper function.
- Implement NtUserBuildHimcList function.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-01-16 09:56:18 +09:00 committed by GitHub
parent 2250ce80f3
commit ce6da820a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 8 deletions

View file

@ -12,6 +12,38 @@ DBG_DEFAULT_CHANNEL(UserMisc);
#define INVALID_THREAD_ID ((ULONG)-1)
DWORD FASTCALL UserBuildHimcList(PTHREADINFO pti, DWORD dwCount, HIMC *phList)
{
PIMC pIMC;
DWORD dwRealCount = 0;
if (pti)
{
for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext)
{
if (dwRealCount < dwCount)
phList[dwRealCount] = UserHMGetHandle(pIMC);
++dwRealCount;
}
}
else
{
for (pti = GetW32ThreadInfo()->ppi->ptiList; pti; pti = pti->ptiSibling)
{
for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext)
{
if (dwRealCount < dwCount)
phList[dwRealCount] = UserHMGetHandle(pIMC);
++dwRealCount;
}
}
}
return dwRealCount;
}
UINT FASTCALL
IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
@ -38,6 +70,59 @@ IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg, WPARAM w
return 0;
}
NTSTATUS
APIENTRY
NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
{
NTSTATUS ret = STATUS_UNSUCCESSFUL;
DWORD dwRealCount;
PTHREADINFO pti;
UserEnterExclusive();
if (!IS_IMM_MODE())
{
EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
goto Quit;
}
if (dwThreadId == 0)
{
pti = GetW32ThreadInfo();
}
else if (dwThreadId == INVALID_THREAD_ID)
{
pti = NULL;
}
else
{
pti = IntTID2PTI(UlongToHandle(dwThreadId));
if (!pti || !pti->rpdesk)
goto Quit;
}
_SEH2_TRY
{
ProbeForWrite(phList, dwCount * sizeof(HIMC), 1);
ProbeForWrite(pdwCount, sizeof(DWORD), 1);
*pdwCount = dwRealCount = UserBuildHimcList(pti, dwCount, phList);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
goto Quit;
}
_SEH2_END;
if (dwCount < dwRealCount)
ret = STATUS_BUFFER_TOO_SMALL;
else
ret = STATUS_SUCCESS;
Quit:
UserLeave();
return ret;
}
BOOL WINAPI
NtUserGetImeHotKey(IN DWORD dwHotKey,
OUT LPUINT lpuModifiers,

View file

@ -51,14 +51,6 @@ NtUserBitBltSysBmp(
return Ret;
}
NTSTATUS
APIENTRY
NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
{
STUB;
return STATUS_NOT_IMPLEMENTED;
}
DWORD
APIENTRY
NtUserDragObject(