mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[IMM32] Rewrite ImmEnumInputContext (#3859)
- Rewrite ImmEnumInputContext function. - Modify NtUserBuildHimcList. CORE-11700
This commit is contained in:
parent
54406bf4f0
commit
89cb8a38b3
3 changed files with 70 additions and 16 deletions
|
@ -1161,6 +1161,50 @@ static PCLIENTIMC APIENTRY Imm32GetClientImcCache(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static NTSTATUS APIENTRY
|
||||
Imm32BuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
|
||||
{
|
||||
return NtUserBuildHimcList(dwThreadId, dwCount, phList, pdwCount);
|
||||
}
|
||||
|
||||
static DWORD APIENTRY Imm32AllocAndBuildHimcList(DWORD dwThreadId, HIMC **pphList)
|
||||
{
|
||||
#define INITIAL_COUNT 0x40
|
||||
#define MAX_RETRY 10
|
||||
NTSTATUS Status;
|
||||
DWORD dwCount = INITIAL_COUNT, cRetry = 0;
|
||||
HIMC *phNewList;
|
||||
|
||||
phNewList = Imm32HeapAlloc(0, dwCount * sizeof(HIMC));
|
||||
if (phNewList == NULL)
|
||||
return 0;
|
||||
|
||||
Status = Imm32BuildHimcList(dwThreadId, dwCount, phNewList, &dwCount);
|
||||
while (Status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
HeapFree(g_hImm32Heap, 0, phNewList);
|
||||
if (cRetry++ >= MAX_RETRY)
|
||||
return 0;
|
||||
|
||||
phNewList = Imm32HeapAlloc(0, dwCount * sizeof(HIMC));
|
||||
if (phNewList == NULL)
|
||||
return 0;
|
||||
|
||||
Status = Imm32BuildHimcList(dwThreadId, dwCount, phNewList, &dwCount);
|
||||
}
|
||||
|
||||
if (NT_ERROR(Status) || !dwCount)
|
||||
{
|
||||
HeapFree(g_hImm32Heap, 0, phNewList);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*pphList = phNewList;
|
||||
return dwCount;
|
||||
#undef INITIAL_COUNT
|
||||
#undef MAX_RETRY
|
||||
}
|
||||
|
||||
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
|
||||
{
|
||||
PCLIENTIMC pClientImc;
|
||||
|
@ -3735,11 +3779,29 @@ BOOL WINAPI ImmDisableTextFrameService(DWORD dwThreadId)
|
|||
/***********************************************************************
|
||||
* ImmEnumInputContext(IMM32.@)
|
||||
*/
|
||||
|
||||
BOOL WINAPI ImmEnumInputContext(DWORD dwThreadId, IMCENUMPROC lpfn, LPARAM lParam)
|
||||
{
|
||||
FIXME("Stub\n");
|
||||
HIMC *phList;
|
||||
DWORD dwIndex, dwCount;
|
||||
BOOL ret = TRUE;
|
||||
HIMC hIMC;
|
||||
|
||||
TRACE("ImmEnumInputContext(%lu, %p, %p)\n", dwThreadId, lpfn, lParam);
|
||||
|
||||
dwCount = Imm32AllocAndBuildHimcList(dwThreadId, &phList);
|
||||
if (!dwCount)
|
||||
return FALSE;
|
||||
|
||||
for (dwIndex = 0; dwIndex < dwCount; ++dwIndex)
|
||||
{
|
||||
hIMC = phList[dwIndex];
|
||||
ret = (*lpfn)(hIMC, lParam);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
|
||||
HeapFree(g_hImm32Heap, 0, phList);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -1253,13 +1253,9 @@ NtUserAssociateInputContext(
|
|||
DWORD dwUnknown2,
|
||||
DWORD dwUnknown3);
|
||||
|
||||
DWORD
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtUserBuildHimcList(
|
||||
DWORD dwUnknown1,
|
||||
DWORD dwUnknown2,
|
||||
DWORD dwUnknown3,
|
||||
DWORD dwUnknown4);
|
||||
NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount);
|
||||
|
||||
DWORD
|
||||
NTAPI
|
||||
|
|
|
@ -54,16 +54,12 @@ NtUserBitBltSysBmp(
|
|||
return Ret;
|
||||
}
|
||||
|
||||
DWORD
|
||||
NTSTATUS
|
||||
APIENTRY
|
||||
NtUserBuildHimcList(
|
||||
DWORD dwUnknown1,
|
||||
DWORD dwUnknown2,
|
||||
DWORD dwUnknown3,
|
||||
DWORD dwUnknown4)
|
||||
NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
|
||||
{
|
||||
STUB;
|
||||
return 0;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
DWORD
|
||||
|
|
Loading…
Reference in a new issue