Hello Detlef,
although Smatch could have handled the task too of finding places where Wine passes -1 as destlen to MultiByteToWideChar / WideChatToMultiByte this can be done with the C compiler too. Please see the attached patch.
This solution doesn't finds more occurrences that you have found and patched already. But this is really only the stuff that the compiler can figure out at compile time. It has no chance at all to catch stuff like
void foo(int bar) { int dstlen = -1;
if (bar) dstlen = 10;
MultiByteToWideChar(a, b, c, d, e, dstlen) }
Those can't be found by a grep either and I think that's why Alexandre is reluctant to apply your patches.
bye michael