http://bugs.winehq.org/show_bug.cgi?id=19839
--- Comment #12 from Juan Lang juan_lang@yahoo.com 2009-08-26 10:51:04 --- (In reply to comment #11)
Oops, seems that if size is 0, windows actually returns the number of characters that *would* be copied into the buffer *if* there was sufficient allocation.
Thanks, I hadn't tested that. Right you are. I sent an updated patch that addresses this case.
memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR)); buf[size - 1] = 0; // This has to be 'size - 1' rather than just 'size'
or you'll get an access overrun?
Heh. Right.