Commit bd9e6081 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

imm32: ImmGetCandidateWindow should not return unset data.

parent 02045662
...@@ -636,6 +636,7 @@ HIMC WINAPI ImmCreateContext(void) ...@@ -636,6 +636,7 @@ HIMC WINAPI ImmCreateContext(void)
InputContextData *new_context; InputContextData *new_context;
LPGUIDELINE gl; LPGUIDELINE gl;
LPCANDIDATEINFO ci; LPCANDIDATEINFO ci;
int i;
new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData)); new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData));
...@@ -663,6 +664,9 @@ HIMC WINAPI ImmCreateContext(void) ...@@ -663,6 +664,9 @@ HIMC WINAPI ImmCreateContext(void)
gl->dwSize = sizeof(GUIDELINE); gl->dwSize = sizeof(GUIDELINE);
ImmUnlockIMCC(new_context->IMC.hGuideLine); 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 */ /* Initialize the IME Private */
new_context->IMC.hPrivate = ImmCreateIMCC(new_context->immKbd->imeInfo.dwPrivateDataSize); new_context->IMC.hPrivate = ImmCreateIMCC(new_context->immKbd->imeInfo.dwPrivateDataSize);
...@@ -1035,6 +1039,9 @@ BOOL WINAPI ImmGetCandidateWindow( ...@@ -1035,6 +1039,9 @@ BOOL WINAPI ImmGetCandidateWindow(
if ( dwIndex >= (sizeof(data->IMC.cfCandForm) / sizeof(CANDIDATEFORM)) ) if ( dwIndex >= (sizeof(data->IMC.cfCandForm) / sizeof(CANDIDATEFORM)) )
return FALSE; return FALSE;
if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
return FALSE;
*lpCandidate = data->IMC.cfCandForm[dwIndex]; *lpCandidate = data->IMC.cfCandForm[dwIndex];
return TRUE; return TRUE;
......
...@@ -465,6 +465,7 @@ static void test_ImmThreads(void) ...@@ -465,6 +465,7 @@ static void test_ImmThreads(void)
BOOL rc; BOOL rc;
LOGFONT lf; LOGFONT lf;
COMPOSITIONFORM cf; COMPOSITIONFORM cf;
CANDIDATEFORM cdf;
DWORD status, sentence; DWORD status, sentence;
POINT pt; POINT pt;
...@@ -552,6 +553,23 @@ static void test_ImmThreads(void) ...@@ -552,6 +553,23 @@ static void test_ImmThreads(void)
rc = ImmGetStatusWindowPos(otherHimc, &pt); rc = ImmGetStatusWindowPos(otherHimc, &pt);
ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n"); 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(threadinfo.hwnd,otherHimc);
ImmReleaseContext(hwnd,himc); ImmReleaseContext(hwnd,himc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment