Commit d71fb722 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

imm32: Set lengths to 0 for NULL strings in ImmSetCompositionString().

parent 834a88fc
......@@ -2539,6 +2539,9 @@ BOOL WINAPI ImmSetCompositionStringA(
return FALSE;
if (!(ime = imc_select_ime( data ))) return FALSE;
if (!lpComp) dwCompLen = 0;
if (!lpRead) dwReadLen = 0;
if (!ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen );
comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0);
......@@ -2596,6 +2599,9 @@ BOOL WINAPI ImmSetCompositionStringW(
return FALSE;
if (!(ime = imc_select_ime( data ))) return FALSE;
if (!lpComp) dwCompLen = 0;
if (!lpRead) dwReadLen = 0;
if (ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen );
comp_len = WideCharToMultiByte(CP_ACP, 0, lpComp, dwCompLen, NULL, 0, NULL,
......
......@@ -1085,12 +1085,24 @@ static void test_SCS_SETSTR(void)
DWORD prop;
imc = ImmGetContext(hwnd);
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL,0);
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
if (!ret) {
win_skip("Composition isn't supported\n");
ImmReleaseContext(hwnd, imc);
return;
}
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 128, NULL, 128);
ok(ret, "got error %lu.\n", GetLastError());
alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20);
ok(!alen, "got %ld.\n", alen);
wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20);
ok(!wlen, "got %ld.\n", alen);
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 2);
ok(ret, "got error %lu.\n", GetLastError());
msg_spy_flush_msgs();
alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20);
......
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