Aric Stewart : imm32: ImmGetCandidateWindow should not return unset data.

Alexandre Julliard julliard at winehq.org
Wed Oct 2 15:49:13 CDT 2013


Module: wine
Branch: master
Commit: bd9e6081333240050584eb216b208728fbccf13b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bd9e6081333240050584eb216b208728fbccf13b

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Oct  1 14:30:12 2013 -0500

imm32: ImmGetCandidateWindow should not return unset data.

---

 dlls/imm32/imm.c         |    7 +++++++
 dlls/imm32/tests/imm32.c |   18 ++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 93e71af..4738103 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -636,6 +636,7 @@ HIMC WINAPI ImmCreateContext(void)
     InputContextData *new_context;
     LPGUIDELINE gl;
     LPCANDIDATEINFO ci;
+    int i;
 
     new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData));
 
@@ -663,6 +664,9 @@ HIMC WINAPI ImmCreateContext(void)
     gl->dwSize = sizeof(GUIDELINE);
     ImmUnlockIMCC(new_context->IMC.hGuideLine);
 
+    for (i = 0; i < sizeof(new_context->IMC.cfCandForm) / sizeof(CANDIDATEFORM); i++)
+        new_context->IMC.cfCandForm[i].dwIndex = ~0u;
+
     /* Initialize the IME Private */
     new_context->IMC.hPrivate = ImmCreateIMCC(new_context->immKbd->imeInfo.dwPrivateDataSize);
 
@@ -1035,6 +1039,9 @@ BOOL WINAPI ImmGetCandidateWindow(
     if ( dwIndex >= (sizeof(data->IMC.cfCandForm) / sizeof(CANDIDATEFORM)) )
         return FALSE;
 
+    if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
+        return FALSE;
+
     *lpCandidate = data->IMC.cfCandForm[dwIndex];
 
     return TRUE;
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 0324304..7b81965 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -465,6 +465,7 @@ static void test_ImmThreads(void)
     BOOL rc;
     LOGFONT lf;
     COMPOSITIONFORM cf;
+    CANDIDATEFORM cdf;
     DWORD status, sentence;
     POINT pt;
 
@@ -552,6 +553,23 @@ static void test_ImmThreads(void)
     rc = ImmGetStatusWindowPos(otherHimc, &pt);
     ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n");
 
+    /* Candidate Window */
+    rc = ImmGetCandidateWindow(himc, 0, &cdf);
+    ok (rc == 0, "ImmGetCandidateWindow should fail\n");
+    cdf.dwIndex = 0;
+    cdf.dwStyle = CFS_CANDIDATEPOS;
+    cdf.ptCurrentPos.x = 0;
+    cdf.ptCurrentPos.y = 0;
+    rc = ImmSetCandidateWindow(himc, &cdf);
+    ok (rc == 1, "ImmSetCandidateWindow should succeed\n");
+    rc = ImmGetCandidateWindow(himc, 0, &cdf);
+    ok (rc == 1, "ImmGetCandidateWindow should succeed\n");
+
+    rc = ImmGetCandidateWindow(otherHimc, 0, &cdf);
+    todo_wine ok (rc == 0, "ImmGetCandidateWindow should fail\n");
+    rc = ImmSetCandidateWindow(otherHimc, &cdf);
+    todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n");
+
     ImmReleaseContext(threadinfo.hwnd,otherHimc);
     ImmReleaseContext(hwnd,himc);
 




More information about the wine-cvs mailing list