From a45a07e4747162d1b1b0ea5c4c8c00b3c1a005ae Mon Sep 17 00:00:00 2001 From: ByeongSik Jeon Date: Fri, 2 May 2008 12:50:58 +0900 Subject: [PATCH] imm32: Updated implementation of the ImmGetCandidateListCount{A|W}. --- dlls/imm32/imm.c | 54 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 590bcccc06e..f382f2b84f3 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -829,9 +829,30 @@ done: DWORD WINAPI ImmGetCandidateListCountA( HIMC hIMC, LPDWORD lpdwListCount) { - FIXME("(%p, %p): stub\n", hIMC, lpdwListCount); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + InputContextData *data = (InputContextData *)hIMC; + LPCANDIDATEINFO candinfo; + DWORD ret, count; + + TRACE("%p, %p\n", hIMC, lpdwListCount); + + if (!data || !lpdwListCount || !data->IMC.hCandInfo) + return 0; + + candinfo = ImmLockIMCC(data->IMC.hCandInfo); + + *lpdwListCount = count = candinfo->dwCount; + + if ( !is_himc_ime_unicode(data) ) + ret = candinfo->dwSize; + else + { + ret = sizeof(CANDIDATEINFO); + while ( count-- ) + ret += ImmGetCandidateListA(hIMC, count, NULL, 0); + } + + ImmUnlockIMCC(data->IMC.hCandInfo); + return ret; } /*********************************************************************** @@ -840,9 +861,30 @@ DWORD WINAPI ImmGetCandidateListCountA( DWORD WINAPI ImmGetCandidateListCountW( HIMC hIMC, LPDWORD lpdwListCount) { - FIXME("(%p, %p): stub\n", hIMC, lpdwListCount); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + InputContextData *data = (InputContextData *)hIMC; + LPCANDIDATEINFO candinfo; + DWORD ret, count; + + TRACE("%p, %p\n", hIMC, lpdwListCount); + + if (!data || !lpdwListCount || !data->IMC.hCandInfo) + return 0; + + candinfo = ImmLockIMCC(data->IMC.hCandInfo); + + *lpdwListCount = count = candinfo->dwCount; + + if ( is_himc_ime_unicode(data) ) + ret = candinfo->dwSize; + else + { + ret = sizeof(CANDIDATEINFO); + while ( count-- ) + ret += ImmGetCandidateListW(hIMC, count, NULL, 0); + } + + ImmUnlockIMCC(data->IMC.hCandInfo); + return ret; } /***********************************************************************