Jacek Caban (@jacek) commented about dlls/kernelbase/path.c:
memcpy(buf + 2, src + 2, 2 * sizeof(WCHAR));
StrToIntExW(buf, STIF_SUPPORT_HEX, &ih);
/* Check if it is a valid continuation byte. */
if (*(src + 1) == '%' && (ih & 0xc0) == 0x80)
{
utf8_buf[i] = ih;
src += 3;
}
else
{
utf8_len = i;
break;
}
}
utf16_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8_buf, utf8_len, NULL, 0);
I think you could pass utf16_but here and avoid calling `MultiByteToWideChar` twice.