Skip to content

Commit 0966e32

Browse files
authored
[IMM32] Rewrite ImmGetCandidateWindow (reactos#3823)
Rewrite ImmGetCandidateWindow function. CORE-11700
1 parent ad37023 commit 0966e32

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

dll/win32/imm32/imm.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
WINE_DEFAULT_DEBUG_CHANNEL(imm);
4646

4747
#define IMM_INIT_MAGIC 0x19650412
48+
#define IMM_INVALID_CANDFORM ULONG_MAX
49+
4850
BOOL WINAPI User32InitializeImmEntryTable(DWORD);
4951

5052
typedef struct _tagImmHkl{
@@ -1449,22 +1451,25 @@ DWORD WINAPI ImmGetCandidateListW(
14491451
BOOL WINAPI ImmGetCandidateWindow(
14501452
HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
14511453
{
1452-
InputContextData *data = get_imc_data(hIMC);
1453-
1454-
TRACE("%p, %d, %p\n", hIMC, dwIndex, lpCandidate);
1455-
1456-
if (!data || !lpCandidate)
1457-
return FALSE;
1454+
BOOL ret = FALSE;
1455+
LPINPUTCONTEXT pIC;
1456+
LPCANDIDATEFORM pCF;
14581457

1459-
if (dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
1460-
return FALSE;
1458+
TRACE("ImmGetCandidateWindow(%p, %lu, %p)\n", hIMC, dwIndex, lpCandidate);
14611459

1462-
if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
1460+
pIC = ImmLockIMC(hIMC);
1461+
if (pIC == NULL)
14631462
return FALSE;
14641463

1465-
*lpCandidate = data->IMC.cfCandForm[dwIndex];
1464+
pCF = &pIC->cfCandForm[dwIndex];
1465+
if (pCF->dwIndex != IMM_INVALID_CANDFORM)
1466+
{
1467+
*lpCandidate = *pCF;
1468+
ret = TRUE;
1469+
}
14661470

1467-
return TRUE;
1471+
ImmUnlockIMC(hIMC);
1472+
return ret;
14681473
}
14691474

14701475
static VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)

0 commit comments

Comments
 (0)