Commit 317ad649 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: LCMapString should include the terminating NULL also for LCMAP_SORTKEY.

parent 6d75522f
......@@ -2371,6 +2371,8 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
if (ret == 0)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
else
ret++;
return ret;
}
......@@ -2510,6 +2512,8 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
if (ret == 0)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
else
ret++;
goto map_string_exit;
}
......
......@@ -1227,9 +1227,11 @@ static void test_LCMapStringA(void)
ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,
upper_case, -1, buf, sizeof(buf));
ok(ret, "LCMapStringA must succeed\n");
ok(buf[ret-1] == 0, "LCMapStringA not null-terminated\n");
ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,
upper_case, lstrlenA(upper_case), buf2, sizeof(buf2));
ok(ret, "LCMapStringA must succeed\n");
ok(ret2, "LCMapStringA must succeed\n");
ok(buf2[ret2-1] == 0, "LCMapStringA not null-terminated\n" );
ok(ret == ret2, "lengths of sort keys must be equal\n");
ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n");
......
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