http://bugs.winehq.org/show_bug.cgi?id=19839
--- Comment #6 from LIGHTNING UK! lightning_uk@imgburn.com 2009-08-25 19:26:48 --- I haven't looked at anything except your patch (i.e no actual source code) but wouldn't you simply have to 'return 0;' rather than 'return -1' ? You can't copy '-1' characters into the buffer so '-1' isn't a valid return value (according to MSDN anyway - and as you pointed out earlier).
The bit in your patch where you memcpy looks like it could cause its own access violation if 'size' is larger than the length of 'infoPtr->parts[0].text' - no ?
memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR));
and along the same line, why is this being used (again, I've NOT looked at the source code, just what I can see in your patch!)...
strcpyW (buf, infoPtr->parts[0].text);
...rather that one that takes into account the actual max length of 'buf' (as specified by the 'size' parameter) - strLcpyW or whatever it would be called.